From: <df...@us...> - 2009-05-26 10:33:09
|
Revision: 1220 http://openutils.svn.sourceforge.net/openutils/?rev=1220&view=rev Author: dfghi Date: 2009-05-26 10:32:35 +0000 (Tue, 26 May 2009) Log Message: ----------- Used colums types from metadata even for the check query (for PostGreSql compatibility). Really skipping sheet if the log says so (there was no return nor else after the check). Modified Paths: -------------- trunk/openutils-dbmigration/src/main/java/it/openutils/migration/task/setup/ExcelConfigurationTask.java trunk/openutils-dbmigration/src/site/changes/changes.xml Modified: trunk/openutils-dbmigration/src/main/java/it/openutils/migration/task/setup/ExcelConfigurationTask.java =================================================================== --- trunk/openutils-dbmigration/src/main/java/it/openutils/migration/task/setup/ExcelConfigurationTask.java 2009-05-24 12:04:12 UTC (rev 1219) +++ trunk/openutils-dbmigration/src/main/java/it/openutils/migration/task/setup/ExcelConfigurationTask.java 2009-05-26 10:32:35 UTC (rev 1220) @@ -145,7 +145,7 @@ for (int j = 0; j < sheetNums; j++) { HSSFSheet sheet = hssfworkbook.getSheetAt(j); - String tableName = hssfworkbook.getSheetName(j); + String tableName = StringUtils.trim(hssfworkbook.getSheetName(j)); QueryConfig conf = config.get(tableName); if (conf == null) @@ -301,26 +301,28 @@ } }); - if (!result) + if (result) { + String checkStatement = StringUtils.remove(StringUtils.trim(con.getCheckQuery()), "\n"); + String insertStatement = StringUtils.remove(StringUtils.trim(con.getInsertQuery()), "\n"); + String selectStatement = StringUtils.remove(StringUtils.trim(con.getSelectQuery()), "\n"); + String updateStatement = StringUtils.remove(StringUtils.trim(con.getUpdateQuery()), "\n"); + + processRecords( + sheet, + columns, + ArrayUtils.toPrimitive(types.toArray(new Integer[types.size()]), Types.NULL), + checkStatement, + insertStatement, + selectStatement, + updateStatement, + dataSource, + tableName); + } + else + { log.warn("Skipping sheet {} ", tableName); } - - String checkStatement = StringUtils.remove(StringUtils.trim(con.getCheckQuery()), "\n"); - String insertStatement = StringUtils.remove(StringUtils.trim(con.getInsertQuery()), "\n"); - String selectStatement = StringUtils.remove(StringUtils.trim(con.getSelectQuery()), "\n"); - String updateStatement = StringUtils.remove(StringUtils.trim(con.getUpdateQuery()), "\n"); - - processRecords( - sheet, - columns, - ArrayUtils.toPrimitive(types.toArray(new Integer[types.size()]), Types.NULL), - checkStatement, - insertStatement, - selectStatement, - updateStatement, - dataSource, - tableName); } /** @@ -394,6 +396,8 @@ } Object[] checkParams = ArrayUtils.subarray(values.toArray(), 0, checkNum); + // We have types from column analysis, so we can use them also in check query. + int[] checkParamTypes = ArrayUtils.subarray(types, 0, checkNum); for (int i = 0; i < checkParams.length; i++) { if (StringUtils.isEmpty((String) checkParams[i])) @@ -405,7 +409,7 @@ int existing; try { - existing = jdbcTemplate.queryForInt(checkStatement, checkParams); + existing = jdbcTemplate.queryForInt(checkStatement, checkParams, checkParamTypes); } catch (BadSqlGrammarException bsge) { Modified: trunk/openutils-dbmigration/src/site/changes/changes.xml =================================================================== --- trunk/openutils-dbmigration/src/site/changes/changes.xml 2009-05-24 12:04:12 UTC (rev 1219) +++ trunk/openutils-dbmigration/src/site/changes/changes.xml 2009-05-26 10:32:35 UTC (rev 1220) @@ -8,6 +8,10 @@ <author email="fgiust(at)users.sourceforge.net">Fabrizio Giustina</author> </properties> <body> + <release version="2.0.6" date="" description=""> + <action type="fix" dev="dghirardelli">Used colums types from metadata even for the check query (for PostGreSql compatibility)</action> + <action type="fix" dev="dghirardelli">Really skipping sheet if the log says so</action> + </release> <release version="2.0.5" date="2009-03-29" description=""> <action type="update" dev="fgiust">Updated slf4j, spring and poi dependencies</action> </release> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |