|
From: <vga...@us...> - 2010-02-11 16:35:36
|
Revision: 491
http://treebase.svn.sourceforge.net/treebase/?rev=491&view=rev
Author: vgapeyev
Date: 2010-02-11 16:35:29 +0000 (Thu, 11 Feb 2010)
Log Message:
-----------
Modifying DB2-specific SQL to work under Pg
Modified Paths:
--------------
trunk/treebase-core/src/main/java/org/cipres/treebase/dao/jdbc/ContinuousMatrixJDBC.java
trunk/treebase-core/src/main/java/org/cipres/treebase/dao/jdbc/DiscreteMatrixJDBC.java
Modified: trunk/treebase-core/src/main/java/org/cipres/treebase/dao/jdbc/ContinuousMatrixJDBC.java
===================================================================
--- trunk/treebase-core/src/main/java/org/cipres/treebase/dao/jdbc/ContinuousMatrixJDBC.java 2010-02-11 06:51:56 UTC (rev 490)
+++ trunk/treebase-core/src/main/java/org/cipres/treebase/dao/jdbc/ContinuousMatrixJDBC.java 2010-02-11 16:35:29 UTC (rev 491)
@@ -165,8 +165,10 @@
// insert new phylochar.
// Note: this is db2 specific code (faster), see EnvrionmentTest.testGetGeneratedKey()
// for generic jdbc code.
- String queryBuf = "select phylochar_id from final table(INSERT INTO PHYLOCHAR(TYPE, PHYLOCHAR_ID, VERSION, DESCRIPTION, LOWERLIMIT, UPPERLIMIT) VALUES('N', default, 0, ?, ?, ?))";
-
+ //--String queryBuf = "select phylochar_id from final table(INSERT INTO PHYLOCHAR(TYPE, PHYLOCHAR_ID, VERSION, DESCRIPTION, LOWERLIMIT, UPPERLIMIT) VALUES('N', default, 0, ?, ?, ?))";
+ //VG 2010-02-10 Replacing above DB2 sql with this PostreSQL:
+ String queryBuf = "INSERT INTO PHYLOCHAR(TYPE, PHYLOCHAR_ID, VERSION, DESCRIPTION, LOWERLIMIT, UPPERLIMIT) VALUES('N', default, 0, ?, ?, ?) returning phylochar_id";
+
PreparedStatement ps = pCon.prepareStatement(queryBuf);
for (MatrixColumnJDBC columnJDBC : columns) {
Modified: trunk/treebase-core/src/main/java/org/cipres/treebase/dao/jdbc/DiscreteMatrixJDBC.java
===================================================================
--- trunk/treebase-core/src/main/java/org/cipres/treebase/dao/jdbc/DiscreteMatrixJDBC.java 2010-02-11 06:51:56 UTC (rev 490)
+++ trunk/treebase-core/src/main/java/org/cipres/treebase/dao/jdbc/DiscreteMatrixJDBC.java 2010-02-11 16:35:29 UTC (rev 491)
@@ -334,8 +334,10 @@
try {
// insert new discrete phylochar.
//Note: this is db2 specific code (faster), see EnvrionmentTest.testGetGeneratedKey() for generic jdbc code.
- String queryBuf = "select phylochar_id from final table(INSERT INTO PHYLOCHAR(TYPE, PHYLOCHAR_ID, VERSION, DESCRIPTION) VALUES('D', default, 0, ?))";
-
+ //VG-- String queryBuf = "select phylochar_id from final table(INSERT INTO PHYLOCHAR(TYPE, PHYLOCHAR_ID, VERSION, DESCRIPTION) VALUES('D', default, 0, ?))";
+ //VG 2010-02-10 Replacing above DB2 sql with this PostreSQL:
+ String queryBuf = "INSERT INTO PHYLOCHAR(TYPE, PHYLOCHAR_ID, VERSION, DESCRIPTION) VALUES('D', default, 0, ?) RETURNING phylochar_id";
+
PreparedStatement ps = pCon.prepareStatement(queryBuf);
// String stateStr = "INSERT INTO DISCRETECHARSTATE(DISCRETECHARSTATE_ID, VERSION,
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|