|
From: Michael K. <ko...@us...> - 2005-12-13 17:07:58
|
Update of /cvsroot/cobricks/cobricks2/src/org/cobricks/core/db In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28259 Modified Files: DBAccessImpl.java Log Message: Index: DBAccessImpl.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/core/db/DBAccessImpl.java,v retrieving revision 1.22 retrieving revision 1.23 diff -u -d -r1.22 -r1.23 --- DBAccessImpl.java 13 Dec 2005 09:05:02 -0000 1.22 +++ DBAccessImpl.java 13 Dec 2005 17:07:39 -0000 1.23 @@ -92,6 +92,7 @@ String jdbcUri = p.getProperty("db.jdbc.uri"); if (jdbcUri.startsWith("jdbc:mysql")) dbtype = DBTYPE_MYSQL; if (jdbcUri.startsWith("jdbc:postgresql")) dbtype = DBTYPE_POSTGRES; + if (jdbcUri.startsWith("jdbc:oracle")) dbtype = DBTYPE_ORACLE; String jdbcUser = p.getProperty("db.jdbc.user"); String jdbcPw = p.getProperty("db.jdbc.pw"); @@ -846,6 +847,7 @@ try { conn = dataSource.getConnection(); stmt = conn.createStatement(); + if (dbtype == DBTYPE_ORACLE) stmt.setEscapeProcessing(false); ResultSet rs = stmt.executeQuery(sql); while (rs.next()) { if (maxRows == 0) break; @@ -932,6 +934,7 @@ try { conn = dataSource.getConnection(); stmt = conn.createStatement(); + if (dbtype == DBTYPE_ORACLE) stmt.setEscapeProcessing(false); ResultSet rs = stmt.executeQuery(sql); if (rs.next()) { getSingleRowAttributes(result, rs); @@ -965,6 +968,7 @@ try { conn = dataSource.getConnection(); stmt = conn.createStatement(); + if (dbtype == DBTYPE_ORACLE) stmt.setEscapeProcessing(false); ResultSet rs = stmt.executeQuery(sql); while (rs.next()) { Map result2 = new HashMap(); @@ -1183,6 +1187,7 @@ try { conn = dataSource.getConnection(); stmt = conn.createStatement(); + if (dbtype == DBTYPE_ORACLE) stmt.setEscapeProcessing(false); stmt.executeUpdate(sql); } catch(Exception e) { logger.error(LogUtil.ex("Failed executing sql statement: "+sql, e)); @@ -1305,29 +1310,35 @@ if (coltype.startsWith("String")) { return "varchar"+coltype.substring(6); } - if (dbtype==DBTYPE_MYSQL && coltype.equalsIgnoreCase("timestamp")) { - return "datetime"; - } - if (dbtype==DBTYPE_MYSQL && coltype.equalsIgnoreCase("clob")) { - return "text"; - } - if (dbtype==DBTYPE_MYSQL && coltype.equalsIgnoreCase("binary")) { - return "blob"; - } - if (dbtype==DBTYPE_ORACLE && coltype.equalsIgnoreCase("binary")) { - return "blob"; - } - if (dbtype==DBTYPE_ORACLE && coltype.equalsIgnoreCase("text")) { - return "clob"; - } - if (dbtype==DBTYPE_POSTGRES && coltype.equalsIgnoreCase("clob")) { - return "text"; + if (dbtype==DBTYPE_MYSQL) { + if (coltype.equalsIgnoreCase("timestamp")) { + return "datetime"; + } + if (coltype.equalsIgnoreCase("clob")) { + return "text"; + } + if (coltype.equalsIgnoreCase("binary")) { + return "blob"; + } } - if (dbtype==DBTYPE_POSTGRES && coltype.equalsIgnoreCase("binary")) { - return "bytea"; + if (dbtype==DBTYPE_POSTGRES) { + if (coltype.equalsIgnoreCase("clob")) { + return "text"; + } + if (coltype.equalsIgnoreCase("binary")) { + return "bytea"; + } + if (coltype.equalsIgnoreCase("blob")) { + return "bytea"; + } } - if (dbtype==DBTYPE_POSTGRES && coltype.equalsIgnoreCase("blob")) { - return "bytea"; + if (dbtype==DBTYPE_ORACLE) { + if (coltype.equalsIgnoreCase("binary")) { + return "blob"; + } + if (coltype.equalsIgnoreCase("text")) { + return "clob"; + } } return coltype; } |