From: JM E. <jos...@us...> - 2007-12-18 10:02:56
|
Update of /cvsroot/babeldoc/babeldoc/modules/sql/src/com/babeldoc/sql/pipeline/stage In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv15776/modules/sql/src/com/babeldoc/sql/pipeline/stage Modified Files: SqlWriterPipelineStage.java Log Message: news pipeline stage Index: SqlWriterPipelineStage.java =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/sql/src/com/babeldoc/sql/pipeline/stage/SqlWriterPipelineStage.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** SqlWriterPipelineStage.java 24 Jul 2004 00:18:54 -0000 1.16 --- SqlWriterPipelineStage.java 18 Dec 2007 10:02:55 -0000 1.17 *************** *** 100,103 **** --- 100,106 ---- public static final String BATCH_SIZE = "batchSize"; public static final String SQL = "sql"; + + // 20071217 jmenriquez + public static final String ISO_FORMAT = "isoFormat"; //This is used for specifying message that should be retuned. It should be *************** *** 142,145 **** --- 145,152 ---- null, true, I18n.get("sql.195"))); + // 20071217 jmenriquez + options.add(new ConfigOption(ISO_FORMAT, IConfigOptionType.BOOLEAN, + "false", false, I18n.get("sql.300"))); + return options; } *************** *** 208,211 **** --- 215,230 ---- return ((Connection) resource.checkOut()); } + + // 20071217 jmenriquez + private boolean isOracle(String productName) { + return productName.toUpperCase().indexOf("ORACLE") > -1; + } + + // 20071217 jmenriquez + private boolean isSqlServer(String productName) { + return productName.toUpperCase().indexOf("MICROSOFT") > -1 + && productName.toUpperCase().indexOf("SQL") > -1 + && productName.toUpperCase().indexOf("SERVER") > -1; + } /** *************** *** 241,247 **** int currentBatchSize = 0; int commandCount = 0; while (true) { ! try { //excute statement String command = br.readLine(); --- 260,279 ---- int currentBatchSize = 0; int commandCount = 0; + + // 20071217 jmenriquez + if (hasOption(ISO_FORMAT) && "true".equalsIgnoreCase(getOptions(ISO_FORMAT))) { + // configure connection + String productName = conn.getMetaData().getDatabaseProductName(); + if (isOracle(productName)) { + stmt.executeUpdate("ALTER SESSION SET NLS_DATE_FORMAT = 'YYYY-MM-DD HH24:MI:SS'"); + stmt.executeUpdate("ALTER SESSION SET NLS_NUMERIC_CHARACTERS = '.,'"); + } + if (isSqlServer(productName)) { + stmt.executeUpdate("SET DATEFORMAT YMD"); + } + } while (true) { ! try { //excute statement String command = br.readLine(); |