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 km...@apache.org on 2006/01/27 04:06:18 UTC
svn commit: r372708 [5/5] - in
/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests:
master/j9_foundation/ tests/jdbcapi/ tests/lang/ util/
Propchange: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/j9_foundation/updatableResultSet.out
------------------------------------------------------------------------------
svn:eol-style = native
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/parameterMapping.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/parameterMapping.java?rev=372708&r1=372707&r2=372708&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/parameterMapping.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/parameterMapping.java Thu Jan 26 19:06:10 2006
@@ -22,6 +22,7 @@
import org.apache.derby.tools.ij;
import org.apache.derbyTesting.functionTests.util.TestUtil;
+import org.apache.derbyTesting.functionTests.util.BigDecimalHandler;
import java.sql.*;
@@ -29,7 +30,16 @@
import java.io.*;
public class parameterMapping {
-
+
+ private static boolean HAVE_BIG_DECIMAL;
+
+ static{
+ if(BigDecimalHandler.representation != BigDecimalHandler.BIGDECIMAL_REPRESENTATION)
+ HAVE_BIG_DECIMAL = false;
+ else
+ HAVE_BIG_DECIMAL = true;
+ }
+
private static int[] jdbcTypes =
{
Types.TINYINT,
@@ -84,31 +94,62 @@
};
- private static Class[] B3_GET_OBJECT =
- {
- java.lang.Integer.class, // Types.TINYINT,
- java.lang.Integer.class, // Types.SMALLINT,
- java.lang.Integer.class, // Types.INTEGER,
- java.lang.Long.class, // Types.BIGINT,
- java.lang.Float.class, // Types.REAL,
- java.lang.Double.class, // Types.FLOAT,
- java.lang.Double.class, // Types.DOUBLE,
- java.math.BigDecimal.class, // Types.DECIMAL,
- java.math.BigDecimal.class, // Types.NUMERIC,
- java.lang.Boolean.class, // Types.BIT,
- java.lang.Boolean.class, // Types.BOOLEAN
- java.lang.String.class, // Types.CHAR,
- java.lang.String.class, // Types.VARCHAR,
- java.lang.String.class, // Types.LONGVARCHAR,
- byte[].class, // Types.NULL, //Types.BINARY,
- byte[].class, // Types.VARBINARY,
- byte[].class, // Types.LONGVARBINARY,
- java.sql.Date.class, // Types.DATE,
- java.sql.Time.class, // Types.TIME,
- java.sql.Timestamp.class, // Types.TIMESTAMP,
- java.sql.Clob.class, // Types.CLOB,
- java.sql.Blob.class, // Types.BLOB,
- };
+ private static Class[] B3_GET_OBJECT;
+
+ static{
+ if(HAVE_BIG_DECIMAL){
+ B3_GET_OBJECT = new Class[] {
+ java.lang.Integer.class, // Types.TINYINT,
+ java.lang.Integer.class, // Types.SMALLINT,
+ java.lang.Integer.class, // Types.INTEGER,
+ java.lang.Long.class, // Types.BIGINT,
+ java.lang.Float.class, // Types.REAL,
+ java.lang.Double.class, // Types.FLOAT,
+ java.lang.Double.class, // Types.DOUBLE,
+ java.math.BigDecimal.class, // Types.DECIMAL,
+ java.math.BigDecimal.class, // Types.NUMERIC,
+ java.lang.Boolean.class, // Types.BIT,
+ java.lang.Boolean.class, // Types.BOOLEAN
+ java.lang.String.class, // Types.CHAR,
+ java.lang.String.class, // Types.VARCHAR,
+ java.lang.String.class, // Types.LONGVARCHAR,
+ byte[].class, // Types.NULL, //Types.BINARY,
+ byte[].class, // Types.VARBINARY,
+ byte[].class, // Types.LONGVARBINARY,
+ java.sql.Date.class, // Types.DATE,
+ java.sql.Time.class, // Types.TIME,
+ java.sql.Timestamp.class, // Types.TIMESTAMP,
+ java.sql.Clob.class, // Types.CLOB,
+ java.sql.Blob.class, // Types.BLOB,
+ };
+ }
+ else {
+ B3_GET_OBJECT = new Class[] {
+ java.lang.Integer.class, // Types.TINYINT,
+ java.lang.Integer.class, // Types.SMALLINT,
+ java.lang.Integer.class, // Types.INTEGER,
+ java.lang.Long.class, // Types.BIGINT,
+ java.lang.Float.class, // Types.REAL,
+ java.lang.Double.class, // Types.FLOAT,
+ java.lang.Double.class, // Types.DOUBLE,
+ java.lang.String.class, // Types.DECIMAL,
+ java.lang.String.class, // Types.NUMERIC,
+ java.lang.Boolean.class, // Types.BIT,
+ java.lang.Boolean.class, // Types.BOOLEAN
+ java.lang.String.class, // Types.CHAR,
+ java.lang.String.class, // Types.VARCHAR,
+ java.lang.String.class, // Types.LONGVARCHAR,
+ byte[].class, // Types.NULL, //Types.BINARY,
+ byte[].class, // Types.VARBINARY,
+ byte[].class, // Types.LONGVARBINARY,
+ java.sql.Date.class, // Types.DATE,
+ java.sql.Time.class, // Types.TIME,
+ java.sql.Timestamp.class, // Types.TIMESTAMP,
+ java.sql.Clob.class, // Types.CLOB,
+ java.sql.Blob.class, // Types.BLOB,
+ };
+ }
+ }
@@ -424,16 +465,28 @@
s.execute("DROP PROCEDURE PMP.TYPE_AS");
}catch (SQLException seq) {
}
- String procSQL = "CREATE PROCEDURE PMP.TYPE_AS(" +
- "IN P1 " + SQLTypes[type] +
+ String procSQL;
+ if(HAVE_BIG_DECIMAL) {
+ procSQL = "CREATE PROCEDURE PMP.TYPE_AS(" +
+ "IN P1 " + SQLTypes[type] +
", INOUT P2 " + SQLTypes[type] +
", OUT P3 " + SQLTypes[type] +
") LANGUAGE JAVA PARAMETER STYLE JAVA NO SQL " +
" EXTERNAL NAME 'org.apache.derbyTesting.functionTests.util.ProcedureTest.pmap'";
-
- System.out.println(procSQL);
+ } else {
+ procSQL = "CREATE PROCEDURE PMP.TYPE_AS(" +
+ "IN P1 " + SQLTypes[type] +
+ ", INOUT P2 " + SQLTypes[type] +
+ ", OUT P3 " + SQLTypes[type] +
+ ") LANGUAGE JAVA PARAMETER STYLE JAVA NO SQL " +
+ " EXTERNAL NAME 'org.apache.derbyTesting.functionTests.util.SimpleProcedureTest.pmap'";
+ }
+
try {
- s.execute(procSQL);
+ if (!HAVE_BIG_DECIMAL && SQLTypes[type].equals("DECIMAL(10,5)"))
+ continue;
+ System.out.println(procSQL);
+ s.execute(procSQL);
} catch (SQLException sqle) {
System.out.println(sqle.getSQLState() + ":" + sqle.getMessage());
continue;
@@ -620,23 +673,24 @@
judge_getXXX(worked, sqleResult, 5, type);
}
- {
- System.out.print(" getBigDecimal=");
- ResultSet rs = ps.executeQuery();
- rs.next();
- boolean worked;
- SQLException sqleResult = null;;
- try {
- System.out.print(rs.getBigDecimal(1));
- System.out.print(" was null " + rs.wasNull());
- worked = true;
-
- } catch (SQLException sqle) {
- sqleResult = sqle;
- worked = false;
- }
- rs.close();
- judge_getXXX(worked, sqleResult, 6, type);
+
+ if(HAVE_BIG_DECIMAL) {
+ System.out.print(" getBigDecimal=");
+ ResultSet rs = ps.executeQuery();
+ rs.next();
+ boolean worked;
+ SQLException sqleResult = null;;
+ try {
+ System.out.print(rs.getBigDecimal(1));
+ System.out.print(" was null " + rs.wasNull());
+ worked = true;
+
+ } catch (SQLException sqle) {
+ sqleResult = sqle;
+ worked = false;
+ }
+ rs.close();
+ judge_getXXX(worked, sqleResult, 6, type);
}
{
@@ -917,13 +971,16 @@
System.out.print(is == null ? "null" : "data");
System.out.print(" was null " + rs.wasNull());
worked = true;
-
+ } catch (NoSuchMethodError e){
+ worked = true;
+ System.out.println("ResultSet.getUnicodeStream not present - correct for JSR169");
} catch (SQLException sqle) {
sqleResult = sqle;
worked = false;
}
rs.close();
- judge_getXXX(worked, sqleResult, 18, type);
+ if(TestUtil.HAVE_DRIVER_CLASS)
+ judge_getXXX(worked, sqleResult, 18, type);
}
// Check to see getObject returns the correct type
@@ -933,28 +990,33 @@
rs.next();
SQLException sqleResult = null;;
try {
- Object o = rs.getObject(1);
-
- Class cgo = B3_GET_OBJECT[type];
-
- String cname;
- if (cgo.equals(byte[].class))
- cname = "byte[]";
- else
- cname = cgo.getName();
-
+
String msg;
- if (o == null)
- {
- msg = "null";
- }
- else if (cgo.isInstance(o))
- {
- msg = "CORRECT :" + cgo.getName();
- }
- else
- {
- msg = "FAIL NOT :" + cgo.getName() + " is " + o.getClass().getName();
+ if(!SQLTypes[type].equals("DECIMAL(10,5)") || HAVE_BIG_DECIMAL) {
+ Object o = rs.getObject(1);
+
+ Class cgo = B3_GET_OBJECT[type];
+
+ String cname;
+ if (cgo.equals(byte[].class))
+ cname = "byte[]";
+ else
+ cname = cgo.getName();
+
+ if (o == null)
+ {
+ msg = "null";
+ }
+ else if (cgo.isInstance(o))
+ {
+ msg = "CORRECT :" + cgo.getName();
+ }
+ else
+ {
+ msg = "FAIL NOT :" + cgo.getName() + " is " + o.getClass().getName();
+ }
+ } else {
+ msg = "ResultSet.getObject not called for DECIMAL type for JSR169";
}
System.out.print(msg);
@@ -1357,6 +1419,7 @@
}
+ if(HAVE_BIG_DECIMAL){
{
s.execute("DELETE FROM PM.TYPE_AS");
@@ -1443,7 +1506,8 @@
}
judge_setXXX(worked, sqleResult, 6, type);
}
-
+ }
+
{
s.execute("DELETE FROM PM.TYPE_AS");
@@ -2415,17 +2479,24 @@
data[4] = (byte) 0x00;
data[5] = (byte) 0x32;
- psi.setUnicodeStream(1, new java.io.ByteArrayInputStream(data), 6);
- psi.executeUpdate();
- getValidValue(psq, jdbcTypes[type]);
-
+ try{
+ psi.setUnicodeStream(1, new java.io.ByteArrayInputStream(data), 6);
+ } catch (NoSuchMethodError e){
+ System.out.println("ResultSet.setUnicodeStream not present - correct for JSR169");
+ }
+
+ if(TestUtil.HAVE_DRIVER_CLASS){
+ psi.executeUpdate();
+ getValidValue(psq, jdbcTypes[type]);
+ }
worked = true;
} catch (SQLException sqle) {
sqleResult = sqle;
worked = false;
}
- judge_setXXX(worked, sqleResult, 14, type);
+ if(TestUtil.HAVE_DRIVER_CLASS)
+ judge_setXXX(worked, sqleResult, 14, type);
}
{
s.execute("DELETE FROM PM.TYPE_AS");
@@ -2434,17 +2505,24 @@
boolean worked;
try {
System.out.print(" setUnicodeStream(null) ");
- psi.setUnicodeStream(1, null, 0);
- psi.executeUpdate();
- getValidValue(psq, jdbcTypes[type]);
-
+ try{
+ psi.setUnicodeStream(1, null, 0);
+ } catch (NoSuchMethodError e){
+ System.out.println("ResultSet.setUnicodeStream not present - correct for JSR169");
+ }
+
+ if(TestUtil.HAVE_DRIVER_CLASS){
+ psi.executeUpdate();
+ getValidValue(psq, jdbcTypes[type]);
+ }
worked = true;
} catch (SQLException sqle) {
sqleResult = sqle;
worked = false;
}
- judge_setXXX(worked, sqleResult, 14, type);
+ if(TestUtil.HAVE_DRIVER_CLASS)
+ judge_setXXX(worked, sqleResult, 14, type);
}
@@ -2492,7 +2570,8 @@
}
setXXX_setObject(s, psi, psq, type, "46", "java.lang.String", 0, executeBatchTests);
- setXXX_setObject(s, psi, psq, type, BigDecimal.valueOf(72L), "java.math.BigDecimal", 1, executeBatchTests);
+ if(HAVE_BIG_DECIMAL)
+ setXXX_setObject(s, psi, psq, type, BigDecimal.valueOf(72L), "java.math.BigDecimal", 1, executeBatchTests);
setXXX_setObject(s, psi, psq, type, Boolean.TRUE, "java.lang.Boolean", 2, executeBatchTests);
setXXX_setObject(s, psi, psq, type, new Integer(74), "java.lang.Integer", 3, executeBatchTests);
setXXX_setObject(s, psi, psq, type, new Long(79), "java.lang.Long", 4, executeBatchTests);
@@ -2629,7 +2708,7 @@
ps.setDouble(param, 32.0);
return true;
case Types.DECIMAL:
- ps.setBigDecimal(param, new BigDecimal(32.0));
+ BigDecimalHandler.setBigDecimalString(ps, param, "32.0");
return true;
case Types.CHAR:
case Types.VARCHAR:
@@ -2700,7 +2779,7 @@
System.out.print("getDouble=" + rs.getDouble(1) + " was null " + rs.wasNull());
return true;
case Types.DECIMAL:
- System.out.print("getBigDecimal=" + rs.getBigDecimal(1) + " was null " + rs.wasNull());
+ System.out.print("getBigDecimal=" + BigDecimalHandler.getBigDecimalString(rs,1) + " was null " + rs.wasNull());
return true;
case Types.CHAR:
case Types.VARCHAR:
@@ -2821,7 +2900,7 @@
System.out.print("cs.getDouble=" + cs.getDouble(param) + " was null " + cs.wasNull());
return true;
case Types.DECIMAL:
- System.out.print("cs.getBigDecimal=" + cs.getBigDecimal(param) + " was null " + cs.wasNull());
+ System.out.print("cs.getBigDecimal=" + BigDecimalHandler.getBigDecimalString(cs,param,jdbcType) + " was null " + cs.wasNull());
return true;
case Types.CHAR:
case Types.VARCHAR:
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/parameterMapping_app.properties
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/parameterMapping_app.properties?rev=372708&r1=372707&r2=372708&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/parameterMapping_app.properties (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/parameterMapping_app.properties Thu Jan 26 19:06:10 2006
@@ -1,5 +1,5 @@
#Exclude for J2ME/Foundation - test requires java.math.BigDecimal
-runwithfoundation=false
+#runwithfoundation=false
usedefaults=true
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/updatableResultSet.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/updatableResultSet.java?rev=372708&r1=372707&r2=372708&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/updatableResultSet.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/updatableResultSet.java Thu Jan 26 19:06:10 2006
@@ -34,6 +34,7 @@
import org.apache.derby.tools.ij;
import org.apache.derby.tools.JDBCDisplayUtil;
import org.apache.derby.iapi.services.info.JVMInfo;
+import org.apache.derbyTesting.functionTests.util.BigDecimalHandler;
import org.apache.derbyTesting.functionTests.util.TestUtil;
import java.math.BigDecimal;
@@ -48,6 +49,15 @@
This tests JDBC 2.0 updateable resutlset - deleteRow, updateRow api
*/
public class updatableResultSet {
+
+ private static boolean HAVE_BIG_DECIMAL;
+
+ static{
+ if(BigDecimalHandler.representation != BigDecimalHandler.BIGDECIMAL_REPRESENTATION)
+ HAVE_BIG_DECIMAL = false;
+ else
+ HAVE_BIG_DECIMAL = true;
+ }
private static Connection conn;
private static DatabaseMetaData dbmt;
@@ -1534,9 +1544,11 @@
rs.updateLong(ColumnNames[0], rs1.getLong(updateXXXName));
} else if (updateXXXName == 4){ //update column with updateBigDecimal methods
if (indexOrName == 1) //test by passing column position
- rs.updateBigDecimal(1, rs1.getBigDecimal(updateXXXName));
+ BigDecimalHandler.updateBigDecimalString(rs, 1,
+ BigDecimalHandler.getBigDecimalString(rs1, updateXXXName));
else //test by passing column name
- rs.updateBigDecimal(ColumnNames[0], rs1.getBigDecimal(updateXXXName));
+ BigDecimalHandler.updateBigDecimalString(rs, ColumnNames[0],
+ BigDecimalHandler.getBigDecimalString(rs1, updateXXXName));
} else if (updateXXXName == 5){ //update column with updateFloat methods
if (indexOrName == 1) //test by passing column position
rs.updateFloat(1, rs1.getFloat(updateXXXName));
@@ -1652,6 +1664,8 @@
System.out.println("Next datatype to test is " + allSQLTypes[sqlType-1]);
for (int updateXXXName = 1; updateXXXName <= allUpdateXXXNames.length; updateXXXName++) {
checkAgainstColumn = updateXXXName;
+ if(!HAVE_BIG_DECIMAL && (updateXXXName == 4))
+ continue;
System.out.println(" Testing " + allUpdateXXXNames[updateXXXName-1] + " on SQL type " + allSQLTypes[sqlType-1]);
for (int indexOrName = 1; indexOrName <= 2; indexOrName++) {
if (indexOrName == 1) //test by passing column position
@@ -1679,10 +1693,12 @@
else //test by passing column name
rs.updateLong(ColumnNames[sqlType-1], rs1.getLong(updateXXXName));
} else if (updateXXXName == 4){ //update column with updateBigDecimal methods
- if (indexOrName == 1) //test by passing column position
- rs.updateBigDecimal(sqlType, rs1.getBigDecimal(updateXXXName));
- else //test by passing column name
- rs.updateBigDecimal(ColumnNames[sqlType-1], rs1.getBigDecimal(updateXXXName));
+ if(HAVE_BIG_DECIMAL) {
+ if (indexOrName == 1) //test by passing column position
+ rs.updateBigDecimal(sqlType, rs1.getBigDecimal(updateXXXName));
+ else //test by passing column name
+ rs.updateBigDecimal(ColumnNames[sqlType-1], rs1.getBigDecimal(updateXXXName));
+ }
} else if (updateXXXName == 5){ //update column with updateFloat methods
if (indexOrName == 1) //test by passing column position
rs.updateFloat(sqlType, rs1.getFloat(updateXXXName));
@@ -1820,6 +1836,8 @@
conn.rollback();
System.out.println("Next datatype to test is " + allSQLTypes[sqlType-1]);
for (int updateXXXName = 1; updateXXXName <= allUpdateXXXNames.length; updateXXXName++) {
+ if(!HAVE_BIG_DECIMAL && (updateXXXName == 4))
+ continue;
for (int indexOrName = 1; indexOrName <= 2; indexOrName++) {
if (indexOrName == 1) //test by passing column position
displayString = " updateObject with column position &";
@@ -1849,11 +1867,13 @@
else //test by passing column name
rs.updateObject(ColumnNames[sqlType-1], new Long(rs1.getLong(updateXXXName)));
} else if (updateXXXName == 4){ //updateObject using BigDecimal object
- System.out.println(displayString + " BigDecimal object as parameters");
- if (indexOrName == 1) //test by passing column position
- rs.updateObject(sqlType, rs1.getBigDecimal(updateXXXName));
- else //test by passing column name
- rs.updateObject(ColumnNames[sqlType-1], rs1.getBigDecimal(updateXXXName));
+ if(HAVE_BIG_DECIMAL) {
+ System.out.println(displayString + " BigDecimal object as parameters");
+ if (indexOrName == 1) //test by passing column position
+ rs.updateObject(sqlType, rs1.getBigDecimal(updateXXXName));
+ else //test by passing column name
+ rs.updateObject(ColumnNames[sqlType-1],rs1.getBigDecimal(updateXXXName));
+ }
} else if (updateXXXName == 5){ //updateObject using Float object
System.out.println(displayString + " Float object as parameters");
if (indexOrName == 1) //test by passing column position
@@ -1959,6 +1979,8 @@
System.out.println("FAILURE : We shouldn't reach here. The test should have failed earlier on updateXXX or updateRow call");
return;
}
+ if(!HAVE_BIG_DECIMAL && (updateXXXName == 4))
+ continue;
if (verifyData(sqlType,updateXXXName, "AllDataTypesNewValuesData") == false)
{
System.out.println("Test failed");
@@ -2023,12 +2045,14 @@
return;
System.out.println(" updateBigDecimal and then cancelRowUpdates");
- BigDecimal bd = rs.getBigDecimal(4);
- rs.updateBigDecimal(4, rs1.getBigDecimal(4));
- if(rs.getBigDecimal(4).compareTo(rs1.getBigDecimal(4)) != 0)
+ String bdString = BigDecimalHandler.getBigDecimalString(rs, 4);
+ BigDecimalHandler.updateBigDecimalString(rs, 4,
+ BigDecimalHandler.getBigDecimalString(rs1, 4));
+ if(!BigDecimalHandler.getBigDecimalString(rs,4)
+ .equals(BigDecimalHandler.getBigDecimalString(rs1, 4)))
return;
rs.cancelRowUpdates();
- if(rs.getBigDecimal(4).compareTo(bd) != 0)
+ if(!BigDecimalHandler.getBigDecimalString(rs, 4).equals(bdString))
return;
System.out.println(" updateFloat and then cancelRowUpdates");
@@ -2485,7 +2509,8 @@
if(rs.getLong(sqlType) != rs1.getLong(updateXXXName)) {
return(false); }
else if (sqlType == 4) //verify update made to DECIMAL column with updateXXX methods
- if(rs.getBigDecimal(sqlType) != rs1.getBigDecimal(updateXXXName)) {
+ if(BigDecimalHandler.getBigDecimalString(rs, sqlType) !=
+ BigDecimalHandler.getBigDecimalString(rs1, updateXXXName)) {
return(false); }
else if (sqlType == 5) //verify update made to REAL column with updateXXX methods
if(rs.getFloat(sqlType) != rs1.getFloat(updateXXXName)) {
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/updatableResultSet_app.properties
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/updatableResultSet_app.properties?rev=372708&r1=372707&r2=372708&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/updatableResultSet_app.properties (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/updatableResultSet_app.properties Thu Jan 26 19:06:10 2006
@@ -1,5 +1,3 @@
-#Exclude for J2ME/Foundation - need to look into reason for failure
-runwithfoundation=false
#Exclude for j9 altogether - test now needs Security Algorithms not automatically in base setup
runwithj9=false
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/BigDecimalHandler.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/BigDecimalHandler.java?rev=372708&r1=372707&r2=372708&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/BigDecimalHandler.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/BigDecimalHandler.java Thu Jan 26 19:06:10 2006
@@ -191,6 +191,50 @@
return objectString;
}
+ /** This method is a wrapper for ResultSet method
+ * updateBigDecimal(int columnIndex, BigDecimal x)
+ * @param rs ResultSet
+ * @param columnIndex Column Index
+ * @param bdString String to be used in updateXXX method
+ * @throws SQLException
+ */
+ public static void updateBigDecimalString(ResultSet rs, int columnIndex, String bdString) throws SQLException{
+
+ switch(representation){
+ case BIGDECIMAL_REPRESENTATION:
+ BigDecimal bd = (bdString == null) ? null : new BigDecimal(bdString);
+ rs.updateBigDecimal(columnIndex, bd);
+ break;
+ case STRING_REPRESENTATION:
+ rs.updateString(columnIndex, bdString);
+ break;
+ default:
+ new Exception("Failed: Invalid Big Decimal representation").printStackTrace();
+ }
+ }
+
+ /** This method is a wrapper for ResultSet method
+ * updateBigDecimal(String columnName, BigDecimal x)
+ * @param rs ResultSet
+ * @param columnName Column Name
+ * @param bdString String to be used in updateXXX method
+ * @throws SQLException
+ */
+ public static void updateBigDecimalString(ResultSet rs, String columnName,String bdString) throws SQLException{
+
+ switch(representation){
+ case BIGDECIMAL_REPRESENTATION:
+ BigDecimal bd = (bdString == null) ? null : new BigDecimal(bdString);
+ rs.updateBigDecimal(columnName, bd);
+ break;
+ case STRING_REPRESENTATION:
+ rs.updateString(columnName, bdString);
+ break;
+ default:
+ new Exception("Failed: Invalid Big Decimal representation").printStackTrace();
+ }
+ }
+
/** This method is a wrapper for the CallableStatement method getBigDecimal(int parameterIndex).
* The wrapper method needs the parameterType as an input since ParameterMetaData is not available in JSR169.
*
@@ -231,7 +275,8 @@
switch(representation){
case BIGDECIMAL_REPRESENTATION:
- ps.setBigDecimal(parameterIndex,new BigDecimal(bdString));
+ BigDecimal bd = (bdString == null) ? null : new BigDecimal(bdString);
+ ps.setBigDecimal(parameterIndex, bd);
break;
case STRING_REPRESENTATION:
//setString is used since setBigDecimal is not available in JSR169
@@ -255,7 +300,8 @@
switch(representation){
case BIGDECIMAL_REPRESENTATION:
- ps.setObject(parameterIndex,new BigDecimal(objectString));
+ BigDecimal bd = (objectString == null) ? null : new BigDecimal(objectString);
+ ps.setObject(parameterIndex,bd);
break;
case STRING_REPRESENTATION:
ps.setObject(parameterIndex,objectString);
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/ProcedureTest.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/ProcedureTest.java?rev=372708&r1=372707&r2=372708&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/ProcedureTest.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/ProcedureTest.java Thu Jan 26 19:06:10 2006
@@ -27,7 +27,7 @@
/**
Java procedures for the procedure.sql test.
*/
-public abstract class ProcedureTest implements ResultSet {
+public abstract class ProcedureTest extends SimpleProcedureTest implements ResultSet {
public static void zeroArg() {
System.out.println("zeroArg() called");
@@ -583,65 +583,13 @@
/*
- ** Procedures for parameter mapping testing.
+ ** Procedure which uses BigDecimal - for parameter mapping testing.
*/
- public static void pmap(short in, short[] inout, short[] out) {
-
- inout[0] += 6;
- out[0] = 77;
- }
- public static void pmap(int in, int[] inout, int[] out) {
- inout[0] += 9;
- out[0] = 88;
-
- }
- public static void pmap(long in, long[] inout, long[] out) {
- inout[0] += 8;
- out[0] = 99;
- }
- public static void pmap(float in, float[] inout, float[] out) {
- inout[0] += 9.9f;
- out[0] = 88.8f;
- }
- public static void pmap(double in, double[] inout, double[] out) {
- inout[0] += 3.9;
- out[0] = 66.8;
- }
public static void pmap(BigDecimal in, BigDecimal[] inout, BigDecimal[] out) {
inout[0] = inout[0].add(new BigDecimal(2.3));
out[0] = new BigDecimal(84.1);
}
- public static void pmap(byte[] in, byte[][] inout, byte[][] out) {
-
- inout[0][2] = 0x56;
- out[0] = new byte[4];
- out[0][0] = (byte) 0x09;
- out[0][1] = (byte) 0xfe;
- out[0][2] = (byte) 0xed;
- out[0][3] = (byte) 0x02;
-
- }
- public static void pmap(Date in, Date[] inout, Date[] out) {
-
- inout[0] = java.sql.Date.valueOf("2004-03-08");
- out[0] = java.sql.Date.valueOf("2005-03-08");
-
- }
- public static void pmap(Time in, Time[] inout, Time[] out) {
- inout[0] = java.sql.Time.valueOf("19:44:42");
- out[0] = java.sql.Time.valueOf("20:44:42");
- }
- public static void pmap(Timestamp in, Timestamp[] inout, Timestamp[] out) {
-
- inout[0] = java.sql.Timestamp.valueOf("2004-03-12 21:14:24.938222433");
- out[0] = java.sql.Timestamp.valueOf("2004-04-12 04:25:26.462983731");
- }
- public static void pmap(String in, String[] inout, String[] out) {
- inout[0] = inout[0].trim().concat("P2-PMAP");
- out[0] = "P3-PMAP";
- }
-
public static int countRows(String schema, String table) throws SQLException
{
Added: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/SimpleProcedureTest.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/SimpleProcedureTest.java?rev=372708&view=auto
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/SimpleProcedureTest.java (added)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/SimpleProcedureTest.java Thu Jan 26 19:06:10 2006
@@ -0,0 +1,88 @@
+/*
+
+Derby - Class org.apache.derbyTesting.functionTests.util.SimpleProcedureTest
+
+Copyright 1999, 2004 The Apache Software Foundation or its licensors, as applicable.
+
+Licensed 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.util;
+
+import java.sql.Date;
+import java.sql.Time;
+import java.sql.Timestamp;
+
+/**
+ * Procedures to be used with J2ME/CDC/FP and JSR169
+ */
+
+public class SimpleProcedureTest {
+
+ /*
+ ** Procedures for parameter mapping testing.
+ */
+
+ public static void pmap(short in, short[] inout, short[] out) {
+
+ inout[0] += 6;
+ out[0] = 77;
+ }
+ public static void pmap(int in, int[] inout, int[] out) {
+ inout[0] += 9;
+ out[0] = 88;
+
+ }
+ public static void pmap(long in, long[] inout, long[] out) {
+ inout[0] += 8;
+ out[0] = 99;
+ }
+ public static void pmap(float in, float[] inout, float[] out) {
+ inout[0] += 9.9f;
+ out[0] = 88.8f;
+ }
+ public static void pmap(double in, double[] inout, double[] out) {
+ inout[0] += 3.9;
+ out[0] = 66.8;
+ }
+ public static void pmap(byte[] in, byte[][] inout, byte[][] out) {
+
+ inout[0][2] = 0x56;
+ out[0] = new byte[4];
+ out[0][0] = (byte) 0x09;
+ out[0][1] = (byte) 0xfe;
+ out[0][2] = (byte) 0xed;
+ out[0][3] = (byte) 0x02;
+
+ }
+ public static void pmap(Date in, Date[] inout, Date[] out) {
+
+ inout[0] = java.sql.Date.valueOf("2004-03-08");
+ out[0] = java.sql.Date.valueOf("2005-03-08");
+
+ }
+ public static void pmap(Time in, Time[] inout, Time[] out) {
+ inout[0] = java.sql.Time.valueOf("19:44:42");
+ out[0] = java.sql.Time.valueOf("20:44:42");
+ }
+ public static void pmap(Timestamp in, Timestamp[] inout, Timestamp[] out) {
+
+ inout[0] = java.sql.Timestamp.valueOf("2004-03-12 21:14:24.938222433");
+ out[0] = java.sql.Timestamp.valueOf("2004-04-12 04:25:26.462983731");
+ }
+ public static void pmap(String in, String[] inout, String[] out) {
+ inout[0] = inout[0].trim().concat("P2-PMAP");
+ out[0] = "P3-PMAP";
+ }
+
+}
Propchange: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/SimpleProcedureTest.java
------------------------------------------------------------------------------
svn:eol-style = native