Changeset: 446cb560e23e for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=446cb560e23e
Added Files:
debian/libmonetdb-client6.install
debian/libmonetdb8.install
java/src/nl/cwi/monetdb/jdbc/types/INET.java
java/src/nl/cwi/monetdb/jdbc/types/URL.java
java/tests/Test_PSmetadata.java
java/tests/Test_PSsqldata.java
java/tests/Test_Rsqldata.java
sql/jdbc/tests/Tests/Test_PSmetadata.SQL.bat
sql/jdbc/tests/Tests/Test_PSmetadata.SQL.sh
sql/jdbc/tests/Tests/Test_PSmetadata.stable.err
sql/jdbc/tests/Tests/Test_PSmetadata.stable.out
sql/jdbc/tests/Tests/Test_PSsqldata.SQL.bat
sql/jdbc/tests/Tests/Test_PSsqldata.SQL.sh
sql/jdbc/tests/Tests/Test_PSsqldata.stable.err
sql/jdbc/tests/Tests/Test_PSsqldata.stable.out
sql/jdbc/tests/Tests/Test_Rsqldata.SQL.bat
sql/jdbc/tests/Tests/Test_Rsqldata.SQL.sh
sql/jdbc/tests/Tests/Test_Rsqldata.stable.err
sql/jdbc/tests/Tests/Test_Rsqldata.stable.out
Removed Files:
debian/libmonetdb-client5.install
debian/libmonetdb6.install
Modified Files:
debian/control
java/ChangeLog.Oct2012
java/Makefile.ag
java/build.properties
java/pom.xml
java/release.txt
java/src/nl/cwi/monetdb/jdbc/MonetConnection.java
java/src/nl/cwi/monetdb/jdbc/MonetPreparedStatement.java
java/src/nl/cwi/monetdb/jdbc/MonetResultSet.java
java/tests/build.xml
sql/jdbc/tests/Tests/All
sql/test/BugTracker-2012/Tests/All
Branch: default
Log Message:
Merge with Oct2012 branch.
diffs (truncated from 1828 to 300 lines):
diff --git a/debian/control b/debian/control
--- a/debian/control
+++ b/debian/control
@@ -16,7 +16,7 @@ Standards-Version: 3.8.0
X-Python-Version: >= 2.6
X-Python3-Version: >= 3.0
-Package: libmonetdb6
+Package: libmonetdb8
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
Conflicts: libmonetdb1, libmonetdb2, libmonetdb-dev
@@ -57,7 +57,7 @@ Description: MonetDB stream library deve
This package contains the files to develop with the
libmonetdb-stream3 library.
-Package: libmonetdb-client5
+Package: libmonetdb-client6
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
Conflicts: libmonetdb-client1, libmonetdb-client2
@@ -73,14 +73,14 @@ Description: MonetDB client/server inter
Package: libmonetdb-client-dev
Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}, libmonetdb-client5
+Depends: ${shlibs:Depends}, ${misc:Depends}, libmonetdb-client6
Description: MonetDB client/server interface library development files
MonetDB is a database management system that is developed from a
main-memory perspective with use of a fully decomposed storage model,
automatic index management, extensibility of data types and search
accelerators. It also has an SQL frontend.
.
- This package contains the files to develop with the libmonetdb-client5
+ This package contains the files to develop with the libmonetdb-client6
library.
Package: monetdb-client
diff --git a/debian/libmonetdb-client5.install
b/debian/libmonetdb-client6.install
rename from debian/libmonetdb-client5.install
rename to debian/libmonetdb-client6.install
diff --git a/debian/libmonetdb6.install b/debian/libmonetdb8.install
rename from debian/libmonetdb6.install
rename to debian/libmonetdb8.install
diff --git a/java/ChangeLog.Oct2012 b/java/ChangeLog.Oct2012
--- a/java/ChangeLog.Oct2012
+++ b/java/ChangeLog.Oct2012
@@ -1,3 +1,15 @@
# ChangeLog file for java
# This file is updated with Maddlog
+* Fri Nov 23 2012 Fabian Groffen <[email protected]>
+- Implemented type map support of Connection to allow custom mapping
+ of UDTs to Java classes. By default the INET and URL UDTs are
+ now mapped to nl.cwi.monetdb.jdbc.types.{INET,URL}. Most notably,
+ ResultSet.getObject() and PreparedStatement.setObject() deal with the
+ type map.
+
+* Thu Nov 22 2012 Fabian Groffen <[email protected]>
+- Fixed a problem in PreparedStatement where the prepared statement's
+ ResultSetMetaData (on its columns to be produced) incorrectly threw
+ exceptions about non existing columns. Bug #3192
+
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.7.jar jdbcclient.jar
+ FILES = monetdb-mcl-1.8.jar monetdb-jdbc-2.8.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=7
+JDBC_MINOR=8
# 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.7</version>
+ <version>2.8</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.7 (Liberica/MCL-1.8)
-Fabian Groffen <[email protected]>
+MonetDB JDBC driver version 2.8 (Liberica/MCL-1.8)
+Fabian Groffen <[email protected]>
-Release date: 2012-11-02
+Release date: 2012-11-22
This JDBC driver is designed for use with MonetDB, a main-memory
@@ -51,7 +51,6 @@ Currently implemented:
- setEscapeProcessing
* java.sql.PreparedStatement interface
The next features are not implemented:
- - getMetaData
- setArray
- setAsciiStream, setBinaryStream, setUnicodeStream
- setBlob
@@ -66,6 +65,5 @@ Currently implemented:
* java.sql.DatabaseMetaData interface
* java.sql.SavePoint interface
-- The get/setObject methods currently ignore any given type map.
- Auto-commit behaviour is defined by the server which handles the
auto-commit. This is in general in line with the JDBC standard.
diff --git a/java/src/nl/cwi/monetdb/jdbc/MonetConnection.java
b/java/src/nl/cwi/monetdb/jdbc/MonetConnection.java
--- a/java/src/nl/cwi/monetdb/jdbc/MonetConnection.java
+++ b/java/src/nl/cwi/monetdb/jdbc/MonetConnection.java
@@ -52,6 +52,8 @@ import java.util.concurrent.locks.Condit
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
+import nl.cwi.monetdb.jdbc.types.INET;
+import nl.cwi.monetdb.jdbc.types.URL;
import nl.cwi.monetdb.mcl.MCLException;
import nl.cwi.monetdb.mcl.io.BufferedMCLReader;
import nl.cwi.monetdb.mcl.io.BufferedMCLWriter;
@@ -114,8 +116,11 @@ public class MonetConnection extends Mon
/** The stack of warnings for this Connection object */
private SQLWarning warnings = null;
/** The Connection specific mapping of user defined types to Java
- * types (not used) */
- private Map<String,Class<?>> typeMap = new HashMap<String,Class<?>>();
+ * types */
+ private Map<String,Class<?>> typeMap = new HashMap<String,Class<?>>() {{
+ put("inet", INET.class);
+ put("url", URL.class);
+ }};
// See javadoc for documentation about WeakHashMap if you don't know
what
// it does !!!NOW!!! (only when you deal with it of course)
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
@@ -302,7 +302,7 @@ public class MonetPreparedStatement
private int getColumnIdx(int colnr) throws SQLException {
int curcol = 0;
for (int i = 0; i < size; i++) {
- if (column[i] != null)
+ if (column[i] == null)
continue;
curcol++;
if (curcol == colnr)
@@ -310,6 +310,22 @@ public class MonetPreparedStatement
}
throw new SQLException("No such column with index: " + colnr,
"M1M05");
}
+ /**
+ * Returns the index in the backing arrays for the given
+ * parameter number
+ */
+ private int getParamIdx(int paramnr) throws SQLException {
+ int curparam = 0;
+ for (int i = 0; i < size; i++) {
+ if (column[i] != null)
+ continue;
+ curparam++;
+ if (curparam == paramnr)
+ return i;
+ }
+ throw new SQLException("No such parameter with index: " +
paramnr, "M1M05");
+ }
+
/* helper for the anonymous class inside getMetaData */
private abstract class rsmdw extends MonetWrapper implements
ResultSetMetaData {}
@@ -480,7 +496,7 @@ public class MonetPreparedStatement
* @return table name or "" if not applicable
*/
public String getTableName(int col) throws SQLException
{
- return column[getColumnIdx(col)];
+ return table[getColumnIdx(col)];
}
/**
@@ -695,7 +711,14 @@ public class MonetPreparedStatement
* @throws SQLException if a database access error
occurs
*/
public int getParameterCount() throws SQLException {
- return size;
+ int cnt = 0;
+
+ for (int i = 0; i < size; i++) {
+ if (column[i] == null)
+ cnt++;
+ }
+
+ return cnt;
}
/**
@@ -726,7 +749,7 @@ public class MonetPreparedStatement
public boolean isSigned(int param) throws SQLException {
// we can hardcode this, based on the colum type
// (from ResultSetMetaData.isSigned)
- switch (javaType[getColumnIdx(param)]) {
+ switch (javaType[getParamIdx(param)]) {
case Types.NUMERIC:
case Types.DECIMAL:
case Types.TINYINT:
@@ -756,7 +779,7 @@ public class MonetPreparedStatement
* @throws SQLException if a database access error
occurs
*/
public int getPrecision(int param) throws SQLException {
- return digits[getColumnIdx(param)];
+ return digits[getParamIdx(param)];
}
/**
@@ -768,7 +791,7 @@ public class MonetPreparedStatement
* @throws SQLException if a database access error
occurs
*/
public int getScale(int param) throws SQLException {
- return scale[getColumnIdx(param)];
+ return scale[getParamIdx(param)];
}
/**
@@ -779,7 +802,7 @@ public class MonetPreparedStatement
* @throws SQLException if a database access error
occurs
*/
public int getParameterType(int param) throws
SQLException {
- return javaType[getColumnIdx(param)];
+ return javaType[getParamIdx(param)];
}
/**
@@ -793,7 +816,7 @@ public class MonetPreparedStatement
* @throws SQLException if a database access error
occurs
*/
public String getParameterTypeName(int param) throws
SQLException {
- return monetdbType[getColumnIdx(param)];
+ return monetdbType[getParamIdx(param)];
}
/**
@@ -810,7 +833,16 @@ public class MonetPreparedStatement
* @throws SQLException if a database access error
occurs
*/
public String getParameterClassName(int param) throws
SQLException {
- return
MonetResultSet.getClassForType(javaType[getColumnIdx(param)]).getName();
+ Map map = getConnection().getTypeMap();
+ Class c;
+ if
(map.containsKey(monetdbType[getParamIdx(param)])) {
+ c =
(Class)map.get(monetdbType[getParamIdx(param)]);
+ } else {
+ c = MonetResultSet.getClassForType(
+
javaType[getParamIdx(param)]
+ );
+ }
+ return c.getName();
}
/**
@@ -1507,7 +1539,7 @@ public class MonetPreparedStatement
* the given object is ambiguous
*/
public void setObject(int index, Object x) throws SQLException {
- setObject(index, x, javaType[getColumnIdx(index)]);
+ setObject(index, x, javaType[getParamIdx(index)]);
}
/**
@@ -1888,10 +1920,126 @@ public class MonetPreparedStatement
} else if (x instanceof SQLXML) {
throw new SQLFeatureNotSupportedException("Operation
setObject() with object of type SQLXML currently not supported!", "0A000");
} else if (x instanceof SQLData) { // not in JDBC4.1???
- // do something with:
- // ((SQLData)x).writeSQL( [java.sql.SQLOutput] );
- // needs an SQLOutput stream... bit too far away from
reality
- throw new SQLFeatureNotSupportedException("Operation
setObject() with object of type SQLData currently not supported!", "0A000");
+ SQLData sx = (SQLData)x;
+ final int paramnr = parameterIndex;
+ final String sqltype = sx.getSQLTypeName();
+ SQLOutput out = new SQLOutput() {
+ public void writeString(String x) throws
SQLException {
_______________________________________________
checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list