You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by ka...@apache.org on 2007/03/06 16:13:47 UTC
svn commit: r515139 [2/2] - in /db/derby/code/trunk:
java/engine/org/apache/derby/iapi/jdbc/
java/engine/org/apache/derby/impl/jdbc/
java/engine/org/apache/derby/impl/sql/catalog/
java/engine/org/apache/derby/loc/ java/shared/org/apache/derby/shared/co...
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/odbc_metadata.out
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/odbc_metadata.out?view=diff&rev=515139&r1=515138&r2=515139
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/odbc_metadata.out (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/odbc_metadata.out Tue Mar 6 07:13:34 2007
@@ -87,6 +87,16 @@
null,SYSCS_UTIL,SYSCS_CHECK_TABLE,org.apache.derby.catalog.SystemProcedures.SYSCS_CHECK_TABLE,xxxxGENERATED-IDxxxx
null,SYSCS_UTIL,SYSCS_GET_DATABASE_PROPERTY,org.apache.derby.catalog.SystemProcedures.SYSCS_GET_DATABASE_PROPERTY,xxxxGENERATED-IDxxxx
null,SYSCS_UTIL,SYSCS_GET_RUNTIMESTATISTICS,org.apache.derby.catalog.SystemProcedures.SYSCS_GET_RUNTIMESTATISTICS,xxxxGENERATED-IDxxxx
+null,SYSIBM,BLOBCREATELOCATOR,org.apache.derby.impl.jdbc.LOBStoredProcedure.BLOBCREATELOCATOR,xxxxGENERATED-IDxxxx
+null,SYSIBM,BLOBGETBYTES,org.apache.derby.impl.jdbc.LOBStoredProcedure.BLOBGETBYTES,xxxxGENERATED-IDxxxx
+null,SYSIBM,BLOBGETLENGTH,org.apache.derby.impl.jdbc.LOBStoredProcedure.BLOBGETLENGTH,xxxxGENERATED-IDxxxx
+null,SYSIBM,BLOBGETPOSITIONFROMBYTES,org.apache.derby.impl.jdbc.LOBStoredProcedure.BLOBGETPOSITIONFROMBYTES,xxxxGENERATED-IDxxxx
+null,SYSIBM,BLOBGETPOSITIONFROMLOCATOR,org.apache.derby.impl.jdbc.LOBStoredProcedure.BLOBGETPOSITIONFROMLOCATOR,xxxxGENERATED-IDxxxx
+null,SYSIBM,CLOBCREATELOCATOR,org.apache.derby.impl.jdbc.LOBStoredProcedure.CLOBCREATELOCATOR,xxxxGENERATED-IDxxxx
+null,SYSIBM,CLOBGETLENGTH,org.apache.derby.impl.jdbc.LOBStoredProcedure.CLOBGETLENGTH,xxxxGENERATED-IDxxxx
+null,SYSIBM,CLOBGETPOSITIONFROMLOCATOR,org.apache.derby.impl.jdbc.LOBStoredProcedure.CLOBGETPOSITIONFROMLOCATOR,xxxxGENERATED-IDxxxx
+null,SYSIBM,CLOBGETPOSITIONFROMSTRING,org.apache.derby.impl.jdbc.LOBStoredProcedure.CLOBGETPOSITIONFROMSTRING,xxxxGENERATED-IDxxxx
+null,SYSIBM,CLOBGETSUBSTRING,org.apache.derby.impl.jdbc.LOBStoredProcedure.CLOBGETSUBSTRING,xxxxGENERATED-IDxxxx
getFunctions("Dummy Catalog",null,null):
FUNCTION_CAT[VARCHAR],FUNCTION_SCHEM[VARCHAR],FUNCTION_NAME[VARCHAR],REMARKS[VARCHAR],SPECIFIC_NAME[VARCHAR]
null,APP,DUMMY1,java.some.func,xxxxGENERATED-IDxxxx
@@ -96,15 +106,43 @@
null,SYSCS_UTIL,SYSCS_CHECK_TABLE,org.apache.derby.catalog.SystemProcedures.SYSCS_CHECK_TABLE,xxxxGENERATED-IDxxxx
null,SYSCS_UTIL,SYSCS_GET_DATABASE_PROPERTY,org.apache.derby.catalog.SystemProcedures.SYSCS_GET_DATABASE_PROPERTY,xxxxGENERATED-IDxxxx
null,SYSCS_UTIL,SYSCS_GET_RUNTIMESTATISTICS,org.apache.derby.catalog.SystemProcedures.SYSCS_GET_RUNTIMESTATISTICS,xxxxGENERATED-IDxxxx
+null,SYSIBM,BLOBCREATELOCATOR,org.apache.derby.impl.jdbc.LOBStoredProcedure.BLOBCREATELOCATOR,xxxxGENERATED-IDxxxx
+null,SYSIBM,BLOBGETBYTES,org.apache.derby.impl.jdbc.LOBStoredProcedure.BLOBGETBYTES,xxxxGENERATED-IDxxxx
+null,SYSIBM,BLOBGETLENGTH,org.apache.derby.impl.jdbc.LOBStoredProcedure.BLOBGETLENGTH,xxxxGENERATED-IDxxxx
+null,SYSIBM,BLOBGETPOSITIONFROMBYTES,org.apache.derby.impl.jdbc.LOBStoredProcedure.BLOBGETPOSITIONFROMBYTES,xxxxGENERATED-IDxxxx
+null,SYSIBM,BLOBGETPOSITIONFROMLOCATOR,org.apache.derby.impl.jdbc.LOBStoredProcedure.BLOBGETPOSITIONFROMLOCATOR,xxxxGENERATED-IDxxxx
+null,SYSIBM,CLOBCREATELOCATOR,org.apache.derby.impl.jdbc.LOBStoredProcedure.CLOBCREATELOCATOR,xxxxGENERATED-IDxxxx
+null,SYSIBM,CLOBGETLENGTH,org.apache.derby.impl.jdbc.LOBStoredProcedure.CLOBGETLENGTH,xxxxGENERATED-IDxxxx
+null,SYSIBM,CLOBGETPOSITIONFROMLOCATOR,org.apache.derby.impl.jdbc.LOBStoredProcedure.CLOBGETPOSITIONFROMLOCATOR,xxxxGENERATED-IDxxxx
+null,SYSIBM,CLOBGETPOSITIONFROMSTRING,org.apache.derby.impl.jdbc.LOBStoredProcedure.CLOBGETPOSITIONFROMSTRING,xxxxGENERATED-IDxxxx
+null,SYSIBM,CLOBGETSUBSTRING,org.apache.derby.impl.jdbc.LOBStoredProcedure.CLOBGETSUBSTRING,xxxxGENERATED-IDxxxx
getFunctions(null,"%SYS%",null):
FUNCTION_CAT[VARCHAR],FUNCTION_SCHEM[VARCHAR],FUNCTION_NAME[VARCHAR],REMARKS[VARCHAR],SPECIFIC_NAME[VARCHAR]
null,SYSCS_UTIL,SYSCS_CHECK_TABLE,org.apache.derby.catalog.SystemProcedures.SYSCS_CHECK_TABLE,xxxxGENERATED-IDxxxx
null,SYSCS_UTIL,SYSCS_GET_DATABASE_PROPERTY,org.apache.derby.catalog.SystemProcedures.SYSCS_GET_DATABASE_PROPERTY,xxxxGENERATED-IDxxxx
null,SYSCS_UTIL,SYSCS_GET_RUNTIMESTATISTICS,org.apache.derby.catalog.SystemProcedures.SYSCS_GET_RUNTIMESTATISTICS,xxxxGENERATED-IDxxxx
+null,SYSIBM,BLOBCREATELOCATOR,org.apache.derby.impl.jdbc.LOBStoredProcedure.BLOBCREATELOCATOR,xxxxGENERATED-IDxxxx
+null,SYSIBM,BLOBGETBYTES,org.apache.derby.impl.jdbc.LOBStoredProcedure.BLOBGETBYTES,xxxxGENERATED-IDxxxx
+null,SYSIBM,BLOBGETLENGTH,org.apache.derby.impl.jdbc.LOBStoredProcedure.BLOBGETLENGTH,xxxxGENERATED-IDxxxx
+null,SYSIBM,BLOBGETPOSITIONFROMBYTES,org.apache.derby.impl.jdbc.LOBStoredProcedure.BLOBGETPOSITIONFROMBYTES,xxxxGENERATED-IDxxxx
+null,SYSIBM,BLOBGETPOSITIONFROMLOCATOR,org.apache.derby.impl.jdbc.LOBStoredProcedure.BLOBGETPOSITIONFROMLOCATOR,xxxxGENERATED-IDxxxx
+null,SYSIBM,CLOBCREATELOCATOR,org.apache.derby.impl.jdbc.LOBStoredProcedure.CLOBCREATELOCATOR,xxxxGENERATED-IDxxxx
+null,SYSIBM,CLOBGETLENGTH,org.apache.derby.impl.jdbc.LOBStoredProcedure.CLOBGETLENGTH,xxxxGENERATED-IDxxxx
+null,SYSIBM,CLOBGETPOSITIONFROMLOCATOR,org.apache.derby.impl.jdbc.LOBStoredProcedure.CLOBGETPOSITIONFROMLOCATOR,xxxxGENERATED-IDxxxx
+null,SYSIBM,CLOBGETPOSITIONFROMSTRING,org.apache.derby.impl.jdbc.LOBStoredProcedure.CLOBGETPOSITIONFROMSTRING,xxxxGENERATED-IDxxxx
+null,SYSIBM,CLOBGETSUBSTRING,org.apache.derby.impl.jdbc.LOBStoredProcedure.CLOBGETSUBSTRING,xxxxGENERATED-IDxxxx
getFunctions(null,null,"%GET%"):
FUNCTION_CAT[VARCHAR],FUNCTION_SCHEM[VARCHAR],FUNCTION_NAME[VARCHAR],REMARKS[VARCHAR],SPECIFIC_NAME[VARCHAR]
null,SYSCS_UTIL,SYSCS_GET_DATABASE_PROPERTY,org.apache.derby.catalog.SystemProcedures.SYSCS_GET_DATABASE_PROPERTY,xxxxGENERATED-IDxxxx
null,SYSCS_UTIL,SYSCS_GET_RUNTIMESTATISTICS,org.apache.derby.catalog.SystemProcedures.SYSCS_GET_RUNTIMESTATISTICS,xxxxGENERATED-IDxxxx
+null,SYSIBM,BLOBGETBYTES,org.apache.derby.impl.jdbc.LOBStoredProcedure.BLOBGETBYTES,xxxxGENERATED-IDxxxx
+null,SYSIBM,BLOBGETLENGTH,org.apache.derby.impl.jdbc.LOBStoredProcedure.BLOBGETLENGTH,xxxxGENERATED-IDxxxx
+null,SYSIBM,BLOBGETPOSITIONFROMBYTES,org.apache.derby.impl.jdbc.LOBStoredProcedure.BLOBGETPOSITIONFROMBYTES,xxxxGENERATED-IDxxxx
+null,SYSIBM,BLOBGETPOSITIONFROMLOCATOR,org.apache.derby.impl.jdbc.LOBStoredProcedure.BLOBGETPOSITIONFROMLOCATOR,xxxxGENERATED-IDxxxx
+null,SYSIBM,CLOBGETLENGTH,org.apache.derby.impl.jdbc.LOBStoredProcedure.CLOBGETLENGTH,xxxxGENERATED-IDxxxx
+null,SYSIBM,CLOBGETPOSITIONFROMLOCATOR,org.apache.derby.impl.jdbc.LOBStoredProcedure.CLOBGETPOSITIONFROMLOCATOR,xxxxGENERATED-IDxxxx
+null,SYSIBM,CLOBGETPOSITIONFROMSTRING,org.apache.derby.impl.jdbc.LOBStoredProcedure.CLOBGETPOSITIONFROMSTRING,xxxxGENERATED-IDxxxx
+null,SYSIBM,CLOBGETSUBSTRING,org.apache.derby.impl.jdbc.LOBStoredProcedure.CLOBGETSUBSTRING,xxxxGENERATED-IDxxxx
getFunctions("","",null):
FUNCTION_CAT[VARCHAR],FUNCTION_SCHEM[VARCHAR],FUNCTION_NAME[VARCHAR],REMARKS[VARCHAR],SPECIFIC_NAME[VARCHAR]
getFunctionColumns(null,null,null,null):
@@ -126,6 +164,36 @@
null,SYSCS_UTIL,SYSCS_GET_DATABASE_PROPERTY,,4,12,VARCHAR,32672,65344,null,null,1,null,65344,0,YES,xxxxGENERATED-IDxxxx,1,-1
null,SYSCS_UTIL,SYSCS_GET_DATABASE_PROPERTY,KEY,1,12,VARCHAR,128,256,null,null,1,null,256,1,YES,xxxxGENERATED-IDxxxx,1,0
null,SYSCS_UTIL,SYSCS_GET_RUNTIMESTATISTICS,,4,12,VARCHAR,32672,65344,null,null,1,null,65344,0,YES,xxxxGENERATED-IDxxxx,0,-1
+null,SYSIBM,BLOBCREATELOCATOR,,4,4,INTEGER,0,2147483647,0,10,1,null,null,0,YES,xxxxGENERATED-IDxxxx,0,-1
+null,SYSIBM,BLOBGETBYTES,,4,-3,VARCHAR () FOR BIT DATA,32672,32672,null,null,1,null,32672,0,YES,xxxxGENERATED-IDxxxx,3,-1
+null,SYSIBM,BLOBGETBYTES,LOCATOR,1,4,INTEGER,10,4,0,10,1,null,null,1,YES,xxxxGENERATED-IDxxxx,3,0
+null,SYSIBM,BLOBGETBYTES,POS,1,-5,BIGINT,19,40,0,10,1,null,null,2,YES,xxxxGENERATED-IDxxxx,3,1
+null,SYSIBM,BLOBGETBYTES,LEN,1,4,INTEGER,10,4,0,10,1,null,null,3,YES,xxxxGENERATED-IDxxxx,3,2
+null,SYSIBM,BLOBGETLENGTH,,4,-5,BIGINT,0,40,0,10,1,null,null,0,YES,xxxxGENERATED-IDxxxx,1,-1
+null,SYSIBM,BLOBGETLENGTH,LOCATOR,1,4,INTEGER,10,4,0,10,1,null,null,1,YES,xxxxGENERATED-IDxxxx,1,0
+null,SYSIBM,BLOBGETPOSITIONFROMBYTES,,4,-5,BIGINT,0,40,0,10,1,null,null,0,YES,xxxxGENERATED-IDxxxx,3,-1
+null,SYSIBM,BLOBGETPOSITIONFROMBYTES,LOCATOR,1,4,INTEGER,10,4,0,10,1,null,null,1,YES,xxxxGENERATED-IDxxxx,3,0
+null,SYSIBM,BLOBGETPOSITIONFROMBYTES,SEARCHBYTES,1,-3,VARCHAR () FOR BIT DATA,32672,32672,null,null,1,null,32672,2,YES,xxxxGENERATED-IDxxxx,3,1
+null,SYSIBM,BLOBGETPOSITIONFROMBYTES,POS,1,-5,BIGINT,19,40,0,10,1,null,null,3,YES,xxxxGENERATED-IDxxxx,3,2
+null,SYSIBM,BLOBGETPOSITIONFROMLOCATOR,,4,-5,BIGINT,0,40,0,10,1,null,null,0,YES,xxxxGENERATED-IDxxxx,3,-1
+null,SYSIBM,BLOBGETPOSITIONFROMLOCATOR,LOCATOR,1,4,INTEGER,10,4,0,10,1,null,null,1,YES,xxxxGENERATED-IDxxxx,3,0
+null,SYSIBM,BLOBGETPOSITIONFROMLOCATOR,SEARCHLOCATOR,1,4,INTEGER,10,4,0,10,1,null,null,2,YES,xxxxGENERATED-IDxxxx,3,1
+null,SYSIBM,BLOBGETPOSITIONFROMLOCATOR,POS,1,-5,BIGINT,19,40,0,10,1,null,null,3,YES,xxxxGENERATED-IDxxxx,3,2
+null,SYSIBM,CLOBCREATELOCATOR,,4,4,INTEGER,0,2147483647,0,10,1,null,null,0,YES,xxxxGENERATED-IDxxxx,0,-1
+null,SYSIBM,CLOBGETLENGTH,,4,-5,BIGINT,0,40,0,10,1,null,null,0,YES,xxxxGENERATED-IDxxxx,1,-1
+null,SYSIBM,CLOBGETLENGTH,LOCATOR,1,4,INTEGER,10,4,0,10,1,null,null,1,YES,xxxxGENERATED-IDxxxx,1,0
+null,SYSIBM,CLOBGETPOSITIONFROMLOCATOR,,4,-5,BIGINT,0,40,0,10,1,null,null,0,YES,xxxxGENERATED-IDxxxx,3,-1
+null,SYSIBM,CLOBGETPOSITIONFROMLOCATOR,LOCATOR,1,4,INTEGER,10,4,0,10,1,null,null,1,YES,xxxxGENERATED-IDxxxx,3,0
+null,SYSIBM,CLOBGETPOSITIONFROMLOCATOR,SEARCHLOCATOR,1,4,INTEGER,10,4,0,10,1,null,null,2,YES,xxxxGENERATED-IDxxxx,3,1
+null,SYSIBM,CLOBGETPOSITIONFROMLOCATOR,POS,1,-5,BIGINT,19,40,0,10,1,null,null,3,YES,xxxxGENERATED-IDxxxx,3,2
+null,SYSIBM,CLOBGETPOSITIONFROMSTRING,,4,-5,BIGINT,0,40,0,10,1,null,null,0,YES,xxxxGENERATED-IDxxxx,3,-1
+null,SYSIBM,CLOBGETPOSITIONFROMSTRING,LOCATOR,1,4,INTEGER,10,4,0,10,1,null,null,1,YES,xxxxGENERATED-IDxxxx,3,0
+null,SYSIBM,CLOBGETPOSITIONFROMSTRING,SEARCHSTR,1,12,VARCHAR,32672,65344,null,null,1,null,65344,2,YES,xxxxGENERATED-IDxxxx,3,1
+null,SYSIBM,CLOBGETPOSITIONFROMSTRING,POS,1,-5,BIGINT,19,40,0,10,1,null,null,3,YES,xxxxGENERATED-IDxxxx,3,2
+null,SYSIBM,CLOBGETSUBSTRING,,4,12,VARCHAR,32672,65344,null,null,1,null,65344,0,YES,xxxxGENERATED-IDxxxx,3,-1
+null,SYSIBM,CLOBGETSUBSTRING,LOCATOR,1,4,INTEGER,10,4,0,10,1,null,null,1,YES,xxxxGENERATED-IDxxxx,3,0
+null,SYSIBM,CLOBGETSUBSTRING,POS,1,-5,BIGINT,19,40,0,10,1,null,null,2,YES,xxxxGENERATED-IDxxxx,3,1
+null,SYSIBM,CLOBGETSUBSTRING,LEN,1,4,INTEGER,10,4,0,10,1,null,null,3,YES,xxxxGENERATED-IDxxxx,3,2
getFunctionColumns(null,"APP","DUMMY%","X"):
FUNCTION_CAT[VARCHAR],FUNCTION_SCHEM[VARCHAR],FUNCTION_NAME[VARCHAR],COLUMN_NAME[VARCHAR],COLUMN_TYPE[SMALLINT],DATA_TYPE[INTEGER],TYPE_NAME[VARCHAR],PRECISION[INTEGER],LENGTH[INTEGER],SCALE[SMALLINT],RADIX[SMALLINT],NULLABLE[SMALLINT],REMARKS[VARCHAR],CHAR_OCTET_LENGTH[INTEGER],ORDINAL_POSITION[INTEGER],IS_NULLABLE[VARCHAR],SPECIFIC_NAME[VARCHAR],METHOD_ID[SMALLINT],PARAMETER_ID[SMALLINT]
null,APP,DUMMY1,X,1,5,SMALLINT,5,2,0,10,1,null,null,1,YES,xxxxGENERATED-IDxxxx,1,0
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/TestDbMetaData.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/TestDbMetaData.java?view=diff&rev=515139&r1=515138&r2=515139
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/TestDbMetaData.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/TestDbMetaData.java Tue Mar 6 07:13:34 2007
@@ -143,6 +143,36 @@
{ null, "SYSCS_UTIL", "SYSCS_GET_RUNTIMESTATISTICS",
"org.apache.derby.catalog.SystemProcedures." +
"SYSCS_GET_RUNTIMESTATISTICS", new GeneratedId() },
+ { null, "SYSIBM", "BLOBCREATELOCATOR",
+ "org.apache.derby.impl.jdbc.LOBStoredProcedure." +
+ "BLOBCREATELOCATOR", new GeneratedId() },
+ { null, "SYSIBM", "BLOBGETBYTES",
+ "org.apache.derby.impl.jdbc.LOBStoredProcedure." +
+ "BLOBGETBYTES", new GeneratedId() },
+ { null, "SYSIBM", "BLOBGETLENGTH",
+ "org.apache.derby.impl.jdbc.LOBStoredProcedure." +
+ "BLOBGETLENGTH", new GeneratedId() },
+ { null, "SYSIBM", "BLOBGETPOSITIONFROMBYTES",
+ "org.apache.derby.impl.jdbc.LOBStoredProcedure." +
+ "BLOBGETPOSITIONFROMBYTES", new GeneratedId() },
+ { null, "SYSIBM", "BLOBGETPOSITIONFROMLOCATOR",
+ "org.apache.derby.impl.jdbc.LOBStoredProcedure." +
+ "BLOBGETPOSITIONFROMLOCATOR", new GeneratedId() },
+ { null, "SYSIBM", "CLOBCREATELOCATOR",
+ "org.apache.derby.impl.jdbc.LOBStoredProcedure." +
+ "CLOBCREATELOCATOR", new GeneratedId() },
+ { null, "SYSIBM", "CLOBGETLENGTH",
+ "org.apache.derby.impl.jdbc.LOBStoredProcedure." +
+ "CLOBGETLENGTH", new GeneratedId() },
+ { null, "SYSIBM", "CLOBGETPOSITIONFROMLOCATOR",
+ "org.apache.derby.impl.jdbc.LOBStoredProcedure." +
+ "CLOBGETPOSITIONFROMLOCATOR", new GeneratedId() },
+ { null, "SYSIBM", "CLOBGETPOSITIONFROMSTRING",
+ "org.apache.derby.impl.jdbc.LOBStoredProcedure." +
+ "CLOBGETPOSITIONFROMSTRING", new GeneratedId() },
+ { null, "SYSIBM", "CLOBGETSUBSTRING",
+ "org.apache.derby.impl.jdbc.LOBStoredProcedure." +
+ "CLOBGETSUBSTRING", new GeneratedId() },
};
public void testGetFunctionsNullNullNull() throws SQLException {
@@ -175,6 +205,36 @@
{ null, "SYSCS_UTIL", "SYSCS_GET_RUNTIMESTATISTICS",
"org.apache.derby.catalog.SystemProcedures." +
"SYSCS_GET_RUNTIMESTATISTICS", new GeneratedId() },
+ { null, "SYSIBM", "BLOBCREATELOCATOR",
+ "org.apache.derby.impl.jdbc.LOBStoredProcedure." +
+ "BLOBCREATELOCATOR", new GeneratedId() },
+ { null, "SYSIBM", "BLOBGETBYTES",
+ "org.apache.derby.impl.jdbc.LOBStoredProcedure." +
+ "BLOBGETBYTES", new GeneratedId() },
+ { null, "SYSIBM", "BLOBGETLENGTH",
+ "org.apache.derby.impl.jdbc.LOBStoredProcedure." +
+ "BLOBGETLENGTH", new GeneratedId() },
+ { null, "SYSIBM", "BLOBGETPOSITIONFROMBYTES",
+ "org.apache.derby.impl.jdbc.LOBStoredProcedure." +
+ "BLOBGETPOSITIONFROMBYTES", new GeneratedId() },
+ { null, "SYSIBM", "BLOBGETPOSITIONFROMLOCATOR",
+ "org.apache.derby.impl.jdbc.LOBStoredProcedure." +
+ "BLOBGETPOSITIONFROMLOCATOR", new GeneratedId() },
+ { null, "SYSIBM", "CLOBCREATELOCATOR",
+ "org.apache.derby.impl.jdbc.LOBStoredProcedure." +
+ "CLOBCREATELOCATOR", new GeneratedId() },
+ { null, "SYSIBM", "CLOBGETLENGTH",
+ "org.apache.derby.impl.jdbc.LOBStoredProcedure." +
+ "CLOBGETLENGTH", new GeneratedId() },
+ { null, "SYSIBM", "CLOBGETPOSITIONFROMLOCATOR",
+ "org.apache.derby.impl.jdbc.LOBStoredProcedure." +
+ "CLOBGETPOSITIONFROMLOCATOR", new GeneratedId() },
+ { null, "SYSIBM", "CLOBGETPOSITIONFROMSTRING",
+ "org.apache.derby.impl.jdbc.LOBStoredProcedure." +
+ "CLOBGETPOSITIONFROMSTRING", new GeneratedId() },
+ { null, "SYSIBM", "CLOBGETSUBSTRING",
+ "org.apache.derby.impl.jdbc.LOBStoredProcedure." +
+ "CLOBGETSUBSTRING", new GeneratedId() },
};
JDBC.assertFullResultSet(rs, sysFunctions, false);
}
@@ -191,6 +251,30 @@
{ null, "SYSCS_UTIL", "SYSCS_GET_RUNTIMESTATISTICS",
"org.apache.derby.catalog.SystemProcedures." +
"SYSCS_GET_RUNTIMESTATISTICS", new GeneratedId() },
+ { null, "SYSIBM", "BLOBGETBYTES",
+ "org.apache.derby.impl.jdbc.LOBStoredProcedure." +
+ "BLOBGETBYTES", new GeneratedId() },
+ { null, "SYSIBM", "BLOBGETLENGTH",
+ "org.apache.derby.impl.jdbc.LOBStoredProcedure." +
+ "BLOBGETLENGTH", new GeneratedId() },
+ { null, "SYSIBM", "BLOBGETPOSITIONFROMBYTES",
+ "org.apache.derby.impl.jdbc.LOBStoredProcedure." +
+ "BLOBGETPOSITIONFROMBYTES", new GeneratedId() },
+ { null, "SYSIBM", "BLOBGETPOSITIONFROMLOCATOR",
+ "org.apache.derby.impl.jdbc.LOBStoredProcedure." +
+ "BLOBGETPOSITIONFROMLOCATOR", new GeneratedId() },
+ { null, "SYSIBM", "CLOBGETLENGTH",
+ "org.apache.derby.impl.jdbc.LOBStoredProcedure." +
+ "CLOBGETLENGTH", new GeneratedId() },
+ { null, "SYSIBM", "CLOBGETPOSITIONFROMLOCATOR",
+ "org.apache.derby.impl.jdbc.LOBStoredProcedure." +
+ "CLOBGETPOSITIONFROMLOCATOR", new GeneratedId() },
+ { null, "SYSIBM", "CLOBGETPOSITIONFROMSTRING",
+ "org.apache.derby.impl.jdbc.LOBStoredProcedure." +
+ "CLOBGETPOSITIONFROMSTRING", new GeneratedId() },
+ { null, "SYSIBM", "CLOBGETSUBSTRING",
+ "org.apache.derby.impl.jdbc.LOBStoredProcedure." +
+ "CLOBGETSUBSTRING", new GeneratedId() },
};
JDBC.assertFullResultSet(rs, getFunctions, false);
}
Added: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/BlobStoredProcedureTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/BlobStoredProcedureTest.java?view=auto&rev=515139
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/BlobStoredProcedureTest.java (added)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/BlobStoredProcedureTest.java Tue Mar 6 07:13:34 2007
@@ -0,0 +1,355 @@
+/*
+ *
+ * Derby - Class org.apache.derbyTesting.functionTests.tests.lang.BlobStoredProcedureTest
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific
+ * language governing permissions and limitations under the License.
+ */
+
+package org.apache.derbyTesting.functionTests.tests.jdbcapi;
+
+import java.sql.Blob;
+import java.sql.CallableStatement;
+import java.sql.Statement;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import junit.framework.Assert;
+import org.apache.derbyTesting.junit.BaseJDBCTestCase;
+import org.apache.derbyTesting.junit.TestConfiguration;
+
+/**
+ * Tests the stored procedures introduced as part of DERBY-208. These stored procedures will
+ * used by the Blob methods on the client side.
+ */
+public class BlobStoredProcedureTest extends BaseJDBCTestCase {
+
+ //The test string that will be used in all the test runs.
+ final String testStr = "I am a simple derby test case";
+
+ //Byte array obatined from the string
+ final byte [] strBytes = testStr.getBytes();
+
+ //The length of the test string that will be used.
+ final long testStrLength = testStr.length();
+
+ /**
+ * Public constructor required for running test as standalone JUnit.
+ * @param name a string containing the name of the test.
+ */
+ public BlobStoredProcedureTest(String name) {
+ super(name);
+ }
+
+ /**
+ * Create a suite of tests.
+ * @return the test suite created.
+ */
+ public static Test suite() {
+ return TestConfiguration.defaultSuite(BlobStoredProcedureTest.class);
+ }
+
+ /**
+ * Setup the test.
+ * @throws a SQLException.
+ */
+ protected void setUp() throws SQLException {
+ //initialize the locator to a default value.
+ int locator = -1;
+ //set auto commit to false for the connection
+ getConnection().setAutoCommit(false);
+ //call the stored procedure to return the created locator.
+ CallableStatement cs = prepareCall
+ ("? = CALL SYSIBM.BLOBCREATELOCATOR()");
+ cs.registerOutParameter(1, java.sql.Types.INTEGER);
+ cs.executeUpdate();
+ locator = cs.getInt(1);
+ cs.close();
+ //use this new locator to test the SETBYTES function
+ //by inserting the new bytes and testing whether it has
+ //been inserted properly.
+
+ //Insert the new substring.
+ cs = prepareCall("CALL SYSIBM.BLOBSETBYTES(?,?,?,?)");
+ cs.setInt(1, locator);
+ cs.setLong(2, 1L);
+ cs.setInt(3, (int)testStrLength);
+ cs.setBytes(4, strBytes);
+ cs.execute();
+ cs.close();
+ }
+
+ /**
+ * Cleanup the test.
+ * @throws SQLException.
+ */
+ protected void tearDown() throws Exception {
+ commit();
+ super.tearDown();
+ }
+
+ /**
+ * test the BLOBGETBYTES stored procedure which will
+ * be used in the implementation of Blob.getBytes.
+ *
+ * @throws a SQLException.
+ */
+ public void testBlobGetBytesSP() throws SQLException {
+ // This string represents the substring that is got from the
+ // stored procedure
+ String testSubStr = testStr.substring(0, 10);
+ byte [] testSubBytes = testSubStr.getBytes();
+
+ //create a callable statement and execute it to call the stored
+ //procedure BLOBGETBYTES that will get the bytes
+ //inserted into the Blob in the setup method.
+ CallableStatement cs = prepareCall
+ ("? = CALL SYSIBM.BLOBGETBYTES(?,?,?)");
+ cs.registerOutParameter(1, java.sql.Types.VARBINARY);
+ cs.setInt(2, 1);
+ cs.setLong(3, 1);
+ //set the length of the bytes returned as 10.
+ cs.setInt(4, 10);
+ cs.executeUpdate();
+ byte [] retVal = cs.getBytes(1);
+
+ for (int i=0;i<10;i++){
+ assertEquals
+ ("The Stored procedure SYSIBM.BLOBGETBYTES " +
+ "returns the wrong bytes"
+ , testSubBytes[i], retVal[i]);
+ }
+ cs.close();
+ }
+
+ /**
+ * Tests the locator value returned by the stored procedure
+ * BLOBCREATELOCATOR.
+ *
+ * @throws SQLException.
+ *
+ */
+ public void testBlobCreateLocatorSP() throws SQLException {
+ //initialize the locator to a default value.
+ int locator = -1;
+ //call the stored procedure to return the created locator.
+ CallableStatement cs = prepareCall
+ ("? = CALL SYSIBM.BLOBCREATELOCATOR()");
+ cs.registerOutParameter(1, java.sql.Types.INTEGER);
+ cs.executeUpdate();
+ locator = cs.getInt(1);
+ //verify if the locator rturned and expected are equal.
+ //remember in setup a locator is already created
+ //hence expected value is 2
+ assertEquals("The locator values returned by " +
+ "SYSIBM.BLOBCREATELOCATOR() are incorrect", 2, locator);
+ cs.close();
+ }
+
+ /**
+ * Tests the SYSIBM.BLOBRELEASELOCATOR stored procedure.
+ *
+ * @throws SQLException
+ */
+ public void testBlobReleaseLocatorSP() throws SQLException {
+ CallableStatement cs = prepareCall
+ ("CALL SYSIBM.BLOBRELEASELOCATOR(?)");
+ cs.setInt(1, 1);
+ cs.execute();
+ cs.close();
+
+ //once the locator has been released the BLOBGETLENGTH on that
+ //locator value will throw an SQLException. This assures that
+ //the locator has been properly released.
+
+ cs = prepareCall("? = CALL SYSIBM.BLOBGETLENGTH(?)");
+ cs.registerOutParameter(1, java.sql.Types.BIGINT);
+ cs.setInt(2, 1);
+ try {
+ cs.executeUpdate();
+ } catch(SQLException sqle) {
+ //on expected lines. The test was successful.
+ return;
+ }
+ //The exception was not thrown. The test has failed here.
+ fail("Error the locator was not released by SYSIBM.BLOBRELEASELOCATOR");
+ cs.close();
+ }
+
+ /**
+ * Tests the SYSIBM.BLOBGETLENGTH stored procedure.
+ *
+ * @throws SQLException.
+ */
+ public void testBlobGetLengthSP() throws SQLException {
+ CallableStatement cs = prepareCall
+ ("? = CALL SYSIBM.BLOBGETLENGTH(?)");
+ cs.registerOutParameter(1, java.sql.Types.BIGINT);
+ cs.setInt(2, 1);
+ cs.executeUpdate();
+ //compare the actual length of the test string and the returned length.
+ assertEquals("Error SYSIBM.BLOBGETLENGTH returns " +
+ "the wrong value for the length of the Blob", testStrLength, cs.getLong(1));
+ cs.close();
+ }
+
+ /**
+ * Tests the SYSIBM.BLOBGETPOSITIONFROMBYTES stored procedure.
+ *
+ * @throws SQLException.
+ */
+ public void testBlobGetPositionFromBytesSP() throws Exception {
+ CallableStatement cs = prepareCall
+ ("? = CALL SYSIBM.BLOBGETPOSITIONFROMBYTES(?,?,?)");
+ cs.registerOutParameter(1, java.sql.Types.BIGINT);
+ cs.setInt(2, 1);
+ //find the position of the bytes corresponding to
+ //the String simple in the test string.
+ cs.setBytes(3, (new String("simple")).getBytes());
+ cs.setLong(4, 1L);
+ cs.executeUpdate();
+ //check to see that the returned position and the expected position
+ //of the substring simple in the string are matching.
+ assertEquals("Error SYSIBM.BLOBGETPOSITIONFROMBYTES returns " +
+ "the wrong value for the position of the Blob", 8, cs.getLong(1));
+ cs.close();
+ }
+
+ /**
+ * Tests the stored procedure SYSIBM.BLOBSETBYTES
+ *
+ * @throws SQLException.
+ */
+ public void testBlobSetBytes() throws SQLException {
+ String newString = "123456789012345";
+ byte [] newBytes = newString.getBytes();
+ //initialize the locator to a default value.
+ int locator = -1;
+ //call the stored procedure to return the created locator.
+ CallableStatement cs = prepareCall
+ ("? = CALL SYSIBM.BLOBCREATELOCATOR()");
+ cs.registerOutParameter(1, java.sql.Types.INTEGER);
+ cs.executeUpdate();
+ locator = cs.getInt(1);
+ cs.close();
+
+ //use this new locator to test the SETBYTES function
+ //by inserting the new bytes and testing whether it has
+ //been inserted properly.
+
+ //Insert the new substring.
+ cs = prepareCall("CALL SYSIBM.BLOBSETBYTES(?,?,?,?)");
+ cs.setInt(1, locator);
+ cs.setLong(2, 1L);
+ cs.setInt(3, newString.length());
+ cs.setBytes(4, newBytes);
+ cs.execute();
+ cs.close();
+
+ //check the new locator to see if the value has been inserted correctly.
+ cs = prepareCall("? = CALL " +
+ "SYSIBM.BLOBGETBYTES(?,?,?)");
+ cs.registerOutParameter(1, java.sql.Types.VARBINARY);
+ cs.setInt(2, locator);
+ cs.setLong(3, 1);
+ cs.setInt(4, newString.length());
+ cs.executeUpdate();
+ byte [] retVal = cs.getBytes(1);
+ //compare the new bytes and the bytes returned by the stored
+ //procedure to see of they are the same.
+ for (int i=0;i<newString.length();i++){
+ assertEquals
+ ("The Stored procedure SYSIBM.BLOBGETBYTES " +
+ "returns the wrong bytes"
+ , newBytes[i], retVal[i]);
+ }
+ cs.close();
+ }
+
+ /**
+ * Test the stored procedure SYSIBM.BLOBGETLENGTH
+ *
+ * @throws SQLException
+ */
+ public void testBlobTruncateSP() throws SQLException {
+ CallableStatement cs = prepareCall
+ ("CALL SYSIBM.BLOBTRUNCATE(?,?)");
+ cs.setInt(1, 1);
+ cs.setLong(2, 10L);
+ cs.execute();
+ cs.close();
+
+ cs = prepareCall
+ ("? = CALL SYSIBM.BLOBGETLENGTH(?)");
+ cs.registerOutParameter(1, java.sql.Types.BIGINT);
+ cs.setInt(2, 1);
+ cs.executeUpdate();
+ //compare the actual length of the test string and the returned length.
+ assertEquals("Error SYSIBM.BLOBGETLENGTH returns " +
+ "the wrong value for the length of the Blob", 10L
+ , cs.getLong(1));
+ cs.close();
+ }
+
+ /**
+ * Tests the SYSIBM.BLOBGETPOSITIONFROMLOCATOR stored procedure.
+ *
+ * @throws SQLException.
+ */
+ public void testBlobGetPositionFromLocatorSP() throws SQLException {
+ String newString = "simple";
+ byte [] newBytes = newString.getBytes();
+ //initialize the locator to a default value.
+ int locator = -1;
+ //call the stored procedure to return the created locator.
+ CallableStatement cs = prepareCall
+ ("? = CALL SYSIBM.BLOBCREATELOCATOR()");
+ cs.registerOutParameter(1, java.sql.Types.INTEGER);
+ cs.executeUpdate();
+ locator = cs.getInt(1);
+ cs.close();
+
+ //use this new locator to test the SETBYTES function
+ //by inserting the new bytes and testing whether it has
+ //been inserted properly.
+
+ //Insert the new substring.
+ cs = prepareCall("CALL SYSIBM.BLOBSETBYTES(?,?,?,?)");
+ cs.setInt(1, locator);
+ cs.setLong(2, 1L);
+ cs.setInt(3, newString.length());
+ cs.setBytes(4, newBytes);
+ cs.execute();
+ cs.close();
+
+ cs = prepareCall
+ ("? = CALL SYSIBM.BLOBGETPOSITIONFROMLOCATOR(?,?,?)");
+ cs.registerOutParameter(1, java.sql.Types.BIGINT);
+ cs.setInt(2, 1);
+ //find the position of the bytes corresponding to
+ //the String simple in the test string.
+ cs.setInt(3, locator);
+ cs.setLong(4, 1L);
+ cs.executeUpdate();
+ //check to see that the returned position and the expected position
+ //of the substring simple in the string are matching.
+ assertEquals("Error SYSIBM.BLOBGETPOSITIONFROMLOCATOR returns " +
+ "the wrong value for the position of the Blob", 8, cs.getLong(1));
+ cs.close();
+ }
+}
Propchange: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/BlobStoredProcedureTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ClobStoredProcedureTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ClobStoredProcedureTest.java?view=auto&rev=515139
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ClobStoredProcedureTest.java (added)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ClobStoredProcedureTest.java Tue Mar 6 07:13:34 2007
@@ -0,0 +1,400 @@
+/*
+ *
+ * Derby - Class org.apache.derbyTesting.functionTests.tests.lang.ClobStoredProcedureTest
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific
+ * language governing permissions and limitations under the License.
+ */
+package org.apache.derbyTesting.functionTests.tests.jdbcapi;
+
+
+import java.sql.CallableStatement;
+import java.sql.Clob;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import junit.framework.Assert;
+import org.apache.derbyTesting.junit.BaseJDBCTestCase;
+import org.apache.derbyTesting.junit.TestConfiguration;
+
+/**
+ * Tests the stored procedures introduced as part of DERBY-208.
+ * These stored procedures will used by the Clob methods on the client side.
+ */
+public class ClobStoredProcedureTest extends BaseJDBCTestCase {
+
+ final String testStr = "I am a simple derby test case";
+ final long testStrLength = testStr.length();
+ /**
+ * Public constructor required for running test as standalone JUnit.
+ * @param name a string containing the name of the test.
+ */
+ public ClobStoredProcedureTest(String name) {
+ super(name);
+ }
+
+ /**
+ * Create a suite of tests.
+ * @return the test suite created.
+ */
+ public static Test suite() {
+ return TestConfiguration.defaultSuite(ClobStoredProcedureTest.class);
+ }
+
+ /**
+ * Setup the test.
+ * @throws a SQLException.
+ */
+ public void setUp() throws Exception {
+ int locator = 0;
+ getConnection().setAutoCommit(false);
+ CallableStatement cs = prepareCall
+ ("? = CALL SYSIBM.CLOBCREATELOCATOR()");
+ cs.registerOutParameter(1, java.sql.Types.INTEGER);
+ cs.executeUpdate();
+ locator = cs.getInt(1);
+
+ cs.close();
+ cs = prepareCall("CALL SYSIBM.CLOBSETSTRING(?,?,?,?)");
+ cs.setInt(1, locator);
+ cs.setInt(2, 1);
+ cs.setLong(3, testStrLength);
+ cs.setString(4, testStr);
+ try {
+ cs.execute();
+ }
+ catch(SQLException sqle) {
+ //expected Unsupported SQLException
+ //The CLOBSETSTRING is not supported but contains
+ //temporary code that shall be removed when
+ //the method is enabled.
+ }
+ cs.close();
+ }
+ /**
+ * Cleanup the test.
+ * @throws SQLException.
+ */
+ public void tearDown() throws Exception {
+ commit();
+ super.tearDown();
+ }
+
+ /**
+ * Test the stored procedure SYSIBM.CLOBGETSUBSTRING
+ *
+ * @throws an SQLException.
+ */
+ public void testGetSubStringSP() throws SQLException {
+ CallableStatement cs = prepareCall("? = CALL " +
+ "SYSIBM.CLOBGETSUBSTRING(?,?,?)");
+ cs.registerOutParameter(1, java.sql.Types.VARCHAR);
+ cs.setInt(2, 1);
+ cs.setLong(3, 1);
+ //get sub-string of length 10 from the clob.
+ cs.setInt(4, 10);
+ cs.executeUpdate();
+ String retVal = cs.getString(1);
+ //compare the string that is returned to the sub-string obtained directly
+ //from the test string. If found to be equal the stored procedure
+ //returns valid values.
+ if (testStr.substring(0, 10).compareTo(retVal) != 0) {
+ fail("Error SYSIBM.CLOBGETSUBSTRING returns the wrong string");
+ }
+ cs.close();
+ }
+
+ /**
+ * Tests the locator value returned by the stored procedure
+ * CLOBCREATELOCATOR.
+ *
+ * @throws SQLException.
+ *
+ */
+ public void testClobCreateLocatorSP() throws SQLException {
+ //initialize the locator to a default value.
+ int locator = -1;
+ //call the stored procedure to return the created locator.
+ CallableStatement cs = prepareCall
+ ("? = CALL SYSIBM.CLOBCREATELOCATOR()");
+ cs.registerOutParameter(1, java.sql.Types.INTEGER);
+ cs.executeUpdate();
+ locator = cs.getInt(1);
+ //verify if the locator rturned and expected are equal.
+ //remember in setup a locator is already created
+ //hence expected value is 2
+ assertEquals("The locator values returned by " +
+ "SYSIBM.CLOBCREATELOCATOR() are incorrect", 2, locator);
+ cs.close();
+ }
+
+ /**
+ * Tests the SYSIBM.CLOBRELEASELOCATOR stored procedure.
+ *
+ * @throws SQLException
+ */
+ public void testClobReleaseLocatorSP() throws SQLException {
+ CallableStatement cs = prepareCall
+ ("CALL SYSIBM.CLOBRELEASELOCATOR(?)");
+ cs.setInt(1, 1);
+ cs.execute();
+ cs.close();
+
+ //once the locator has been released the CLOBGETLENGTH on that
+ //locator value will throw an SQLException. This assures that
+ //the locator has been properly released.
+
+ cs = prepareCall
+ ("? = CALL SYSIBM.CLOBGETLENGTH(?)");
+ cs.registerOutParameter(1, java.sql.Types.BIGINT);
+ cs.setInt(2, 1);
+ try {
+ cs.executeUpdate();
+ } catch(SQLException sqle) {
+ //on expected lines. The test was successful.
+ return;
+ }
+ //The exception was not thrown. The test has failed here.
+ fail("Error the locator was not released by SYSIBM.CLOBRELEASELOCATOR");
+ cs.close();
+ }
+
+ /**
+ * Tests the stored procedure SYSIBM.CLOBGETLENGTH.
+ *
+ * @throws SQLException
+ */
+ public void testClobGetLengthSP() throws SQLException {
+ CallableStatement cs = prepareCall
+ ("? = CALL SYSIBM.CLOBGETLENGTH(?)");
+ cs.registerOutParameter(1, java.sql.Types.BIGINT);
+ cs.setInt(2, 1);
+ cs.executeUpdate();
+ //compare the actual length of the test string and the returned length.
+ assertEquals("Error SYSIBM.CLOBGETLENGTH returns " +
+ "the wrong value for the length of the Clob", testStrLength, cs.getLong(1));
+ cs.close();
+ }
+
+ /**
+ * Tests the stored procedure SYSIBM.CLOBGETPOSITIONFROMSTRING.
+ *
+ * @throws SQLException.
+ */
+ public void testClobGetPositionFromStringSP() throws SQLException {
+ CallableStatement cs = prepareCall
+ ("? = CALL SYSIBM.CLOBGETPOSITIONFROMSTRING(?,?,?)");
+ cs.registerOutParameter(1, java.sql.Types.BIGINT);
+ cs.setInt(2, 1);
+ cs.setString(3, new String("simple"));
+ cs.setLong(4, 1L);
+ cs.executeUpdate();
+ //compare the substring position returned from the stored procedure and that
+ //returned from the String class functions. If not found to be equal throw an
+ //error.
+ assertEquals("Error SYSIBM.CLOBGETPOSITIONFROMSTRING returns " +
+ "the wrong value for the position of the SUBSTRING", testStr.indexOf("simple")+1, cs.getLong(1));
+ cs.close();
+ }
+
+ /**
+ * Tests the stored procedure SYSIBM.CLOBSETSTRING
+ *
+ * @throws SQLException.
+ */
+ public void testClobSetStringSP() throws SQLException {
+
+ //----------TO BE ENABLED LATER------------------------------
+ //This code needs to be enabled once the set methods on the
+ //Clob interface are implemented. Until that time keep checking
+ //for a not implemented exception being thrown.
+ /*
+ String newString = "123456789012345";
+ //initialize the locator to a default value.
+ int locator = -1;
+ //call the stored procedure to return the created locator.
+ CallableStatement cs = prepareCall
+ ("? = CALL SYSIBM.CLOBCREATELOCATOR()");
+ cs.registerOutParameter(1, java.sql.Types.INTEGER);
+ cs.executeUpdate();
+ locator = cs.getInt(1);
+ cs.close();
+
+ //use this new locator to test the SETSUBSTRING function
+ //by inserting a new sub string and testing whether it has
+ //been inserted properly.
+
+ //Insert the new substring.
+ cs = prepareCall("CALL SYSIBM.CLOBSETSTRING(?,?,?,?)");
+ cs.setInt(1, locator);
+ cs.setInt(2, 1);
+ cs.setLong(3, newString.length());
+ cs.setString(4, newString);
+ cs.execute();
+ cs.close();
+
+ //check the new locator to see if the value has been inserted correctly.
+ cs = prepareCall("? = CALL " +
+ "SYSIBM.CLOBGETSUBSTRING(?,?,?)");
+ cs.registerOutParameter(1, java.sql.Types.VARCHAR);
+ cs.setInt(2, locator);
+ cs.setLong(3, 1);
+ //get sub-string of length 10 from the clob.
+ cs.setInt(4, newString.length());
+ cs.executeUpdate();
+ String retVal = cs.getString(1);
+ //compare the new string and the string returned by the stored
+ //procedure to see of they are the same.
+ if (newString.compareTo(retVal) != 0)
+ fail("SYSIBM.CLOBSETSTRING does not insert the right value");
+ cs.close();
+ */
+ //--------------TO BE ENABLED LATER--------------------------
+
+
+ String newString = "123456789012345";
+ //initialize the locator to a default value.
+ int locator = -1;
+ //call the stored procedure to return the created locator.
+ CallableStatement cs = prepareCall
+ ("? = CALL SYSIBM.CLOBCREATELOCATOR()");
+ cs.registerOutParameter(1, java.sql.Types.INTEGER);
+ cs.executeUpdate();
+ locator = cs.getInt(1);
+ cs.close();
+
+ //use this new locator to test the SETSUBSTRING function
+ //by inserting a new sub string and testing whether it has
+ //been inserted properly.
+
+ //Insert the new substring.
+ cs = prepareCall("CALL SYSIBM.CLOBSETSTRING(?,?,?,?)");
+ cs.setInt(1, locator);
+ cs.setInt(2, 1);
+ cs.setLong(3, newString.length());
+ cs.setString(4, newString);
+ try {
+ cs.execute();
+ }
+ catch(SQLException sqle) {
+ //expected Unsupported SQLException
+ //The CLOBSETSTRING is not supported but contains
+ //temporary code that shall be removed when
+ //the method is enabled.
+ }
+ cs.close();
+ }
+
+ /**
+ * Test the stored procedure SYSIBM.CLOBGETLENGTH
+ *
+ * @throws SQLException
+ */
+ public void testClobTruncateSP() throws SQLException {
+
+ //----------TO BE ENABLED LATER------------------------------
+ //This code needs to be enabled once the set methods on the
+ //Clob interface are implemented. Until that time keep checking
+ //for a not implemented exception being thrown.
+ /*
+ CallableStatement cs = prepareCall
+ ("CALL SYSIBM.CLOBTRUNCATE(?,?)");
+ cs.setInt(1, 1);
+ cs.setLong(2, 10L);
+ cs.execute();
+ cs.close();
+
+ cs = prepareCall
+ ("? = CALL SYSIBM.CLOBGETLENGTH(?)");
+ cs.registerOutParameter(1, java.sql.Types.BIGINT);
+ cs.setInt(2, 1);
+ cs.executeUpdate();
+ //compare the actual length of the test string and the returned length.
+ assertEquals("Error SYSIBM.CLOBGETLENGTH returns " +
+ "the wrong value for the length of the Clob", 10
+ , cs.getLong(1));
+ cs.close();
+ */
+ //----------TO BE ENABLED LATER------------------------------
+
+ CallableStatement cs = prepareCall
+ ("CALL SYSIBM.CLOBTRUNCATE(?,?)");
+ cs.setInt(1, 1);
+ cs.setLong(2, 10L);
+ try {
+ cs.execute();
+ }
+ catch(SQLException sqle) {
+ //expected Unsupported SQLException
+ //The CLOBTRUNCATE is not supported but contains
+ //temporary code that shall be removed when
+ //the method is enabled.
+ }
+ cs.close();
+ }
+
+ /**
+ * Tests the SYSIBM.CLOBGETPOSITIONFROMLOCATOR stored procedure.
+ *
+ * @throws SQLException.
+ */
+ public void testClobGetPositionFromLocatorSP() throws SQLException {
+ int locator = 0;
+
+ String newStr = "simple";
+
+ CallableStatement cs = prepareCall
+ ("? = CALL SYSIBM.CLOBCREATELOCATOR()");
+ cs.registerOutParameter(1, java.sql.Types.INTEGER);
+ cs.executeUpdate();
+ locator = cs.getInt(1);
+ cs.close();
+
+ cs = prepareCall("CALL SYSIBM.CLOBSETSTRING(?,?,?,?)");
+ cs.setInt(1, locator);
+ cs.setInt(2, 1);
+ cs.setLong(3, newStr.length());
+ cs.setString(4, newStr);
+ try {
+ cs.execute();
+ }
+ catch(SQLException sqle) {
+ //expected Unsupported SQLException
+ //The CLOBSETSTRING is not supported but contains
+ //temporary code that shall be removed when
+ //the method is enabled.
+ }
+
+ cs.close();
+ cs = prepareCall
+ ("? = CALL SYSIBM.CLOBGETPOSITIONFROMLOCATOR(?,?,?)");
+ cs.registerOutParameter(1, java.sql.Types.BIGINT);
+ cs.setInt(2, 1);
+ //find the position of the bytes corresponding to
+ //the String simple in the test string.
+ cs.setInt(3, locator);
+ cs.setLong(4, 1L);
+ cs.executeUpdate();
+ //check to see that the returned position and the expected position
+ //of the substring simple in the string are matching.
+ assertEquals("Error SYSIBM.CLOBGETPOSITIONFROMLOCATOR returns " +
+ "the wrong value for the position of the Clob", 8, cs.getLong(1));
+ cs.close();
+ }
+}
Propchange: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ClobStoredProcedureTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/_Suite.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/_Suite.java?view=diff&rev=515139&r1=515138&r2=515139
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/_Suite.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/_Suite.java Tue Mar 6 07:13:34 2007
@@ -63,6 +63,8 @@
suite.addTest(StreamTest.suite());
suite.addTest(ParameterMappingTest.suite());
suite.addTest(DboPowersTest.suite());
+ suite.addTest(BlobStoredProcedureTest.suite());
+ suite.addTest(ClobStoredProcedureTest.suite());
suite.addTest(CallableTest.suite());
// Old harness .java tests that run using the HarnessJavaTest
Modified: db/derby/code/trunk/tools/jar/extraDBMSclasses.properties
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/tools/jar/extraDBMSclasses.properties?view=diff&rev=515139&r1=515138&r2=515139
==============================================================================
--- db/derby/code/trunk/tools/jar/extraDBMSclasses.properties (original)
+++ db/derby/code/trunk/tools/jar/extraDBMSclasses.properties Tue Mar 6 07:13:34 2007
@@ -48,7 +48,7 @@
derby.module.catalog.getprocedurecolumns=org.apache.derby.catalog.GetProcedureColumns
derby.module.catalog.systemprocedures=org.apache.derby.catalog.SystemProcedures
-
+derby.module.LOB.storedProcedures=org.apache.derby.impl.jdbc.LOBStoredProcedure
#
# Format id getters.
#