Changeset: a514016682c9 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=a514016682c9 Modified Files: java/ChangeLog.Oct2012 java/Makefile.ag java/build.properties java/pom.xml java/release.txt java/src/nl/cwi/monetdb/jdbc/MonetPreparedStatement.java monetdb5/extras/jaql/jaqlgencode.c monetdb5/extras/jaql/jaqltests/Tests/shred.jaql.in monetdb5/extras/jaql/jaqltests/Tests/shred.stable.out monetdb5/extras/jaql/json.c Branch: default Log Message:
Merged from Oct2012 diffs (truncated from 420 to 300 lines): diff --git a/java/ChangeLog.Oct2012 b/java/ChangeLog.Oct2012 --- a/java/ChangeLog.Oct2012 +++ b/java/ChangeLog.Oct2012 @@ -1,3 +1,7 @@ # ChangeLog file for java # This file is updated with Maddlog +* Wed Oct 10 2012 Fabian Groffen <fab...@cwi.nl> +- Fixed problem with PreparedStatements and setXXX() methods using column + numbers instead of names, bug #3158 + diff --git a/java/Makefile.ag b/java/Makefile.ag --- a/java/Makefile.ag +++ b/java/Makefile.ag @@ -27,7 +27,7 @@ JAVA_HOME = @JAVA_HOME@ ant_distjdbc = { COND = HAVE_JAVAJDBC DIR = datadir/monetdb/lib - FILES = monetdb-mcl-1.8.jar monetdb-jdbc-2.5.jar jdbcclient.jar + FILES = monetdb-mcl-1.8.jar monetdb-jdbc-2.6.jar jdbcclient.jar } ant_distmerocontrol = { diff --git a/java/build.properties b/java/build.properties --- a/java/build.properties +++ b/java/build.properties @@ -19,7 +19,7 @@ MCL_MINOR=8 # major release number JDBC_MAJOR=2 # minor release number -JDBC_MINOR=5 +JDBC_MINOR=6 # an additional identifying string JDBC_VER_SUFFIX=Liberica # the default port to connect on, if no port given when using SQL diff --git a/java/pom.xml b/java/pom.xml --- a/java/pom.xml +++ b/java/pom.xml @@ -6,7 +6,7 @@ <modelVersion>4.0.0</modelVersion> <groupId>monetdb</groupId> <artifactId>monetdb-jdbc</artifactId> - <version>2.5</version> + <version>2.6</version> <name>monetdb-jdbc</name> <description>MonetDB JDBC driver</description> <repositories> diff --git a/java/release.txt b/java/release.txt --- a/java/release.txt +++ b/java/release.txt @@ -1,8 +1,8 @@ RELEASE NOTES -MonetDB JDBC driver version 2.5 (Liberica/MCL-1.8) +MonetDB JDBC driver version 2.6 (Liberica/MCL-1.8) Fabian Groffen <fabian.grof...@cwi.nl> -Release date: 2012-08-23 +Release date: 2012-10-10 This JDBC driver is designed for use with MonetDB, a main-memory diff --git a/java/src/nl/cwi/monetdb/jdbc/MonetPreparedStatement.java b/java/src/nl/cwi/monetdb/jdbc/MonetPreparedStatement.java --- a/java/src/nl/cwi/monetdb/jdbc/MonetPreparedStatement.java +++ b/java/src/nl/cwi/monetdb/jdbc/MonetPreparedStatement.java @@ -724,12 +724,9 @@ public class MonetPreparedStatement * @throws SQLException if a database access error occurs */ public boolean isSigned(int param) throws SQLException { - if (param < 1 || param > size) - throw new SQLException("No such parameter with index: " + param, "M1M05"); - // we can hardcode this, based on the colum type // (from ResultSetMetaData.isSigned) - switch (javaType[param - 1]) { + switch (javaType[getColumnIdx(param)]) { case Types.NUMERIC: case Types.DECIMAL: case Types.TINYINT: @@ -759,10 +756,7 @@ public class MonetPreparedStatement * @throws SQLException if a database access error occurs */ public int getPrecision(int param) throws SQLException { - if (param < 1 || param > size) - throw new SQLException("No such parameter with index: " + param, "M1M05"); - - return digits[param - 1]; + return digits[getColumnIdx(param)]; } /** @@ -774,10 +768,7 @@ public class MonetPreparedStatement * @throws SQLException if a database access error occurs */ public int getScale(int param) throws SQLException { - if (param < 1 || param > size) - throw new SQLException("No such parameter with index: " + param, "M1M05"); - - return scale[param - 1]; + return scale[getColumnIdx(param)]; } /** @@ -788,10 +779,7 @@ public class MonetPreparedStatement * @throws SQLException if a database access error occurs */ public int getParameterType(int param) throws SQLException { - if (param < 1 || param > size) - throw new SQLException("No such parameter with index: " + param, "M1M05"); - - return javaType[param - 1]; + return javaType[getColumnIdx(param)]; } /** @@ -805,10 +793,7 @@ public class MonetPreparedStatement * @throws SQLException if a database access error occurs */ public String getParameterTypeName(int param) throws SQLException { - if (param < 1 || param > size) - throw new SQLException("No such parameter with index: " + param, "M1M05"); - - return monetdbType[param - 1]; + return monetdbType[getColumnIdx(param)]; } /** @@ -825,10 +810,7 @@ public class MonetPreparedStatement * @throws SQLException if a database access error occurs */ public String getParameterClassName(int param) throws SQLException { - if (param < 1 || param > size) - throw new SQLException("No such parameter with index: " + param, "M1M05"); - - return MonetResultSet.getClassForType(javaType[param - 1]).getName(); + return MonetResultSet.getClassForType(javaType[getColumnIdx(param)]).getName(); } /** @@ -1525,15 +1507,12 @@ public class MonetPreparedStatement * the given object is ambiguous */ public void setObject(int index, Object x) throws SQLException { - if (index < 1 || index > size) - throw new SQLException("No such parameter with index: " + index, "M1M05"); - - setObject(index, x, javaType[index - 1]); + setObject(index, x, javaType[getColumnIdx(index)]); } /** * Sets the value of the designated parameter with the given object. This - * method is like the method setObject blow, except that it assumes a scale + * method is like the method setObject below, except that it assumes a scale * of zero. * * @param parameterIndex the first parameter is 1, the second is 2, ... @@ -2023,10 +2002,7 @@ public class MonetPreparedStatement public void setTime(int index, Time x, Calendar cal) throws SQLException { - if (index < 1 || index > size) - throw new SQLException("No such parameter with index: " + index, "M1M05"); - - boolean hasTimeZone = monetdbType[index - 1].endsWith("tz"); + boolean hasTimeZone = monetdbType[getColumnIdx(index)].endsWith("tz"); if (hasTimeZone) { // timezone shouldn't matter, since the server is timezone // aware in this case @@ -2081,10 +2057,7 @@ public class MonetPreparedStatement public void setTimestamp(int index, Timestamp x, Calendar cal) throws SQLException { - if (index < 1 || index > size) - throw new SQLException("No such parameter with index: " + index, "M1M05"); - - boolean hasTimeZone = monetdbType[index - 1].endsWith("tz"); + boolean hasTimeZone = monetdbType[getColumnIdx(index)].endsWith("tz"); if (hasTimeZone) { // timezone shouldn't matter, since the server is timezone // aware in this case diff --git a/monetdb5/extras/jaql/jaqlgencode.c b/monetdb5/extras/jaql/jaqlgencode.c --- a/monetdb5/extras/jaql/jaqlgencode.c +++ b/monetdb5/extras/jaql/jaqlgencode.c @@ -3977,7 +3977,11 @@ dumpvariabletransformation(jc *j, Client q = pushArgument(mb, q, j->j5); q = pushArgument(mb, q, j->j6); q = pushArgument(mb, q, j->j7); - q = pushArgument(mb, q, j->startoid); + if (j->startoid == 0) { + q = pushOid(mb, q, 0); + } else { + q = pushArgument(mb, q, j->startoid); + } dynaarg[i][0] = getArg(q, 0); pushInstruction(mb, q); } else { @@ -4021,7 +4025,11 @@ dumpvariabletransformation(jc *j, Client q = pushArgument(mb, q, j->j5); q = pushArgument(mb, q, j->j6); q = pushArgument(mb, q, j->j7); - q = pushArgument(mb, q, j->startoid); + if (j->startoid == 0) { + q = pushOid(mb, q, 0); + } else { + q = pushArgument(mb, q, j->startoid); + } q = pushStr(mb, q, ""); dynaarg[i][1] = getArg(q, 0); pushInstruction(mb, q); @@ -4062,7 +4070,11 @@ dumpvariabletransformation(jc *j, Client q = pushArgument(mb, q, j->j5); q = pushArgument(mb, q, j->j6); q = pushArgument(mb, q, j->j7); - q = pushArgument(mb, q, j->startoid); + if (j->startoid == 0) { + q = pushOid(mb, q, 0); + } else { + q = pushArgument(mb, q, j->startoid); + } q = pushDbl(mb, q, 0.0); dynaarg[i][2] = getArg(q, 0); pushInstruction(mb, q); @@ -4103,7 +4115,11 @@ dumpvariabletransformation(jc *j, Client q = pushArgument(mb, q, j->j5); q = pushArgument(mb, q, j->j6); q = pushArgument(mb, q, j->j7); - q = pushArgument(mb, q, j->startoid); + if (j->startoid == 0) { + q = pushOid(mb, q, 0); + } else { + q = pushArgument(mb, q, j->startoid); + } q = pushLng(mb, q, 0); dynaarg[i][3] = getArg(q, 0); pushInstruction(mb, q); @@ -6611,6 +6627,46 @@ dumptree(jc *j, Client cntxt, MalBlkPtr /* treat pipe as first input */ switch (coltypes[i]) { case j_json_arr: + /* make sure we give "clean" input to a + * function */ + if (j->startoid != 0) { + a = dumpwalkvar(mb, j->j1, j->j5, j->startoid); + q = newInstruction(mb, ASSIGNsymbol); + setModuleId(q, batRef); + setFunctionId(q, mirrorRef); + q = pushReturn(mb, q, newTmpVariable(mb, TYPE_any)); + q = pushArgument(mb, q, a); + a = getArg(q, 0); + pushInstruction(mb, q); + q = newInstruction(mb, ASSIGNsymbol); + setModuleId(q, putName("json", 4)); + setFunctionId(q, putName("extract", 7)); + q = pushReturn(mb, q, newTmpVariable(mb, TYPE_any)); + q = pushReturn(mb, q, newTmpVariable(mb, TYPE_any)); + q = pushReturn(mb, q, newTmpVariable(mb, TYPE_any)); + q = pushReturn(mb, q, newTmpVariable(mb, TYPE_any)); + q = pushReturn(mb, q, newTmpVariable(mb, TYPE_any)); + q = pushReturn(mb, q, newTmpVariable(mb, TYPE_any)); + q = pushReturn(mb, q, newTmpVariable(mb, TYPE_any)); + q = pushArgument(mb, q, j->j1); + q = pushArgument(mb, q, j->j2); + q = pushArgument(mb, q, j->j3); + q = pushArgument(mb, q, j->j4); + q = pushArgument(mb, q, j->j5); + q = pushArgument(mb, q, j->j6); + q = pushArgument(mb, q, j->j7); + q = pushArgument(mb, q, a); + q = pushOid(mb, q, 0); + j->j1 = getArg(q, 0); + j->j2 = getArg(q, 1); + j->j3 = getArg(q, 2); + j->j4 = getArg(q, 3); + j->j5 = getArg(q, 4); + j->j6 = getArg(q, 5); + j->j7 = getArg(q, 6); + pushInstruction(mb, q); + j->startoid = 0; + } dynaarg[i][0] = j->j1; dynaarg[i][1] = j->j2; dynaarg[i][2] = j->j3; @@ -6636,7 +6692,11 @@ dumptree(jc *j, Client cntxt, MalBlkPtr q = pushArgument(mb, q, j->j5); q = pushArgument(mb, q, j->j6); q = pushArgument(mb, q, j->j7); - q = pushOid(mb, q, (oid)0); + if (j->startoid == 0) { + q = pushOid(mb, q, (oid)0); + } else { + q = pushArgument(mb, q, j->startoid); + } a = getArg(q, 0); dynaarg[i][0] = a; pushInstruction(mb, q); @@ -6672,7 +6732,11 @@ dumptree(jc *j, Client cntxt, MalBlkPtr q = pushArgument(mb, q, j->j5); q = pushArgument(mb, q, j->j6); q = pushArgument(mb, q, j->j7); - q = pushOid(mb, q, (oid)0); _______________________________________________ checkin-list mailing list checkin-list@monetdb.org http://mail.monetdb.org/mailman/listinfo/checkin-list