### Eclipse Workspace Patch 1.0
#P jython-trunk
Index: tests/java/com/ziclix/python/sql/DataHandlerTest.java
===================================================================
--- tests/java/com/ziclix/python/sql/DataHandlerTest.java (revision 7127)
+++ tests/java/com/ziclix/python/sql/DataHandlerTest.java (working copy)
@@ -39,6 +39,7 @@
"DATALINK",
"DISTINCT",
"REF",
+ "ROWID", // java 6
"STRUCT");
for (Field field : Types.class.getDeclaredFields()) {
String typeName = field.getName();
Index: src/com/ziclix/python/sql/DataHandler.java
===================================================================
--- src/com/ziclix/python/sql/DataHandler.java (revision 7127)
+++ src/com/ziclix/python/sql/DataHandler.java (working copy)
@@ -236,11 +236,14 @@
case Types.CHAR:
case Types.VARCHAR:
+ case Java6Types.NCHAR:
+ case Java6Types.NVARCHAR:
String string = set.getString(col);
obj = string == null ? Py.None : Py.newUnicode(string);
break;
case Types.LONGVARCHAR:
+ case Java6Types.LONGNVARCHAR:
Reader reader = set.getCharacterStream(col);
obj = reader == null ? Py.None : Py.newUnicode(read(reader));
break;
@@ -310,6 +313,8 @@
break;
case Types.CLOB:
+ case Java6Types.NCLOB:
+ case Java6Types.SQLXML:
Clob clob = set.getClob(col);
obj = clob == null ? Py.None : Py.java2py(read(clob.getCharacterStream()));
break;
@@ -323,6 +328,8 @@
throw createUnsupportedTypeSQLException("DISTINCT", col);
case Types.REF:
throw createUnsupportedTypeSQLException("REF", col);
+ case Java6Types.ROWID:
+ throw createUnsupportedTypeSQLException("STRUCT", col);
case Types.STRUCT:
throw createUnsupportedTypeSQLException("STRUCT", col);
@@ -560,5 +567,60 @@
public String toString() {
return getClass().getName();
}
+
+ /**
+ * This interface can be removed as soon as we target java 6
+ */
+ private static interface Java6Types{
+ /**
+ * The constant in the Java programming language, sometimes referred to
+ * as a type code, that identifies the generic SQL type ROWID
+ *
+ * @since 1.6
+ *
+ */
+ public final static int ROWID = -8;
+
+ /**
+ * The constant in the Java programming language, sometimes referred to
+ * as a type code, that identifies the generic SQL type NCHAR
+ *
+ * @since 1.6
+ */
+ public static final int NCHAR = -15;
+
+ /**
+ * The constant in the Java programming language, sometimes referred to
+ * as a type code, that identifies the generic SQL type NVARCHAR
.
+ *
+ * @since 1.6
+ */
+ public static final int NVARCHAR = -9;
+
+ /**
+ * The constant in the Java programming language, sometimes referred to
+ * as a type code, that identifies the generic SQL type LONGNVARCHAR
.
+ *
+ * @since 1.6
+ */
+ public static final int LONGNVARCHAR = -16;
+
+ /**
+ * The constant in the Java programming language, sometimes referred to
+ * as a type code, that identifies the generic SQL type NCLOB
.
+ *
+ * @since 1.6
+ */
+ public static final int NCLOB = 2011;
+
+ /**
+ * The constant in the Java programming language, sometimes referred to
+ * as a type code, that identifies the generic SQL type XML
.
+ *
+ * @since 1.6
+ */
+ public static final int SQLXML = 2009;
+ }
+
}