Skip to content
Snippets Groups Projects
Commit d7318cb7 authored by Johannes Goderbauer's avatar Johannes Goderbauer
Browse files

Liquibase_lib fix when giving a condition

parent 5cb2af8f
No related branches found
No related tags found
No related merge requests found
......@@ -43,9 +43,8 @@ LiquiUtils.exportAllTablesAsLiquibaseFiles = function(pOutFolderPath, pAuthor, p
if (ArrayUtils.hasElement(excludedTables, tables[i], true))
continue;
var columns = db.getColumns(tables[i], alias);
var cond = null;
LiquiUtils.exportTableAsLiquibaseFiles(pOutFolderPath, tables[i], columns, cond, pAuthor, pIncludeClearTableDirective, alias);
LiquiUtils.exportTableAsLiquibaseFiles(pOutFolderPath, tables[i], null, cond, pAuthor, pIncludeClearTableDirective, alias);
}
};
......@@ -85,7 +84,7 @@ LiquiUtils.exportTableAsLiquibaseFiles = function(pPath, pTableName, pColumns, p
* @param {String} [pLobPath=not set] file-path where lob files and folders will be created; the folder must be on the server;
* if you've no lob-fields you don't have to specify somehing here
* @param {String} pTableName name of the DB-table that will be exported; this is also the name of the file that is stored
* @param {Array} pColumns db-columns within the table that will be exported
* @param {Array} [pColumns=all columns within the table] db-columns within the table that will be exported
* @param {String} [pCondition=none] db-condition to limit the data that will be exported; if nothing given the whole content will be exported
* @param {Boolean} [pIncludeClearTableDirective=false] if true, a delete element is added at the beginning of the changeset for the table
* @param {String} [pAlias=current db-alias] alias where the data will be loaded from
......@@ -99,10 +98,11 @@ LiquiUtils._getDataXml = function(pAuthor, pLobPath, pTableName, pColumns, pCond
//cannot be added within jdito code to the XML-object, so instead add it as string
var XML_HEADER_LINE= '<?xml version="1.1" encoding="UTF-8" standalone="no"?>';
var dbData = db.table("select " + pColumns.join(", ") + " from " + pTableName + " " + (pCondition ? pCondition : ""), alias);
var columns = pColumns || db.getColumns(pTableName, alias);
var dbData = db.table("select " + columns.join(", ") + " from " + pTableName + " " + (pCondition ? "where " + pCondition : ""), alias);
if (dbData.length == 0)
return "";
var colTypes = db.getColumnTypes(pTableName, pColumns, alias);
var colTypes = db.getColumnTypes(pTableName, columns, alias);
//every type has its function that accepts a columnName- and a value-parameter
//so let's dertermine once the corresponding funtion to its type for faster access
//(the function will only depend on the type and not change per datarow - so no need to determine the correct function per datarow)
......@@ -126,7 +126,7 @@ LiquiUtils._getDataXml = function(pAuthor, pLobPath, pTableName, pColumns, pCond
else
return LiquiXTable.prototype.addStrCol;
});
var columnLen = pColumns.length;
var columnLen = columns.length;
var changeLogXml = LiquiXmlUtils.databaseChangeLog(author);
if (pIncludeClearTableDirective)
......@@ -138,7 +138,7 @@ LiquiUtils._getDataXml = function(pAuthor, pLobPath, pTableName, pColumns, pCond
tableXml.setLobBasePath(pLobPath);
for (var i = 0; i < columnLen; i++)
{
var colName = pColumns[i];
var colName = columns[i];
var value = row[i];
var fnToUse = colCallbackFn[i];
if (fnToUse != null)
......
......@@ -5,10 +5,16 @@ import("Liquibase_lib");
import("system.db");
import("system.fileIO");
var outFolderPath = "C:\\temp\\generatedData";
var alias = "betterData";
var alias = "_____SYSTEMALIAS";
//var alias = "betterDataSys";
//var alias = "betterData";
//var alias = db.getCurrentAlias();
var outFolderPath = "C:\\temp\\generatedData\\" + alias + "\\";
var excludedTables = ["AB_COUNTRYINFO", "AB_LANGUAGE"];
LiquiUtils.exportAllTablesAsLiquibaseFiles(outFolderPath, null, alias, excludedTables, true);
//LiquiUtils.exportAllTablesAsLiquibaseFiles(outFolderPath, null, alias, excludedTables, true);
alias = "_____SYSTEMALIAS";
outFolderPath = "C:\\temp\\generatedData\\" + alias + "\\";
LiquiUtils.exportTableAsLiquibaseFiles(outFolderPath, "ASYS_USERS", null, "PROPKEY in ('mailserverAlias', 'userserverEnabled') ", null, false, alias);
logging.log("finish");
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment