diff --git a/src/test/JD/CS/JDCSGetBigDecimal.java b/src/test/JD/CS/JDCSGetBigDecimal.java index 30f5ca9f..e0befc05 100644 --- a/src/test/JD/CS/JDCSGetBigDecimal.java +++ b/src/test/JD/CS/JDCSGetBigDecimal.java @@ -59,12 +59,12 @@ public static void main(String args[]) throws Exception { test.JDCSTest.main(newArgs); } // table names - private static String INTEGER_TABLE = JDCSTest.COLLECTION + ".int_tab"; - private static String INTEGER_PROCEDURE = JDCSTest.COLLECTION + ".int_proc"; - private static String VARCHAR_TABLE = JDCSTest.COLLECTION + ".vc_tab"; - private static String VARCHAR_PROCEDURE = JDCSTest.COLLECTION + ".vc_proc"; - private static String NUMERIC_TABLE = JDCSTest.COLLECTION + ".num_tab"; - private static String NUMERIC_PROCEDURE = JDCSTest.COLLECTION + ".num_proc"; + private static String INTEGER_TABLE = JDCSTest.COLLECTION + ".int_tabgbd"; + private static String INTEGER_PROCEDURE = JDCSTest.COLLECTION + ".int_procgbd"; + private static String VARCHAR_TABLE = JDCSTest.COLLECTION + ".vc_tabgbd"; + private static String VARCHAR_PROCEDURE = JDCSTest.COLLECTION + ".vc_procgbd"; + private static String NUMERIC_TABLE = JDCSTest.COLLECTION + ".num_tabgbd"; + private static String NUMERIC_PROCEDURE = JDCSTest.COLLECTION + ".num_procgbd"; // Private data. @@ -100,12 +100,12 @@ protected void setup () { // reset table names after -lib arg is processed. - INTEGER_TABLE = JDCSTest.COLLECTION + ".int_tab"; - INTEGER_PROCEDURE = JDCSTest.COLLECTION + ".int_proc"; - VARCHAR_TABLE = JDCSTest.COLLECTION + ".vc_tab"; - VARCHAR_PROCEDURE = JDCSTest.COLLECTION + ".vc_proc"; - NUMERIC_TABLE = JDCSTest.COLLECTION + ".num_tab"; - NUMERIC_PROCEDURE = JDCSTest.COLLECTION + ".num_proc"; + INTEGER_TABLE = JDCSTest.COLLECTION + ".int_tabgbd"; + INTEGER_PROCEDURE = JDCSTest.COLLECTION + ".int_procgbd"; + VARCHAR_TABLE = JDCSTest.COLLECTION + ".vc_tabgbd"; + VARCHAR_PROCEDURE = JDCSTest.COLLECTION + ".vc_procgbd"; + NUMERIC_TABLE = JDCSTest.COLLECTION + ".num_tabgbd"; + NUMERIC_PROCEDURE = JDCSTest.COLLECTION + ".num_procgbd"; diff --git a/src/test/JDDataAreaLock.java b/src/test/JD/JDDataAreaLock.java similarity index 74% rename from src/test/JDDataAreaLock.java rename to src/test/JD/JDDataAreaLock.java index 85cd0182..1c2aad95 100644 --- a/src/test/JDDataAreaLock.java +++ b/src/test/JD/JDDataAreaLock.java @@ -10,17 +10,20 @@ // others. All rights reserved. // /////////////////////////////////////////////////////////////////////////////// -package test; +package test.JD; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.sql.Timestamp; +import test.JTOpenTestEnvironment; + public class JDDataAreaLock { private Statement s_; private String dataArea_; + private String library_; public JDDataAreaLock(Statement s, String dataArea) throws SQLException { if (dataArea.length() > 10) { @@ -28,15 +31,31 @@ public JDDataAreaLock(Statement s, String dataArea) throws SQLException { } s_ = s; dataArea_ = dataArea; + library_ = JTOpenTestEnvironment.testInfoSchema; } + + + public JDDataAreaLock(Statement s, String library, String dataArea) throws SQLException { + if (dataArea.length() > 10) { + throw new SQLException("Too long :"+dataArea); + } + s_ = s; + dataArea_ = dataArea; + library_ = library ; + } + public void lock(String comment, int waitTime) throws SQLException { - String sql="CALL QSYS2.QCMDEXC(' CRTDTAARA DTAARA("+JTOpenTestEnvironment.testInfoSchema+"/"+dataArea_+") TYPE(*CHAR) LEN(2000)')"; + String sql="CALL QSYS2.QCMDEXC(' CRTDTAARA DTAARA("+library_+"/"+dataArea_+") TYPE(*CHAR) LEN(2000)')"; try { s_.execute(sql); + sql = "CALL QSYS2.QCMDEXC('GRTOBJAUT OBJ("+library_+"/"+dataArea_+") OBJTYPE(*DTAARA) USER(*PUBLIC) AUT(*ALL)')"; + s_.execute(sql); + + } catch (Exception e) { String message = e.getMessage(); String expected = "exists"; @@ -47,11 +66,11 @@ public void lock(String comment, int waitTime) throws SQLException { } // Lock exclusive on the system and delay one second try { - sql="CALL QSYS2.QCMDEXC(' ALCOBJ OBJ(("+JTOpenTestEnvironment.testInfoSchema+"/"+dataArea_+" *DTAARA *EXCLRD)) WAIT("+waitTime+") ')"; + sql="CALL QSYS2.QCMDEXC(' ALCOBJ OBJ(("+library_+"/"+dataArea_+" *DTAARA *EXCLRD)) WAIT("+waitTime+") ')"; s_.execute(sql); // Look at the data area to make sure it isn't already locked sql="select JOB_NAME, TRIM(INTERPRET(REPLACE(BINARY(DATA_AREA_VALUE),BX'00',BX'40') AS CHAR(2000) CCSID 37)) " - + "from qsys2.data_area_info where DATA_AREA_LIBRARY='" + JTOpenTestEnvironment.testInfoSchema + + "from qsys2.data_area_info where DATA_AREA_LIBRARY='" + library_ + "' AND DATA_AREA_NAME='" + dataArea_ + "'"; try (ResultSet rs = s_.executeQuery(sql)) { if (rs.next()) { @@ -60,13 +79,13 @@ public void lock(String comment, int waitTime) throws SQLException { if (data.indexOf("LOCK") == 0) { String jobname = rs.getString(1); if (data.indexOf(jobname) > 0) { - sql = "CALL QSYS2.QCMDEXC(' DLCOBJ OBJ((" + JTOpenTestEnvironment.testInfoSchema + "/" + dataArea_ + sql = "CALL QSYS2.QCMDEXC(' DLCOBJ OBJ((" + library_ + "/" + dataArea_ + " *DTAARA *EXCLRD)) ')"; try { s_.execute(sql); } catch (SQLException sqlex) { } - throw new SQLException("Data area " + JTOpenTestEnvironment.testInfoSchema + "/" + dataArea_ + throw new SQLException("Data area " + library_ + "/" + dataArea_ + " already locked by this job " + jobname); } } @@ -77,7 +96,7 @@ public void lock(String comment, int waitTime) throws SQLException { Timestamp ts = new Timestamp(System.currentTimeMillis()); String callerString = getCallString(); - sql="CALL QSYS2.QCMDEXC(' CHGDTAARA DTAARA("+JTOpenTestEnvironment.testInfoSchema+"/"+dataArea_+" *ALL) VALUE(''LOCK ' || JOB_NAME || ' "+ + sql="CALL QSYS2.QCMDEXC(' CHGDTAARA DTAARA("+library_+"/"+dataArea_+" *ALL) VALUE(''LOCK ' || JOB_NAME || ' "+ " "+ pad50(comment+" "+ts.toString())+" "+callerString+"'')')"; @@ -88,6 +107,7 @@ public void lock(String comment, int waitTime) throws SQLException { throw e; } + } @@ -102,12 +122,17 @@ private String pad50(String inString) { } + + private String getCallString() { String stackString = ""; StackTraceElement[] stackTrace = Thread.currentThread().getStackTrace(); - for(int i = 3; i < 10 && i 10) { + name = name.substring(len-10); + } + if (Character.isDigit(name.charAt(0))) { + name='X'+name.substring(1); + } + + String baseFilename = null; + String baseCollection = null; + int dotIndex = filename_.indexOf("."); + if (dotIndex > 0) { + baseFilename = filename_.substring(dotIndex+1); + baseCollection = filename_.substring(0,dotIndex); + } else { + baseFilename= filename_; + baseCollection= JTOpenTestEnvironment.testInfoSchema; + filename_ = baseCollection+"."+baseFilename; + } + dataAreaLock_ = new JDDataAreaLock(statement_, name); + dataAreaLock_.lock("JDparallelCounter", 3600); + + /* If the table does not exist, create it and add a row for the counter */ + + /* Wait for a long time if there is much contention */ + statement_.executeUpdate("CALL QSYS2.QCMDEXC('CHGJOB DFTWAIT(3600)')"); + + String sql = "SELECT * FROM QSYS2.SYSTABLES where TABLE_NAME='"+baseFilename+"' and TABLE_SCHEMA='"+baseCollection+"' " ; + ResultSet rs = statement_.executeQuery(sql); + if (!rs.next()) { + rs.close(); + + sql = "CREATE OR REPLACE TABLE "+filename_+" (LOCKJOBNAME VARCHAR(80), STARTTIME TIMESTAMP) ON REPLACE PRESERVE ROWS"; + System.out.println("Running "+sql); + statement_.executeUpdate(sql); + c.commit(); + } else { + rs.close(); + } + + /* If the jobname is CLEANUP, then cleanup is in progress. */ + /* Unlock the data area and wait for it to become positive. */ + /* Once positive reaquire the data area */ + sql = "SELECT count(*) FROM "+filename_+" WHERE LOCKJOBNAME='CLEANUP'"; + rs = statement_.executeQuery(sql); + rs.next(); + int count = rs.getInt(1); + while (count > 0) { + dataAreaLock_.unlock("JDSerializeFile", null); + Thread.sleep(1000); + rs.close(); + rs = statement_.executeQuery(sql); + rs.next(); + count = rs.getInt(1); + dataAreaLock_.lock("JDSerializeFile", 3600); + } + rs.close(); + + + + + /* Register the job */ + Timestamp startTimestamp = new Timestamp(System.currentTimeMillis()); + PreparedStatement ps = c.prepareStatement("INSERT INTO "+filename_+" VALUES(QSYS2.JOB_NAME,?)"); + ps.setTimestamp(1,startTimestamp); + ps.executeUpdate(); + ps.close(); + c.commit(); + statement_.executeUpdate("CALL QSYS2.QCMDEXC('CHGJOB DFTWAIT(30)')"); + + dataAreaLock_.unlock("JDSerializeFile", null); + + } + + + public String toString() { + return "JDParalleCounter("+filename_+","+name_+")"; + } + + public String getName() { + return name_; + } + + @SuppressWarnings("resource") + /** determine if cleanup should be called. + * If cleanup should be called, the data area is locked until + * the counter is closed. + * + * @return + * @throws SQLException + */ + public boolean doCleanup() throws SQLException { + boolean cleanup = false; + + dataAreaLock_.lock("JDparallelCounter", 3600); + + /* Check the files. If we are the only job then */ + /* add a CLEANUP entry to prevent new counters from being added */ + + + String sql = "SELECT count(*) FROM "+filename_; + ResultSet rs = statement_.executeQuery(sql); + rs.next(); + int count = rs.getInt(1); + if (count == 1) { + sql = "INSERT INTO "+filename_+" VALUES('CLEANUP',CURRENT TIMESTAMP)"; + statement_.execute(sql); + cleanupSet_ = true; + cleanup = true; + } + rs.close(); + + if (!cleanupSet_) { + dataAreaLock_.unlock("JDSerializeFile", null); + } + statement_.getConnection().commit(); + + return cleanup; + } + /* + * Must be called before the connection is closed + */ + @SuppressWarnings("resource") + public void close() throws SQLException { + if (!cleanupSet_) { + dataAreaLock_.lock("JDparallelCounter", 3600); + } + String sql; + /* If we were doing cleanup, remove the cleanup entry */ + if (cleanupSet_) { + sql = "DELETE FROM "+filename_+" WHERE LOCKJOBNAME='CLEANUP'"; + statement_.execute(sql); + } + + /* Otherwise, remove the entry for the job */ + sql = "DELETE FROM "+filename_+" A WHERE A.LOCKJOBNAME=QSYS2.JOB_NAME"; + statement_.execute(sql); + + + dataAreaLock_.unlock("JDSerializeFile", null); + statement_.getConnection().commit(); + + + if (closeStatement_) + statement_.close(); + + + } + + + public static void main(String args[]) { + System.out.println("Testing JDParallelCounter system userid password "); + try { + String system=args[0]; + String userid = args[1]; + String password = args[2]; + String tablename="QGPL.JDPCNTTST"; + int failureCount= 0; + System.out.println("Getting connections"); + System.out.println("Running to "+system+" using "+userid); + Connection c1 = DriverManager.getConnection("jdbc:as400:"+system, userid, password); + Connection c2 = DriverManager.getConnection("jdbc:as400:"+system, userid, password); + Connection c3 = DriverManager.getConnection("jdbc:as400:"+system, userid, password); + + System.out.println("TEST 1 : Simple"); + System.out.println(" creating counter"); + JDParallelCounter counter1= new JDParallelCounter(c1, tablename); + System.out.println(" calling doCleanup"); + boolean doCleanup = counter1.doCleanup(); + if (!doCleanup) { + System.out.println("Cleanup should have worked"); + failureCount++; + } + System.out.println(" calling close"); + counter1.close(); + + System.out.println("TEST 2 : Simple"); + System.out.println(" creating counter"); + counter1= new JDParallelCounter(c1, tablename); + System.out.println(" calling doCleanup"); + doCleanup = counter1.doCleanup(); + if (!doCleanup) { + System.out.println("Cleanup should have worked"); + failureCount++; + } + System.out.println(" calling close"); + counter1.close(); + + + System.out.println("TEST 3 : Concurrent "); + System.out.println(" creating counter1"); + counter1= new JDParallelCounter(c1, tablename); + System.out.println(" creating counter2"); + JDParallelCounter counter2 = new JDParallelCounter(c2, tablename); + System.out.println(" calling counter1.doCleanup"); + doCleanup = counter1.doCleanup(); + if (doCleanup) { + System.out.println("Cleanup have returned false"); + failureCount++; + } + System.out.println(" calling count1.close"); + counter1.close(); + System.out.println(" calling counter2.doCleanup"); + doCleanup = counter2.doCleanup(); + if (!doCleanup) { + System.out.println("Failure Cleanup should have worked"); + failureCount++; + } + System.out.println(" calling counter2.close"); + counter2.close(); + + + + + + System.out.println("Closing connections"); + c1.close(); + c2.close(); + c3.close(); + if (failureCount == 0) { + System.out.println(" TESTCASE SUCCESSFUL"); + } else { + System.out.println("********************************"); + System.out.println(" TESTCASE HAD "+failureCount+" FAILURES"); + System.out.println("********************************"); + + } + } catch (Exception e) { + System.out.println("********************************"); + System.out.println(" TEST FAILED"); + System.out.println("********************************"); + e.printStackTrace(); + } + + } + +} diff --git a/src/test/JD/JDSerializeFile.java b/src/test/JD/JDSerializeFile.java index b8cfd412..4fde9941 100644 --- a/src/test/JD/JDSerializeFile.java +++ b/src/test/JD/JDSerializeFile.java @@ -17,10 +17,23 @@ import java.sql.SQLException; import java.sql.Statement; -import test.JDDataAreaLock; /** - * Class to serialize access to a find using data area. + * Class to serialize access to a file using data area. + The pattern for using the file looks like this + JDSerializeFile serializeFile = null; + try { + serializeFile = new JDSerializeFile(connection_, filename); + ..... + } finally { + if (serializeFile != null) { + try { + serializeFile.close(); + } catch (SQLException e) { + e.printStackTrace(); + } + } + } */ public class JDSerializeFile implements AutoCloseable{ String name_; @@ -29,10 +42,16 @@ public class JDSerializeFile implements AutoCloseable{ JDDataAreaLock dataAreaLock_ ; public JDSerializeFile(Connection c, String name) throws Exception { + String library = null; name_ = name; + int dotIndex = name.indexOf("."); + if (dotIndex > 0) { + library = name.substring(0,dotIndex); + name=name.substring(dotIndex+1); + } statement_ = c.createStatement(); closeStatement_ = true; - name = name.replace("/","X").replace(".","X"); + name = name.replace("/","X").replace(".","X").replace("\"","X"); int len = name.length(); if (len > 10) { name = name.substring(len-10); @@ -40,14 +59,24 @@ public JDSerializeFile(Connection c, String name) throws Exception { if (Character.isDigit(name.charAt(0))) { name='X'+name.substring(1); } - dataAreaLock_ = new JDDataAreaLock(statement_, name); + if (library != null) { + dataAreaLock_ = new JDDataAreaLock(statement_, library, name); + } else { + dataAreaLock_ = new JDDataAreaLock(statement_, name); + } dataAreaLock_.lock("JDSerializeFile", 3600); } public JDSerializeFile(Statement s, String name) throws SQLException { + String library = null; name_ = name; + int dotIndex = name.indexOf("."); + if (dotIndex > 0) { + library = name.substring(0,dotIndex); + name=name.substring(dotIndex+1); + } statement_ = s; - name = name.replace("/","X").replace(".","X"); + name = name.replace("/","X").replace(".","X").replace("\"","X"); int len = name.length(); if (len > 10) { name = name.substring(len-10); @@ -55,7 +84,11 @@ public JDSerializeFile(Statement s, String name) throws SQLException { if (Character.isDigit(name.charAt(0))) { name='X'+name.substring(1); } - dataAreaLock_ = new JDDataAreaLock(statement_, name); + if (library != null) { + dataAreaLock_ = new JDDataAreaLock(statement_, library, name); + } else { + dataAreaLock_ = new JDDataAreaLock(statement_, name); + } dataAreaLock_.lock("JDSerializeFile", 3600); } diff --git a/src/test/JD/JDSetupCollection.java b/src/test/JD/JDSetupCollection.java index 5e92427b..dd5918cf 100644 --- a/src/test/JD/JDSetupCollection.java +++ b/src/test/JD/JDSetupCollection.java @@ -20,7 +20,6 @@ import com.ibm.as400.access.ObjectDescription; import com.ibm.as400.access.ObjectLockListEntry; -import test.JDDataAreaLock; import test.JDSupportedFeatures; import test.TestDriver; diff --git a/src/test/JD/Lob/JDLobClob5035.java b/src/test/JD/Lob/JDLobClob5035.java index 6c249f50..622f1579 100644 --- a/src/test/JD/Lob/JDLobClob5035.java +++ b/src/test/JD/Lob/JDLobClob5035.java @@ -51,6 +51,7 @@ public JDLobClob5035 (AS400 systemObject, namesAndVars, runMode, fileOutputStream, password); lobThreshold="1000000000"; + suffix="K"; } diff --git a/src/test/JD/Lob/JDLobClob8.java b/src/test/JD/Lob/JDLobClob8.java index 0fd80743..57c393cb 100644 --- a/src/test/JD/Lob/JDLobClob8.java +++ b/src/test/JD/Lob/JDLobClob8.java @@ -51,6 +51,7 @@ public JDLobClob8 (AS400 systemObject, namesAndVars, runMode, fileOutputStream, password); lobThreshold="1000000000"; + suffix="L"; output_.println("JDLobClob8 set lob threshold to "+lobThreshold); } diff --git a/src/test/JD/Lob/JDLobClobLocator.java b/src/test/JD/Lob/JDLobClobLocator.java index 628a54da..3b281ed6 100644 --- a/src/test/JD/Lob/JDLobClobLocator.java +++ b/src/test/JD/Lob/JDLobClobLocator.java @@ -74,16 +74,17 @@ public class JDLobClobLocator extends JDTestcase { ResultSet rs4_; ResultSet rs6_; - public String TABLE_ = JDLobTest.COLLECTION + ".CLOBLOC"; - public String TABLE2_ = JDLobTest.COLLECTION + ".CLOBLOC2"; - public String TABLE3_ = JDLobTest.COLLECTION + ".CLOBLOC3"; - public String TABLE4_ = JDLobTest.COLLECTION + ".CLOBLOC4"; - public String TABLE5_ = JDLobTest.COLLECTION + ".CLOBLOC5"; - public String TABLE6_ = JDLobTest.COLLECTION + ".CLOBLOC6"; - public String TABLEHUGE_ = JDLobTest.COLLECTION + ".CLOBLOCH"; - - public String TABLE120_ = JDLobTest.COLLECTION + ".CLOBLOC120"; - public String TABLE121_ = JDLobTest.COLLECTION + ".CLOBLOC121"; + public String suffix=""; + public String TABLE_ = JDLobTest.COLLECTION + ".CLBLOC"+suffix; + public String TABLE2_ = JDLobTest.COLLECTION + ".CLBLOC2+suffix"; + public String TABLE3_ = JDLobTest.COLLECTION + ".CLBLOC3+suffix"; + public String TABLE4_ = JDLobTest.COLLECTION + ".CLBLOC4+suffix"; + public String TABLE5_ = JDLobTest.COLLECTION + ".CLBLOC5+suffix"; + public String TABLE6_ = JDLobTest.COLLECTION + ".CLBLOC6+suffix"; + public String TABLEHUGE_ = JDLobTest.COLLECTION + ".CLBLOCH+suffix"; + + public String TABLE120_ = JDLobTest.COLLECTION + ".CLBLOC120+suffix"; + public String TABLE121_ = JDLobTest.COLLECTION + ".CLBLOC121+suffix"; public String MEDIUM_ = "A really big object."; public String LARGE_ = "TBD"; // final @@ -149,15 +150,15 @@ public JDLobClobLocator(AS400 systemObject, String testname, Hashtable", - "#include ", "#include ", "#include ", "", "void CLOBLOCINF (int * locator,", + " CRTCMOD MODULE(CLBLOCINF"+suffix+") DBGVIEW(*ALL) ", " CRTSRVPGM CLBLOCINF"+suffix+" export(*all)", "", + " CREATE FUNCTION CLBLOCINF"+suffix+" (int) RETURNS VARCHAR(200) ", " LANGUAGE C EXTERNAL NAME ", + " 'QGPL/CLBLOCINF"+suffix+"(CLBLOCINF"+suffix+")', PARAMETER STYLE SQL", "", " To test", "", + " select CLBLOCINF"+suffix+"(256) from qsys2.qsqptabl", "", "", "", "", " */", "", "#include ", + "#include ", "#include ", "#include ", "", "void CLBLOCINF"+suffix+" (int * locator,", " char * output,", " int * ind0,", " int * ind1,", " char * sqlstate,", " char * functionName,", " char * specificName,", " char * messageText", " ) {", @@ -456,13 +458,13 @@ protected void setup() throws Exception { String url2 = baseURL_; Connection noneConnection = testDriver_.getConnection(url2, systemObject_.getUserId(), encryptedPassword_); - stringArrayToSourceFile(noneConnection, cProgram, JDLobTest.COLLECTION, "CLOBLOCINF"); + stringArrayToSourceFile(noneConnection, cProgram, JDLobTest.COLLECTION, "CLBLOCINF"+suffix); noneConnection.close(); sql = "call QGPL.JDCMDEXEC(?,?)"; CallableStatement cmd = connection_.prepareCall(sql); - String command = "QSYS/CRTCMOD MODULE(" + JDLobTest.COLLECTION + "/CLOBLOCINF) " + " SRCFILE(" + JDLobTest.COLLECTION - + "/CLOBLOCINF) "; + String command = "QSYS/CRTCMOD MODULE(" + JDLobTest.COLLECTION + "/CLBLOCINF"+suffix+") " + " SRCFILE(" + JDLobTest.COLLECTION + + "/CLBLOCINF"+suffix+") "; sql = sql + " command=" + command; cmd.setString(1, command); @@ -474,8 +476,8 @@ protected void setup() throws Exception { e.printStackTrace(); } - command = "QSYS/CRTSRVPGM SRVPGM(" + JDLobTest.COLLECTION + "/CLOBLOCINF) MODULE(" + JDLobTest.COLLECTION - + "/CLOBLOCINF) EXPORT(*ALL) "; + command = "QSYS/CRTSRVPGM SRVPGM(" + JDLobTest.COLLECTION + "/CLBLOCINF"+suffix+") MODULE(" + JDLobTest.COLLECTION + + "/CLBLOCINF"+suffix+") EXPORT(*ALL) "; cmd.setString(1, command); cmd.setInt(2, command.length()); try { @@ -485,12 +487,12 @@ protected void setup() throws Exception { e.printStackTrace(); } - sql = " CREATE FUNCTION " + JDLobTest.COLLECTION + ".CLOBLOCINF (int) RETURNS VARCHAR(200) " - + "LANGUAGE C EXTERNAL NAME " + "'" + JDLobTest.COLLECTION + "/CLOBLOCINF(CLOBLOCINF)' PARAMETER STYLE SQL"; + sql = " CREATE FUNCTION " + JDLobTest.COLLECTION + ".CLBLOCINF"+suffix+" (int) RETURNS VARCHAR(200) " + + "LANGUAGE C EXTERNAL NAME " + "'" + JDLobTest.COLLECTION + "/CLBLOCINF"+suffix+"(CLBLOCINF"+suffix+")' PARAMETER STYLE SQL"; Statement stmt = connection_.createStatement(); try { - stmt.executeUpdate("drop FUNCTION " + JDLobTest.COLLECTION + ".CLOBLOCINF"); + stmt.executeUpdate("drop FUNCTION " + JDLobTest.COLLECTION + ".CLBLOCINF"+suffix+""); } catch (Exception e) { } try { @@ -541,7 +543,7 @@ protected void cleanup() throws Exception { } catch (Exception e) { } try { - statement_.executeUpdate("drop FUNCTION " + JDLobTest.COLLECTION + ".CLOBLOCINF"); + statement_.executeUpdate("drop FUNCTION " + JDLobTest.COLLECTION + ".CLBLOCINF"+suffix); } catch (Exception e) { } @@ -7695,7 +7697,7 @@ public void Var240() { for (int i = 0; i < FREE_LOCATOR_BLOCK_SIZE; i++) { // Check the locator using DB locator value (not using the CLOB // object) - lastSql = "select " + JDLobTest.COLLECTION + ".CLOBLOCINF(" + locator[i] + ")" + " from qsys2.qsqptabl"; + lastSql = "select " + JDLobTest.COLLECTION + ".CLBLOCINF"+suffix+"(" + locator[i] + ")" + " from qsys2.qsqptabl"; ResultSet rs = statement2_.executeQuery(lastSql); rs.next(); answer1[i] = rs.getString(1); @@ -7709,7 +7711,7 @@ public void Var240() { // Check the locator using DB locator value (not using the CLOB // object) for (int i = 0; i < FREE_LOCATOR_BLOCK_SIZE; i++) { - lastSql = "select " + JDLobTest.COLLECTION + ".CLOBLOCINF(" + locator[i] + ")" + " from qsys2.qsqptabl"; + lastSql = "select " + JDLobTest.COLLECTION + ".CLBLOCINF"+suffix+"(" + locator[i] + ")" + " from qsys2.qsqptabl"; ResultSet rs = statement2_.executeQuery(lastSql); rs.next(); answer2[i] = rs.getString(1); @@ -7770,7 +7772,7 @@ public void Var241() { // object) ResultSet rs = statement2_.executeQuery( - "select " + JDLobTest.COLLECTION + ".CLOBLOCINF(" + locator[i] + ")" + " from qsys2.qsqptabl"); + "select " + JDLobTest.COLLECTION + ".CLBLOCINF"+suffix+"(" + locator[i] + ")" + " from qsys2.qsqptabl"); rs.next(); answer2[i] = rs.getString(1); rs.close(); @@ -7826,7 +7828,7 @@ public void Var242() { // object) ResultSet rs = statement2_.executeQuery( - "select " + JDLobTest.COLLECTION + ".CLOBLOCINF(" + locator[i] + ")" + " from qsys2.qsqptabl"); + "select " + JDLobTest.COLLECTION + ".CLBLOCINF"+suffix+"(" + locator[i] + ")" + " from qsys2.qsqptabl"); rs.next(); answer2[i] = rs.getString(1); rs.close(); @@ -7895,7 +7897,7 @@ public void Var243() { int locator = JDReflectionUtil.callMethod_I(clob[i], "getLocator"); ResultSet rs = statement2_.executeQuery( - "select " + JDLobTest.COLLECTION + ".CLOBLOCINF(" + locator + ")" + " from qsys2.qsqptabl"); + "select " + JDLobTest.COLLECTION + ".CLBLOCINF"+suffix+"(" + locator + ")" + " from qsys2.qsqptabl"); rs.next(); answer2[i] = rs.getString(1); rs.close(); @@ -8262,7 +8264,7 @@ public void Var256() { // object) ResultSet rs = statement2_.executeQuery( - "select " + JDLobTest.COLLECTION + ".CLOBLOCINF(" + locator + ")" + " from qsys2.qsqptabl"); + "select " + JDLobTest.COLLECTION + ".CLBLOCINF"+suffix+"(" + locator + ")" + " from qsys2.qsqptabl"); rs.next(); String answer1 = rs.getString(1); rs.close(); @@ -8273,7 +8275,7 @@ public void Var256() { // object) rs = statement2_.executeQuery( - "select " + JDLobTest.COLLECTION + ".CLOBLOCINF(" + locator + ")" + " from qsys2.qsqptabl"); + "select " + JDLobTest.COLLECTION + ".CLBLOCINF"+suffix+"(" + locator + ")" + " from qsys2.qsqptabl"); rs.next(); String answer2 = rs.getString(1); rs.close(); @@ -8317,7 +8319,7 @@ public void Var257() { // object) ResultSet rs = statement2_ - .executeQuery("select " + JDLobTest.COLLECTION + ".CLOBLOCINF(" + locator + ")" + " from qsys2.qsqptabl"); + .executeQuery("select " + JDLobTest.COLLECTION + ".CLBLOCINF"+suffix+"(" + locator + ")" + " from qsys2.qsqptabl"); rs.next(); String answer1 = rs.getString(1); rs.close(); @@ -8329,7 +8331,7 @@ public void Var257() { // object) rs = statement2_ - .executeQuery("select " + JDLobTest.COLLECTION + ".CLOBLOCINF(" + locator + ")" + " from qsys2.qsqptabl"); + .executeQuery("select " + JDLobTest.COLLECTION + ".CLBLOCINF"+suffix+"(" + locator + ")" + " from qsys2.qsqptabl"); rs.next(); String answer2 = rs.getString(1); rs.close(); diff --git a/src/test/JD/Lob/JDLobClobLocator5035.java b/src/test/JD/Lob/JDLobClobLocator5035.java index 26a25f6f..87776120 100644 --- a/src/test/JD/Lob/JDLobClobLocator5035.java +++ b/src/test/JD/Lob/JDLobClobLocator5035.java @@ -73,6 +73,7 @@ public JDLobClobLocator5035 (AS400 systemObject, super (systemObject, "JDLobClobLocator5035", namesAndVars, runMode, fileOutputStream, password); + suffix="F"; } @@ -87,23 +88,10 @@ public JDLobClobLocator5035 (AS400 systemObject, namesAndVars, runMode, fileOutputStream, password); lobThreshold = "1"; - + suffix="F"; } - void setupTableNames() { - TABLE_ = JDLobTest.COLLECTION + ".CL5035"; - TABLE2_ = JDLobTest.COLLECTION + ".CL50352"; - TABLE3_ = JDLobTest.COLLECTION + ".CL50353"; - TABLE4_ = JDLobTest.COLLECTION + ".CL50354"; - TABLE5_ = JDLobTest.COLLECTION + ".CL50355"; - TABLE6_ = JDLobTest.COLLECTION + ".CL50356"; - TABLE120_= JDLobTest.COLLECTION + ".CL5035120"; - TABLE121_= JDLobTest.COLLECTION + ".CL5035121"; - TABLEHUGE_ = JDLobTest.COLLECTION + ".CL5035H"; - - - } - + void setupTestStringValues() { // Note: This must end with a charcter that does not exist elsewhere in the string @@ -193,6 +181,7 @@ void setupTestStringValues() { protected void setup () throws Exception { + if (suffix.equals("")) suffix="F"; super.setup(); } diff --git a/src/test/JD/Lob/JDLobClobLocator8.java b/src/test/JD/Lob/JDLobClobLocator8.java index b8fb7fd2..cc2240a1 100644 --- a/src/test/JD/Lob/JDLobClobLocator8.java +++ b/src/test/JD/Lob/JDLobClobLocator8.java @@ -79,6 +79,7 @@ public JDLobClobLocator8 (AS400 systemObject, super (systemObject, "JDLobClobLocator8", namesAndVars, runMode, fileOutputStream, password); + suffix="E"; } @@ -93,20 +94,10 @@ public JDLobClobLocator8 (AS400 systemObject, namesAndVars, runMode, fileOutputStream, password); lobThreshold = "1"; + suffix="E"; } - void setupTableNames() { - TABLE_ = JDLobTest.COLLECTION + ".CLOBLU8"; - TABLE2_ = JDLobTest.COLLECTION + ".CLOBLU82"; - TABLE3_ = JDLobTest.COLLECTION + ".CLOBLU83"; - TABLE4_ = JDLobTest.COLLECTION + ".CLOBLU84"; - TABLE5_ = JDLobTest.COLLECTION + ".CLOBLU85"; - TABLE6_ = JDLobTest.COLLECTION + ".CLOBLU86"; - TABLE120_= JDLobTest.COLLECTION + ".CLOBLU8120"; - TABLE121_= JDLobTest.COLLECTION + ".CLOBLU8121"; - TABLEHUGE_ = JDLobTest.COLLECTION + ".CLOBLU8H"; - } void setupTestStringValues() { @@ -188,6 +179,7 @@ protected void setup () throws Exception { try { + if (suffix.equals("")) suffix="E"; super.setup(); diff --git a/src/test/JD/Lob/JDLobNClobLocator.java b/src/test/JD/Lob/JDLobNClobLocator.java index 7c372873..caa132ab 100644 --- a/src/test/JD/Lob/JDLobNClobLocator.java +++ b/src/test/JD/Lob/JDLobNClobLocator.java @@ -69,6 +69,7 @@ public JDLobNClobLocator (AS400 systemObject, updateMethod = "updateNClob"; setMethod = "setNClob"; requireJdbc40 = true; + suffix="X"; } @@ -97,6 +98,7 @@ public JDLobNClobLocator (AS400 systemObject, protected void setup () throws Exception { + if (suffix.equals("")) suffix="X"; super.setup(); getMethod = "getNClob"; updateMethod = "updateNClob"; diff --git a/src/test/JD/Lob/JDLobNClobLocator8.java b/src/test/JD/Lob/JDLobNClobLocator8.java index 7e5faf1a..93524554 100644 --- a/src/test/JD/Lob/JDLobNClobLocator8.java +++ b/src/test/JD/Lob/JDLobNClobLocator8.java @@ -95,21 +95,11 @@ public JDLobNClobLocator8 (AS400 systemObject, namesAndVars, runMode, fileOutputStream, password); lobThreshold = "1"; + suffix="Z"; } - void setupTableNames() { - TABLE_ = JDLobTest.COLLECTION + ".CLOBLU8"; - TABLE2_ = JDLobTest.COLLECTION + ".CLOBLU82"; - TABLE3_ = JDLobTest.COLLECTION + ".CLOBLU83"; - TABLE4_ = JDLobTest.COLLECTION + ".CLOBLU84"; - TABLE5_ = JDLobTest.COLLECTION + ".CLOBLU85"; - TABLE6_ = JDLobTest.COLLECTION + ".CLOBLU86"; - TABLE120_= JDLobTest.COLLECTION + ".CLOBLU8120"; - TABLE121_= JDLobTest.COLLECTION + ".CLOBLU8121"; - TABLEHUGE_ = JDLobTest.COLLECTION + ".CLOBLU8H"; - } - + void setupTestStringValues() { SMALL_ = "\u0391 really =\u03b2ig object\u02f3"; @@ -189,6 +179,7 @@ protected void setup () throws Exception { try { + if (suffix.equals("")) suffix="Z"; super.setup(); diff --git a/src/test/JD/PS/JDPSBatch.java b/src/test/JD/PS/JDPSBatch.java index 174ae1fa..44ec57f4 100644 --- a/src/test/JD/PS/JDPSBatch.java +++ b/src/test/JD/PS/JDPSBatch.java @@ -69,7 +69,6 @@ public static void main(String args[]) throws Exception { } - boolean runningJ9 = false; // Private data. private static String table_ = JDPSTest.COLLECTION + ".JDPSB"; @@ -84,12 +83,13 @@ public static void main(String args[]) throws Exception { private static String insert7_ = "INSERT INTO " + table_ + " ? ROWS VALUES (?, ?)"; //@D1A private static String insert8_ = "INSERT INTO " + table_ + " ? ROWS (NAME, ID) VALUES ('Mountain Dew', ?)"; //@D1A public static final int WIDTH_ = 30000; //@K2A - public static String TABLE1_ = JDPSTest.COLLECTION + ".BLOBLOC"; //@K2A - public static String TABLE2_ = JDPSTest.COLLECTION + ".CLOBLOC"; //@K2A - public static String TABLE3_ = JDPSTest.COLLECTION + ".CLOBLOC2"; //@K2A + public static String tableLob1_ = JDPSTest.COLLECTION + ".BLOBLOC"; //@K2A + public static String tableLob2_ = JDPSTest.COLLECTION + ".CLOBLOC"; //@K2A + public static String tableLob3_ = JDPSTest.COLLECTION + ".CLOBLOC2"; //@K2A public static String LARGECLOB_ = null; //@K2A public static String table4_ = JDPSTest.COLLECTION + ".GRAPHIC"; // @L2 + public static String table5_ = JDPSTest.COLLECTION + ".JDPSTEMP37"; private static String insertT41_, insertT42_; // @L2 public static String tableBoolean_ = JDPSTest.COLLECTION + ".JDPSBBOOL"; @@ -154,164 +154,143 @@ public JDPSBatch (AS400 systemObject, } + /** + * Performs setup needed before running variations. + * + * @exception Exception If an exception occurs. + **/ + protected void setup() throws Exception { + setup(""); + } -/** -Performs setup needed before running variations. + protected void setup(String suffix) throws Exception { + String url = baseURL_; + connection_ = testDriver_.getConnection(url, userId_, encryptedPassword_); + connection_.setAutoCommit(true); // for xa -@exception Exception If an exception occurs. -**/ - protected void setup() throws Exception { - setup(""); - } - protected void setup (String suffix) - throws Exception - { - String url = baseURL_; - connection_ = testDriver_.getConnection (url, userId_, encryptedPassword_); - connection_.setAutoCommit(true); // for xa + JDSerializeFile setupLock = null; + try { + setupLock = new JDSerializeFile(connection_, "JDPSSETUP"); - JDSerializeFile setupLock = null; - try { - setupLock = new JDSerializeFile(connection_, "JDPSSETUP"); - - connection2_ = testDriver_.getConnection(url + ";lob threshold=1", userId_, encryptedPassword_); //@K2A + connection2_ = testDriver_.getConnection(url + ";lob threshold=1", userId_, encryptedPassword_); // @K2A - Statement s = connection_.createStatement (); + Statement s = connection_.createStatement(); - table_ = JDPSTest.COLLECTION + ".JDPSB"+suffix; - insert0_ = "INSERT INTO " + table_ + "(NAME) VALUES ('NORMAN')"; - insert1_ = "INSERT INTO " + table_ + "(NAME) VALUES (?)"; - insert2_ = "INSERT INTO " + table_ + "(NAME, ID) VALUES (?, ?)"; - insert3_ = "INSERT INTO " + table_ + "(NAME, ID) VALUES ('Vanilla Coke', ?)"; //@D1A - insert4_ = "INSERT INTO " + table_ + "(NAME, ID) VALUES (NULL, ?)"; //@D1A - insert5_ = "INSERT INTO " + table_ + "(NAME, ID) VALUES (?, 5)"; //@D1A - insert6_ = "INSERT INTO " + table_ + "(NAME, ID) VALUES (?, NULL)"; //@D1A - insert7_ = "INSERT INTO " + table_ + " ? ROWS VALUES (?, ?)"; //@D1A - insert8_ = "INSERT INTO " + table_ + " ? ROWS (NAME, ID) VALUES ('Mountain Dew', ?)"; //@D1A - - - table2_ = JDPSTest.COLLECTION + ".JDSB2"+suffix; - - table4_ = JDPSTest.COLLECTION + ".GRAPHIC"+suffix; // @L2 - insertT41_ = "INSERT INTO "+table4_+" (COL1) VALUES(?) "; // @L2 - insertT42_ = "INSERT INTO "+table4_+" (COL2) VALUES(?) "; // @L2 - - TABLE1_ = JDPSTest.COLLECTION + ".BLOBLOC"+suffix; //@K2A - TABLE2_ = JDPSTest.COLLECTION + ".CLOBLOC"+suffix; //@K2A - TABLE3_ = JDPSTest.COLLECTION + ".CLOBLOC2"+suffix; //@K2A - table4_ = JDPSTest.COLLECTION + ".GRAPHIC"+suffix; // @L2 - tableBoolean_ = JDPSTest.COLLECTION + ".JDPSBBOOL"+suffix; - insertBoolean_ = "INSERT INTO "+tableBoolean_+"(COL1,COL2) VALUES(?,?)"; - - try{ - s.executeUpdate(" DROP TABLE "+table_); - }catch(Exception e0){ - } - try{ - s.executeUpdate(" DROP TABLE "+table2_); - }catch(Exception e0){ - } - try{ - s.executeUpdate(" DROP TABLE "+TABLE1_); - }catch(Exception e1){ - } - try{ - s.executeUpdate(" DROP TABLE "+TABLE2_); - }catch(Exception e2){ - } - try{ - s.executeUpdate(" DROP TABLE "+TABLE3_); - }catch(Exception e3){ - String message = e3.toString(); - if (message.indexOf("not found") < 0) { - output_.println("Warning TABLE3 not dropped"); - e3.printStackTrace(); - } - } - try{ - s.executeUpdate(" DROP TABLE "+table4_); - }catch(Exception e4){ - } + table_ = JDPSTest.COLLECTION + ".JDPSB" + suffix; + insert0_ = "INSERT INTO " + table_ + "(NAME) VALUES ('NORMAN')"; + insert1_ = "INSERT INTO " + table_ + "(NAME) VALUES (?)"; + insert2_ = "INSERT INTO " + table_ + "(NAME, ID) VALUES (?, ?)"; + insert3_ = "INSERT INTO " + table_ + "(NAME, ID) VALUES ('Vanilla Coke', ?)"; // @D1A + insert4_ = "INSERT INTO " + table_ + "(NAME, ID) VALUES (NULL, ?)"; // @D1A + insert5_ = "INSERT INTO " + table_ + "(NAME, ID) VALUES (?, 5)"; // @D1A + insert6_ = "INSERT INTO " + table_ + "(NAME, ID) VALUES (?, NULL)"; // @D1A + insert7_ = "INSERT INTO " + table_ + " ? ROWS VALUES (?, ?)"; // @D1A + insert8_ = "INSERT INTO " + table_ + " ? ROWS (NAME, ID) VALUES ('Mountain Dew', ?)"; // @D1A + table2_ = JDPSTest.COLLECTION + ".JDSB2" + suffix; + + table4_ = JDPSTest.COLLECTION + ".GRAPHIC" + suffix; // @L2 + table5_ = JDPSTest.COLLECTION + ".JDPST37" + suffix; + + insertT41_ = "INSERT INTO " + table4_ + " (COL1) VALUES(?) "; // @L2 + insertT42_ = "INSERT INTO " + table4_ + " (COL2) VALUES(?) "; // @L2 + + tableLob1_ = JDPSTest.COLLECTION + ".BLOBLOC" + suffix; // @K2A + tableLob2_ = JDPSTest.COLLECTION + ".CLOBLOC" + suffix; // @K2A + tableLob3_ = JDPSTest.COLLECTION + ".CLOBLOC2" + suffix; // @K2A + table4_ = JDPSTest.COLLECTION + ".GRAPHIC" + suffix; // @L2 + + tableBoolean_ = JDPSTest.COLLECTION + ".JDPSBBOOL" + suffix; + insertBoolean_ = "INSERT INTO " + tableBoolean_ + "(COL1,COL2) VALUES(?,?)"; + + // + // Note: no need to serialize files because suffix causes different files to be + // used + + try { + s.executeUpdate(" DROP TABLE " + table_); + } catch (Exception e0) { + } // We create a unique key so it is easy to force errors. - s.executeUpdate ("CREATE TABLE " + table_ - + " (NAME VARCHAR(25), ID INTEGER, UNIQUE(ID))"); + s.executeUpdate("CREATE TABLE " + table_ + " (NAME VARCHAR(25), ID INTEGER, UNIQUE(ID))"); - s.executeUpdate ("INSERT INTO " + table_ + " (ID) VALUES (" - + forceErrorId_ + ")"); + s.executeUpdate("INSERT INTO " + table_ + " (ID) VALUES (" + forceErrorId_ + ")"); - try{ - s.executeUpdate ("CREATE TABLE " + table2_ - + " (NAME VARCHAR(10), ID INTEGER)"); - }catch(Exception e){ - e.printStackTrace(); - } - - s.executeUpdate ("CREATE TABLE " + TABLE1_ - + "(C_BLOB BLOB(" + WIDTH_ + "))"); //@K2A + try { + s.executeUpdate(" DROP TABLE " + table2_); + } catch (Exception e0) { + } - s.executeUpdate ("CREATE TABLE " + TABLE2_ - + "(C_CLOB CLOB(" + WIDTH_ + "))"); //@K2A + try { + s.executeUpdate("CREATE TABLE " + table2_ + " (NAME VARCHAR(10), ID INTEGER)"); + } catch (Exception e) { + e.printStackTrace(); + } - s.executeUpdate ("CREATE TABLE " + TABLE3_ - + "(C_CLOB CLOB(" + WIDTH_ + "))"); //@K2A + try { + s.executeUpdate(" DROP TABLE " + table4_); + } catch (Exception e4) { + } + s.executeUpdate( + "CREATE TABLE " + table4_ + " (COL1 GRAPHIC(200) ccsid 13488, COL2 VARGRAPHIC(200) ccsid 13488)"); // @L2 - try { - s.executeUpdate("DROP TABLE "+JDPSTest.COLLECTION + ".JDPSTEMP37"); // @L1 - } catch (Exception e) { + try { + s.executeUpdate(" DROP TABLE " + tableLob1_); + } catch (Exception e1) { + } + s.executeUpdate("CREATE TABLE " + tableLob1_ + "(C_BLOB BLOB(" + WIDTH_ + "))"); // @K2A - } - s.executeUpdate("CREATE TABLE "+JDPSTest.COLLECTION + ".JDPSTEMP37 (X INT)"); // @ L1 + try { + s.executeUpdate(" DROP TABLE " + tableLob2_); + } catch (Exception e2) { + } + s.executeUpdate("CREATE TABLE " + tableLob2_ + "(C_CLOB CLOB(" + WIDTH_ + "))"); // @K2A + try { + s.executeUpdate(" DROP TABLE " + tableLob3_); + } catch (Exception e3) { + String message = e3.toString(); + if (message.indexOf("not found") < 0) { + output_.println("Warning TABLE3 not dropped"); + e3.printStackTrace(); + } + } + s.executeUpdate("CREATE TABLE " + tableLob3_ + "(C_CLOB CLOB(" + WIDTH_ + "))"); // @K2A - s.executeUpdate("CREATE TABLE "+table4_+" (COL1 GRAPHIC(200) ccsid 13488, COL2 VARGRAPHIC(200) ccsid 13488)"); // @L2 - - - if (areBooleansSupported()) { - try { - s.executeUpdate(" DROP TABLE " + tableBoolean_); - } catch (Exception e4) { - } - s.executeUpdate("CREATE TABLE " + tableBoolean_ - + " (COL1 VARGRAPHIC(200) ccsid 13488, COL2 BOOLEAN)"); + try { + s.executeUpdate("DROP TABLE " + table5_); // @L1 + } catch (Exception e) { - } - - connection_.commit(); // for xa - s.close (); + } + s.executeUpdate("CREATE TABLE " + table5_ + " (X INT)"); // @ L1 + if (areBooleansSupported()) { + try { + s.executeUpdate(" DROP TABLE " + tableBoolean_); + } catch (Exception e4) { + } + s.executeUpdate("CREATE TABLE " + tableBoolean_ + " (COL1 VARGRAPHIC(200) ccsid 13488, COL2 BOOLEAN)"); + + } + + connection_.commit(); // for xa + s.close(); - if (getDriver() == JDTestDriver.DRIVER_NATIVE) { - String vmName = System.getProperty("java.vm.name"); - if (vmName == null) { - runningJ9 = false; - } else { - if (vmName.indexOf("Classic VM") >= 0) { - runningJ9 = false; - } else { - runningJ9 = true; - } - } - } - - // - // In V5R4, randomly pick one of the 2 of the 8 long running tests + // Randomly pick long running tests // - Random random = new Random(); - longRunTest = random.nextInt(4); + Random random = new Random(); + longRunTest = random.nextInt(4); - } finally { - - if (setupLock != null) { - setupLock.close(); - } - - } - } + } finally { + if (setupLock != null) { + setupLock.close(); + } + } + } /** Performs cleanup needed after running variations. @@ -324,11 +303,11 @@ protected void cleanup () Statement s = connection_.createStatement (); s.executeUpdate ("DROP TABLE " + table_); s.executeUpdate ("DROP TABLE " + table2_); - s.executeUpdate ("DROP TABLE " + TABLE1_); //@K2A - s.executeUpdate ("DROP TABLE " + TABLE2_); //@K2A - s.executeUpdate ("DROP TABLE " + TABLE3_); //@K2A - s.executeUpdate("DROP TABLE "+JDPSTest.COLLECTION + ".JDPSTEMP37"); // @L1 + s.executeUpdate ("DROP TABLE " + tableLob1_); //@K2A + s.executeUpdate ("DROP TABLE " + tableLob2_); //@K2A + s.executeUpdate ("DROP TABLE " + tableLob3_); //@K2A s.executeUpdate("DROP TABLE "+table4_); // @L2 + s.executeUpdate("DROP TABLE " +table5_); // @L1 if (areBooleansSupported()) { s.executeUpdate("DROP TABLE "+tableBoolean_); @@ -2105,22 +2084,22 @@ public void Var046 () conn = testDriver_.getConnection (url46, userId_, encryptedPassword_); conn.setTransactionIsolation(Connection.TRANSACTION_SERIALIZABLE); conn.setAutoCommit(true); // for xa - + // stmt.executeUpdate("DROP TABLE "+JDPSTest.COLLECTION + ".JDPSTEMP37"); // stmt.executeUpdate("CREATE TABLE "+JDPSTest.COLLECTION + ".JDPSTEMP37 (X INT)"); - PreparedStatement ps = conn.prepareStatement ("INSERT INTO " +JDPSTest.COLLECTION+ ".JDPSTEMP37 (X) VALUES (?)"); + PreparedStatement ps = conn.prepareStatement ("INSERT INTO " +table5_+" (X) VALUES (?)"); for (int i = 0; i<5; i++) { ps.setInt(1, (i%2)); ps.addBatch (); } int updateCounts[] = ps.executeBatch(); - PreparedStatement ps1 = conn.prepareStatement ("Select x from " +JDPSTest.COLLECTION+ ".JDPSTEMP37 where x = 1"); + PreparedStatement ps1 = conn.prepareStatement ("Select x from " +table5_+" where x = 1"); ps1.execute(); - PreparedStatement ps2 = conn.prepareStatement ("Delete from " +JDPSTest.COLLECTION+ ".JDPSTEMP37 X where X = 0"); + PreparedStatement ps2 = conn.prepareStatement ("Delete from " +table5_+" X where X = 0"); ps2.addBatch(); int updateCounts2[] = ps2.executeBatch(); - ps2 = conn.prepareStatement ("INSERT INTO " +JDPSTest.COLLECTION+ ".JDPSTEMP37 (X) VALUES (?)"); + ps2 = conn.prepareStatement ("INSERT INTO " +table5_+" (X) VALUES (?)"); for (int i = 0; i<5; i++) { ps2.setInt(1, (i%2)); @@ -2344,7 +2323,7 @@ public void Var050() try { PreparedStatement ps = connection2_.prepareStatement ( - "INSERT INTO " + TABLE1_ + "INSERT INTO " + tableLob1_ + " (C_BLOB) VALUES (?)"); byte[] b = new byte[] { (byte) 1, (byte) -12, (byte) 57, (byte) 45, @@ -2364,7 +2343,7 @@ public void Var050() ps.close (); Statement s = connection_.createStatement(); - ResultSet rs = s.executeQuery ("SELECT C_BLOB FROM " + TABLE1_);//pstestSet.getName()); // @L2 + ResultSet rs = s.executeQuery ("SELECT C_BLOB FROM " + tableLob1_);//pstestSet.getName()); // @L2 boolean success = true; int count = 0; @@ -2410,7 +2389,7 @@ public void Var051() try { PreparedStatement ps = connection_.prepareStatement ( - "INSERT INTO " + TABLE2_ + "INSERT INTO " + tableLob2_ + " (C_CLOB) VALUES (?)"); for (int i = 0; i<5; i++) { @@ -2422,7 +2401,7 @@ public void Var051() Statement s = connection_.createStatement(); - ResultSet rs = s.executeQuery("SELECT C_CLOB FROM " + TABLE2_); + ResultSet rs = s.executeQuery("SELECT C_CLOB FROM " + tableLob2_); boolean success = true; int count = 0; while(rs.next()) @@ -2462,7 +2441,7 @@ public void Var052() try { PreparedStatement ps = connection_.prepareStatement ( - "INSERT INTO " + TABLE3_ + "INSERT INTO " + tableLob3_ + " (C_CLOB) VALUES (?)"); for (int i = 0; i<5; i++) { @@ -2477,7 +2456,7 @@ public void Var052() Statement s = connection_.createStatement(); - ResultSet rs = s.executeQuery("Select * FROM " + TABLE3_); + ResultSet rs = s.executeQuery("Select * FROM " + tableLob3_); boolean success = true; int count = 0; while(rs.next()) diff --git a/src/test/JD/PS/JDPSSetCharacterStream.java b/src/test/JD/PS/JDPSSetCharacterStream.java index b5b3d938..31784778 100644 --- a/src/test/JD/PS/JDPSSetCharacterStream.java +++ b/src/test/JD/PS/JDPSSetCharacterStream.java @@ -124,18 +124,18 @@ public void Var001() { JDSerializeFile pstestSet = null; try { pstestSet = JDPSTest.getPstestSet(connection_); -if (checkJdbc20()) { - try { - PreparedStatement ps = connection_ - .prepareStatement("INSERT INTO " + pstestSet.getName() + " (C_VARCHAR_50) VALUES (?)"); - ps.close(); - Reader r = new StringReader("Rochester"); - ps.setCharacterStream(1, r, 9); - failed("Didn't throw SQLException"); - } catch (Exception e) { - assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + if (checkJdbc20()) { + try { + PreparedStatement ps = connection_ + .prepareStatement("INSERT INTO " + pstestSet.getName() + " (C_VARCHAR_50) VALUES (?)"); + ps.close(); + Reader r = new StringReader("Rochester"); + ps.setCharacterStream(1, r, 9); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } - } } catch (Exception e) { failed(e, "Unexpected Exception"); } finally { diff --git a/src/test/JD/PS/JDPSSetObject3.java b/src/test/JD/PS/JDPSSetObject3.java index 84d70014..287d119e 100644 --- a/src/test/JD/PS/JDPSSetObject3.java +++ b/src/test/JD/PS/JDPSSetObject3.java @@ -139,6 +139,8 @@ public void Var001() JDSerializeFile pstestSet = null; try { pstestSet = JDPSTest.getPstestSet(connection_); + statement_.executeUpdate ("DELETE FROM " + pstestSet.getName()); + PreparedStatement ps = connection_.prepareStatement ( "INSERT INTO " + pstestSet.getName() + " (C_NUMERIC_105) VALUES (?)"); @@ -170,6 +172,8 @@ public void Var002() JDSerializeFile pstestSet = null; try { pstestSet = JDPSTest.getPstestSet(connection_); + statement_.executeUpdate ("DELETE FROM " + pstestSet.getName()); + PreparedStatement ps = connection_.prepareStatement ( "INSERT INTO " + pstestSet.getName() + " (C_INTEGER, C_SMALLINT, C_VARCHAR_50) VALUES (?, ?, ?)"); @@ -200,6 +204,8 @@ public void Var003() JDSerializeFile pstestSet = null; try { pstestSet = JDPSTest.getPstestSet(connection_); + statement_.executeUpdate ("DELETE FROM " + pstestSet.getName()); + PreparedStatement ps = connection_.prepareStatement ( "INSERT INTO " + pstestSet.getName() + " (C_INTEGER, C_SMALLINT, C_VARCHAR_50) VALUES (?, ?, ?)"); @@ -230,6 +236,8 @@ public void Var004() JDSerializeFile pstestSet = null; try { pstestSet = JDPSTest.getPstestSet(connection_); + statement_.executeUpdate ("DELETE FROM " + pstestSet.getName()); + PreparedStatement ps = connection_.prepareStatement ( "INSERT INTO " + pstestSet.getName() + " (C_INTEGER, C_SMALLINT, C_VARCHAR_50) VALUES (?, ?, ?)"); @@ -407,10 +415,13 @@ public void Var009() JDSerializeFile pstestSet = null; try { pstestSet = JDPSTest.getPstestSet(connection_); + statement_.executeUpdate ("DELETE FROM " + pstestSet.getName()); + PreparedStatement ps = connection_.prepareStatement ( "INSERT INTO " + pstestSet.getName() + " (C_SMALLINT) VALUES (?)"); ps.setObject (1, new Hashtable (), Types.SMALLINT); + ps.close(); failed ("Didn't throw SQLException"); } catch (Exception e) { assertExceptionIsInstanceOf (e, "java.sql.SQLException"); @@ -2037,42 +2048,40 @@ public void Var052() /** setObject() - Set a BINARY parameter. **/ - public void Var053() - { - JDSerializeFile pstestSet = null; - try - { - pstestSet = JDPSTest.getPstestSet(connection_); - PreparedStatement ps = connection_.prepareStatement ( - "INSERT INTO " + pstestSet.getName() - + " (C_BINARY_20) VALUES (?)"); - byte[] b = { (byte) 32, (byte) 0, (byte) -1, (byte) -11}; - ps.setObject (1, b, Types.BINARY); - ps.executeUpdate (); - ps.close (); - - ResultSet rs = statement_.executeQuery ("SELECT C_BINARY_20 FROM " + pstestSet.getName()); - rs.next (); - byte[] check = rs.getBytes (1); - rs.close (); - - byte[] b2 = new byte[20]; - System.arraycopy (b, 0, b2, 0, b.length); - assertCondition (areEqual (check, b2)); - } catch (Exception e) { - failed (e, "Unexpected Exception"); - - } finally { - if (pstestSet != null) { - try { - pstestSet.close(); - } catch (SQLException e) { - e.printStackTrace(); - } +public void Var053() { + JDSerializeFile pstestSet = null; + try { + pstestSet = JDPSTest.getPstestSet(connection_); + statement_.executeUpdate ("DELETE FROM " + pstestSet.getName()); + + PreparedStatement ps = connection_ + .prepareStatement("INSERT INTO " + pstestSet.getName() + " (C_BINARY_20) VALUES (?)"); + byte[] b = { (byte) 32, (byte) 0, (byte) -1, (byte) -11 }; + ps.setObject(1, b, Types.BINARY); + ps.executeUpdate(); + ps.close(); + + ResultSet rs = statement_.executeQuery("SELECT C_BINARY_20 FROM " + pstestSet.getName()); + rs.next(); + byte[] check = rs.getBytes(1); + rs.close(); + + byte[] b2 = new byte[20]; + System.arraycopy(b, 0, b2, 0, b.length); + assertCondition(areEqual(check, b2)); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + + } finally { + if (pstestSet != null) { + try { + pstestSet.close(); + } catch (SQLException e) { + e.printStackTrace(); } } } - +} @@ -2084,6 +2093,8 @@ public void Var054() JDSerializeFile pstestSet = null; try { pstestSet = JDPSTest.getPstestSet(connection_); + statement_.executeUpdate ("DELETE FROM " + pstestSet.getName()); + PreparedStatement ps = connection_.prepareStatement ( "INSERT INTO " + pstestSet.getName() + " (C_BINARY_20) VALUES (?)"); @@ -2143,33 +2154,33 @@ public void Var055() -/** -setObject() - Set a BINARY parameter, when the type is invalid. -**/ - public void Var056() - { + /** + * setObject() - Set a BINARY parameter, when the type is invalid. + **/ + public void Var056() { JDSerializeFile pstestSet = null; - try { + try { pstestSet = JDPSTest.getPstestSet(connection_); - PreparedStatement ps = connection_.prepareStatement ( - "INSERT INTO " + pstestSet.getName() - + " (C_BINARY_20) VALUES (?)"); - byte[] b = { (byte) 32, (byte) 0, (byte) -1, (byte) -11}; - ps.setObject (1, b, Types.TIMESTAMP); - ps.executeUpdate (); - ps.close (); + statement_.executeUpdate("DELETE FROM " + pstestSet.getName()); - ResultSet rs = statement_.executeQuery ("SELECT C_BINARY_20 FROM " + pstestSet.getName()); - rs.next (); - byte[] check = rs.getBytes (1); - rs.close (); + PreparedStatement ps = connection_ + .prepareStatement("INSERT INTO " + pstestSet.getName() + " (C_BINARY_20) VALUES (?)"); + byte[] b = { (byte) 32, (byte) 0, (byte) -1, (byte) -11 }; + ps.setObject(1, b, Types.TIMESTAMP); + ps.executeUpdate(); + ps.close(); + + ResultSet rs = statement_.executeQuery("SELECT C_BINARY_20 FROM " + pstestSet.getName()); + rs.next(); + byte[] check = rs.getBytes(1); + rs.close(); + + byte[] b2 = new byte[20]; + System.arraycopy(b, 0, b2, 0, b.length); + assertCondition(areEqual(check, b2)); + } catch (Exception e) { + failed(e, "Unexpected Exception"); - byte[] b2 = new byte[20]; - System.arraycopy (b, 0, b2, 0, b.length); - assertCondition (areEqual (check, b2)); - } catch (Exception e) { - failed (e, "Unexpected Exception"); - } finally { if (pstestSet != null) { try { @@ -2181,8 +2192,6 @@ public void Var056() } } - - /** setObject() - Set a VARBINARY parameter. **/ @@ -2231,6 +2240,8 @@ public void Var058() JDSerializeFile pstestSet = null; try { pstestSet = JDPSTest.getPstestSet(connection_); + statement_.executeUpdate ("DELETE FROM " + pstestSet.getName()); + PreparedStatement ps = connection_.prepareStatement ( "INSERT INTO " + pstestSet.getName() + " (C_VARBINARY_20) VALUES (?)"); @@ -2332,6 +2343,8 @@ public void Var061() if (checkJdbc20 ()) { if (checkLobSupport ()) { try { + statement_.executeUpdate ("DELETE FROM " + pstestSet.getName()); + PreparedStatement ps = connection_.prepareStatement ( "INSERT INTO " + pstestSet.getName() + " (C_BLOB) VALUES (?)"); @@ -2915,6 +2928,8 @@ public void Var076() pstestSet = JDPSTest.getPstestSet(connection_); if (checkLobSupport ()) { try { + statement_.executeUpdate ("DELETE FROM " + pstestSet.getName()); + PreparedStatement ps = connection_.prepareStatement ( "INSERT INTO " + pstestSet.getName() + " (C_DISTINCT) VALUES (?)"); @@ -4201,6 +4216,8 @@ public void testSetFailure(String columnName, Object o, int sqltype, JDSerializeFile pstestSet = null; try { pstestSet = JDPSTest.getPstestSet(connection_); + statement_.executeUpdate ("DELETE FROM " + pstestSet.getName()); + PreparedStatement ps = connection_.prepareStatement("INSERT INTO " + pstestSet.getName() + " (" + columnName + ") VALUES (?)"); ps.setObject(1, o, sqltype); diff --git a/src/test/JD/PS/JDPSSetObject3SQLType.java b/src/test/JD/PS/JDPSSetObject3SQLType.java index 7576728e..31657c8a 100644 --- a/src/test/JD/PS/JDPSSetObject3SQLType.java +++ b/src/test/JD/PS/JDPSSetObject3SQLType.java @@ -150,6 +150,8 @@ public void Var001() pstestSet = JDPSTest.getPstestSet(connection_); if (checkJdbc42()) { try { + statement_.executeUpdate ("DELETE FROM " + pstestSet.getName()); + PreparedStatement ps = connection_.prepareStatement ( "INSERT INTO " + pstestSet.getName() + " (C_NUMERIC_105) VALUES (?)"); @@ -188,6 +190,8 @@ public void Var002() pstestSet = JDPSTest.getPstestSet(connection_); if (checkJdbc42()) { try { + statement_.executeUpdate ("DELETE FROM " + pstestSet.getName()); + PreparedStatement ps = connection_.prepareStatement ( "INSERT INTO " + pstestSet.getName() + " (C_INTEGER, C_SMALLINT, C_VARCHAR_50) VALUES (?, ?, ?)"); @@ -223,6 +227,8 @@ public void Var003() if (checkJdbc42()) { try { + statement_.executeUpdate ("DELETE FROM " + pstestSet.getName()); + PreparedStatement ps = connection_.prepareStatement ( "INSERT INTO " + pstestSet.getName() + " (C_INTEGER, C_SMALLINT, C_VARCHAR_50) VALUES (?, ?, ?)"); @@ -258,6 +264,8 @@ public void Var004() if (checkJdbc42()) { try { + statement_.executeUpdate ("DELETE FROM " + pstestSet.getName()); + PreparedStatement ps = connection_.prepareStatement ( "INSERT INTO " + pstestSet.getName() + " (C_INTEGER, C_SMALLINT, C_VARCHAR_50) VALUES (?, ?, ?)"); @@ -463,6 +471,8 @@ public void Var009() try { pstestSet = JDPSTest.getPstestSet(connection_); if (checkJdbc42()) { + statement_.executeUpdate ("DELETE FROM " + pstestSet.getName()); + try (PreparedStatement ps = connection_.prepareStatement ( "INSERT INTO " + pstestSet.getName() + " (C_SMALLINT) VALUES (?)")) { @@ -2239,6 +2249,7 @@ public void Var053() if (checkJdbc42()) { try { + statement_.executeUpdate ("DELETE FROM " + pstestSet.getName()); PreparedStatement ps = connection_.prepareStatement ( "INSERT INTO " + pstestSet.getName() + " (C_BINARY_20) VALUES (?)"); @@ -2284,6 +2295,7 @@ public void Var054() pstestSet = JDPSTest.getPstestSet(connection_); if (checkJdbc42()) { try { + statement_.executeUpdate ("DELETE FROM " + pstestSet.getName()); PreparedStatement ps = connection_.prepareStatement ( "INSERT INTO " + pstestSet.getName() + " (C_BINARY_20) VALUES (?)"); @@ -2359,6 +2371,7 @@ public void Var056() pstestSet = JDPSTest.getPstestSet(connection_); if (checkJdbc42()) { try { + statement_.executeUpdate ("DELETE FROM " + pstestSet.getName()); PreparedStatement ps = connection_.prepareStatement ( "INSERT INTO " + pstestSet.getName() + " (C_BINARY_20) VALUES (?)"); @@ -2447,6 +2460,7 @@ public void Var058() pstestSet = JDPSTest.getPstestSet(connection_); if (checkJdbc42()) { try { + statement_.executeUpdate ("DELETE FROM " + pstestSet.getName()); PreparedStatement ps = connection_.prepareStatement ( "INSERT INTO " + pstestSet.getName() + " (C_VARBINARY_20) VALUES (?)"); @@ -2557,6 +2571,7 @@ public void Var061() pstestSet = JDPSTest.getPstestSet(connection_); if (checkJdbc42 ()) { try { + statement_.executeUpdate ("DELETE FROM " + pstestSet.getName()); PreparedStatement ps = connection_.prepareStatement ( "INSERT INTO " + pstestSet.getName() + " (C_BLOB) VALUES (?)"); @@ -3153,6 +3168,7 @@ public void Var076() pstestSet = JDPSTest.getPstestSet(connection_); if (checkJdbc42 ()) { try { + statement_.executeUpdate ("DELETE FROM " + pstestSet.getName()); PreparedStatement ps = connection_.prepareStatement ( "INSERT INTO " + pstestSet.getName() + " (C_DISTINCT) VALUES (?)"); @@ -4502,6 +4518,8 @@ public void testSetFailure(String columnName, Object setObject, int setType, JDSerializeFile pstestSet = null; try { pstestSet = JDPSTest.getPstestSet(connection_); + statement_.executeUpdate ("DELETE FROM " + pstestSet.getName()); + PreparedStatement ps = connection_.prepareStatement("INSERT INTO " + pstestSet.getName() + " (" + columnName + ") VALUES (?)"); diff --git a/src/test/JD/PS/JDPSSetObject4.java b/src/test/JD/PS/JDPSSetObject4.java index ac42f04a..3a0314f4 100644 --- a/src/test/JD/PS/JDPSSetObject4.java +++ b/src/test/JD/PS/JDPSSetObject4.java @@ -134,6 +134,8 @@ public void Var001() try { pstestSet = JDPSTest.getPstestSet(connection_); + statement_.executeUpdate ("DELETE FROM " + pstestSet.getName()); + PreparedStatement ps = connection_.prepareStatement ( "INSERT INTO " + pstestSet.getName() + " (C_NUMERIC_105) VALUES (?)"); @@ -168,6 +170,8 @@ public void Var002() try { pstestSet = JDPSTest.getPstestSet(connection_); + statement_.executeUpdate ("DELETE FROM " + pstestSet.getName()); + PreparedStatement ps = connection_.prepareStatement ( "INSERT INTO " + pstestSet.getName() + " (C_INTEGER, C_SMALLINT, C_VARCHAR_50) VALUES (?, ?, ?)"); @@ -201,6 +205,8 @@ public void Var003() try { pstestSet = JDPSTest.getPstestSet(connection_); + statement_.executeUpdate ("DELETE FROM " + pstestSet.getName()); + PreparedStatement ps = connection_.prepareStatement ( "INSERT INTO " + pstestSet.getName() + " (C_INTEGER, C_SMALLINT, C_VARCHAR_50) VALUES (?, ?, ?)"); @@ -234,6 +240,8 @@ public void Var004() try { pstestSet = JDPSTest.getPstestSet(connection_); + statement_.executeUpdate ("DELETE FROM " + pstestSet.getName()); + PreparedStatement ps = connection_.prepareStatement ( "INSERT INTO " + pstestSet.getName() + " (C_INTEGER, C_SMALLINT, C_VARCHAR_50) VALUES (?, ?, ?)"); @@ -399,6 +407,8 @@ public void Var008() try { pstestSet = JDPSTest.getPstestSet(connection_); + statement_.executeUpdate ("DELETE FROM " + pstestSet.getName()); + PreparedStatement ps = connection_.prepareStatement ( "INSERT INTO " + pstestSet.getName() + " (C_INTEGER, C_SMALLINT, C_VARCHAR_50) VALUES (?, ?, ?)"); @@ -455,6 +465,8 @@ public void Var010() try { pstestSet = JDPSTest.getPstestSet(connection_); + statement_.executeUpdate ("DELETE FROM " + pstestSet.getName()); + PreparedStatement ps = connection_.prepareStatement ( "INSERT INTO " + pstestSet.getName() + " (C_SMALLINT) VALUES (?)"); diff --git a/src/test/JD/PS/JDPSSetObject4SQLType.java b/src/test/JD/PS/JDPSSetObject4SQLType.java index acee9512..2ab06192 100644 --- a/src/test/JD/PS/JDPSSetObject4SQLType.java +++ b/src/test/JD/PS/JDPSSetObject4SQLType.java @@ -120,6 +120,8 @@ public void Var001() { pstestSet = JDPSTest.getPstestSet(connection_); if (checkJdbc42()) { try { + statement_.executeUpdate ("DELETE FROM " + pstestSet.getName()); + PreparedStatement ps = connection_.prepareStatement("INSERT INTO " + pstestSet.getName() + " (C_NUMERIC_105) VALUES (?)"); ps.close(); @@ -152,6 +154,8 @@ public void Var002() { pstestSet = JDPSTest.getPstestSet(connection_); if (checkJdbc42()) { try { + statement_.executeUpdate ("DELETE FROM " + pstestSet.getName()); + PreparedStatement ps = connection_.prepareStatement("INSERT INTO " + pstestSet.getName() + " (C_INTEGER, C_SMALLINT, C_VARCHAR_50) VALUES (?, ?, ?)"); @@ -185,6 +189,8 @@ public void Var003() { pstestSet = JDPSTest.getPstestSet(connection_); if (checkJdbc42()) { try { + statement_.executeUpdate ("DELETE FROM " + pstestSet.getName()); + PreparedStatement ps = connection_.prepareStatement("INSERT INTO " + pstestSet.getName() + " (C_INTEGER, C_SMALLINT, C_VARCHAR_50) VALUES (?, ?, ?)"); @@ -218,6 +224,8 @@ public void Var004() { pstestSet = JDPSTest.getPstestSet(connection_); if (checkJdbc42()) { try { + statement_.executeUpdate ("DELETE FROM " + pstestSet.getName()); + PreparedStatement ps = connection_.prepareStatement("INSERT INTO " + pstestSet.getName() + " (C_INTEGER, C_SMALLINT, C_VARCHAR_50) VALUES (?, ?, ?)"); @@ -387,6 +395,8 @@ public void Var008() { PreparedStatement ps = null; try { pstestSet = JDPSTest.getPstestSet(connection_); + statement_.executeUpdate ("DELETE FROM " + pstestSet.getName()); + ps = connection_.prepareStatement("INSERT INTO " + pstestSet.getName() + " (C_INTEGER, C_SMALLINT, C_VARCHAR_50) VALUES (?, ?, ?)"); @@ -439,6 +449,8 @@ public void Var010() { pstestSet = JDPSTest.getPstestSet(connection_); if (checkJdbc42()) { try { + statement_.executeUpdate ("DELETE FROM " + pstestSet.getName()); + ps = connection_.prepareStatement("INSERT INTO " + pstestSet.getName() + " (C_SMALLINT) VALUES (?)"); JDReflectionUtil.callMethod_V(ps, "setObject", 1, new Hashtable(), getSQLType(Types.SMALLINT), 0); failed("Didn't throw SQLException"); @@ -1411,9 +1423,10 @@ public void Var033() { + pstestSet.getName()); rs.next(); Clob check = rs.getClob(1); + String answer = check.getSubString(1, (int) check.length()); rs.close(); ps.close(); - assertCondition(check.getSubString(1, (int) check.length()).equals( + assertCondition(answer.equals( "Milbank")); // @D1C } catch (Exception e) { failed(e, "Unexpected Exception"); @@ -1778,9 +1791,10 @@ public void Var041() { + pstestSet.getName()); rs.next(); Blob check = rs.getBlob(1); + byte[] answer = check.getBytes(1, (int) check.length()); // rs.close (); // @F1D rs.close(); - assertCondition(areEqual(check.getBytes(1, (int) check.length()), b)); // @D1C + assertCondition(areEqual(answer, b)); // @D1C } catch (Exception e) { failed(e, "Unexpected Exception"); } @@ -1823,9 +1837,10 @@ public void Var042() { + pstestSet.getName()); rs.next(); Blob check = rs.getBlob(1); + byte[] answer = check.getBytes(1, (int) check.length()); // rs.close (); // @F1D rs.close(); - assertCondition(areEqual(check.getBytes(1, (int) check.length()), b)); // @D1C + assertCondition(areEqual(answer, b)); // @D1C } catch (Exception e) { failed(e, "Unexpected Exception"); } diff --git a/src/test/JD/PS/JDPSSetSQLXML.java b/src/test/JD/PS/JDPSSetSQLXML.java index 357c5bbf..d1c4456f 100644 --- a/src/test/JD/PS/JDPSSetSQLXML.java +++ b/src/test/JD/PS/JDPSSetSQLXML.java @@ -163,6 +163,8 @@ public void Var001() { pstestSet = JDPSTest.getPstestSet(connection_); if (checkJdbc40()) { try { + statement_.executeUpdate("DELETE FROM " + pstestSet.getName()); + PreparedStatement ps = connection_.prepareStatement( "INSERT INTO " + pstestSet.getName() + " (C_CLOB) VALUES (?)"); ps.close(); @@ -194,6 +196,8 @@ public void Var002() { pstestSet = JDPSTest.getPstestSet(connection_); if (checkJdbc40()) { try { + statement_.executeUpdate("DELETE FROM " + pstestSet.getName()); + PreparedStatement ps = connection_ .prepareStatement("INSERT INTO " + pstestSet.getName() + " (C_INTEGER, C_SMALLINT) VALUES (?, ?, ?)"); @@ -227,6 +231,8 @@ public void Var003() { pstestSet = JDPSTest.getPstestSet(connection_); if (checkJdbc40()) { try { + statement_.executeUpdate("DELETE FROM " + pstestSet.getName()); + PreparedStatement ps = connection_ .prepareStatement("INSERT INTO " + pstestSet.getName() + " (C_INTEGER, C_SMALLINT) VALUES (?, ?, ?)"); @@ -260,6 +266,8 @@ public void Var004() { pstestSet = JDPSTest.getPstestSet(connection_); if (checkJdbc40()) { try { + statement_.executeUpdate("DELETE FROM " + pstestSet.getName()); + PreparedStatement ps = connection_ .prepareStatement("INSERT INTO " + pstestSet.getName() + " (C_INTEGER, C_SMALLINT) VALUES (?, ?, ?)"); @@ -489,6 +497,8 @@ public void testSetFailed(String columnName, Object sqlxml) { pstestSet = JDPSTest.getPstestSet(connection_); if (checkJdbc40()) { try { + statement_.executeUpdate("DELETE FROM " + pstestSet.getName()); + PreparedStatement ps = connection_.prepareStatement("INSERT INTO " + pstestSet.getName() + " (" + columnName + ") VALUES (?)"); JDReflectionUtil.callMethod_V(ps, "setSQLXML", 1, sqlxml); @@ -528,6 +538,8 @@ public void Var010() { pstestSet = JDPSTest.getPstestSet(connection_); if (checkJdbc40()) { try { + statement_.executeUpdate("DELETE FROM " + pstestSet.getName()); + PreparedStatement ps = connection_.prepareStatement( "INSERT INTO " + pstestSet.getName() + " (C_INTEGER) VALUES (?)"); JDReflectionUtil.callMethod_V(ps, "setSQLXML", 1, sqlxml_); @@ -560,6 +572,8 @@ public void Var011() { pstestSet = JDPSTest.getPstestSet(connection_); if (checkJdbc40()) { try { + statement_.executeUpdate("DELETE FROM " + pstestSet.getName()); + PreparedStatement ps = connection_.prepareStatement( "INSERT INTO " + pstestSet.getName() + " (C_REAL) VALUES (?)"); JDReflectionUtil.callMethod_V(ps, "setSQLXML", 1, sqlxml_); @@ -592,6 +606,8 @@ public void Var012() { pstestSet = JDPSTest.getPstestSet(connection_); if (checkJdbc40()) { try { + statement_.executeUpdate("DELETE FROM " + pstestSet.getName()); + PreparedStatement ps = connection_.prepareStatement( "INSERT INTO " + pstestSet.getName() + " (C_FLOAT) VALUES (?)"); JDReflectionUtil.callMethod_V(ps, "setSQLXML", 1, sqlxml_); @@ -624,6 +640,8 @@ public void Var013() { pstestSet = JDPSTest.getPstestSet(connection_); if (checkJdbc40()) { try { + statement_.executeUpdate("DELETE FROM " + pstestSet.getName()); + PreparedStatement ps = connection_.prepareStatement( "INSERT INTO " + pstestSet.getName() + " (C_DOUBLE) VALUES (?)"); JDReflectionUtil.callMethod_V(ps, "setSQLXML", 1, sqlxml_); @@ -656,6 +674,8 @@ public void Var014() { pstestSet = JDPSTest.getPstestSet(connection_); if (checkJdbc40()) { try { + statement_.executeUpdate("DELETE FROM " + pstestSet.getName()); + PreparedStatement ps = connection_.prepareStatement("INSERT INTO " + pstestSet.getName() + " (C_DECIMAL_105) VALUES (?)"); JDReflectionUtil.callMethod_V(ps, "setSQLXML", 1, sqlxml_); @@ -688,6 +708,8 @@ public void Var015() { pstestSet = JDPSTest.getPstestSet(connection_); if (checkJdbc40()) { try { + statement_.executeUpdate("DELETE FROM " + pstestSet.getName()); + PreparedStatement ps = connection_.prepareStatement("INSERT INTO " + pstestSet.getName() + " (C_NUMERIC_50) VALUES (?)"); JDReflectionUtil.callMethod_V(ps, "setSQLXML", 1, sqlxml_); @@ -1126,6 +1148,8 @@ public void Var025() { messageBuffer.setLength(0); if (checkJdbc40()) { try { + statement_.executeUpdate("DELETE FROM " + pstestSet.getName()); + PreparedStatement ps = connection_.prepareStatement( "INSERT INTO " + pstestSet.getName() + " (C_BLOB) VALUES (?)"); @@ -1183,6 +1207,8 @@ public void Var026() { pstestSet = JDPSTest.getPstestSet(connection_); if (checkJdbc40()) { try { + statement_.executeUpdate("DELETE FROM " + pstestSet.getName()); + PreparedStatement ps = connection_.prepareStatement( "INSERT INTO " + pstestSet.getName() + " (C_DATE) VALUES (?)"); JDReflectionUtil.callMethod_V(ps, "setSQLXML", 1, sqlxml_); @@ -1215,6 +1241,8 @@ public void Var027() { pstestSet = JDPSTest.getPstestSet(connection_); if (checkJdbc40()) { try { + statement_.executeUpdate("DELETE FROM " + pstestSet.getName()); + PreparedStatement ps = connection_.prepareStatement( "INSERT INTO " + pstestSet.getName() + " (C_TIME) VALUES (?)"); JDReflectionUtil.callMethod_V(ps, "setSQLXML", 1, sqlxml_); @@ -1247,6 +1275,8 @@ public void Var028() { pstestSet = JDPSTest.getPstestSet(connection_); if (checkJdbc40()) { try { + statement_.executeUpdate("DELETE FROM " + pstestSet.getName()); + PreparedStatement ps = connection_.prepareStatement( "INSERT INTO " + pstestSet.getName() + " (C_TIMESTAMP) VALUES (?)"); JDReflectionUtil.callMethod_V(ps, "setSQLXML", 1, sqlxml_); @@ -1284,6 +1314,8 @@ public void Var029() { if (checkJdbc40()) { if (checkDatalinkSupport()) { try { + statement_.executeUpdate("DELETE FROM " + pstestSet.getName()); + PreparedStatement ps = connection_.prepareStatement("INSERT INTO " + pstestSet.getName() + " (C_DATALINK) VALUES (?)"); JDReflectionUtil.callMethod_V(ps, "setSQLXML", 1, sqlxml_); @@ -1326,6 +1358,7 @@ public void Var030() { if (checkJdbc40()) { if (checkLobSupport()) { try { + statement_.executeUpdate("DELETE FROM " + pstestSet.getName()); PreparedStatement ps = connection_.prepareStatement("INSERT INTO " + pstestSet.getName() + " (C_DISTINCT) VALUES (?)"); JDReflectionUtil.callMethod_V(ps, "setSQLXML", 1, sqlxml_); @@ -1360,6 +1393,7 @@ public void Var031() { if (checkJdbc40()) { if (checkBigintSupport()) { try { + statement_.executeUpdate("DELETE FROM " + pstestSet.getName()); PreparedStatement ps = connection_.prepareStatement( "INSERT INTO " + pstestSet.getName() + " (C_BIGINT) VALUES (?)"); JDReflectionUtil.callMethod_V(ps, "setSQLXML", 1, sqlxml_); @@ -1398,15 +1432,25 @@ public void Var033() { public void Var034() { if (checkJdbc40()) { if (checkDecFloatSupport()) { + JDSerializeFile pstestSetdfp16 = null; try { - PreparedStatement ps = connection_.prepareStatement( - "INSERT INTO " + JDPSTest.SETDFP16 + " VALUES (?)"); + pstestSetdfp16 = JDPSTest.getPstestSetdfp16(connection_); + statement_.executeUpdate("DELETE FROM " + pstestSetdfp16.getName()); + PreparedStatement ps = connection_.prepareStatement("INSERT INTO " + pstestSetdfp16.getName() + " VALUES (?)"); JDReflectionUtil.callMethod_V(ps, "setSQLXML", 1, sqlxml_); ps.executeUpdate(); ps.close(); failed("Didn't throw SQLException"); } catch (Exception e) { assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } finally { + if (pstestSetdfp16 != null) { + try { + pstestSetdfp16.close(); + } catch (SQLException e) { + e.printStackTrace(); + } + } } } } @@ -1419,7 +1463,10 @@ public void Var034() { public void Var035() { if (checkJdbc40()) { if (checkDecFloatSupport()) { + JDSerializeFile pstestSetdfp34 = null; try { + pstestSetdfp34 = JDPSTest.getPstestSetdfp16(connection_); + statement_.executeUpdate("DELETE FROM " + pstestSetdfp34.getName()); PreparedStatement ps = connection_.prepareStatement( "INSERT INTO " + JDPSTest.SETDFP34 + " VALUES (?)"); JDReflectionUtil.callMethod_V(ps, "setSQLXML", 1, sqlxml_); @@ -1428,7 +1475,16 @@ public void Var035() { failed("Didn't throw SQLException"); } catch (Exception e) { assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } finally { + if (pstestSetdfp34 != null) { + try { + pstestSetdfp34.close(); + } catch (SQLException e) { + e.printStackTrace(); + } + } } + } } diff --git a/src/test/JD/PS/JDPSSetTimestamp.java b/src/test/JD/PS/JDPSSetTimestamp.java index 6e172e10..1c34371d 100644 --- a/src/test/JD/PS/JDPSSetTimestamp.java +++ b/src/test/JD/PS/JDPSSetTimestamp.java @@ -124,6 +124,8 @@ public void Var001() { JDSerializeFile pstestSet = null; try { pstestSet = JDPSTest.getPstestSet(connection_); + statement_.executeUpdate("DELETE FROM " + pstestSet.getName()); + PreparedStatement ps = connection_.prepareStatement( "INSERT INTO " + pstestSet.getName() + " (C_TIMESTAMP) VALUES (?)"); ps.close(); @@ -150,6 +152,7 @@ public void Var002() { JDSerializeFile pstestSet = null; try { pstestSet = JDPSTest.getPstestSet(connection_); + statement_.executeUpdate("DELETE FROM " + pstestSet.getName()); PreparedStatement ps = connection_ .prepareStatement("INSERT INTO " + pstestSet.getName() + " (C_INTEGER, C_SMALLINT, C_VARCHAR_50) VALUES (?, ?, ?)"); @@ -178,7 +181,8 @@ public void Var003() { JDSerializeFile pstestSet = null; try { pstestSet = JDPSTest.getPstestSet(connection_); - PreparedStatement ps = connection_ + statement_.executeUpdate("DELETE FROM " + pstestSet.getName()); + PreparedStatement ps = connection_ .prepareStatement("INSERT INTO " + pstestSet.getName() + " (C_INTEGER, C_SMALLINT, C_VARCHAR_50) VALUES (?, ?, ?)"); ps.setTimestamp(0, new Timestamp(24534543)); @@ -206,6 +210,7 @@ public void Var004() { JDSerializeFile pstestSet = null; try { pstestSet = JDPSTest.getPstestSet(connection_); + statement_.executeUpdate("DELETE FROM " + pstestSet.getName()); PreparedStatement ps = connection_ .prepareStatement("INSERT INTO " + pstestSet.getName() + " (C_INTEGER, C_SMALLINT, C_VARCHAR_50) VALUES (?, ?, ?)"); @@ -311,6 +316,7 @@ public void Var007() { pstestSet = JDPSTest.getPstestSet(connection_); if (checkJdbc20()) { try { + statement_.executeUpdate("DELETE FROM " + pstestSet.getName()); PreparedStatement ps = connection_.prepareStatement( "INSERT INTO " + pstestSet.getName() + " (C_TIMESTAMP) VALUES (?)"); ps.setTimestamp(1, new Timestamp(797899789), null); @@ -359,6 +365,7 @@ public void testSetFailure(String columnName, Timestamp inTimestamp) { JDSerializeFile pstestSet = null; try { pstestSet = JDPSTest.getPstestSet(connection_); + statement_.executeUpdate("DELETE FROM " + pstestSet.getName()); PreparedStatement ps = connection_.prepareStatement("INSERT INTO " + pstestSet.getName() + " (" + columnName + ") VALUES (?)"); ps.setTimestamp(1, inTimestamp); @@ -393,7 +400,8 @@ public void Var010() { JDSerializeFile pstestSet = null; try { pstestSet = JDPSTest.getPstestSet(connection_); - PreparedStatement ps = connection_.prepareStatement( + statement_.executeUpdate("DELETE FROM " + pstestSet.getName()); + PreparedStatement ps = connection_.prepareStatement( "INSERT INTO " + pstestSet.getName() + " (C_INTEGER) VALUES (?)"); ps.setTimestamp(1, new Timestamp(214748364)); ps.executeUpdate(); @@ -420,6 +428,7 @@ public void Var011() { JDSerializeFile pstestSet = null; try { pstestSet = JDPSTest.getPstestSet(connection_); + statement_.executeUpdate("DELETE FROM " + pstestSet.getName()); PreparedStatement ps = connection_.prepareStatement( "INSERT INTO " + pstestSet.getName() + " (C_REAL) VALUES (?)"); ps.setTimestamp(1, new Timestamp(21768644)); @@ -447,6 +456,7 @@ public void Var012() { JDSerializeFile pstestSet = null; try { pstestSet = JDPSTest.getPstestSet(connection_); + statement_.executeUpdate("DELETE FROM " + pstestSet.getName()); PreparedStatement ps = connection_.prepareStatement( "INSERT INTO " + pstestSet.getName() + " (C_FLOAT) VALUES (?)"); ps.setTimestamp(1, new Timestamp(26786744)); @@ -475,6 +485,7 @@ public void Var013() { try { pstestSet = JDPSTest.getPstestSet(connection_); try { + statement_.executeUpdate("DELETE FROM " + pstestSet.getName()); PreparedStatement ps = connection_.prepareStatement( "INSERT INTO " + pstestSet.getName() + " (C_DOUBLE) VALUES (?)"); ps.setTimestamp(1, new Timestamp(22567544)); @@ -504,6 +515,7 @@ public void Var014() { JDSerializeFile pstestSet = null; try { pstestSet = JDPSTest.getPstestSet(connection_); + statement_.executeUpdate("DELETE FROM " + pstestSet.getName()); PreparedStatement ps = connection_.prepareStatement( "INSERT INTO " + pstestSet.getName() + " (C_DECIMAL_105) VALUES (?)"); ps.setTimestamp(1, new Timestamp(2253444)); @@ -531,6 +543,7 @@ public void Var015() { JDSerializeFile pstestSet = null; try { pstestSet = JDPSTest.getPstestSet(connection_); + statement_.executeUpdate("DELETE FROM " + pstestSet.getName()); PreparedStatement ps = connection_.prepareStatement( "INSERT INTO " + pstestSet.getName() + " (C_NUMERIC_50) VALUES (?)"); ps.setTimestamp(1, new Timestamp(290904)); @@ -634,6 +647,7 @@ public void Var018() { pstestSet = JDPSTest.getPstestSet(connection_); if (checkLobSupport()) { try { + statement_.executeUpdate("DELETE FROM " + pstestSet.getName()); PreparedStatement ps = connection_.prepareStatement( "INSERT INTO " + pstestSet.getName() + " (C_CLOB) VALUES (?)"); ps.setTimestamp(1, new Timestamp(22213444)); @@ -666,7 +680,8 @@ public void Var019() { pstestSet = JDPSTest.getPstestSet(connection_); if (checkLobSupport()) { try { - PreparedStatement ps = connection_.prepareStatement( + statement_.executeUpdate("DELETE FROM " + pstestSet.getName()); + PreparedStatement ps = connection_.prepareStatement( "INSERT INTO " + pstestSet.getName() + " (C_DBCLOB) VALUES (?)"); ps.setTimestamp(1, new Timestamp(2298724)); ps.executeUpdate(); @@ -754,6 +769,7 @@ public void Var022() { JDSerializeFile pstestSet = null; try { pstestSet = JDPSTest.getPstestSet(connection_); + statement_.executeUpdate("DELETE FROM " + pstestSet.getName()); PreparedStatement ps = connection_.prepareStatement( "INSERT INTO " + pstestSet.getName() + " (C_BLOB) VALUES (?)"); ps.setTimestamp(1, new Timestamp(123444)); @@ -785,6 +801,8 @@ public void Var023() { JDSerializeFile pstestSet = null; try { pstestSet = JDPSTest.getPstestSet(connection_); + statement_.executeUpdate("DELETE FROM " + pstestSet.getName()); + PreparedStatement ps = connection_.prepareStatement( "INSERT INTO " + pstestSet.getName() + " (C_DATE) VALUES (?)"); Timestamp t = new Timestamp(8640000000L); @@ -942,22 +960,19 @@ public void Var027() { JDSerializeFile pstestSet = null; try { pstestSet = JDPSTest.getPstestSet(connection_); - if ((getDriver() == JDTestDriver.DRIVER_NATIVE) && (getJdbcLevel() <= 2)) { - notApplicable("Native driver pre-JDBC 3.0"); - return; - } - if (checkDatalinkSupport()) { - try { - PreparedStatement ps = connection_.prepareStatement( - "INSERT INTO " + pstestSet.getName() + " (C_DATALINK) VALUES (?)"); - ps.setTimestamp(1, new Timestamp(265454)); - ps.executeUpdate(); - ps.close(); - failed("Didn't throw SQLException"); - } catch (Exception e) { - assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + if (checkDatalinkSupport()) { + try { + statement_.executeUpdate("DELETE FROM " + pstestSet.getName()); + PreparedStatement ps = connection_ + .prepareStatement("INSERT INTO " + pstestSet.getName() + " (C_DATALINK) VALUES (?)"); + ps.setTimestamp(1, new Timestamp(265454)); + ps.executeUpdate(); + ps.close(); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } - } } catch (Exception e) { failed(e, "Unexpected Exception"); } finally { @@ -980,6 +995,7 @@ public void Var028() { pstestSet = JDPSTest.getPstestSet(connection_); if (checkLobSupport()) { try { + statement_.executeUpdate("DELETE FROM " + pstestSet.getName()); PreparedStatement ps = connection_.prepareStatement( "INSERT INTO " + pstestSet.getName() + " (C_DISTINCT) VALUES (?)"); ps.setTimestamp(1, new Timestamp(2246454)); @@ -1012,6 +1028,7 @@ public void Var029() { pstestSet = JDPSTest.getPstestSet(connection_); if (checkBigintSupport()) { try { + statement_.executeUpdate("DELETE FROM " + pstestSet.getName()); PreparedStatement ps = connection_.prepareStatement( "INSERT INTO " + pstestSet.getName() + " (C_BIGINT) VALUES (?)"); ps.setTimestamp(1, new Timestamp(214748364)); @@ -1098,6 +1115,7 @@ public void Var031() { try { pstestSetdfp = JDPSTest.getPstestSetdfp16(connection_); String tablename16=pstestSetdfp.getName(); + statement_.executeUpdate("DELETE FROM " + pstestSetdfp.getName()); PreparedStatement ps = connection_.prepareStatement("INSERT INTO " + tablename16 + " (C_BIGINT) VALUES (?)"); ps.setTimestamp(1, new Timestamp(214748364)); @@ -1127,7 +1145,8 @@ public void Var032() { try { pstestSetdfp = JDPSTest.getPstestSetdfp34(connection_); String tablename34=pstestSetdfp.getName(); - PreparedStatement ps = connection_.prepareStatement("INSERT INTO " + statement_.executeUpdate("DELETE FROM " + pstestSetdfp.getName()); + PreparedStatement ps = connection_.prepareStatement("INSERT INTO " + tablename34 + " (C_BIGINT) VALUES (?)"); ps.setTimestamp(1, new Timestamp(214748364)); ps.executeUpdate(); @@ -1156,7 +1175,8 @@ public void Var033() { try { pstestSetxml = JDPSTest.getSerializeFile(connection_, JDPSTest.SETXML); String tablename = pstestSetxml.getName(); - PreparedStatement ps = connection_.prepareStatement( + statement_.executeUpdate("DELETE FROM " + pstestSetxml.getName()); + PreparedStatement ps = connection_.prepareStatement( "INSERT INTO " + tablename + " VALUES (?)"); try { ps.setTimestamp(1, new Timestamp(214748364)); @@ -1244,8 +1264,9 @@ public void testTimestampX(String tableName, String tableDefinition, StringBuffer sb = new StringBuffer(); boolean passed = true; String sql = ""; + JDSerializeFile serializeFile = null; try { - + serializeFile = new JDSerializeFile(connection_, tableName); Statement stmt = connection_.createStatement(); try { sql = "DROP TABLE " + tableName; @@ -1300,6 +1321,14 @@ public void testTimestampX(String tableName, String tableDefinition, } catch (Exception e) { failed(e, "unexpected exception " + sb.toString()); + } finally { + if (serializeFile != null) { + try { + serializeFile.close(); + } catch (Exception e) { + e.printStackTrace(System.out); + } + } } } } diff --git a/src/test/JD/RS/JDRSAbsolute.java b/src/test/JD/RS/JDRSAbsolute.java index 3429af52..6700160b 100644 --- a/src/test/JD/RS/JDRSAbsolute.java +++ b/src/test/JD/RS/JDRSAbsolute.java @@ -18,11 +18,13 @@ import test.JDRSTest; import test.JDTestcase; +import test.JD.JDSerializeFile; import java.io.FileOutputStream; import java.sql.DatabaseMetaData; import java.sql.PreparedStatement; import java.sql.ResultSet; +import java.sql.SQLException; import java.sql.SQLWarning; import java.sql.Statement; import java.util.Hashtable; @@ -171,9 +173,8 @@ public void Var002 () public void Var003 () { if (checkJdbc20 ()) { - try { - ResultSet rs = statement_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_POS); + try (ResultSet rs = statement_.executeQuery ("SELECT * FROM " + + JDRSTest.RSTEST_POS)) { statement_.cancel (); rs.absolute (1); failed ("Didn't throw SQLException"); @@ -192,11 +193,10 @@ public void Var003 () public void Var004 () { if (checkJdbc20 ()) { - try { - Statement s = connection_.createStatement (ResultSet.TYPE_FORWARD_ONLY, - ResultSet.CONCUR_READ_ONLY); + try (Statement s = connection_.createStatement (ResultSet.TYPE_FORWARD_ONLY, + ResultSet.CONCUR_READ_ONLY); ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_POS); + + JDRSTest.RSTEST_POS)) { rs.next (); rs.absolute (10); failed ("Didn't throw SQLException"); @@ -243,9 +243,8 @@ public void Var005 () public void Var006 () { if (checkJdbc20 ()) { - try { - ResultSet rs = statement_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_POS); + try (ResultSet rs = statement_.executeQuery ("SELECT * FROM " + + JDRSTest.RSTEST_POS)) { /* boolean success = */ rs.absolute (0); assertCondition(rs.isBeforeFirst()); @@ -415,10 +414,10 @@ public void Var012 () public void Var013 () { if (checkJdbc20 ()) { - try { - ResultSet rs; - // Note: don't use statement_ since it is updatable - rs = statement2_.executeQuery("select * from SYSIBM.SYSDUMMY1"); + // Note: don't use statement_ since it is updatable + try (ResultSet rs = statement2_.executeQuery("select * from SYSIBM.SYSDUMMY1");) { + + /* boolean success = */ rs.absolute (0); assertCondition(rs.isBeforeFirst(), "isBeforeFirst() returned false, but should have returned true"); } @@ -611,10 +610,9 @@ public void Var020 () { if (checkJdbc20 ()) { - try + try (ResultSet rs = dmd_.getColumns (null, "QIWS", + "QCUSTCDT", "%")) { - ResultSet rs = dmd_.getColumns (null, "QIWS", - "QCUSTCDT", "%"); /* boolean success = */ rs.absolute (0); assertCondition(rs.isBeforeFirst()); } @@ -1149,7 +1147,9 @@ public void Var039 () public void Var040 () { if (checkJdbc20 ()) { + JDSerializeFile serializeFile = null; try { + serializeFile = new JDSerializeFile(connection_, JDRSTest.RSTEST_POS); // Update each value. ResultSet rs = statement_.executeQuery ("SELECT * FROM " + JDRSTest.RSTEST_POS + " FOR UPDATE OF VALUE"); @@ -1180,7 +1180,15 @@ public void Var040 () } catch (Exception e) { failed (e, "Unexpected Exception"); - } + } finally { + if (serializeFile != null) { + try { + serializeFile.close(); + } catch (SQLException e) { + e.printStackTrace(); + } + } + } } } diff --git a/src/test/JD/RS/JDRSAfterLast.java b/src/test/JD/RS/JDRSAfterLast.java index 4efc3cb2..23a85ed1 100644 --- a/src/test/JD/RS/JDRSAfterLast.java +++ b/src/test/JD/RS/JDRSAfterLast.java @@ -18,6 +18,7 @@ import test.JDRSTest; import test.JDTestDriver; import test.JDTestcase; +import test.JD.JDSerializeFile; import java.io.FileOutputStream; import java.sql.Connection; @@ -25,2795 +26,2375 @@ import java.sql.PreparedStatement; import java.sql.ResultSet; - +import java.sql.SQLException; import java.sql.SQLWarning; import java.sql.Statement; import java.util.Hashtable; import java.util.Vector; - - /** -Testcase JDRSAfterLast. This tests the following -methods of the JDBC ResultSet classes: - -
    -
  • afterLast() -
  • isAfterLast() -
-**/ -public class JDRSAfterLast -extends JDTestcase { + * Testcase JDRSAfterLast. This tests the following methods of the JDBC + * ResultSet classes: + * + *
    + *
  • afterLast() + *
  • isAfterLast() + *
+ **/ +public class JDRSAfterLast extends JDTestcase { public static void main(String args[]) throws Exception { - String[] newArgs = new String[args.length+2]; - newArgs[0] = "-tc"; - newArgs[1] = "JDRSAfterLast"; - for (int i = 0; i < args.length; i++) { - newArgs[2+i]=args[i]; - } - test.JDRSTest.main(newArgs); - } - - - - // Private data. - private DatabaseMetaData dmd_; - private Statement statement_; - private Statement statement2_; - - - private Connection connectionNoPrefetch_; - private DatabaseMetaData dmdNoPrefetch_; - private Statement statementNoPrefetch_; - private Statement statement2NoPrefetch_; - - -/** -Constructor. -**/ - public JDRSAfterLast (AS400 systemObject, - Hashtable> namesAndVars, - int runMode, - FileOutputStream fileOutputStream, - - String password) - { - super (systemObject, "JDRSAfterLast", - namesAndVars, runMode, fileOutputStream, - password); - } - - - -/** -Performs setup needed before running variations. - -@exception Exception If an exception occurs. -**/ - protected void setup () - throws Exception - { - if (connection_ != null) connection_.close(); - - if (isJdbc20 ()) { - connection_ = testDriver_.getConnection (baseURL_ + ";data truncation=true", userId_, encryptedPassword_, "JDRSAfterLast1"); - dmd_ = connection_.getMetaData (); - statement_ = connection_.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, - ResultSet.CONCUR_UPDATABLE); - - // This statement is used for variations that - // need to test with the max rows set. - statement2_ = connection_.createStatement (ResultSet.TYPE_SCROLL_INSENSITIVE, - ResultSet.CONCUR_READ_ONLY); - statement2_.setMaxRows (50); - - - connectionNoPrefetch_ = testDriver_.getConnection (baseURL_ + ";data truncation=true;prefetch=false", userId_, encryptedPassword_,"JDRSAfterLast2"); - - dmdNoPrefetch_ = connectionNoPrefetch_.getMetaData (); - - statementNoPrefetch_ = connectionNoPrefetch_.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, - ResultSet.CONCUR_UPDATABLE); - - statement2NoPrefetch_ = connectionNoPrefetch_.createStatement (ResultSet.TYPE_SCROLL_INSENSITIVE, - ResultSet.CONCUR_READ_ONLY); - statement2NoPrefetch_.setMaxRows (50); - - - } - } - - - -/** -Performs cleanup needed after running variations. - -@exception Exception If an exception occurs. -**/ - protected void cleanup () - throws Exception - { - if (isJdbc20 ()) { - statement_.close (); - statement2_.close (); - connection_.close (); - statementNoPrefetch_.close(); - statement2NoPrefetch_.close(); - connectionNoPrefetch_.close(); - } - } - - - public void cleanupConnections () throws Exception - { - if (isJdbc20 ()) { - connection_.close (); - connectionNoPrefetch_.close(); - } - } - - - -/** -afterLast() - Should work on a empty result set. -**/ - public void Var001 () - { - if (checkJdbc20 ()) { - try { - ResultSet rs = statement_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_POS + " WHERE ID = -1"); - rs.afterLast (); - boolean success = rs.next (); - rs.close (); - assertCondition (success == false); - } catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } - - - -/** -afterLast() - Should throw an exception on a closed result set. -**/ - public void Var002 () - { - if (checkJdbc20 ()) { - try { - ResultSet rs = statement_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_POS); - rs.close (); - rs.afterLast (); - failed ("Didn't throw SQLException"); - } catch (Exception e) { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } - } - - - -/** -afterLast() - Should throw an exception on a cancelled statement. -**/ - public void Var003 () - { - if (checkJdbc20 ()) { - try { - ResultSet rs = statement_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_POS); - statement_.cancel (); - rs.afterLast (); - failed ("Didn't throw SQLException"); - } catch (Exception e) { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } - } - - - -/** -afterLast() - Should throw an exception on a foward only result set. -**/ - public void Var004 () - { - if (checkJdbc20 ()) { - try { - Statement s = connection_.createStatement (ResultSet.TYPE_FORWARD_ONLY, - ResultSet.CONCUR_READ_ONLY); - ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_POS); - rs.afterLast (); - failed ("Didn't throw SQLException"); - } catch (Exception e) { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } - } - - - -/** -afterLast() - Should work on a 1 row result set. -**/ - public void Var005 () - { - if (checkJdbc20 ()) { - try { - ResultSet rs = statement_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_POS + " WHERE ID = 1"); - rs.afterLast (); - rs.previous (); - int id1 = rs.getInt (1); - rs.close (); - assertCondition (id1 == 1); - } catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } - - - -/** -afterLast() - Should work on a large result set. -**/ - public void Var006 () - { - if (checkJdbc20 ()) { - try { - ResultSet rs = statement_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_POS); - rs.afterLast (); - rs.previous (); - int id1 = rs.getInt (1); - rs.close (); - assertCondition (id1 == 99); - } catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } - - - -/** -afterLast() - Should work on a "simple" result set. -**/ - public void Var007 () - { - if (checkJdbc20 ()) { - try { - ResultSet rs ; - - rs = statement2_.executeQuery("select * from SYSIBM.SYSTBLTYPE"); - rs.afterLast (); - rs.previous (); - String s1 = rs.getString ("TABLE_TYPE"); - rs.close (); - if (s1 == null) { - output_.println("TABLE_TYPE returned null"); - s1=""; - } - assertCondition (s1.length () > 0); - } catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } - - - -/** -afterLast() - Should work on a "mapped" result set. - -SQL400 - We can't support scrollable metadata resultsets (CLI/DB restriction). -**/ - public void Var008 () - { - if (isToolboxDriver() && !isSysibmMetadata()) { - if (checkJdbc20 ()) { - try { - ResultSet rs = dmd_.getColumns (null, "QIWS", - "QCUSTCDT", "%"); - rs.afterLast (); - rs.previous (); - String s1 = rs.getString ("TABLE_NAME"); - rs.close (); - assertCondition (s1.startsWith ("QCUSTCDT")); - } catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } else { - notApplicable(); - } - } - - - -/** -afterLast() - Should work after a beforeFirst(). -**/ - public void Var009 () - { - if (checkJdbc20 ()) { - try { - ResultSet rs = statement_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_POS); - rs.beforeFirst (); - rs.afterLast (); - rs.previous (); - int id1 = rs.getInt (1); - rs.close (); - assertCondition (id1 == 99); - } catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } - - - - -/** -afterLast() - Should work after a first(). -**/ - public void Var010 () - { - if (checkJdbc20 ()) { - try { - ResultSet rs = statement_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_POS); - rs.first (); - rs.afterLast (); - rs.previous (); - int id1 = rs.getInt (1); - rs.close (); - assertCondition (id1 == 99); - } catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } - - - - -/** -afterLast() - Should work after an absolute(). -**/ - public void Var011 () - { - if (checkJdbc20 ()) { - try { - ResultSet rs = statement_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_POS); - rs.absolute (50); - rs.afterLast (); - rs.previous (); - int id1 = rs.getInt (1); - rs.close (); - assertCondition (id1 == 99); - } catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } - - - - -/** -afterLast() - Should work after a relative(). -**/ - public void Var012 () - { - if (checkJdbc20 ()) { - try { - ResultSet rs = statement_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_POS); - rs.relative (75); - rs.afterLast (); - rs.previous (); - int id1 = rs.getInt (1); - rs.close (); - assertCondition (id1 == 99); - } catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } - - - - -/** -afterLast() - Should work after a next(). -**/ - public void Var013 () - { - if (checkJdbc20 ()) { - try { - ResultSet rs = statement_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_POS); - rs.next (); - rs.afterLast (); - rs.previous (); - int id1 = rs.getInt (1); - rs.close (); - assertCondition (id1 == 99); - } catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } - - - -/** -afterLast() - Should work after a previous(). -**/ - public void Var014 () - { - if (checkJdbc20 ()) { - try { - ResultSet rs = statement_.executeQuery ("SELECT ID, VALUE FROM " - + JDRSTest.RSTEST_POS); - rs.last (); - rs.previous (); - rs.afterLast (); - rs.previous (); - int id1 = rs.getInt ("ID"); - rs.close (); - assertCondition (id1 == 99); - } catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } - - - -/** -afterLast() - Should work after a last(). -**/ - public void Var015 () - { - if (checkJdbc20 ()) { - try { - ResultSet rs = statement_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_POS); - rs.last (); - rs.afterLast (); - rs.previous (); - int id1 = rs.getInt (1); - rs.close (); - assertCondition (id1 == 99); - } catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } - - - - -/** -afterLast() - Should work after an afterLast(). -**/ - public void Var016 () - { - if (checkJdbc20 ()) { - try { - ResultSet rs = statement_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_POS); - rs.afterLast (); - rs.afterLast (); - rs.previous (); - int id1 = rs.getInt (1); - rs.close (); - assertCondition (id1 == 99); - } catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } - - - -/** -afterLast() - Should work after a moveToInsertRow(). -**/ - public void Var017 () - { - if (checkJdbc20 ()) { - try { - ResultSet rs = statement_.executeQuery ("SELECT ID, VALUE FROM " - + JDRSTest.RSTEST_POS + " FOR UPDATE"); - rs.absolute (-43); - rs.moveToInsertRow (); - rs.afterLast (); - rs.previous (); - int id1 = rs.getInt (1); - rs.close (); - assertCondition (id1 == 99); - } catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } - - - -/** -afterLast() - Should work after a moveToInsertRow(), -then moveToCurrentRow(). -**/ - public void Var018 () - { - if (checkJdbc20 ()) { - try { - ResultSet rs = statement_.executeQuery ("SELECT ID, VALUE FROM " - + JDRSTest.RSTEST_POS + " FOR UPDATE"); - rs.last (); - rs.previous (); - rs.previous (); - rs.previous (); - rs.moveToInsertRow (); - rs.moveToCurrentRow (); - rs.afterLast (); - rs.previous (); - int id1 = rs.getInt (1); - rs.close (); - assertCondition (id1 == 99); - } catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } - - - -/** -afterLast() - Should clear any warnings. -**/ - @SuppressWarnings("deprecation") - public void Var019 () - { - if (checkJdbc20 ()) { - try { - Statement s = connection_.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, - ResultSet.CONCUR_UPDATABLE); - ResultSet rs = s.executeQuery ("SELECT C_KEY,C_CHAR_50 FROM " + JDRSTest.RSTEST_GET); - JDRSTest.position0 (rs, "CHAR_FLOAT"); - - // Force a warning (data truncation). - rs.getBigDecimal("C_CHAR_50", 0); - - SQLWarning before = rs.getWarnings (); - rs.afterLast (); - SQLWarning after = rs.getWarnings (); - rs.close (); - s.close (); - assertCondition ((before != null) && (after == null)); - } catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } - - - -/** -afterLast() - Set max rows and fetch the rows using afterLast(). -Max rows should not affect this. Native JDBC honors the max rows -setting on all cursor positioning methods. The last row in this -case has the value 50. -**/ - public void Var020 () - { - if (checkJdbc20 ()) { - try { - ResultSet rs = statement2_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_POS); - rs.afterLast (); - rs.previous (); - int id1 = rs.getInt (1); - rs.close (); - - assertCondition (id1 == 50); - - } catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } - - - -/** -afterLast() - Update the rows using afterLast(). -**/ - public void Var021 () - { - if (checkJdbc20 ()) { - try { - // Update each value. - ResultSet rs = statement_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_POS + " FOR UPDATE OF VALUE"); - PreparedStatement ps = connection_.prepareStatement ("UPDATE " - + JDRSTest.RSTEST_POS + " SET VALUE = 'AFTERLAST' WHERE CURRENT OF " - + rs.getCursorName ()); - rs.afterLast (); - rs.previous (); - ps.execute (); - rs.close (); - ps.close (); - - // Go through the result set again as a check. - // It is okay to just use next() here. - ResultSet rs2 = statement_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_POS); - for (int i = 1; i <= 99; ++i) - rs2.next (); - String s1 = rs2.getString (2); - rs2.close (); - - assertCondition (s1.equals ("AFTERLAST")); - } catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } - - + String[] newArgs = new String[args.length + 2]; + newArgs[0] = "-tc"; + newArgs[1] = "JDRSAfterLast"; + for (int i = 0; i < args.length; i++) { + newArgs[2 + i] = args[i]; + } + test.JDRSTest.main(newArgs); + } + + // Private data. + private DatabaseMetaData dmd_; + private Statement statement_; + private Statement statement2_; + + private Connection connectionNoPrefetch_; + private DatabaseMetaData dmdNoPrefetch_; + private Statement statementNoPrefetch_; + private Statement statement2NoPrefetch_; + + /** + * Constructor. + **/ + public JDRSAfterLast(AS400 systemObject, Hashtable> namesAndVars, int runMode, + FileOutputStream fileOutputStream, + + String password) { + super(systemObject, "JDRSAfterLast", namesAndVars, runMode, fileOutputStream, password); + } + + /** + * Performs setup needed before running variations. + * + * @exception Exception If an exception occurs. + **/ + protected void setup() throws Exception { + if (connection_ != null) + connection_.close(); + + if (isJdbc20()) { + connection_ = testDriver_.getConnection(baseURL_ + ";data truncation=true", userId_, encryptedPassword_, + "JDRSAfterLast1"); + dmd_ = connection_.getMetaData(); + statement_ = connection_.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); + + // This statement is used for variations that + // need to test with the max rows set. + statement2_ = connection_.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); + statement2_.setMaxRows(50); + + connectionNoPrefetch_ = testDriver_.getConnection(baseURL_ + ";data truncation=true;prefetch=false", userId_, + encryptedPassword_, "JDRSAfterLast2"); + + dmdNoPrefetch_ = connectionNoPrefetch_.getMetaData(); + + statementNoPrefetch_ = connectionNoPrefetch_.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, + ResultSet.CONCUR_UPDATABLE); + + statement2NoPrefetch_ = connectionNoPrefetch_.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, + ResultSet.CONCUR_READ_ONLY); + statement2NoPrefetch_.setMaxRows(50); + + } + } + + /** + * Performs cleanup needed after running variations. + * + * @exception Exception If an exception occurs. + **/ + protected void cleanup() throws Exception { + if (isJdbc20()) { + statement_.close(); + statement2_.close(); + connection_.close(); + statementNoPrefetch_.close(); + statement2NoPrefetch_.close(); + connectionNoPrefetch_.close(); + } + } + + public void cleanupConnections() throws Exception { + if (isJdbc20()) { + connection_.close(); + connectionNoPrefetch_.close(); + } + } + + /** + * afterLast() - Should work on a empty result set. + **/ + public void Var001() { + if (checkJdbc20()) { + try { + ResultSet rs = statement_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_POS + " WHERE ID = -1"); + rs.afterLast(); + boolean success = rs.next(); + rs.close(); + assertCondition(success == false); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + + /** + * afterLast() - Should throw an exception on a closed result set. + **/ + public void Var002() { + if (checkJdbc20()) { + try { + ResultSet rs = statement_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_POS); + rs.close(); + rs.afterLast(); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } + } + } + + /** + * afterLast() - Should throw an exception on a cancelled statement. + **/ + public void Var003() { + if (checkJdbc20()) { + try (ResultSet rs = statement_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_POS)) { + statement_.cancel(); + rs.afterLast(); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } + } + } + + /** + * afterLast() - Should throw an exception on a foward only result set. + **/ + public void Var004() { + if (checkJdbc20()) { + try (Statement s = connection_.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY); + ResultSet rs = s.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_POS)) { + rs.afterLast(); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } + } + } + + /** + * afterLast() - Should work on a 1 row result set. + **/ + public void Var005() { + if (checkJdbc20()) { + try { + ResultSet rs = statement_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_POS + " WHERE ID = 1"); + rs.afterLast(); + rs.previous(); + int id1 = rs.getInt(1); + rs.close(); + assertCondition(id1 == 1); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + + /** + * afterLast() - Should work on a large result set. + **/ + public void Var006() { + if (checkJdbc20()) { + try { + ResultSet rs = statement_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_POS); + rs.afterLast(); + rs.previous(); + int id1 = rs.getInt(1); + rs.close(); + assertCondition(id1 == 99); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + + /** + * afterLast() - Should work on a "simple" result set. + **/ + public void Var007() { + if (checkJdbc20()) { + try { + ResultSet rs; + + rs = statement2_.executeQuery("select * from SYSIBM.SYSTBLTYPE"); + rs.afterLast(); + rs.previous(); + String s1 = rs.getString("TABLE_TYPE"); + rs.close(); + if (s1 == null) { + output_.println("TABLE_TYPE returned null"); + s1 = ""; + } + assertCondition(s1.length() > 0); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + + /** + * afterLast() - Should work on a "mapped" result set. + * + * SQL400 - We can't support scrollable metadata resultsets (CLI/DB + * restriction). + **/ + public void Var008() { + if (isToolboxDriver() && !isSysibmMetadata()) { + if (checkJdbc20()) { + try { + ResultSet rs = dmd_.getColumns(null, "QIWS", "QCUSTCDT", "%"); + rs.afterLast(); + rs.previous(); + String s1 = rs.getString("TABLE_NAME"); + rs.close(); + assertCondition(s1.startsWith("QCUSTCDT")); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } else { + notApplicable(); + } + } + + /** + * afterLast() - Should work after a beforeFirst(). + **/ + public void Var009() { + if (checkJdbc20()) { + try { + ResultSet rs = statement_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_POS); + rs.beforeFirst(); + rs.afterLast(); + rs.previous(); + int id1 = rs.getInt(1); + rs.close(); + assertCondition(id1 == 99); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + + /** + * afterLast() - Should work after a first(). + **/ + public void Var010() { + if (checkJdbc20()) { + try { + ResultSet rs = statement_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_POS); + rs.first(); + rs.afterLast(); + rs.previous(); + int id1 = rs.getInt(1); + rs.close(); + assertCondition(id1 == 99); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + + /** + * afterLast() - Should work after an absolute(). + **/ + public void Var011() { + if (checkJdbc20()) { + try { + ResultSet rs = statement_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_POS); + rs.absolute(50); + rs.afterLast(); + rs.previous(); + int id1 = rs.getInt(1); + rs.close(); + assertCondition(id1 == 99); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + + /** + * afterLast() - Should work after a relative(). + **/ + public void Var012() { + if (checkJdbc20()) { + try { + ResultSet rs = statement_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_POS); + rs.relative(75); + rs.afterLast(); + rs.previous(); + int id1 = rs.getInt(1); + rs.close(); + assertCondition(id1 == 99); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + + /** + * afterLast() - Should work after a next(). + **/ + public void Var013() { + if (checkJdbc20()) { + try { + ResultSet rs = statement_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_POS); + rs.next(); + rs.afterLast(); + rs.previous(); + int id1 = rs.getInt(1); + rs.close(); + assertCondition(id1 == 99); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + + /** + * afterLast() - Should work after a previous(). + **/ + public void Var014() { + if (checkJdbc20()) { + try { + ResultSet rs = statement_.executeQuery("SELECT ID, VALUE FROM " + JDRSTest.RSTEST_POS); + rs.last(); + rs.previous(); + rs.afterLast(); + rs.previous(); + int id1 = rs.getInt("ID"); + rs.close(); + assertCondition(id1 == 99); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + + /** + * afterLast() - Should work after a last(). + **/ + public void Var015() { + if (checkJdbc20()) { + try { + ResultSet rs = statement_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_POS); + rs.last(); + rs.afterLast(); + rs.previous(); + int id1 = rs.getInt(1); + rs.close(); + assertCondition(id1 == 99); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + + /** + * afterLast() - Should work after an afterLast(). + **/ + public void Var016() { + if (checkJdbc20()) { + try { + ResultSet rs = statement_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_POS); + rs.afterLast(); + rs.afterLast(); + rs.previous(); + int id1 = rs.getInt(1); + rs.close(); + assertCondition(id1 == 99); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + + /** + * afterLast() - Should work after a moveToInsertRow(). + **/ + public void Var017() { + if (checkJdbc20()) { + try { + ResultSet rs = statement_.executeQuery("SELECT ID, VALUE FROM " + JDRSTest.RSTEST_POS + " FOR UPDATE"); + rs.absolute(-43); + rs.moveToInsertRow(); + rs.afterLast(); + rs.previous(); + int id1 = rs.getInt(1); + rs.close(); + assertCondition(id1 == 99); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + + /** + * afterLast() - Should work after a moveToInsertRow(), then moveToCurrentRow(). + **/ + public void Var018() { + if (checkJdbc20()) { + try { + ResultSet rs = statement_.executeQuery("SELECT ID, VALUE FROM " + JDRSTest.RSTEST_POS + " FOR UPDATE"); + rs.last(); + rs.previous(); + rs.previous(); + rs.previous(); + rs.moveToInsertRow(); + rs.moveToCurrentRow(); + rs.afterLast(); + rs.previous(); + int id1 = rs.getInt(1); + rs.close(); + assertCondition(id1 == 99); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + + /** + * afterLast() - Should clear any warnings. + **/ + @SuppressWarnings("deprecation") + public void Var019() { + if (checkJdbc20()) { + try { + Statement s = connection_.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); + ResultSet rs = s.executeQuery("SELECT C_KEY,C_CHAR_50 FROM " + JDRSTest.RSTEST_GET); + JDRSTest.position0(rs, "CHAR_FLOAT"); + + // Force a warning (data truncation). + rs.getBigDecimal("C_CHAR_50", 0); + + SQLWarning before = rs.getWarnings(); + rs.afterLast(); + SQLWarning after = rs.getWarnings(); + rs.close(); + s.close(); + assertCondition((before != null) && (after == null)); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + + /** + * afterLast() - Set max rows and fetch the rows using afterLast(). Max rows + * should not affect this. Native JDBC honors the max rows setting on all cursor + * positioning methods. The last row in this case has the value 50. + **/ + public void Var020() { + if (checkJdbc20()) { + try { + ResultSet rs = statement2_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_POS); + rs.afterLast(); + rs.previous(); + int id1 = rs.getInt(1); + rs.close(); + + assertCondition(id1 == 50); + + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + + /** + * afterLast() - Update the rows using afterLast(). + **/ + public void Var021() { + if (checkJdbc20()) { + JDSerializeFile serializeFile = null; + try { + serializeFile = new JDSerializeFile(connection_, JDRSTest.RSTEST_POS); + // Update each value. + ResultSet rs = statement_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_POS + " FOR UPDATE OF VALUE"); + PreparedStatement ps = connection_.prepareStatement( + "UPDATE " + JDRSTest.RSTEST_POS + " SET VALUE = 'AFTERLAST' WHERE CURRENT OF " + rs.getCursorName()); + rs.afterLast(); + rs.previous(); + ps.execute(); + rs.close(); + ps.close(); + + // Go through the result set again as a check. + // It is okay to just use next() here. + ResultSet rs2 = statement_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_POS); + for (int i = 1; i <= 99; ++i) + rs2.next(); + String s1 = rs2.getString(2); + rs2.close(); + + assertCondition(s1.equals("AFTERLAST")); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } finally { + if (serializeFile != null) { + try { + serializeFile.close(); + } catch (SQLException e) { + e.printStackTrace(); + } + } + } + } + } // TEST NOTE: It would be nice to verify that afterLast() implicity // closes a previously retrieved InputStream. However // it is not obvious how to check that an InputStream // has been closed. - - -/** -isAfterLast() - Should return false on an empty result set with -no positioning. -**/ - public void Var022 () - { - if (checkJdbc20 ()) { - try { - ResultSet rs = statement_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_POS + " WHERE ID = -1"); - boolean success = rs.isAfterLast (); - rs.close (); - assertCondition (success == false); - } catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } - - - -/** -isAfterLast() - Should return false on an empty result set even after -explicitly positioning the cursor using afterLast(). -**/ - public void Var023 () - { - if (checkJdbc20 ()) { - try { - ResultSet rs = statement_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_POS + " WHERE ID = -1"); - rs.afterLast (); - boolean success = rs.isAfterLast (); - rs.close (); - assertCondition (success == false); - } catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } - - - -/** -isAfterLast() - Should throw an exception on a closed result set. -**/ - public void Var024 () - { - if (checkJdbc20 ()) { - try { - ResultSet rs = statement_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_POS); - rs.close (); - rs.isAfterLast (); - failed ("Didn't throw SQLException for calling isAfterLast on a closed result set"); - } catch (Exception e) { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } - } - - - -/** -isAfterLast() - Should throw an exception on a cancelled statement. -**/ - public void Var025 () - { - if (checkJdbc20 ()) { - try { - ResultSet rs = statement_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_POS); - statement_.cancel (); - rs.isAfterLast (); - failed ("Didn't throw SQLException for calling isAfterLast on a cancelled statement "); - } catch (Exception e) { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } - } - - - -/** -isAfterLast() - Should return false on a 1 row result set when positioned -before the only row. -**/ - public void Var026 () - { - if (checkJdbc20 ()) { - try { - ResultSet rs = statement_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_POS + " WHERE ID = 1"); - boolean success = rs.isAfterLast (); - rs.close (); - assertCondition (success == false); - } catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } - - - -/** -isAfterLast() - Should return false on a 1 row result set when positioned -on the only row. -**/ - public void Var027 () - { - if (checkJdbc20 ()) { - try { - ResultSet rs = statement_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_POS + " WHERE ID = 1"); - rs.next (); - boolean success = rs.isAfterLast (); - rs.close (); - assertCondition (success == false); - } catch (Exception e) { - failed (e, "Unexpected Exception"); + /** + * isAfterLast() - Should return false on an empty result set with no + * positioning. + **/ + public void Var022() { + if (checkJdbc20()) { + try { + ResultSet rs = statement_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_POS + " WHERE ID = -1"); + boolean success = rs.isAfterLast(); + rs.close(); + assertCondition(success == false); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + + /** + * isAfterLast() - Should return false on an empty result set even after + * explicitly positioning the cursor using afterLast(). + **/ + public void Var023() { + if (checkJdbc20()) { + try { + ResultSet rs = statement_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_POS + " WHERE ID = -1"); + rs.afterLast(); + boolean success = rs.isAfterLast(); + rs.close(); + assertCondition(success == false); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + + /** + * isAfterLast() - Should throw an exception on a closed result set. + **/ + public void Var024() { + if (checkJdbc20()) { + try { + ResultSet rs = statement_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_POS); + rs.close(); + rs.isAfterLast(); + failed("Didn't throw SQLException for calling isAfterLast on a closed result set"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } + } + } + + /** + * isAfterLast() - Should throw an exception on a cancelled statement. + **/ + public void Var025() { + if (checkJdbc20()) { + try (ResultSet rs = statement_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_POS)) { + statement_.cancel(); + rs.isAfterLast(); + failed("Didn't throw SQLException for calling isAfterLast on a cancelled statement "); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } + } + } + + /** + * isAfterLast() - Should return false on a 1 row result set when positioned + * before the only row. + **/ + public void Var026() { + if (checkJdbc20()) { + try { + ResultSet rs = statement_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_POS + " WHERE ID = 1"); + boolean success = rs.isAfterLast(); + rs.close(); + assertCondition(success == false); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + + /** + * isAfterLast() - Should return false on a 1 row result set when positioned on + * the only row. + **/ + public void Var027() { + if (checkJdbc20()) { + try { + ResultSet rs = statement_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_POS + " WHERE ID = 1"); + rs.next(); + boolean success = rs.isAfterLast(); + rs.close(); + assertCondition(success == false); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + + /** + * isAfterLast() - Should return true on a 1 row result set when positioned + * after the only row. + **/ + public void Var028() { + if (checkJdbc20()) { + try { + ResultSet rs = statement_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_POS + " WHERE ID = 1"); + rs.next(); + rs.next(); + boolean success = rs.isAfterLast(); + rs.close(); + assertCondition(success == true); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + + /** + * isAfterLast() - Should return false on a large result set when not after the + * last row. + **/ + public void Var029() { + if (checkJdbc20()) { + try { + ResultSet rs = statement_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_POS); + rs.last(); + boolean success = rs.isAfterLast(); + rs.close(); + assertCondition(success == false); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + + /** + * isAfterLast() - Should return true on a large result set when positioned + * after the last row. + **/ + public void Var030() { + if (checkJdbc20()) { + try { + ResultSet rs = statement_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_POS); + rs.last(); + rs.next(); + boolean success = rs.isAfterLast(); + rs.close(); + assertCondition(success == true); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + + /** + * isAfterLast() - Should return false on a "simple" result set when not after + * the last row. + **/ + public void Var031() { + if (checkJdbc20()) { + try { + ResultSet rs = dmd_.getTableTypes(); + boolean success = rs.isAfterLast(); + rs.close(); + assertCondition(success == false); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + + /** + * isAfterLast() - Should return true on a "simple" result set when positioned + * after the last row. + **/ + public void Var032() { + if (checkJdbc20()) { + try { + String message = "Changed by native 08/03/2005. Not all rows processed: Rows Processed: "; + ResultSet rs = dmd_.getTableTypes(); + rs.next(); + message += rs.getString("TABLE_TYPE") + ","; + rs.next(); + message += rs.getString("TABLE_TYPE") + ","; + rs.next(); + message += rs.getString("TABLE_TYPE") + ","; + rs.next(); + message += rs.getString("TABLE_TYPE") + ","; + if (true) { // @C2A V5R3 and higher have Materialized Query Tables + rs.next(); // @C2A + message += rs.getString("TABLE_TYPE") + ","; + } + if (true) { // @C3A V5R3 and should have Aliases + rs.next(); // @C3A + } + if (getRelease() > JDTestDriver.RELEASE_V7R6M0) { + rs.next(); + } + + boolean success = rs.isAfterLast(); + rs.close(); + assertCondition(success == true, message); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + + /** + * isAfterLast() - Should return false on a "mapped" result set when not after + * the last row. + * + * SQL400 - We can't support scrollable metadata resultsets (CLI/DB + * restriction). + **/ + public void Var033() { + if (isToolboxDriver() && !isSysibmMetadata()) { + if (checkJdbc20()) { + try { + ResultSet rs = dmd_.getColumns(null, "QIWS", "QCUSTCDT", "%"); + rs.next(); + rs.relative(4); + boolean success = rs.isAfterLast(); + rs.close(); + assertCondition(success == false); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } else { + notApplicable(); + } + } + + /** + * isAfterLast() - Should return true on a "mapped" result set when positioned + * to the last row. + * + * SQL400 - We can't support scrollable metadata resultsets (CLI/DB + * restriction). + **/ + public void Var034() { + if (isToolboxDriver() && !isSysibmMetadata()) { + if (checkJdbc20()) { + try { + ResultSet rs = dmd_.getColumns(null, "QIWS", "QCUSTCDT", "%"); + rs.afterLast(); + boolean success = rs.isAfterLast(); + rs.close(); + assertCondition(success == true); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } else { + notApplicable(); + } + } + + /** + * isAfterLast() - Should return false after a beforeFirst(). + **/ + public void Var035() { + if (checkJdbc20()) { + try { + ResultSet rs = statement_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_POS); + rs.beforeFirst(); + boolean success = rs.isAfterLast(); + rs.close(); + assertCondition(success == false); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + + /** + * isAfterLast() - Should return false after a first(). + **/ + public void Var036() { + if (checkJdbc20()) { + try { + ResultSet rs = statement_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_POS); + rs.first(); + boolean success = rs.isAfterLast(); + rs.close(); + assertCondition(success == false); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + + /** + * isAfterLast() - Should return false after an absolute(+) to a row other than + * after the last. + **/ + public void Var037() { + if (checkJdbc20()) { + try { + ResultSet rs = statement_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_POS); + rs.absolute(50); + boolean success = rs.isAfterLast(); + rs.close(); + assertCondition(success == false); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + + /** + * isAfterLast() - Should return true after an absolute(+) to after the last + * row. + **/ + public void Var038() { + if (checkJdbc20()) { + try { + ResultSet rs = statement_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_POS); + rs.absolute(100); + boolean success = rs.isAfterLast(); + rs.close(); + assertCondition(success == true); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + + /** + * isAfterLast() - Should return false after an absolute(-) to a row other than + * after the last. + **/ + public void Var039() { + if (checkJdbc20()) { + try { + ResultSet rs = statement_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_POS); + rs.absolute(-50); + boolean success = rs.isAfterLast(); + rs.close(); + assertCondition(success == false); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + + /** + * isAfterLast() - Should return true after an absolute(-) to after the last + * row. (It is not really possible to test this variation!) + **/ + public void Var040() { + if (checkJdbc20()) { + try { + ResultSet rs = statement_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_POS); + rs.absolute(-1); + boolean success = rs.isAfterLast(); + rs.close(); + assertCondition(success == false); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + + /** + * isAfterLast() - Should return false after a relative(+) to a row other than + * after the last. + **/ + public void Var041() { + if (checkJdbc20()) { + try { + ResultSet rs = statement_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_POS); + rs.next(); + rs.relative(39); + boolean success = rs.isAfterLast(); + rs.close(); + assertCondition(success == false); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + + /** + * isAfterLast() - Should return true after a relative(+) to after the last row. + **/ + public void Var042() { + if (checkJdbc20()) { + try { + ResultSet rs = statement_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_POS); + rs.next(); + rs.relative(99); + boolean success = rs.isAfterLast(); + rs.close(); + assertCondition(success == true); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + + /** + * isAfterLast() - Should return false after a relative(-) to a row other than + * after the last. + **/ + public void Var043() { + if (checkJdbc20()) { + try { + ResultSet rs = statement_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_POS); + rs.last(); + rs.relative(-50); + boolean success = rs.isAfterLast(); + rs.close(); + assertCondition(success == false); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + + /** + * isAfterLast() - Should return false after a next() when not after the last + * row. + **/ + public void Var044() { + if (checkJdbc20()) { + try { + ResultSet rs = statement_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_POS); + rs.next(); + boolean success = rs.isAfterLast(); + rs.close(); + assertCondition(success == false); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + + /** + * isAfterLast() - Should return true after a next() when positioned after the + * last row. + **/ + public void Var045() { + if (checkJdbc20()) { + try { + ResultSet rs = statement_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_POS); + for (int i = 1; i <= 100; ++i) + rs.next(); + boolean success = rs.isAfterLast(); + rs.close(); + assertCondition(success == true); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + + /** + * isAfterLast() - Should return false after a previous() when not after the + * last row. + **/ + public void Var046() { + if (checkJdbc20()) { + try { + ResultSet rs = statement_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_POS); + rs.absolute(50); + rs.previous(); + boolean success = rs.isAfterLast(); + rs.close(); + assertCondition(success == false); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + + /** + * isAfterLast() - Should return false after a last(). + **/ + public void Var047() { + if (checkJdbc20()) { + try { + ResultSet rs = statement_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_POS); + rs.last(); + boolean success = rs.isAfterLast(); + rs.close(); + assertCondition(success == false); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + + /** + * isAfterLast() - Should return true after an afterLast(). + **/ + public void Var048() { + if (checkJdbc20()) { + try { + ResultSet rs = statement_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_POS); + rs.afterLast(); + boolean success = rs.isAfterLast(); + rs.close(); + assertCondition(success == true); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + + /** + * isAfterLast() - Should return false after a moveToInsertRow(). + **/ + public void Var049() { + if (checkJdbc20()) { + try { + ResultSet rs = statement_.executeQuery("SELECT ID, VALUE FROM " + JDRSTest.RSTEST_POS + " FOR UPDATE"); + rs.absolute(-43); + rs.moveToInsertRow(); + boolean success = rs.isAfterLast(); + rs.close(); + assertCondition(success == false); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + + /** + * isAfterLast() - Should return false after a moveToInsertRow(), then + * moveToCurrentRow() when not after the last row. + **/ + public void Var050() { + if (checkJdbc20()) { + try { + ResultSet rs = statement_.executeQuery("SELECT ID, VALUE FROM " + JDRSTest.RSTEST_POS + " FOR UPDATE"); + rs.last(); + rs.previous(); + rs.previous(); + rs.previous(); + rs.moveToInsertRow(); + rs.moveToCurrentRow(); + boolean success = rs.isAfterLast(); + rs.close(); + assertCondition(success == false); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + + /** + * isAfterLast() - Should return true after a moveToInsertRow(), then + * moveToCurrentRow() when after the last row. + **/ + public void Var051() { + if (checkJdbc20()) { + try { + ResultSet rs = statement_.executeQuery("SELECT ID, VALUE FROM " + JDRSTest.RSTEST_POS + " FOR UPDATE"); + rs.afterLast(); + rs.moveToInsertRow(); + rs.moveToCurrentRow(); + boolean success = rs.isAfterLast(); + rs.close(); + assertCondition(success == true); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + + /** + * isAfterLast() - Set max rows and fetch the rows using next(), Verify that max + * rows is honored. + **/ + public void Var052() { + if (checkJdbc20()) { + try { + ResultSet rs = statement2_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_POS); + for (int i = 1; i <= 51; ++i) + rs.next(); + + boolean success = rs.isAfterLast(); + rs.close(); + assertCondition(success == true); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + + /** + * isAfterLast() -- Verify that isAfterLast does not move the cursor when called + * before the beginning of a result set row. This was a bug in the native driver + * reported by APAR SE20242 + **/ + public void Var053() { + if (checkJdbc20()) { + try { + ResultSet rs = statement_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_POS + " WHERE ID = 1"); + boolean success = rs.isAfterLast(); + boolean fetched = rs.next(); + rs.close(); + assertCondition((success == false) && (fetched == true), + "afterLast returned " + success + " sb false and next returned " + fetched + + " sb true -- added by native driver (08/03/2005) for APAR SE20242"); + } catch (Exception e) { + failed(e, "Unexpected Exception -- added by native driver (08/03/2005)"); + } + } + } + + /** + * isAfterLast() - Should return false after a first() even if the result set is + * empty. + **/ + public void Var054() { + if (checkJdbc20()) { + try { + ResultSet rs = statement_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_POS + " where 0=1"); + rs.first(); + boolean success = rs.isAfterLast(); + rs.close(); + assertCondition(success == false, + "isAfterLast() should return false for an empty result Set -- Added by native driver 08/03/2005"); + } catch (Exception e) { + failed(e, "Unexpected Exception -- added by native driver (08/03/2005)"); + } + } + } + + /** + * isAfterLast() -- Should return false where there is still more data. Also + * verify that the result set is correct when isAfterLast is used when prefetch + * is off + **/ + + public void Var055() { + if (checkJdbc20()) { + if (checkNative()) { + StringBuffer sb = new StringBuffer(); + String sql = "Select 'A' from sysibm.sysdummy1 UNION Select 'B' from sysibm.sysdummy1 UNION SELECT 'C' from sysibm.sysdummy1"; + try { + boolean passed = true; + try (ResultSet rs = statementNoPrefetch_.executeQuery(sql)) { + boolean fetch1 = rs.next(); + if (!fetch1) { + passed = false; + sb.append("fetch1 returned " + fetch1 + "\n"); + } + + boolean afterLast1 = rs.isAfterLast(); + if (afterLast1) { + passed = false; + sb.append("afterLast1 returned " + afterLast1 + "\n"); + } + + String string1 = rs.getString(1); + if (!"A".equals(string1)) { + passed = false; + sb.append("Expected 'A' got '" + string1 + "'\n"); + } + + boolean fetch2 = rs.next(); + if (!fetch2) { + passed = false; + sb.append("fetch2 returned " + fetch2 + "\n"); + } + + boolean afterLast2 = rs.isAfterLast(); + if (afterLast2) { + passed = false; + sb.append("afterLast2 returned " + afterLast2 + "\n"); + } + + String string2 = rs.getString(1); + if (!"B".equals(string2)) { + passed = false; + sb.append("Expected 'B' got '" + string2 + "'\n"); + } + + boolean fetch3 = rs.next(); + if (!fetch3) { + passed = false; + sb.append("fetch3 returned " + fetch3 + "\n"); + } + + boolean afterLast3 = rs.isAfterLast(); + if (afterLast3) { + passed = false; + sb.append("afterLast3 returned " + afterLast3 + "\n"); + } + + String string3 = rs.getString(1); + if (!"C".equals(string3)) { + passed = false; + sb.append("Expected 'C' got '" + string3 + "'\n"); } - } - } - - -/** -isAfterLast() - Should return true on a 1 row result set when positioned -after the only row. -**/ - public void Var028() - { - if (checkJdbc20 ()) { - try { - ResultSet rs = statement_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_POS + " WHERE ID = 1"); - rs.next (); - rs.next (); - boolean success = rs.isAfterLast (); - rs.close (); - assertCondition (success == true); - } catch (Exception e) { - failed (e, "Unexpected Exception"); + boolean fetch4 = rs.next(); + if (fetch4) { + passed = false; + sb.append("fetch4 returned " + fetch4 + "\n"); } - } - } - - -/** -isAfterLast() - Should return false on a large result set when -not after the last row. -**/ - public void Var029 () - { - if (checkJdbc20 ()) { - try { - ResultSet rs = statement_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_POS); - rs.last (); - boolean success = rs.isAfterLast (); - rs.close (); - assertCondition (success == false); - } catch (Exception e) { - failed (e, "Unexpected Exception"); + boolean afterLast4 = rs.isAfterLast(); + if (!afterLast4) { + passed = false; + sb.append("afterLast4 returned " + afterLast4 + "\n"); } - } - } - + } - -/** -isAfterLast() - Should return true on a large result set when -positioned after the last row. -**/ - public void Var030 () - { - if (checkJdbc20 ()) { - try { - ResultSet rs = statement_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_POS); - rs.last (); - rs.next (); - boolean success = rs.isAfterLast (); - rs.close (); - assertCondition (success == true); - } catch (Exception e) { - failed (e, "Unexpected Exception"); - } + assertCondition(passed, sb.toString() + " -- Added by native driver 11/29/2010"); + } catch (Exception e) { + failed(e, "Unexpected Exception sql=" + sql + " -- added by native driver (11/29/2010)"); } + } } + } +// +// Repeat all testcases with prefetching off +// + public void Var056() { + notApplicable(); + } + + public void Var057() { + notApplicable(); + } + + public void Var058() { + notApplicable(); + } + + public void Var059() { + notApplicable(); + } + + public void Var060() { + notApplicable(); + } + + /** + * afterLast() - Should work on a empty result set. + **/ + public void Var061() { + if (checkJdbc20()) { + try { + ResultSet rs = statementNoPrefetch_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_POS + " WHERE ID = -1"); + rs.afterLast(); + boolean success = rs.next(); + rs.close(); + assertCondition(success == false); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + + /** + * afterLast() - Should throw an exception on a closed result set. + **/ + public void Var062() { + if (checkJdbc20()) { + try { + ResultSet rs = statementNoPrefetch_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_POS); + rs.close(); + rs.afterLast(); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } + } + } + + /** + * afterLast() - Should throw an exception on a cancelled statement. + **/ + public void Var063() { + if (checkJdbc20()) { + try (ResultSet rs = statementNoPrefetch_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_POS)) { + statementNoPrefetch_.cancel(); + rs.afterLast(); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } + } + } + + /** + * afterLast() - Should throw an exception on a foward only result set. + **/ + public void Var064() { + if (checkJdbc20()) { + try (Statement s = connectionNoPrefetch_.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY); + ResultSet rs = s.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_POS)) { + rs.afterLast(); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } + } + } + + /** + * afterLast() - Should work on a 1 row result set. + **/ + public void Var065() { + if (checkJdbc20()) { + try { + ResultSet rs = statementNoPrefetch_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_POS + " WHERE ID = 1"); + rs.afterLast(); + rs.previous(); + int id1 = rs.getInt(1); + rs.close(); + assertCondition(id1 == 1); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + + /** + * afterLast() - Should work on a large result set. + **/ + public void Var066() { + if (checkJdbc20()) { + try { + ResultSet rs = statementNoPrefetch_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_POS); + rs.afterLast(); + rs.previous(); + int id1 = rs.getInt(1); + rs.close(); + assertCondition(id1 == 99); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + + /** + * afterLast() - Should work on a "simple" result set. + **/ + public void Var067() { + if (checkJdbc20()) { + try { + ResultSet rs; + + rs = statement2NoPrefetch_.executeQuery("select * from SYSIBM.SYSTBLTYPE"); + rs.afterLast(); + rs.previous(); + String s1 = rs.getString("TABLE_TYPE"); + rs.close(); + if (s1 == null) { + output_.println("TABLE_TYPE returned null"); + s1 = ""; + } + assertCondition(s1.length() > 0); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + + /** + * afterLast() - Should work on a "mapped" result set. + * + * SQL400 - We can't support scrollable metadata resultsets (CLI/DB + * restriction). + **/ + public void Var068() { + if (isToolboxDriver() && !isSysibmMetadata()) { + if (checkJdbc20()) { + try { + ResultSet rs = dmdNoPrefetch_.getColumns(null, "QIWS", "QCUSTCDT", "%"); + rs.afterLast(); + rs.previous(); + String s1 = rs.getString("TABLE_NAME"); + rs.close(); + assertCondition(s1.startsWith("QCUSTCDT")); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } else { + notApplicable(); + } + } + + /** + * afterLast() - Should work after a beforeFirst(). + **/ + public void Var069() { + if (checkJdbc20()) { + try { + ResultSet rs = statementNoPrefetch_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_POS); + rs.beforeFirst(); + rs.afterLast(); + rs.previous(); + int id1 = rs.getInt(1); + rs.close(); + assertCondition(id1 == 99); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + + /** + * afterLast() - Should work after a first(). + **/ + public void Var070() { + if (checkJdbc20()) { + try { + ResultSet rs = statementNoPrefetch_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_POS); + rs.first(); + rs.afterLast(); + rs.previous(); + int id1 = rs.getInt(1); + rs.close(); + assertCondition(id1 == 99); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + + /** + * afterLast() - Should work after an absolute(). + **/ + public void Var071() { + if (checkJdbc20()) { + try { + ResultSet rs = statementNoPrefetch_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_POS); + rs.absolute(50); + rs.afterLast(); + rs.previous(); + int id1 = rs.getInt(1); + rs.close(); + assertCondition(id1 == 99); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + + /** + * afterLast() - Should work after a relative(). + **/ + public void Var072() { + if (checkJdbc20()) { + try { + ResultSet rs = statementNoPrefetch_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_POS); + rs.relative(75); + rs.afterLast(); + rs.previous(); + int id1 = rs.getInt(1); + rs.close(); + assertCondition(id1 == 99); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + + /** + * afterLast() - Should work after a next(). + **/ + public void Var073() { + if (checkJdbc20()) { + try { + ResultSet rs = statementNoPrefetch_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_POS); + rs.next(); + rs.afterLast(); + rs.previous(); + int id1 = rs.getInt(1); + rs.close(); + assertCondition(id1 == 99); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + + /** + * afterLast() - Should work after a previous(). + **/ + public void Var074() { + if (checkJdbc20()) { + try { + ResultSet rs = statementNoPrefetch_.executeQuery("SELECT ID, VALUE FROM " + JDRSTest.RSTEST_POS); + rs.last(); + rs.previous(); + rs.afterLast(); + rs.previous(); + int id1 = rs.getInt("ID"); + rs.close(); + assertCondition(id1 == 99); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + + /** + * afterLast() - Should work after a last(). + **/ + public void Var075() { + if (checkJdbc20()) { + try { + ResultSet rs = statementNoPrefetch_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_POS); + rs.last(); + rs.afterLast(); + rs.previous(); + int id1 = rs.getInt(1); + rs.close(); + assertCondition(id1 == 99); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + + /** + * afterLast() - Should work after an afterLast(). + **/ + public void Var076() { + if (checkJdbc20()) { + try { + ResultSet rs = statementNoPrefetch_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_POS); + rs.afterLast(); + rs.afterLast(); + rs.previous(); + int id1 = rs.getInt(1); + rs.close(); + assertCondition(id1 == 99); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + + /** + * afterLast() - Should work after a moveToInsertRow(). + **/ + public void Var077() { + if (checkJdbc20()) { + try { + ResultSet rs = statementNoPrefetch_ + .executeQuery("SELECT ID, VALUE FROM " + JDRSTest.RSTEST_POS + " FOR UPDATE"); + rs.absolute(-43); + rs.moveToInsertRow(); + rs.afterLast(); + rs.previous(); + int id1 = rs.getInt(1); + rs.close(); + assertCondition(id1 == 99); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + + /** + * afterLast() - Should work after a moveToInsertRow(), then moveToCurrentRow(). + **/ + public void Var078() { + if (checkJdbc20()) { + try { + ResultSet rs = statementNoPrefetch_ + .executeQuery("SELECT ID, VALUE FROM " + JDRSTest.RSTEST_POS + " FOR UPDATE"); + rs.last(); + rs.previous(); + rs.previous(); + rs.previous(); + rs.moveToInsertRow(); + rs.moveToCurrentRow(); + rs.afterLast(); + rs.previous(); + int id1 = rs.getInt(1); + rs.close(); + assertCondition(id1 == 99); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + + /** + * afterLast() - Should clear any warnings. + **/ + @SuppressWarnings("deprecation") + public void Var079() { + if (checkJdbc20()) { + try { + Statement s = connectionNoPrefetch_.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, + ResultSet.CONCUR_UPDATABLE); + ResultSet rs = s.executeQuery("SELECT C_KEY,C_CHAR_50 FROM " + JDRSTest.RSTEST_GET); + JDRSTest.position0(rs, "CHAR_FLOAT"); + + // Force a warning (data truncation). + rs.getBigDecimal("C_CHAR_50", 0); + + SQLWarning before = rs.getWarnings(); + rs.afterLast(); + SQLWarning after = rs.getWarnings(); + rs.close(); + s.close(); + assertCondition((before != null) && (after == null)); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + + /** + * afterLast() - Set max rows and fetch the rows using afterLast(). Max rows + * should not affect this. Native JDBC honors the max rows setting on all cursor + * positioning methods. The last row in this case has the value 50. + **/ + public void Var080() { + if (checkJdbc20()) { + try { + ResultSet rs = statement2NoPrefetch_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_POS); + rs.afterLast(); + rs.previous(); + int id1 = rs.getInt(1); + rs.close(); + + assertCondition(id1 == 50); + + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + + /** + * afterLast() - Update the rows using afterLast(). + **/ + public void Var081() { + if (checkJdbc20()) { + JDSerializeFile serializeFile = null; + try { + serializeFile = new JDSerializeFile(connection_, JDRSTest.RSTEST_POS); + // Update each value. + ResultSet rs = statementNoPrefetch_ + .executeQuery("SELECT * FROM " + JDRSTest.RSTEST_POS + " FOR UPDATE OF VALUE"); + PreparedStatement ps = connectionNoPrefetch_.prepareStatement( + "UPDATE " + JDRSTest.RSTEST_POS + " SET VALUE = 'AFTERLAST' WHERE CURRENT OF " + rs.getCursorName()); + rs.afterLast(); + rs.previous(); + ps.execute(); + rs.close(); + ps.close(); + + // Go through the result set again as a check. + // It is okay to just use next() here. + ResultSet rs2 = statementNoPrefetch_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_POS); + for (int i = 1; i <= 99; ++i) + rs2.next(); + String s1 = rs2.getString(2); + rs2.close(); + + assertCondition(s1.equals("AFTERLAST")); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } finally { + if (serializeFile != null) { + try { + serializeFile.close(); + } catch (SQLException e) { + e.printStackTrace(); + } + } + } + } + } +// TEST NOTE: It would be nice to verify that afterLast() implicity +// closes a previously retrieved InputStream. However +// it is not obvious how to check that an InputStream +// has been closed. -/** -isAfterLast() - Should return false on a "simple" result set -when not after the last row. -**/ - public void Var031 () - { - if (checkJdbc20 ()) { - try { - ResultSet rs = dmd_.getTableTypes (); - boolean success = rs.isAfterLast (); - rs.close (); - assertCondition (success == false); - } catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } - - - -/** -isAfterLast() - Should return true on a "simple" result set -when positioned after the last row. -**/ - public void Var032 () - { - if (checkJdbc20 ()) { - try { - String message="Changed by native 08/03/2005. Not all rows processed: Rows Processed: "; - ResultSet rs = dmd_.getTableTypes (); - rs.next (); - message+=rs.getString("TABLE_TYPE")+","; - rs.next (); - message+=rs.getString("TABLE_TYPE")+","; - rs.next (); - message+=rs.getString("TABLE_TYPE")+","; - rs.next (); - message+=rs.getString("TABLE_TYPE")+","; - if(true) { // @C2A V5R3 and higher have Materialized Query Tables - rs.next(); // @C2A - message+=rs.getString("TABLE_TYPE")+","; - } - if(true) { // @C3A V5R3 and should have Aliases - rs.next(); // @C3A - } - if (getRelease() > JDTestDriver.RELEASE_V7R6M0) { - rs.next(); - } - - boolean success = rs.isAfterLast (); - rs.close (); - assertCondition (success == true, message); - } catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } - - - -/** -isAfterLast() - Should return false on a "mapped" result set -when not after the last row. - -SQL400 - We can't support scrollable metadata resultsets (CLI/DB restriction). -**/ - public void Var033 () - { - if (isToolboxDriver() && !isSysibmMetadata()) { - if (checkJdbc20 ()) { - try { - ResultSet rs = dmd_.getColumns (null, "QIWS", - "QCUSTCDT", "%"); - rs.next (); - rs.relative (4); - boolean success = rs.isAfterLast (); - rs.close (); - assertCondition (success == false); - } catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } else { - notApplicable(); - } - } - - - -/** -isAfterLast() - Should return true on a "mapped" result set -when positioned to the last row. - -SQL400 - We can't support scrollable metadata resultsets (CLI/DB restriction). -**/ - public void Var034 () - { - if (isToolboxDriver() && !isSysibmMetadata()) { - if (checkJdbc20 ()) { - try { - ResultSet rs = dmd_.getColumns (null, "QIWS", - "QCUSTCDT", "%"); - rs.afterLast (); - boolean success = rs.isAfterLast (); - rs.close (); - assertCondition (success == true); - } catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } else { - notApplicable(); - } - } - - - -/** -isAfterLast() - Should return false after a beforeFirst(). -**/ - public void Var035 () - { - if (checkJdbc20 ()) { - try { - ResultSet rs = statement_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_POS); - rs.beforeFirst (); - boolean success = rs.isAfterLast (); - rs.close (); - assertCondition (success == false); - } catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } - - - - -/** -isAfterLast() - Should return false after a first(). -**/ - public void Var036 () - { - if (checkJdbc20 ()) { - try { - ResultSet rs = statement_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_POS); - rs.first (); - boolean success = rs.isAfterLast (); - rs.close (); - assertCondition (success == false); - } catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } - - - - -/** -isAfterLast() - Should return false after an absolute(+) to a -row other than after the last. -**/ - public void Var037 () - { - if (checkJdbc20 ()) { - try { - ResultSet rs = statement_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_POS); - rs.absolute (50); - boolean success = rs.isAfterLast (); - rs.close (); - assertCondition (success == false); - } catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } - - - - -/** -isAfterLast() - Should return true after an absolute(+) to -after the last row. -**/ - public void Var038 () - { - if (checkJdbc20 ()) { - try { - ResultSet rs = statement_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_POS); - rs.absolute (100); - boolean success = rs.isAfterLast (); - rs.close (); - assertCondition (success == true); - } catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } - - - - -/** -isAfterLast() - Should return false after an absolute(-) to a -row other than after the last. -**/ - public void Var039 () - { - if (checkJdbc20 ()) { - try { - ResultSet rs = statement_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_POS); - rs.absolute (-50); - boolean success = rs.isAfterLast (); - rs.close (); - assertCondition (success == false); - } catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } - - - - -/** -isAfterLast() - Should return true after an absolute(-) to after -the last row. -(It is not really possible to test this variation!) -**/ - public void Var040 () - { - if (checkJdbc20 ()) { - try { - ResultSet rs = statement_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_POS); - rs.absolute (-1); - boolean success = rs.isAfterLast (); - rs.close (); - assertCondition (success == false); - } catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } - - - - -/** -isAfterLast() - Should return false after a relative(+) to a -row other than after the last. -**/ - public void Var041 () - { - if (checkJdbc20 ()) { - try { - ResultSet rs = statement_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_POS); - rs.next (); - rs.relative (39); - boolean success = rs.isAfterLast (); - rs.close (); - assertCondition (success == false); - } catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } - - - - -/** -isAfterLast() - Should return true after a relative(+) to -after the last row. -**/ - public void Var042 () - { - if (checkJdbc20 ()) { - try { - ResultSet rs = statement_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_POS); - rs.next (); - rs.relative (99); - boolean success = rs.isAfterLast (); - rs.close (); - assertCondition (success == true); - } catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } - - - - -/** -isAfterLast() - Should return false after a relative(-) to a -row other than after the last. -**/ - public void Var043 () - { - if (checkJdbc20 ()) { - try { - ResultSet rs = statement_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_POS); - rs.last (); - rs.relative (-50); - boolean success = rs.isAfterLast (); - rs.close (); - assertCondition (success == false); - } catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } - - - - -/** -isAfterLast() - Should return false after a next() when not after -the last row. -**/ - public void Var044 () - { - if (checkJdbc20 ()) { - try { - ResultSet rs = statement_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_POS); - rs.next (); - boolean success = rs.isAfterLast (); - rs.close (); - assertCondition (success == false); - } catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } - - - -/** -isAfterLast() - Should return true after a next() when positioned -after the last row. -**/ - public void Var045 () - { - if (checkJdbc20 ()) { - try { - ResultSet rs = statement_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_POS); - for (int i = 1; i <= 100; ++i) - rs.next (); - boolean success = rs.isAfterLast (); - rs.close (); - assertCondition (success == true); - } catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } - - - -/** -isAfterLast() - Should return false after a previous() when not -after the last row. -**/ - public void Var046 () - { - if (checkJdbc20 ()) { - try { - ResultSet rs = statement_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_POS); - rs.absolute (50); - rs.previous (); - boolean success = rs.isAfterLast (); - rs.close (); - assertCondition (success == false); - } catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } - - - -/** -isAfterLast() - Should return false after a last(). -**/ - public void Var047 () - { - if (checkJdbc20 ()) { - try { - ResultSet rs = statement_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_POS); - rs.last (); - boolean success = rs.isAfterLast (); - rs.close (); - assertCondition (success == false); - } catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } - - - - -/** -isAfterLast() - Should return true after an afterLast(). -**/ - public void Var048 () - { - if (checkJdbc20 ()) { - try { - ResultSet rs = statement_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_POS); - rs.afterLast (); - boolean success = rs.isAfterLast (); - rs.close (); - assertCondition (success == true); - } catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } - - - -/** -isAfterLast() - Should return false after a moveToInsertRow(). -**/ - public void Var049 () - { - if (checkJdbc20 ()) { - try { - ResultSet rs = statement_.executeQuery ("SELECT ID, VALUE FROM " - + JDRSTest.RSTEST_POS + " FOR UPDATE"); - rs.absolute (-43); - rs.moveToInsertRow (); - boolean success = rs.isAfterLast (); - rs.close (); - assertCondition (success == false); - } catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } - - - -/** -isAfterLast() - Should return false after a moveToInsertRow(), -then moveToCurrentRow() when not after the last row. -**/ - public void Var050 () - { - if (checkJdbc20 ()) { - try { - ResultSet rs = statement_.executeQuery ("SELECT ID, VALUE FROM " - + JDRSTest.RSTEST_POS + " FOR UPDATE"); - rs.last (); - rs.previous (); - rs.previous (); - rs.previous (); - rs.moveToInsertRow (); - rs.moveToCurrentRow (); - boolean success = rs.isAfterLast (); - rs.close (); - assertCondition (success == false); - } catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } - - - -/** -isAfterLast() - Should return true after a moveToInsertRow(), -then moveToCurrentRow() when after the last row. -**/ - public void Var051 () - { - if (checkJdbc20 ()) { - try { - ResultSet rs = statement_.executeQuery ("SELECT ID, VALUE FROM " - + JDRSTest.RSTEST_POS + " FOR UPDATE"); - rs.afterLast (); - rs.moveToInsertRow (); - rs.moveToCurrentRow (); - boolean success = rs.isAfterLast (); - rs.close (); - assertCondition (success == true); - } catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } - - - -/** -isAfterLast() - Set max rows and fetch the rows using next(), -Verify that max rows is honored. -**/ - public void Var052 () - { - if (checkJdbc20 ()) { - try { - ResultSet rs = statement2_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_POS); - for (int i = 1; i <= 51; ++i) - rs.next (); - - boolean success = rs.isAfterLast (); - rs.close (); - assertCondition (success == true); - } catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } - - -/** - isAfterLast() -- Verify that isAfterLast does not move the cursor when - called before the beginning of a result set row. This was a bug in the - native driver reported by APAR SE20242 -**/ - public void Var053 () - { - if (checkJdbc20 ()) { - try { - ResultSet rs = statement_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_POS + " WHERE ID = 1"); - boolean success = rs.isAfterLast (); - boolean fetched = rs.next(); - rs.close (); - assertCondition ((success == false) && (fetched==true), "afterLast returned "+success+" sb false and next returned "+fetched+" sb true -- added by native driver (08/03/2005) for APAR SE20242"); - } catch (Exception e) { - failed (e, "Unexpected Exception -- added by native driver (08/03/2005)"); - } - } - } - -/** -isAfterLast() - Should return false after a first() even if the result set is empty. -**/ - public void Var054 () - { - if (checkJdbc20 ()) { - try { - ResultSet rs = statement_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_POS +" where 0=1"); - rs.first (); - boolean success = rs.isAfterLast (); - rs.close (); - assertCondition (success == false, "isAfterLast() should return false for an empty result Set -- Added by native driver 08/03/2005"); - } catch (Exception e) { - failed (e, "Unexpected Exception -- added by native driver (08/03/2005)"); - } - } - } - - -/** -isAfterLast() -- Should return false where there is still more data. - Also verify that the result set is correct when isAfterLast is used when - prefetch is off -**/ - - public void Var055 () - { - if (checkJdbc20 ()) { - if (checkNative()) { - StringBuffer sb = new StringBuffer(); - String sql = "Select 'A' from sysibm.sysdummy1 UNION Select 'B' from sysibm.sysdummy1 UNION SELECT 'C' from sysibm.sysdummy1"; - try { - boolean passed=true; - ResultSet rs = statementNoPrefetch_.executeQuery (sql); - - boolean fetch1 = rs.next(); - if (!fetch1) { passed=false; sb.append("fetch1 returned "+fetch1+"\n"); } - - boolean afterLast1 = rs.isAfterLast(); - if (afterLast1) { passed=false; sb.append("afterLast1 returned "+afterLast1+"\n"); } - - String string1 = rs.getString(1); - if (! "A".equals(string1)) { passed = false; sb.append("Expected 'A' got '"+string1+"'\n");} - - - boolean fetch2 = rs.next(); - if (!fetch2) { passed=false; sb.append("fetch2 returned "+fetch2+"\n"); } - - boolean afterLast2 = rs.isAfterLast(); - if (afterLast2) { passed=false; sb.append("afterLast2 returned "+afterLast2+"\n"); } - - String string2 = rs.getString(1); - if (! "B".equals(string2)) { passed = false; sb.append("Expected 'B' got '"+string2+"'\n");} - - - boolean fetch3 = rs.next(); - if (!fetch3) { passed=false; sb.append("fetch3 returned "+fetch3+"\n"); } - - boolean afterLast3 = rs.isAfterLast(); - if (afterLast3) { passed=false; sb.append("afterLast3 returned "+afterLast3+"\n"); } - - String string3 = rs.getString(1); - if (! "C".equals(string3)) { passed = false; sb.append("Expected 'C' got '"+string3+"'\n");} - - - boolean fetch4 = rs.next(); - if (fetch4) { passed=false; sb.append("fetch4 returned "+fetch4+"\n"); } - - boolean afterLast4 = rs.isAfterLast(); - if (!afterLast4) { passed=false; sb.append("afterLast4 returned "+afterLast4+"\n"); } - - assertCondition (passed, sb.toString() +" -- Added by native driver 11/29/2010"); - } catch (Exception e) { - failed (e, "Unexpected Exception sql="+sql+" -- added by native driver (11/29/2010)"); - } - } - } - } - - -// -// Repeat all testcases with prefetching off -// - public void Var056 () { notApplicable(); } - public void Var057 () { notApplicable(); } - public void Var058 () { notApplicable(); } - public void Var059 () { notApplicable(); } - public void Var060 () { notApplicable(); } - - - -/** -afterLast() - Should work on a empty result set. -**/ - public void Var061 () - { - if (checkJdbc20 ()) { - try { - ResultSet rs = statementNoPrefetch_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_POS + " WHERE ID = -1"); - rs.afterLast (); - boolean success = rs.next (); - rs.close (); - assertCondition (success == false); - } catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } - - - -/** -afterLast() - Should throw an exception on a closed result set. -**/ - public void Var062 () - { - if (checkJdbc20 ()) { - try { - ResultSet rs = statementNoPrefetch_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_POS); - rs.close (); - rs.afterLast (); - failed ("Didn't throw SQLException"); - } catch (Exception e) { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } - } - - - -/** -afterLast() - Should throw an exception on a cancelled statement. -**/ - public void Var063 () - { - if (checkJdbc20 ()) { - try { - ResultSet rs = statementNoPrefetch_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_POS); - statementNoPrefetch_.cancel (); - rs.afterLast (); - failed ("Didn't throw SQLException"); - } catch (Exception e) { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } - } - - - -/** -afterLast() - Should throw an exception on a foward only result set. -**/ - public void Var064 () - { - if (checkJdbc20 ()) { - try { - Statement s = connectionNoPrefetch_.createStatement (ResultSet.TYPE_FORWARD_ONLY, - ResultSet.CONCUR_READ_ONLY); - ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_POS); - rs.afterLast (); - failed ("Didn't throw SQLException"); - } catch (Exception e) { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } - } - - - -/** -afterLast() - Should work on a 1 row result set. -**/ - public void Var065 () - { - if (checkJdbc20 ()) { - try { - ResultSet rs = statementNoPrefetch_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_POS + " WHERE ID = 1"); - rs.afterLast (); - rs.previous (); - int id1 = rs.getInt (1); - rs.close (); - assertCondition (id1 == 1); - } catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } - - - -/** -afterLast() - Should work on a large result set. -**/ - public void Var066 () - { - if (checkJdbc20 ()) { - try { - ResultSet rs = statementNoPrefetch_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_POS); - rs.afterLast (); - rs.previous (); - int id1 = rs.getInt (1); - rs.close (); - assertCondition (id1 == 99); - } catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } - - - -/** -afterLast() - Should work on a "simple" result set. -**/ - public void Var067 () - { - if (checkJdbc20 ()) { - try { - ResultSet rs ; - - rs = statement2NoPrefetch_.executeQuery("select * from SYSIBM.SYSTBLTYPE"); - rs.afterLast (); - rs.previous (); - String s1 = rs.getString ("TABLE_TYPE"); - rs.close (); - if (s1 == null) { - output_.println("TABLE_TYPE returned null"); - s1=""; - } - assertCondition (s1.length () > 0); - } catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } - - - -/** -afterLast() - Should work on a "mapped" result set. - -SQL400 - We can't support scrollable metadata resultsets (CLI/DB restriction). -**/ - public void Var068 () - { - if (isToolboxDriver() && !isSysibmMetadata()) { - if (checkJdbc20 ()) { - try { - ResultSet rs = dmdNoPrefetch_.getColumns (null, "QIWS", - "QCUSTCDT", "%"); - rs.afterLast (); - rs.previous (); - String s1 = rs.getString ("TABLE_NAME"); - rs.close (); - assertCondition (s1.startsWith ("QCUSTCDT")); - } catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } else { - notApplicable(); - } - } - - - -/** -afterLast() - Should work after a beforeFirst(). -**/ - public void Var069 () - { - if (checkJdbc20 ()) { - try { - ResultSet rs = statementNoPrefetch_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_POS); - rs.beforeFirst (); - rs.afterLast (); - rs.previous (); - int id1 = rs.getInt (1); - rs.close (); - assertCondition (id1 == 99); - } catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } - - - - -/** -afterLast() - Should work after a first(). -**/ - public void Var070 () - { - if (checkJdbc20 ()) { - try { - ResultSet rs = statementNoPrefetch_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_POS); - rs.first (); - rs.afterLast (); - rs.previous (); - int id1 = rs.getInt (1); - rs.close (); - assertCondition (id1 == 99); - } catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } - - - - -/** -afterLast() - Should work after an absolute(). -**/ - public void Var071 () - { - if (checkJdbc20 ()) { - try { - ResultSet rs = statementNoPrefetch_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_POS); - rs.absolute (50); - rs.afterLast (); - rs.previous (); - int id1 = rs.getInt (1); - rs.close (); - assertCondition (id1 == 99); - } catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } - - - - -/** -afterLast() - Should work after a relative(). -**/ - public void Var072 () - { - if (checkJdbc20 ()) { - try { - ResultSet rs = statementNoPrefetch_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_POS); - rs.relative (75); - rs.afterLast (); - rs.previous (); - int id1 = rs.getInt (1); - rs.close (); - assertCondition (id1 == 99); - } catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } - - - - -/** -afterLast() - Should work after a next(). -**/ - public void Var073 () - { - if (checkJdbc20 ()) { - try { - ResultSet rs = statementNoPrefetch_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_POS); - rs.next (); - rs.afterLast (); - rs.previous (); - int id1 = rs.getInt (1); - rs.close (); - assertCondition (id1 == 99); - } catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } - - - -/** -afterLast() - Should work after a previous(). -**/ - public void Var074 () - { - if (checkJdbc20 ()) { - try { - ResultSet rs = statementNoPrefetch_.executeQuery ("SELECT ID, VALUE FROM " - + JDRSTest.RSTEST_POS); - rs.last (); - rs.previous (); - rs.afterLast (); - rs.previous (); - int id1 = rs.getInt ("ID"); - rs.close (); - assertCondition (id1 == 99); - } catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } - - - -/** -afterLast() - Should work after a last(). -**/ - public void Var075 () - { - if (checkJdbc20 ()) { - try { - ResultSet rs = statementNoPrefetch_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_POS); - rs.last (); - rs.afterLast (); - rs.previous (); - int id1 = rs.getInt (1); - rs.close (); - assertCondition (id1 == 99); - } catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } - - - - -/** -afterLast() - Should work after an afterLast(). -**/ - public void Var076 () - { - if (checkJdbc20 ()) { - try { - ResultSet rs = statementNoPrefetch_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_POS); - rs.afterLast (); - rs.afterLast (); - rs.previous (); - int id1 = rs.getInt (1); - rs.close (); - assertCondition (id1 == 99); - } catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } - - - -/** -afterLast() - Should work after a moveToInsertRow(). -**/ - public void Var077 () - { - if (checkJdbc20 ()) { - try { - ResultSet rs = statementNoPrefetch_.executeQuery ("SELECT ID, VALUE FROM " - + JDRSTest.RSTEST_POS + " FOR UPDATE"); - rs.absolute (-43); - rs.moveToInsertRow (); - rs.afterLast (); - rs.previous (); - int id1 = rs.getInt (1); - rs.close (); - assertCondition (id1 == 99); - } catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } - - - -/** -afterLast() - Should work after a moveToInsertRow(), -then moveToCurrentRow(). -**/ - public void Var078 () - { - if (checkJdbc20 ()) { - try { - ResultSet rs = statementNoPrefetch_.executeQuery ("SELECT ID, VALUE FROM " - + JDRSTest.RSTEST_POS + " FOR UPDATE"); - rs.last (); - rs.previous (); - rs.previous (); - rs.previous (); - rs.moveToInsertRow (); - rs.moveToCurrentRow (); - rs.afterLast (); - rs.previous (); - int id1 = rs.getInt (1); - rs.close (); - assertCondition (id1 == 99); - } catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } - - - -/** -afterLast() - Should clear any warnings. -**/ - @SuppressWarnings("deprecation") - public void Var079 () - { - if (checkJdbc20 ()) { - try { - Statement s = connectionNoPrefetch_.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, - ResultSet.CONCUR_UPDATABLE); - ResultSet rs = s.executeQuery ("SELECT C_KEY,C_CHAR_50 FROM " + JDRSTest.RSTEST_GET); - JDRSTest.position0 (rs, "CHAR_FLOAT"); - - // Force a warning (data truncation). - rs.getBigDecimal("C_CHAR_50", 0); - - SQLWarning before = rs.getWarnings (); - rs.afterLast (); - SQLWarning after = rs.getWarnings (); - rs.close (); - s.close (); - assertCondition ((before != null) && (after == null)); - } catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } - - - -/** -afterLast() - Set max rows and fetch the rows using afterLast(). -Max rows should not affect this. Native JDBC honors the max rows -setting on all cursor positioning methods. The last row in this -case has the value 50. -**/ - public void Var080 () - { - if (checkJdbc20 ()) { - try { - ResultSet rs = statement2NoPrefetch_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_POS); - rs.afterLast (); - rs.previous (); - int id1 = rs.getInt (1); - rs.close (); - - assertCondition (id1 == 50); - - } catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } - - - -/** -afterLast() - Update the rows using afterLast(). -**/ - public void Var081 () - { - if (checkJdbc20 ()) { - try { - // Update each value. - ResultSet rs = statementNoPrefetch_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_POS + " FOR UPDATE OF VALUE"); - PreparedStatement ps = connectionNoPrefetch_.prepareStatement ("UPDATE " - + JDRSTest.RSTEST_POS + " SET VALUE = 'AFTERLAST' WHERE CURRENT OF " - + rs.getCursorName ()); - rs.afterLast (); - rs.previous (); - ps.execute (); - rs.close (); - ps.close (); - - // Go through the result set again as a check. - // It is okay to just use next() here. - ResultSet rs2 = statementNoPrefetch_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_POS); - for (int i = 1; i <= 99; ++i) - rs2.next (); - String s1 = rs2.getString (2); - rs2.close (); - - assertCondition (s1.equals ("AFTERLAST")); - } catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } - - - -// TEST NOTE: It would be nice to verify that afterLast() implicity -// closes a previously retrieved InputStream. However -// it is not obvious how to check that an InputStream -// has been closed. - - - -/** -isAfterLast() - Should return false on an empty result set with -no positioning. -**/ - public void Var082 () - { - if (checkJdbc20 ()) { - try { - ResultSet rs = statementNoPrefetch_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_POS + " WHERE ID = -1"); - boolean success = rs.isAfterLast (); - rs.close (); - assertCondition (success == false); - } catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } - - - -/** -isAfterLast() - Should return false on an empty result set even after -explicitly positioning the cursor using afterLast(). -**/ - public void Var083 () - { - if (checkJdbc20 ()) { - try { - ResultSet rs = statementNoPrefetch_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_POS + " WHERE ID = -1"); - rs.afterLast (); - boolean success = rs.isAfterLast (); - rs.close (); - assertCondition (success == false); - } catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } - - - -/** -isAfterLast() - Should throw an exception on a closed result set. -**/ - public void Var084 () - { - if (checkJdbc20 ()) { - try { - ResultSet rs = statementNoPrefetch_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_POS); - rs.close (); - rs.isAfterLast (); - failed ("Didn't throw SQLException for calling isAfterLast on a closed result set"); - } catch (Exception e) { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } - } - - - -/** -isAfterLast() - Should throw an exception on a cancelled statement. -**/ - public void Var085 () - { - if (checkJdbc20 ()) { - try { - ResultSet rs = statementNoPrefetch_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_POS); - statementNoPrefetch_.cancel (); - rs.isAfterLast (); - failed ("Didn't throw SQLException for calling isAfterLast on a cancelled statement "); - } catch (Exception e) { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } - } - - - -/** -isAfterLast() - Should return false on a 1 row result set when positioned -before the only row. -**/ - public void Var086 () - { - if (checkJdbc20 ()) { - try { - ResultSet rs = statementNoPrefetch_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_POS + " WHERE ID = 1"); - boolean success = rs.isAfterLast (); - rs.close (); - assertCondition (success == false); - } catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } - - - -/** -isAfterLast() - Should return false on a 1 row result set when positioned -on the only row. -**/ - public void Var087 () - { - if (checkJdbc20 ()) { - try { - ResultSet rs = statementNoPrefetch_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_POS + " WHERE ID = 1"); - rs.next (); - boolean success = rs.isAfterLast (); - rs.close (); - assertCondition (success == false); - } catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } - - - -/** -isAfterLast() - Should return true on a 1 row result set when positioned -after the only row. -**/ - public void Var088() - { - if (checkJdbc20 ()) { - try { - ResultSet rs = statementNoPrefetch_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_POS + " WHERE ID = 1"); - rs.next (); - rs.next (); - boolean success = rs.isAfterLast (); - rs.close (); - assertCondition (success == true); - } catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } - - - -/** -isAfterLast() - Should return false on a large result set when -not after the last row. -**/ - public void Var089 () - { - if (checkJdbc20 ()) { - try { - ResultSet rs = statementNoPrefetch_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_POS); - rs.last (); - boolean success = rs.isAfterLast (); - rs.close (); - assertCondition (success == false); - } catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } - - - -/** -isAfterLast() - Should return true on a large result set when -positioned after the last row. -**/ - public void Var090 () - { - if (checkJdbc20 ()) { - try { - ResultSet rs = statementNoPrefetch_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_POS); - rs.last (); - rs.next (); - boolean success = rs.isAfterLast (); - rs.close (); - assertCondition (success == true); - } catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } - - - -/** -isAfterLast() - Should return false on a "simple" result set -when not after the last row. -**/ - public void Var091 () - { - if (checkJdbc20 ()) { - try { - ResultSet rs = dmdNoPrefetch_.getTableTypes (); - boolean success = rs.isAfterLast (); - rs.close (); - assertCondition (success == false); - } catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } - - - -/** -isAfterLast() - Should return true on a "simple" result set -when positioned after the last row. -**/ - public void Var092 () - { - if (checkJdbc20 ()) { - try { - String message="Changed by native 08/03/2005. Not all rows processed: Rows Processed: "; - ResultSet rs = dmdNoPrefetch_.getTableTypes (); - rs.next (); - message+=rs.getString("TABLE_TYPE")+","; - rs.next (); - message+=rs.getString("TABLE_TYPE")+","; - rs.next (); - message+=rs.getString("TABLE_TYPE")+","; - rs.next (); - message+=rs.getString("TABLE_TYPE")+","; - if(true) { // @C2A V5R3 and higher have Materialized Query Tables - rs.next(); // @C2A - message+=rs.getString("TABLE_TYPE")+","; - } - if(true) { // @C3A V5R3 and should have Aliases - rs.next(); // @C3A - } - if (getRelease() > JDTestDriver.RELEASE_V7R6M0) { - rs.next(); - } - - boolean success = rs.isAfterLast (); - rs.close (); - assertCondition (success == true, message); - } catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } - - - -/** -isAfterLast() - Should return false on a "mapped" result set -when not after the last row. - -SQL400 - We can't support scrollable metadata resultsets (CLI/DB restriction). -**/ - public void Var093 () - { - if (isToolboxDriver() && !isSysibmMetadata()) { - if (checkJdbc20 ()) { - try { - ResultSet rs = dmdNoPrefetch_.getColumns (null, "QIWS", - "QCUSTCDT", "%"); - rs.next (); - rs.relative (4); - boolean success = rs.isAfterLast (); - rs.close (); - assertCondition (success == false); - } catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } else { - notApplicable(); - } - } - - - -/** -isAfterLast() - Should return true on a "mapped" result set -when positioned to the last row. - -SQL400 - We can't support scrollable metadata resultsets (CLI/DB restriction). -**/ - public void Var094 () - { - if (isToolboxDriver() && !isSysibmMetadata()) { - if (checkJdbc20 ()) { - try { - ResultSet rs = dmdNoPrefetch_.getColumns (null, "QIWS", - "QCUSTCDT", "%"); - rs.afterLast (); - boolean success = rs.isAfterLast (); - rs.close (); - assertCondition (success == true); - } catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } else { - notApplicable(); - } - } - - - -/** -isAfterLast() - Should return false after a beforeFirst(). -**/ - public void Var095 () - { - if (checkJdbc20 ()) { - try { - ResultSet rs = statementNoPrefetch_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_POS); - rs.beforeFirst (); - boolean success = rs.isAfterLast (); - rs.close (); - assertCondition (success == false); - } catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } - - - - -/** -isAfterLast() - Should return false after a first(). -**/ - public void Var096 () - { - if (checkJdbc20 ()) { - try { - ResultSet rs = statementNoPrefetch_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_POS); - rs.first (); - boolean success = rs.isAfterLast (); - rs.close (); - assertCondition (success == false); - } catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } - - - - -/** -isAfterLast() - Should return false after an absolute(+) to a -row other than after the last. -**/ - public void Var097 () - { - if (checkJdbc20 ()) { - try { - ResultSet rs = statementNoPrefetch_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_POS); - rs.absolute (50); - boolean success = rs.isAfterLast (); - rs.close (); - assertCondition (success == false); - } catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } - - - - -/** -isAfterLast() - Should return true after an absolute(+) to -after the last row. -**/ - public void Var098 () - { - if (checkJdbc20 ()) { - try { - ResultSet rs = statementNoPrefetch_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_POS); - rs.absolute (100); - boolean success = rs.isAfterLast (); - rs.close (); - assertCondition (success == true); - } catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } - - - - -/** -isAfterLast() - Should return false after an absolute(-) to a -row other than after the last. -**/ - public void Var099 () - { - if (checkJdbc20 ()) { - try { - ResultSet rs = statementNoPrefetch_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_POS); - rs.absolute (-50); - boolean success = rs.isAfterLast (); - rs.close (); - assertCondition (success == false); - } catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } - - - - -/** -isAfterLast() - Should return true after an absolute(-) to after -the last row. -(It is not really possible to test this variation!) -**/ - public void Var100 () - { - if (checkJdbc20 ()) { - try { - ResultSet rs = statementNoPrefetch_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_POS); - rs.absolute (-1); - boolean success = rs.isAfterLast (); - rs.close (); - assertCondition (success == false); - } catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } - - - - -/** -isAfterLast() - Should return false after a relative(+) to a -row other than after the last. -**/ - public void Var101 () - { - if (checkJdbc20 ()) { - try { - ResultSet rs = statementNoPrefetch_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_POS); - rs.next (); - rs.relative (39); - boolean success = rs.isAfterLast (); - rs.close (); - assertCondition (success == false); - } catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } - - - - -/** -isAfterLast() - Should return true after a relative(+) to -after the last row. -**/ - public void Var102 () - { - if (checkJdbc20 ()) { - try { - ResultSet rs = statementNoPrefetch_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_POS); - rs.next (); - rs.relative (99); - boolean success = rs.isAfterLast (); - rs.close (); - assertCondition (success == true); - } catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } - - - - -/** -isAfterLast() - Should return false after a relative(-) to a -row other than after the last. -**/ - public void Var103 () - { - if (checkJdbc20 ()) { - try { - ResultSet rs = statementNoPrefetch_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_POS); - rs.last (); - rs.relative (-50); - boolean success = rs.isAfterLast (); - rs.close (); - assertCondition (success == false); - } catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } - - - - -/** -isAfterLast() - Should return false after a next() when not after -the last row. -**/ - public void Var104 () - { - if (checkJdbc20 ()) { - try { - ResultSet rs = statementNoPrefetch_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_POS); - rs.next (); - boolean success = rs.isAfterLast (); - rs.close (); - assertCondition (success == false); - } catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } - - - -/** -isAfterLast() - Should return true after a next() when positioned -after the last row. -**/ - public void Var105 () - { - if (checkJdbc20 ()) { - try { - ResultSet rs = statementNoPrefetch_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_POS); - for (int i = 1; i <= 100; ++i) - rs.next (); - boolean success = rs.isAfterLast (); - rs.close (); - assertCondition (success == true); - } catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } - - - -/** -isAfterLast() - Should return false after a previous() when not -after the last row. -**/ - public void Var106 () - { - if (checkJdbc20 ()) { - try { - ResultSet rs = statementNoPrefetch_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_POS); - rs.absolute (50); - rs.previous (); - boolean success = rs.isAfterLast (); - rs.close (); - assertCondition (success == false); - } catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } - - - -/** -isAfterLast() - Should return false after a last(). -**/ - public void Var107 () - { - if (checkJdbc20 ()) { - try { - ResultSet rs = statementNoPrefetch_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_POS); - rs.last (); - boolean success = rs.isAfterLast (); - rs.close (); - assertCondition (success == false); - } catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } - - - - -/** -isAfterLast() - Should return true after an afterLast(). -**/ - public void Var108 () - { - if (checkJdbc20 ()) { - try { - ResultSet rs = statementNoPrefetch_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_POS); - rs.afterLast (); - boolean success = rs.isAfterLast (); - rs.close (); - assertCondition (success == true); - } catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } - - - -/** -isAfterLast() - Should return false after a moveToInsertRow(). -**/ - public void Var109 () - { - if (checkJdbc20 ()) { - try { - ResultSet rs = statementNoPrefetch_.executeQuery ("SELECT ID, VALUE FROM " - + JDRSTest.RSTEST_POS + " FOR UPDATE"); - rs.absolute (-43); - rs.moveToInsertRow (); - boolean success = rs.isAfterLast (); - rs.close (); - assertCondition (success == false); - } catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } - - - -/** -isAfterLast() - Should return false after a moveToInsertRow(), -then moveToCurrentRow() when not after the last row. -**/ - public void Var110 () - { - if (checkJdbc20 ()) { - try { - ResultSet rs = statementNoPrefetch_.executeQuery ("SELECT ID, VALUE FROM " - + JDRSTest.RSTEST_POS + " FOR UPDATE"); - rs.last (); - rs.previous (); - rs.previous (); - rs.previous (); - rs.moveToInsertRow (); - rs.moveToCurrentRow (); - boolean success = rs.isAfterLast (); - rs.close (); - assertCondition (success == false); - } catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } - - - -/** -isAfterLast() - Should return true after a moveToInsertRow(), -then moveToCurrentRow() when after the last row. -**/ - public void Var111 () - { - if (checkJdbc20 ()) { - try { - ResultSet rs = statementNoPrefetch_.executeQuery ("SELECT ID, VALUE FROM " - + JDRSTest.RSTEST_POS + " FOR UPDATE"); - rs.afterLast (); - rs.moveToInsertRow (); - rs.moveToCurrentRow (); - boolean success = rs.isAfterLast (); - rs.close (); - assertCondition (success == true); - } catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } - - - -/** -isAfterLast() - Set max rows and fetch the rows using next(), -Verify that max rows is honored. -**/ - public void Var112 () - { - if (checkJdbc20 ()) { - try { - ResultSet rs = statement2NoPrefetch_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_POS); - for (int i = 1; i <= 51; ++i) - rs.next (); - - boolean success = rs.isAfterLast (); - rs.close (); - assertCondition (success == true); - } catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } - - -/** - isAfterLast() -- Verify that isAfterLast does not move the cursor when - called before the beginning of a result set row. This was a bug in the - native driver reported by APAR SE20242 -**/ - public void Var113 () - { - if (checkJdbc20 ()) { - try { - ResultSet rs = statementNoPrefetch_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_POS + " WHERE ID = 1"); - boolean success = rs.isAfterLast (); - boolean fetched = rs.next(); - rs.close (); - assertCondition ((success == false) && (fetched==true), "afterLast returned "+success+" sb false and next returned "+fetched+" sb true -- added by native driver (08/03/2005) for APAR SE20242"); - } catch (Exception e) { - failed (e, "Unexpected Exception -- added by native driver (08/03/2005)"); - } - } - } - -/** -isAfterLast() - Should return false after a first() even if the result set is empty. -**/ - public void Var114 () - { - if (checkJdbc20 ()) { - try { - ResultSet rs = statementNoPrefetch_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_POS +" where 0=1"); - rs.first (); - boolean success = rs.isAfterLast (); - rs.close (); - assertCondition (success == false, "isAfterLast() should return false for an empty result Set -- Added by native driver 08/03/2005"); - } catch (Exception e) { - failed (e, "Unexpected Exception -- added by native driver (08/03/2005)"); - } - } - } - - + /** + * isAfterLast() - Should return false on an empty result set with no + * positioning. + **/ + public void Var082() { + if (checkJdbc20()) { + try { + ResultSet rs = statementNoPrefetch_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_POS + " WHERE ID = -1"); + boolean success = rs.isAfterLast(); + rs.close(); + assertCondition(success == false); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + + /** + * isAfterLast() - Should return false on an empty result set even after + * explicitly positioning the cursor using afterLast(). + **/ + public void Var083() { + if (checkJdbc20()) { + try { + ResultSet rs = statementNoPrefetch_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_POS + " WHERE ID = -1"); + rs.afterLast(); + boolean success = rs.isAfterLast(); + rs.close(); + assertCondition(success == false); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + + /** + * isAfterLast() - Should throw an exception on a closed result set. + **/ + public void Var084() { + if (checkJdbc20()) { + try { + ResultSet rs = statementNoPrefetch_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_POS); + rs.close(); + rs.isAfterLast(); + failed("Didn't throw SQLException for calling isAfterLast on a closed result set"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } + } + } + + /** + * isAfterLast() - Should throw an exception on a cancelled statement. + **/ + public void Var085() { + if (checkJdbc20()) { + try (ResultSet rs = statementNoPrefetch_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_POS)) { + statementNoPrefetch_.cancel(); + rs.isAfterLast(); + failed("Didn't throw SQLException for calling isAfterLast on a cancelled statement "); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } + } + } + + /** + * isAfterLast() - Should return false on a 1 row result set when positioned + * before the only row. + **/ + public void Var086() { + if (checkJdbc20()) { + try { + ResultSet rs = statementNoPrefetch_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_POS + " WHERE ID = 1"); + boolean success = rs.isAfterLast(); + rs.close(); + assertCondition(success == false); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + + /** + * isAfterLast() - Should return false on a 1 row result set when positioned on + * the only row. + **/ + public void Var087() { + if (checkJdbc20()) { + try { + ResultSet rs = statementNoPrefetch_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_POS + " WHERE ID = 1"); + rs.next(); + boolean success = rs.isAfterLast(); + rs.close(); + assertCondition(success == false); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + + /** + * isAfterLast() - Should return true on a 1 row result set when positioned + * after the only row. + **/ + public void Var088() { + if (checkJdbc20()) { + try { + ResultSet rs = statementNoPrefetch_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_POS + " WHERE ID = 1"); + rs.next(); + rs.next(); + boolean success = rs.isAfterLast(); + rs.close(); + assertCondition(success == true); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + + /** + * isAfterLast() - Should return false on a large result set when not after the + * last row. + **/ + public void Var089() { + if (checkJdbc20()) { + try { + ResultSet rs = statementNoPrefetch_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_POS); + rs.last(); + boolean success = rs.isAfterLast(); + rs.close(); + assertCondition(success == false); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + + /** + * isAfterLast() - Should return true on a large result set when positioned + * after the last row. + **/ + public void Var090() { + if (checkJdbc20()) { + try { + ResultSet rs = statementNoPrefetch_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_POS); + rs.last(); + rs.next(); + boolean success = rs.isAfterLast(); + rs.close(); + assertCondition(success == true); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + + /** + * isAfterLast() - Should return false on a "simple" result set when not after + * the last row. + **/ + public void Var091() { + if (checkJdbc20()) { + try { + ResultSet rs = dmdNoPrefetch_.getTableTypes(); + boolean success = rs.isAfterLast(); + rs.close(); + assertCondition(success == false); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + + /** + * isAfterLast() - Should return true on a "simple" result set when positioned + * after the last row. + **/ + public void Var092() { + if (checkJdbc20()) { + try { + String message = "Changed by native 08/03/2005. Not all rows processed: Rows Processed: "; + ResultSet rs = dmdNoPrefetch_.getTableTypes(); + rs.next(); + message += rs.getString("TABLE_TYPE") + ","; + rs.next(); + message += rs.getString("TABLE_TYPE") + ","; + rs.next(); + message += rs.getString("TABLE_TYPE") + ","; + rs.next(); + message += rs.getString("TABLE_TYPE") + ","; + if (true) { // @C2A V5R3 and higher have Materialized Query Tables + rs.next(); // @C2A + message += rs.getString("TABLE_TYPE") + ","; + } + if (true) { // @C3A V5R3 and should have Aliases + rs.next(); // @C3A + } + if (getRelease() > JDTestDriver.RELEASE_V7R6M0) { + rs.next(); + } + + boolean success = rs.isAfterLast(); + rs.close(); + assertCondition(success == true, message); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + + /** + * isAfterLast() - Should return false on a "mapped" result set when not after + * the last row. + * + * SQL400 - We can't support scrollable metadata resultsets (CLI/DB + * restriction). + **/ + public void Var093() { + if (isToolboxDriver() && !isSysibmMetadata()) { + if (checkJdbc20()) { + try { + ResultSet rs = dmdNoPrefetch_.getColumns(null, "QIWS", "QCUSTCDT", "%"); + rs.next(); + rs.relative(4); + boolean success = rs.isAfterLast(); + rs.close(); + assertCondition(success == false); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } else { + notApplicable(); + } + } + + /** + * isAfterLast() - Should return true on a "mapped" result set when positioned + * to the last row. + * + * SQL400 - We can't support scrollable metadata resultsets (CLI/DB + * restriction). + **/ + public void Var094() { + if (isToolboxDriver() && !isSysibmMetadata()) { + if (checkJdbc20()) { + try { + ResultSet rs = dmdNoPrefetch_.getColumns(null, "QIWS", "QCUSTCDT", "%"); + rs.afterLast(); + boolean success = rs.isAfterLast(); + rs.close(); + assertCondition(success == true); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } else { + notApplicable(); + } + } + + /** + * isAfterLast() - Should return false after a beforeFirst(). + **/ + public void Var095() { + if (checkJdbc20()) { + try { + ResultSet rs = statementNoPrefetch_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_POS); + rs.beforeFirst(); + boolean success = rs.isAfterLast(); + rs.close(); + assertCondition(success == false); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + + /** + * isAfterLast() - Should return false after a first(). + **/ + public void Var096() { + if (checkJdbc20()) { + try { + ResultSet rs = statementNoPrefetch_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_POS); + rs.first(); + boolean success = rs.isAfterLast(); + rs.close(); + assertCondition(success == false); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + + /** + * isAfterLast() - Should return false after an absolute(+) to a row other than + * after the last. + **/ + public void Var097() { + if (checkJdbc20()) { + try { + ResultSet rs = statementNoPrefetch_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_POS); + rs.absolute(50); + boolean success = rs.isAfterLast(); + rs.close(); + assertCondition(success == false); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + + /** + * isAfterLast() - Should return true after an absolute(+) to after the last + * row. + **/ + public void Var098() { + if (checkJdbc20()) { + try { + ResultSet rs = statementNoPrefetch_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_POS); + rs.absolute(100); + boolean success = rs.isAfterLast(); + rs.close(); + assertCondition(success == true); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + + /** + * isAfterLast() - Should return false after an absolute(-) to a row other than + * after the last. + **/ + public void Var099() { + if (checkJdbc20()) { + try { + ResultSet rs = statementNoPrefetch_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_POS); + rs.absolute(-50); + boolean success = rs.isAfterLast(); + rs.close(); + assertCondition(success == false); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + + /** + * isAfterLast() - Should return true after an absolute(-) to after the last + * row. (It is not really possible to test this variation!) + **/ + public void Var100() { + if (checkJdbc20()) { + try { + ResultSet rs = statementNoPrefetch_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_POS); + rs.absolute(-1); + boolean success = rs.isAfterLast(); + rs.close(); + assertCondition(success == false); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + + /** + * isAfterLast() - Should return false after a relative(+) to a row other than + * after the last. + **/ + public void Var101() { + if (checkJdbc20()) { + try { + ResultSet rs = statementNoPrefetch_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_POS); + rs.next(); + rs.relative(39); + boolean success = rs.isAfterLast(); + rs.close(); + assertCondition(success == false); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + + /** + * isAfterLast() - Should return true after a relative(+) to after the last row. + **/ + public void Var102() { + if (checkJdbc20()) { + try { + ResultSet rs = statementNoPrefetch_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_POS); + rs.next(); + rs.relative(99); + boolean success = rs.isAfterLast(); + rs.close(); + assertCondition(success == true); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + + /** + * isAfterLast() - Should return false after a relative(-) to a row other than + * after the last. + **/ + public void Var103() { + if (checkJdbc20()) { + try { + ResultSet rs = statementNoPrefetch_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_POS); + rs.last(); + rs.relative(-50); + boolean success = rs.isAfterLast(); + rs.close(); + assertCondition(success == false); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + + /** + * isAfterLast() - Should return false after a next() when not after the last + * row. + **/ + public void Var104() { + if (checkJdbc20()) { + try { + ResultSet rs = statementNoPrefetch_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_POS); + rs.next(); + boolean success = rs.isAfterLast(); + rs.close(); + assertCondition(success == false); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + + /** + * isAfterLast() - Should return true after a next() when positioned after the + * last row. + **/ + public void Var105() { + if (checkJdbc20()) { + try { + ResultSet rs = statementNoPrefetch_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_POS); + for (int i = 1; i <= 100; ++i) + rs.next(); + boolean success = rs.isAfterLast(); + rs.close(); + assertCondition(success == true); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + + /** + * isAfterLast() - Should return false after a previous() when not after the + * last row. + **/ + public void Var106() { + if (checkJdbc20()) { + try { + ResultSet rs = statementNoPrefetch_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_POS); + rs.absolute(50); + rs.previous(); + boolean success = rs.isAfterLast(); + rs.close(); + assertCondition(success == false); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + + /** + * isAfterLast() - Should return false after a last(). + **/ + public void Var107() { + if (checkJdbc20()) { + try { + ResultSet rs = statementNoPrefetch_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_POS); + rs.last(); + boolean success = rs.isAfterLast(); + rs.close(); + assertCondition(success == false); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + + /** + * isAfterLast() - Should return true after an afterLast(). + **/ + public void Var108() { + if (checkJdbc20()) { + try { + ResultSet rs = statementNoPrefetch_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_POS); + rs.afterLast(); + boolean success = rs.isAfterLast(); + rs.close(); + assertCondition(success == true); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + + /** + * isAfterLast() - Should return false after a moveToInsertRow(). + **/ + public void Var109() { + if (checkJdbc20()) { + try { + ResultSet rs = statementNoPrefetch_ + .executeQuery("SELECT ID, VALUE FROM " + JDRSTest.RSTEST_POS + " FOR UPDATE"); + rs.absolute(-43); + rs.moveToInsertRow(); + boolean success = rs.isAfterLast(); + rs.close(); + assertCondition(success == false); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + + /** + * isAfterLast() - Should return false after a moveToInsertRow(), then + * moveToCurrentRow() when not after the last row. + **/ + public void Var110() { + if (checkJdbc20()) { + try { + ResultSet rs = statementNoPrefetch_ + .executeQuery("SELECT ID, VALUE FROM " + JDRSTest.RSTEST_POS + " FOR UPDATE"); + rs.last(); + rs.previous(); + rs.previous(); + rs.previous(); + rs.moveToInsertRow(); + rs.moveToCurrentRow(); + boolean success = rs.isAfterLast(); + rs.close(); + assertCondition(success == false); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + + /** + * isAfterLast() - Should return true after a moveToInsertRow(), then + * moveToCurrentRow() when after the last row. + **/ + public void Var111() { + if (checkJdbc20()) { + try { + ResultSet rs = statementNoPrefetch_ + .executeQuery("SELECT ID, VALUE FROM " + JDRSTest.RSTEST_POS + " FOR UPDATE"); + rs.afterLast(); + rs.moveToInsertRow(); + rs.moveToCurrentRow(); + boolean success = rs.isAfterLast(); + rs.close(); + assertCondition(success == true); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + + /** + * isAfterLast() - Set max rows and fetch the rows using next(), Verify that max + * rows is honored. + **/ + public void Var112() { + if (checkJdbc20()) { + try { + ResultSet rs = statement2NoPrefetch_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_POS); + for (int i = 1; i <= 51; ++i) + rs.next(); + + boolean success = rs.isAfterLast(); + rs.close(); + assertCondition(success == true); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + + /** + * isAfterLast() -- Verify that isAfterLast does not move the cursor when called + * before the beginning of a result set row. This was a bug in the native driver + * reported by APAR SE20242 + **/ + public void Var113() { + if (checkJdbc20()) { + try { + ResultSet rs = statementNoPrefetch_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_POS + " WHERE ID = 1"); + boolean success = rs.isAfterLast(); + boolean fetched = rs.next(); + rs.close(); + assertCondition((success == false) && (fetched == true), + "afterLast returned " + success + " sb false and next returned " + fetched + + " sb true -- added by native driver (08/03/2005) for APAR SE20242"); + } catch (Exception e) { + failed(e, "Unexpected Exception -- added by native driver (08/03/2005)"); + } + } + } + + /** + * isAfterLast() - Should return false after a first() even if the result set is + * empty. + **/ + public void Var114() { + if (checkJdbc20()) { + try { + ResultSet rs = statementNoPrefetch_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_POS + " where 0=1"); + rs.first(); + boolean success = rs.isAfterLast(); + rs.close(); + assertCondition(success == false, + "isAfterLast() should return false for an empty result Set -- Added by native driver 08/03/2005"); + } catch (Exception e) { + failed(e, "Unexpected Exception -- added by native driver (08/03/2005)"); + } + } + } } - - - diff --git a/src/test/JD/RS/JDRSBeforeFirst.java b/src/test/JD/RS/JDRSBeforeFirst.java index 6ad1adf8..84574c6e 100644 --- a/src/test/JD/RS/JDRSBeforeFirst.java +++ b/src/test/JD/RS/JDRSBeforeFirst.java @@ -18,6 +18,7 @@ import test.JDRSTest; import test.JDTestcase; +import test.JD.JDSerializeFile; import java.io.FileOutputStream; import java.sql.Connection; @@ -25,7 +26,7 @@ import java.sql.PreparedStatement; import java.sql.ResultSet; - +import java.sql.SQLException; import java.sql.SQLWarning; import java.sql.Statement; import java.util.Hashtable; @@ -203,9 +204,8 @@ public void Var002 () public void Var003 () { if (checkJdbc20 ()) { - try { - ResultSet rs = statement_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_POS); + try (ResultSet rs = statement_.executeQuery ("SELECT * FROM " + + JDRSTest.RSTEST_POS)) { statement_.cancel (); rs.beforeFirst (); failed ("Didn't throw SQLException"); @@ -224,11 +224,10 @@ public void Var003 () public void Var004 () { if (checkJdbc20 ()) { - try { - Statement s = connection_.createStatement (ResultSet.TYPE_FORWARD_ONLY, - ResultSet.CONCUR_READ_ONLY); + try (Statement s = connection_.createStatement (ResultSet.TYPE_FORWARD_ONLY, + ResultSet.CONCUR_READ_ONLY); ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_POS); + + JDRSTest.RSTEST_POS)) { rs.beforeFirst (); failed ("Didn't throw SQLException"); } @@ -654,7 +653,9 @@ public void Var020 () public void Var021 () { if (checkJdbc20 ()) { - try { + JDSerializeFile serializeFile = null; + try { + serializeFile = new JDSerializeFile(connection_, JDRSTest.RSTEST_POS); // Update each value. ResultSet rs = statement_.executeQuery ("SELECT * FROM " + JDRSTest.RSTEST_POS + " FOR UPDATE OF VALUE"); @@ -679,6 +680,14 @@ public void Var021 () } catch (Exception e) { failed (e, "Unexpected Exception"); + } finally { + if (serializeFile != null) { + try { + serializeFile.close(); + } catch (SQLException e) { + e.printStackTrace(); + } + } } } } @@ -764,9 +773,8 @@ public void Var024 () public void Var025 () { if (checkJdbc20 ()) { - try { - ResultSet rs = statement_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_POS); + try (ResultSet rs = statement_.executeQuery ("SELECT * FROM " + + JDRSTest.RSTEST_POS)) { statement_.cancel (); rs.isBeforeFirst (); failed ("Didn't throw SQLException"); @@ -1396,10 +1404,8 @@ public void Var051 () if (checkNative()) { StringBuffer sb = new StringBuffer(); String sql = "Select 'A' from sysibm.sysdummy1 UNION Select 'B' from sysibm.sysdummy1 UNION SELECT 'C' from sysibm.sysdummy1"; - try { - boolean passed=true; - ResultSet rs = statementNoPrefetch_.executeQuery (sql); - + boolean passed=true; + try (ResultSet rs = statementNoPrefetch_.executeQuery (sql)) { boolean fetch1 = rs.next(); if (!fetch1) { passed=false; sb.append("fetch1 returned "+fetch1+"\n"); } @@ -1476,9 +1482,8 @@ public void Var052 () public void Var053 () { if (checkJdbc20 ()) { - try { - ResultSet rs = statementNoPrefetch_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_POS); + try (ResultSet rs = statementNoPrefetch_.executeQuery ("SELECT * FROM " + + JDRSTest.RSTEST_POS)) { statementNoPrefetch_.cancel (); rs.beforeFirst (); failed ("Didn't throw SQLException"); @@ -1497,11 +1502,10 @@ public void Var053 () public void Var054 () { if (checkJdbc20 ()) { - try { - Statement s = connectionNoPrefetch_.createStatement (ResultSet.TYPE_FORWARD_ONLY, - ResultSet.CONCUR_READ_ONLY); + try (Statement s = connectionNoPrefetch_.createStatement (ResultSet.TYPE_FORWARD_ONLY, + ResultSet.CONCUR_READ_ONLY); ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_POS); + + JDRSTest.RSTEST_POS)) { rs.beforeFirst (); failed ("Didn't throw SQLException"); } @@ -1927,7 +1931,9 @@ public void Var070 () public void Var071 () { if (checkJdbc20 ()) { - try { + JDSerializeFile serializeFile = null; + try { + serializeFile = new JDSerializeFile(connection_, JDRSTest.RSTEST_POS); // Update each value. ResultSet rs = statementNoPrefetch_.executeQuery ("SELECT * FROM " + JDRSTest.RSTEST_POS + " FOR UPDATE OF VALUE"); @@ -1952,6 +1958,14 @@ public void Var071 () } catch (Exception e) { failed (e, "Unexpected Exception"); + } finally { + if (serializeFile != null) { + try { + serializeFile.close(); + } catch (SQLException e) { + e.printStackTrace(); + } + } } } } @@ -2037,9 +2051,8 @@ public void Var074 () public void Var075 () { if (checkJdbc20 ()) { - try { - ResultSet rs = statementNoPrefetch_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_POS); + try (ResultSet rs = statementNoPrefetch_.executeQuery ("SELECT * FROM " + + JDRSTest.RSTEST_POS)) { statementNoPrefetch_.cancel (); rs.isBeforeFirst (); failed ("Didn't throw SQLException"); diff --git a/src/test/JD/RS/JDRSCachedRowSet.java b/src/test/JD/RS/JDRSCachedRowSet.java index 443f593b..8ae8f5c5 100644 --- a/src/test/JD/RS/JDRSCachedRowSet.java +++ b/src/test/JD/RS/JDRSCachedRowSet.java @@ -1214,7 +1214,7 @@ public void Var043() JDReflectionUtil.callMethod_V(crs,"execute"); JDReflectionUtil.callMethod_B(crs,"next"); crs.updateString(1, "ZERO"); - crs.updateRow(); + crs.updateRow(); /* unique table */ boolean check1 = crs.rowUpdated(); JDReflectionUtil.callMethod_V(crs,"setTableName",TABLE_); JDReflectionUtil.callMethod_V(crs,"acceptChanges"); @@ -1248,7 +1248,7 @@ public void Var044() JDReflectionUtil.callMethod_B(crs,"next"); crs.updateString(1, "FIRST"); crs.cancelRowUpdates(); - crs.updateRow(); + crs.updateRow(); /* unique table */ boolean check1 = crs.rowUpdated(); JDReflectionUtil.callMethod_V(crs,"setTableName",TABLE_); JDReflectionUtil.callMethod_V(crs,"acceptChanges"); diff --git a/src/test/JD/RS/JDRSCursorScroll.java b/src/test/JD/RS/JDRSCursorScroll.java index ea07cce4..f97580ba 100644 --- a/src/test/JD/RS/JDRSCursorScroll.java +++ b/src/test/JD/RS/JDRSCursorScroll.java @@ -62,7 +62,7 @@ public static void main(String args[]) throws Exception { boolean cursorFromCall = false; boolean cursorSensitive = false; - + String suffix=""; /** Constructor. **/ @@ -1550,7 +1550,7 @@ public boolean checkRow49(ResultSet rs, int expectedRow, int lastRow, void setupTable49 () throws Exception { if (!table49ready) { Connection c = null; - table49 = JDRSTest.COLLECTION+".JDRSCRS49"; + table49 = JDRSTest.COLLECTION+".JDRSCRS49"+suffix; initTable(statement_, table49, "( ROWNUMBER INT, INFO VARCHAR(91))"); PreparedStatement ps; if ( getDriver() == JDTestDriver.DRIVER_NATIVE) { @@ -1572,6 +1572,7 @@ void setupTable49 () throws Exception { } } if (batchCount > 0) ps.executeBatch(); + ps.close(); if (c != null) { c.commit(); c.close(); @@ -1825,10 +1826,9 @@ public void Var050() { int TABLESIZE = 100000; int RUNMILLIS = 10000; - try{ + try (Statement stmt = connection_.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, + ResultSet.CONCUR_READ_ONLY);) { setupTable49(); - Statement stmt = connection_.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, - ResultSet.CONCUR_READ_ONLY); ResultSet rs=stmt.executeQuery("SELECT count(*) FROM " + table49 ); rs.next(); int rowCount = rs.getInt(1); @@ -1996,6 +1996,9 @@ public void Var050() } catch(Exception e){ + if (cs != null) try { + cs.close(); + } catch (Exception e2) { e2.printStackTrace(); } failed(e, "Unexpected Exception"); } } diff --git a/src/test/JD/RS/JDRSCursorScrollInsensitiveFromCall.java b/src/test/JD/RS/JDRSCursorScrollInsensitiveFromCall.java index 7a3bd88a..31c2f219 100644 --- a/src/test/JD/RS/JDRSCursorScrollInsensitiveFromCall.java +++ b/src/test/JD/RS/JDRSCursorScrollInsensitiveFromCall.java @@ -57,6 +57,7 @@ public JDRSCursorScrollInsensitiveFromCall (AS400 systemObject, password); cursorFromCall = true; cursorSensitive = false; + suffix="I"; } diff --git a/src/test/JD/RS/JDRSCursorScrollSensitiveFromCall.java b/src/test/JD/RS/JDRSCursorScrollSensitiveFromCall.java index 92e83f9b..4bc5af87 100644 --- a/src/test/JD/RS/JDRSCursorScrollSensitiveFromCall.java +++ b/src/test/JD/RS/JDRSCursorScrollSensitiveFromCall.java @@ -57,6 +57,7 @@ public JDRSCursorScrollSensitiveFromCall (AS400 systemObject, password); cursorFromCall = true; cursorSensitive = true; + suffix="S"; } diff --git a/src/test/JD/RS/JDRSCursorSensitivity.java b/src/test/JD/RS/JDRSCursorSensitivity.java index 0f1bbd5e..f72a09f6 100644 --- a/src/test/JD/RS/JDRSCursorSensitivity.java +++ b/src/test/JD/RS/JDRSCursorSensitivity.java @@ -11,1193 +11,1332 @@ // /////////////////////////////////////////////////////////////////////////////// - package test.JD.RS; import com.ibm.as400.access.*; import test.JDRSTest; import test.JDTestcase; +import test.JD.JDSerializeFile; import java.io.FileOutputStream; import java.sql.*; import java.util.*; - - /** -Testcase JDRSCursorSensitivity. This tests the cursor sensitivity connection property along with the following -types of the JDBC ResultSet class: - -
    -
  • TYPE_FORWARD_ONLY -
  • TYPE_SCROLL_INSENSITIVE -
  • TYPE_SCROLL_SENSITIVE -
-**/ -public class JDRSCursorSensitivity -extends JDTestcase { + * Testcase JDRSCursorSensitivity. This tests the cursor sensitivity connection + * property along with the following types of the JDBC ResultSet class: + * + *
    + *
  • TYPE_FORWARD_ONLY + *
  • TYPE_SCROLL_INSENSITIVE + *
  • TYPE_SCROLL_SENSITIVE + *
+ **/ +public class JDRSCursorSensitivity extends JDTestcase { public static void main(String args[]) throws Exception { - String[] newArgs = new String[args.length+2]; - newArgs[0] = "-tc"; - newArgs[1] = "JDRSCursorSensitivity"; - for (int i = 0; i < args.length; i++) { - newArgs[2+i]=args[i]; - } - test.JDRSTest.main(newArgs); - } - - - - // Private data. - private Connection connectionDefault_; - private Connection connectionAsensitive_; - private Connection connectionSensitive_; - private Connection connectionInsensitive_; - - - -/** -Constructor. -**/ - public JDRSCursorSensitivity (AS400 systemObject, - Hashtable> namesAndVars, - int runMode, - FileOutputStream fileOutputStream, - - String password) - { - super (systemObject, "JDRSCursorSensitivity", - namesAndVars, runMode, fileOutputStream, - password); + String[] newArgs = new String[args.length + 2]; + newArgs[0] = "-tc"; + newArgs[1] = "JDRSCursorSensitivity"; + for (int i = 0; i < args.length; i++) { + newArgs[2 + i] = args[i]; } - - - -/** -Performs setup needed before running variations. - -@exception Exception If an exception occurs. -**/ - protected void setup () - throws Exception - { - if (isJdbc20 ()) - { - connectionDefault_ = testDriver_.getConnection (baseURL_ + ";data truncation=true", userId_, encryptedPassword_,"JDRSCursorSensitivity1"); - connectionAsensitive_ = testDriver_.getConnection (baseURL_ + ";data truncation=true;cursor sensitivity=asensitive", userId_, encryptedPassword_,"JDRSCursorSensitivity2"); - connectionSensitive_ = testDriver_.getConnection (baseURL_ + ";data truncation=true;cursor sensitivity=sensitive", userId_, encryptedPassword_,"JDRSCursorSensitivity3"); - connectionInsensitive_ = testDriver_.getConnection (baseURL_ + ";data truncation=true;cursor sensitivity=insensitive", userId_, encryptedPassword_,"JDRSCursorSensitivity4"); - } + test.JDRSTest.main(newArgs); + } + + // Private data. + private Connection connectionDefault_; + private Connection connectionAsensitive_; + private Connection connectionSensitive_; + private Connection connectionInsensitive_; + + /** + * Constructor. + **/ + public JDRSCursorSensitivity(AS400 systemObject, Hashtable> namesAndVars, int runMode, + FileOutputStream fileOutputStream, + + String password) { + super(systemObject, "JDRSCursorSensitivity", namesAndVars, runMode, fileOutputStream, password); + } + + /** + * Performs setup needed before running variations. + * + * @exception Exception If an exception occurs. + **/ + protected void setup() throws Exception { + if (isJdbc20()) { + connectionDefault_ = testDriver_.getConnection(baseURL_ + ";data truncation=true", userId_, encryptedPassword_, + "JDRSCursorSensitivity1"); + connectionAsensitive_ = testDriver_.getConnection( + baseURL_ + ";data truncation=true;cursor sensitivity=asensitive", userId_, encryptedPassword_, + "JDRSCursorSensitivity2"); + connectionSensitive_ = testDriver_.getConnection(baseURL_ + ";data truncation=true;cursor sensitivity=sensitive", + userId_, encryptedPassword_, "JDRSCursorSensitivity3"); + connectionInsensitive_ = testDriver_.getConnection( + baseURL_ + ";data truncation=true;cursor sensitivity=insensitive", userId_, encryptedPassword_, + "JDRSCursorSensitivity4"); } - - - -/** -Performs cleanup needed after running variations. - -@exception Exception If an exception occurs. -**/ - protected void cleanup () - throws Exception - { - cleanupConnections(); + } + + /** + * Performs cleanup needed after running variations. + * + * @exception Exception If an exception occurs. + **/ + protected void cleanup() throws Exception { + cleanupConnections(); + } + + public void cleanupConnections() throws Exception { + + if (isJdbc20()) { + connectionDefault_.close(); + connectionAsensitive_.close(); + connectionSensitive_.close(); + connectionInsensitive_.close(); } - - public void cleanupConnections() throws Exception { - - if (isJdbc20 ()) - { - connectionDefault_.close (); - connectionAsensitive_.close(); - connectionSensitive_.close(); - connectionInsensitive_.close(); + } + + /** + * The result set should be able to scroll forward if TYPE_FORWARD_ONLY Note: + * Toolbox opens a nonscrollable asensitive cursor + **/ + public void Var001() { + if (checkJdbc20()) { + try { + Statement statement_ = connectionDefault_.createStatement(ResultSet.TYPE_FORWARD_ONLY, + ResultSet.CONCUR_READ_ONLY); + ResultSet rs = statement_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_SENSITIVE); + + boolean success1 = rs.next(); + boolean success2 = rs.next(); + rs.close(); + statement_.close(); + assertCondition(success1 == true && success2 == true); + } catch (Exception e) { + failed(e, "Unexpected Exception - New testcase created by toolbox 5/15/2003"); } } - -/** -The result set should be able to scroll forward if TYPE_FORWARD_ONLY -Note: Toolbox opens a nonscrollable asensitive cursor -**/ - public void Var001 () - { - if (checkJdbc20 ()) - { - try - { - Statement statement_ = connectionDefault_.createStatement (ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY); - ResultSet rs = statement_.executeQuery ("SELECT * FROM " + JDRSTest.RSTEST_SENSITIVE ); - - boolean success1 = rs.next(); - boolean success2 = rs.next(); - rs.close (); - statement_.close(); - assertCondition (success1 == true && success2 == true); - } - catch (Exception e) - { - failed (e, "Unexpected Exception - New testcase created by toolbox 5/15/2003"); - } - } - } - -/** -Exeption should be thrown if try to jump ahead more than one row if TYPE_FORWARD_ONLY -**/ - public void Var002 () - { - if (checkJdbc20()) { - Statement statement_ = null; + } + + /** + * Exeption should be thrown if try to jump ahead more than one row if + * TYPE_FORWARD_ONLY + **/ + public void Var002() { + if (checkJdbc20()) { + Statement statement = null; ResultSet rs = null; - try - { - statement_ = connectionDefault_.createStatement (ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY); - rs = statement_.executeQuery ("SELECT * FROM " + JDRSTest.RSTEST_SENSITIVE ); - - rs.next(); - rs.absolute(3); - rs.close (); - failed("Didn't throw SQLException - New testcase created by toolbox 5/15/2003"); - } - catch (Exception e) - { - assertExceptionIsInstanceOf(e, "java.sql.SQLException"); - try - { - rs.close(); - statement_.close(); - } - catch (Exception c) {} + try { + statement = connectionDefault_.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY); + rs = statement.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_SENSITIVE); + + rs.next(); + rs.absolute(3); + rs.close(); + statement.close(); + failed("Didn't throw SQLException - New testcase created by toolbox 5/15/2003"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + try { + rs.close(); + } catch (Exception c) { + } + try { + statement.close(); + } catch (Exception c) { + } } - } } - -/** -Should show changes made to the database while ResultSet is open if TYPE_SCROLL_INSENSITIVE and CONCUR_UPDATEABLE -Note: If the concurrency is updateable, the toolbox automatically sets the type to TYPE_SCROLL_SENSITIVE -Toolbox opens a scrollable sensitive cursor -**/ - public void Var003 () - { - if (checkJdbc20 ()) { - try - { - Statement statement_ = connectionDefault_.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE); - ResultSet rs = statement_.executeQuery ("SELECT * FROM " + JDRSTest.RSTEST_SENSITIVE ); - rs.absolute(3); - rs.getInt(1); - - Statement statement2_ = connectionDefault_.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE); - ResultSet rs1 = statement2_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_SENSITIVE ); - rs1.absolute(3); - rs1.updateInt(1, 154); - rs1.updateRow(); - rs1.close(); - statement2_.close(); - - rs.beforeFirst(); - rs.absolute(3); - int after = rs.getInt(1); - rs.close (); - statement_.close(); - assertCondition( after == 154, "after is " + after + ", after should be 154"); - } - catch (Exception e) - { - failed(e, "Unexpected Exception - New testcase created by toolbox 5/15/2003"); + } + + /** + * Should show changes made to the database while ResultSet is open if + * TYPE_SCROLL_INSENSITIVE and CONCUR_UPDATEABLE Note: If the concurrency is + * updateable, the toolbox automatically sets the type to TYPE_SCROLL_SENSITIVE + * Toolbox opens a scrollable sensitive cursor + **/ + public void Var003() { + if (checkJdbc20()) { + JDSerializeFile serializeFile = null; + try { + serializeFile = new JDSerializeFile(connectionDefault_, JDRSTest.RSTEST_SENSITIVE); + Statement statement_ = connectionDefault_.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, + ResultSet.CONCUR_UPDATABLE); + ResultSet rs = statement_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_SENSITIVE); + rs.absolute(3); + rs.getInt(1); + + Statement statement2_ = connectionDefault_.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, + ResultSet.CONCUR_UPDATABLE); + ResultSet rs1 = statement2_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_SENSITIVE); + rs1.absolute(3); + rs1.updateInt(1, 154); + rs1.updateRow(); /* serialized */ + rs1.close(); + statement2_.close(); + + rs.beforeFirst(); + rs.absolute(3); + int after = rs.getInt(1); + rs.close(); + statement_.close(); + assertCondition(after == 154, "after is " + after + ", after should be 154"); + } catch (Exception e) { + failed(e, "Unexpected Exception - New testcase created by toolbox 5/15/2003"); + } finally { + if (serializeFile != null) { + try { + serializeFile.close(); + } catch (SQLException e) { + e.printStackTrace(); + } + } } - } } - -/** -Should show changes made to the database while ResultSet is open if TYPE_SCROLL_SENSITIVE and CONCUR_UPDATEABLE -Note: Toolbox opens a scrollable sensitive cursor -**/ - public void Var004 () - { - if (checkJdbc20 ()) { - try - { - Statement statement_ = connectionDefault_.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); - ResultSet rs = statement_.executeQuery ("SELECT * FROM " + JDRSTest.RSTEST_SENSITIVE ); - rs.absolute(4); - rs.getInt(1); - - Statement statement2_ = connectionDefault_.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE); - ResultSet rs1 = statement2_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_SENSITIVE ); - rs1.absolute(4); - rs1.updateInt(1, 154); - rs1.updateRow(); - rs1.close(); - statement2_.close(); - - rs.beforeFirst(); - rs.absolute(4); - int after = rs.getInt(1); - rs.close (); - statement_.close(); - assertCondition( after == 154, "after is " + after + ", after should be 154"); - } - catch (Exception e) - { - failed(e, "Unexpected Exception - New testcase created by toolbox 5/15/2003"); + } + + /** + * Should show changes made to the database while ResultSet is open if + * TYPE_SCROLL_SENSITIVE and CONCUR_UPDATEABLE Note: Toolbox opens a scrollable + * sensitive cursor + **/ + public void Var004() { + if (checkJdbc20()) { + JDSerializeFile serializeFile = null; + try { + serializeFile = new JDSerializeFile(connectionDefault_, JDRSTest.RSTEST_SENSITIVE); + Statement statement_ = connectionDefault_.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, + ResultSet.CONCUR_UPDATABLE); + ResultSet rs = statement_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_SENSITIVE); + rs.absolute(4); + rs.getInt(1); + + Statement statement2_ = connectionDefault_.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, + ResultSet.CONCUR_UPDATABLE); + ResultSet rs1 = statement2_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_SENSITIVE); + rs1.absolute(4); + rs1.updateInt(1, 154); + rs1.updateRow(); /* serialized */ + rs1.close(); + statement2_.close(); + + rs.beforeFirst(); + rs.absolute(4); + int after = rs.getInt(1); + rs.close(); + statement_.close(); + assertCondition(after == 154, "after is " + after + ", after should be 154"); + } catch (Exception e) { + failed(e, "Unexpected Exception - New testcase created by toolbox 5/15/2003"); + } finally { + if (serializeFile != null) { + try { + serializeFile.close(); + } catch (SQLException e) { + e.printStackTrace(); + } + } } - } } - -/** -Shouldn't show changes made to the database while ResultSet is open if TYPE_SCROLL_INSENSITIVE and CONCUR_READ_ONLY -Note: Toolbox opens a scrollable insensitive cursor -**/ - public void Var005 () - { - if (checkJdbc20 ()) { - try - { - Statement statement_ = connectionDefault_.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); - ResultSet rs = statement_.executeQuery ("SELECT * FROM " + JDRSTest.RSTEST_SENSITIVE ); - rs.absolute(5); - int before = rs.getInt(1); - - Statement statement2_ = connectionAsensitive_.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE); - ResultSet rs1 = statement2_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_SENSITIVE ); - rs1.absolute(5); - rs1.updateInt(1, 154); - rs1.updateRow(); - rs1.close(); - statement2_.close(); - - rs.beforeFirst(); - rs.absolute(5); - int after = rs.getInt(1); - rs.close (); - statement_.close(); - assertCondition( after == before, "after is " + after + ", before is " + before + ", after should be " + before); - } - catch (Exception e) - { - failed(e, "Unexpected Exception - New testcase created by toolbox 5/15/2003"); + } + + /** + * Shouldn't show changes made to the database while ResultSet is open if + * TYPE_SCROLL_INSENSITIVE and CONCUR_READ_ONLY Note: Toolbox opens a scrollable + * insensitive cursor + **/ + public void Var005() { + if (checkJdbc20()) { + JDSerializeFile serializeFile = null; + try { + serializeFile = new JDSerializeFile(connectionDefault_, JDRSTest.RSTEST_SENSITIVE); + Statement statement_ = connectionDefault_.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, + ResultSet.CONCUR_READ_ONLY); + ResultSet rs = statement_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_SENSITIVE); + rs.absolute(5); + int before = rs.getInt(1); + + Statement statement2_ = connectionAsensitive_.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, + ResultSet.CONCUR_UPDATABLE); + ResultSet rs1 = statement2_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_SENSITIVE); + rs1.absolute(5); + rs1.updateInt(1, 154); + rs1.updateRow();/* serialized */ + rs1.close(); + statement2_.close(); + + rs.beforeFirst(); + rs.absolute(5); + int after = rs.getInt(1); + rs.close(); + statement_.close(); + assertCondition(after == before, "after is " + after + ", before is " + before + ", after should be " + before); + } catch (Exception e) { + failed(e, "Unexpected Exception - New testcase created by toolbox 5/15/2003"); + } finally { + if (serializeFile != null) { + try { + serializeFile.close(); + } catch (SQLException e) { + e.printStackTrace(); + } + } } - } } - -/** -Should show changes made to the database while ResultSet is open if TYPE_SCROLL_SENSITIVE and CONCUR_READ_ONLY -**/ - public void Var006 () - { - if (checkJdbc20 ()) { - try - { - // Note.. connection_ is default - which is asenstive. Must use the sensitive one. - Statement statement_ = connectionSensitive_.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY); - ResultSet rs = statement_.executeQuery ("SELECT * FROM " + JDRSTest.RSTEST_SENSITIVE ); - rs.absolute(6); - rs.getInt(1); - - Statement statement2_ = connectionDefault_.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE); - ResultSet rs1 = statement2_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_SENSITIVE ); - rs1.absolute(6); - rs1.updateInt(1, 154); - rs1.updateRow(); - rs1.close(); - statement2_.close(); - - rs.beforeFirst(); - rs.absolute(6); - int after = rs.getInt(1); - rs.close (); - statement_.close(); - assertCondition( after == 154, "after is " + after + ", after should be " + 154); - } - catch (Exception e) - { - failed(e, "Unexpected Exception - New testcase created by toolbox 5/15/2003"); + } + + /** + * Should show changes made to the database while ResultSet is open if + * TYPE_SCROLL_SENSITIVE and CONCUR_READ_ONLY + **/ + public void Var006() { + if (checkJdbc20()) { + JDSerializeFile serializeFile = null; + try { + serializeFile = new JDSerializeFile(connectionSensitive_, JDRSTest.RSTEST_SENSITIVE); + // Note.. connection_ is default - which is asenstive. Must use the sensitive + // one. + Statement statement_ = connectionSensitive_.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, + ResultSet.CONCUR_READ_ONLY); + ResultSet rs = statement_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_SENSITIVE); + rs.absolute(6); + rs.getInt(1); + + Statement statement2_ = connectionDefault_.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, + ResultSet.CONCUR_UPDATABLE); + ResultSet rs1 = statement2_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_SENSITIVE); + rs1.absolute(6); + rs1.updateInt(1, 154); + rs1.updateRow();/* serialized */ + rs1.close(); + statement2_.close(); + + rs.beforeFirst(); + rs.absolute(6); + int after = rs.getInt(1); + rs.close(); + statement_.close(); + assertCondition(after == 154, "after is " + after + ", after should be " + 154); + } catch (Exception e) { + failed(e, "Unexpected Exception - New testcase created by toolbox 5/15/2003"); + } finally { + if (serializeFile != null) { + try { + serializeFile.close(); + } catch (SQLException e) { + e.printStackTrace(); + } + } } - } } - -/** -Should show changes made to the database while ResultSet is open if TYPE_SCROLL_INSENSITIVE and CONCUR_UPDATEABLE -cursor sensitivity connection property is equal to insensitive -Note: If the concurrency is updateable, the toolbox automatically sets the type to TYPE_SCROLL_SENSITIVE -Toolbox opens a scrollable sensitive cursor -**/ - public void Var007 () - { - if (checkJdbc20()) { - try - { - Statement statement_ = connectionInsensitive_.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE); - ResultSet rs = statement_.executeQuery ("SELECT * FROM " + JDRSTest.RSTEST_SENSITIVE ); - rs.absolute(7); - rs.getInt(1); - - Statement statement2_ = connectionInsensitive_.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); - ResultSet rs1 = statement2_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_SENSITIVE ); - rs1.absolute(7); - rs1.updateInt(1, 154); - rs1.updateRow(); - rs1.close(); - statement2_.close(); - - rs.beforeFirst(); - rs.absolute(7); - int after = rs.getInt(1); - rs.close (); - statement_.close(); - assertCondition( after == 154, "after is " + after + ", after should be 154"); - } - catch (Exception e) - { - failed(e, "Unexpected Exception - New testcase created by toolbox 5/15/2003"); + } + + /** + * Should show changes made to the database while ResultSet is open if + * TYPE_SCROLL_INSENSITIVE and CONCUR_UPDATEABLE cursor sensitivity connection + * property is equal to insensitive Note: If the concurrency is updateable, the + * toolbox automatically sets the type to TYPE_SCROLL_SENSITIVE Toolbox opens a + * scrollable sensitive cursor + **/ + public void Var007() { + if (checkJdbc20()) { + JDSerializeFile serializeFile = null; + try { + serializeFile = new JDSerializeFile(connectionInsensitive_, JDRSTest.RSTEST_SENSITIVE); + Statement statement_ = connectionInsensitive_.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, + ResultSet.CONCUR_UPDATABLE); + ResultSet rs = statement_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_SENSITIVE); + rs.absolute(7); + rs.getInt(1); + + Statement statement2_ = connectionInsensitive_.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, + ResultSet.CONCUR_UPDATABLE); + ResultSet rs1 = statement2_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_SENSITIVE); + rs1.absolute(7); + rs1.updateInt(1, 154); + rs1.updateRow();/* serialized */ + rs1.close(); + statement2_.close(); + + rs.beforeFirst(); + rs.absolute(7); + int after = rs.getInt(1); + rs.close(); + statement_.close(); + assertCondition(after == 154, "after is " + after + ", after should be 154"); + } catch (Exception e) { + failed(e, "Unexpected Exception - New testcase created by toolbox 5/15/2003"); + } finally { + if (serializeFile != null) { + try { + serializeFile.close(); + } catch (SQLException e) { + e.printStackTrace(); + } + } } - } } - -/** -Should show changes made to the database while ResultSet is open if TYPE_SCROLL_SENSITIVE and CONCUR_UPDATEABLE -cursor sensitivity property is equal to insensitive -Note: Toolbox opens a scrollable sensitive cursor -**/ - public void Var008 () - { - if (checkJdbc20 ()) { - try - { - Statement statement_ = connectionInsensitive_.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); - ResultSet rs = statement_.executeQuery ("SELECT * FROM " + JDRSTest.RSTEST_SENSITIVE ); - rs.absolute(8); - rs.getInt(1); - - Statement statement2_ = connectionInsensitive_.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE); - ResultSet rs1 = statement2_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_SENSITIVE ); - rs1.absolute(8); - rs1.updateInt(1, 154); - rs1.updateRow(); - rs1.close(); - statement2_.close(); - - rs.beforeFirst(); - rs.absolute(8); - int after = rs.getInt(1); - rs.close (); - statement_.close(); - assertCondition( after == 154, "after is " + after + ", after should be 154"); - } - catch (Exception e) - { - failed(e, "Unexpected Exception - New testcase created by toolbox 5/15/2003"); + } + + /** + * Should show changes made to the database while ResultSet is open if + * TYPE_SCROLL_SENSITIVE and CONCUR_UPDATEABLE cursor sensitivity property is + * equal to insensitive Note: Toolbox opens a scrollable sensitive cursor + **/ + public void Var008() { + if (checkJdbc20()) { + JDSerializeFile serializeFile = null; + try { + serializeFile = new JDSerializeFile(connectionInsensitive_, JDRSTest.RSTEST_SENSITIVE); + Statement statement_ = connectionInsensitive_.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, + ResultSet.CONCUR_UPDATABLE); + ResultSet rs = statement_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_SENSITIVE); + rs.absolute(8); + rs.getInt(1); + + Statement statement2_ = connectionInsensitive_.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, + ResultSet.CONCUR_UPDATABLE); + ResultSet rs1 = statement2_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_SENSITIVE); + rs1.absolute(8); + rs1.updateInt(1, 154); + rs1.updateRow();/* serialized */ + rs1.close(); + statement2_.close(); + + rs.beforeFirst(); + rs.absolute(8); + int after = rs.getInt(1); + rs.close(); + statement_.close(); + assertCondition(after == 154, "after is " + after + ", after should be 154"); + } catch (Exception e) { + failed(e, "Unexpected Exception - New testcase created by toolbox 5/15/2003"); + } finally { + if (serializeFile != null) { + try { + serializeFile.close(); + } catch (SQLException e) { + e.printStackTrace(); + } + } } - } } - -/** -Should throw an exception if try to see if changes are made while the ResultSet is open if TYPE_FORWARD_ONLY and CONCUR_UPDATEABLE -cursor sensitivity property is equal to insensitive -Note: Toolbox opens a non-scrollable insensitive cursor -**/ - public void Var009 () - { - if (checkJdbc20 ()) { - Statement statement_ = null; + } + + /** + * Should throw an exception if try to see if changes are made while the + * ResultSet is open if TYPE_FORWARD_ONLY and CONCUR_UPDATEABLE cursor + * sensitivity property is equal to insensitive Note: Toolbox opens a + * non-scrollable insensitive cursor + **/ + public void Var009() { + if (checkJdbc20()) { ResultSet rs = null; - try - { - statement_ = connectionInsensitive_.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE); - rs = statement_.executeQuery ("SELECT * FROM " + JDRSTest.RSTEST_SENSITIVE ); - rs.next(); - rs.getInt(1); - - Statement statement2_ = connectionInsensitive_.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE); - ResultSet rs1 = statement2_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_SENSITIVE ); - rs1.absolute(1); - rs1.updateInt(1, 154); - rs1.updateRow(); - rs1.close(); - statement2_.close(); - - rs.beforeFirst(); - rs.next(); - failed("Didn't throw Exception - New testcase created by toolbox 5/15/2003."); + JDSerializeFile serializeFile = null; + Statement statement = null; + try { + serializeFile = new JDSerializeFile(connectionInsensitive_, JDRSTest.RSTEST_SENSITIVE); + statement = connectionInsensitive_.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE); + rs = statement.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_SENSITIVE); + rs.next(); + rs.getInt(1); + + Statement statement2_ = connectionInsensitive_.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, + ResultSet.CONCUR_UPDATABLE); + ResultSet rs1 = statement2_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_SENSITIVE); + rs1.absolute(1); + rs1.updateInt(1, 154); + rs1.updateRow();/* serialized */ + rs1.close(); + statement2_.close(); + + rs.beforeFirst(); + rs.next(); + rs.close(); + statement.close(); + failed("Didn't throw Exception - New testcase created by toolbox 5/15/2003."); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + try { + rs.close(); + } catch (Exception c) { + } + try { + statement.close(); + } catch (Exception c) { + } + } finally { + if (serializeFile != null) { + try { + serializeFile.close(); + } catch (SQLException e) { + e.printStackTrace(); + } + } } - catch (Exception e) - { - assertExceptionIsInstanceOf(e, "java.sql.SQLException"); - try - { - rs.close(); - statement_.close(); + } + } + + /** + * Shouldn't show changes that are made while the ResultSet is open if + * TYPE_FORWARD_ONLY and CONCUR_UPDATEABLE cursor sensitivity property is equal + * to insensitive Toolbox opens a non-scrollable insensitive cursor + **/ + public void Var010() { + if (checkJdbc20()) { + JDSerializeFile serializeFile = null; + try { + serializeFile = new JDSerializeFile(connectionInsensitive_, JDRSTest.RSTEST_SENSITIVE); + Statement statement_ = connectionInsensitive_.createStatement(ResultSet.TYPE_FORWARD_ONLY, + ResultSet.CONCUR_UPDATABLE); + ResultSet rs = statement_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_SENSITIVE); + rs.next(); + int before = rs.getInt(1); + + Statement statement2_ = connectionInsensitive_.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, + ResultSet.CONCUR_UPDATABLE); + ResultSet rs1 = statement2_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_SENSITIVE); + rs1.absolute(1); + rs1.updateInt(1, 154); + rs1.updateRow();/* serialized */ + rs1.close(); + statement2_.close(); + + int after = rs.getInt(1); + rs.close(); + statement_.close(); + assertCondition(after == before, "after = " + after + ", after should be " + before); + } catch (Exception e) { + failed(e, "Unexpected Exception - New testcase created by toolbox 5/15/2003"); + } finally { + if (serializeFile != null) { + try { + serializeFile.close(); + } catch (SQLException e) { + e.printStackTrace(); } - catch (Exception c) {} + } } - } } - -/** -Shouldn't show changes that are made while the ResultSet is open if TYPE_FORWARD_ONLY and CONCUR_UPDATEABLE -cursor sensitivity property is equal to insensitive -Toolbox opens a non-scrollable insensitive cursor -**/ - public void Var010 () - { - if (checkJdbc20 ()) { - try - { - Statement statement_ = connectionInsensitive_.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE); - ResultSet rs = statement_.executeQuery ("SELECT * FROM " + JDRSTest.RSTEST_SENSITIVE ); + } + + /** + * Might/Might Not show changes that are made while the ResultSet is open if + * TYPE_FORWARD_ONLY and CONCUR_UPDATEABLE cursor sensitivity property is equal + * to sensitive Toolbox opens a non-scrollable asensitive cursor + **/ + public void Var011() { + if (checkJdbc20()) { + JDSerializeFile serializeFile = null; + try { + serializeFile = new JDSerializeFile(connectionSensitive_, JDRSTest.RSTEST_SENSITIVE); + Statement statement_ = connectionSensitive_.createStatement(ResultSet.TYPE_FORWARD_ONLY, + ResultSet.CONCUR_UPDATABLE); + ResultSet rs = statement_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_SENSITIVE); + for (int i = 0; i < 11; i++) rs.next(); - int before = rs.getInt(1); - - Statement statement2_ = connectionInsensitive_.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE); - ResultSet rs1 = statement2_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_SENSITIVE ); - rs1.absolute(1); - rs1.updateInt(1, 154); - rs1.updateRow(); - rs1.close(); - statement2_.close(); - - int after = rs.getInt(1); - rs.close(); - statement_.close(); - assertCondition(after == before, "after = " + after + ", after should be " + before); - } - catch (Exception e) - { - failed(e, "Unexpected Exception - New testcase created by toolbox 5/15/2003"); + int before = rs.getInt(1); + + Statement statement2_ = connectionSensitive_.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, + ResultSet.CONCUR_UPDATABLE); + ResultSet rs1 = statement2_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_SENSITIVE); + rs1.absolute(1); + rs1.updateInt(1, 154); + rs1.updateRow();/* serialized */ + rs1.close(); + statement2_.close(); + + int after = rs.getInt(1); + rs.close(); + statement_.close(); + assertCondition(after == before || after == 154); + } catch (Exception e) { + failed(e, "Unexpected Exception - New testcase created by toolbox 5/15/2003"); + } finally { + if (serializeFile != null) { + try { + serializeFile.close(); + } catch (SQLException e) { + e.printStackTrace(); + } + } } - } - } - -/** -Might/Might Not show changes that are made while the ResultSet is open if TYPE_FORWARD_ONLY and CONCUR_UPDATEABLE -cursor sensitivity property is equal to sensitive -Toolbox opens a non-scrollable asensitive cursor -**/ - public void Var011 () - { - if (checkJdbc20 ()) { - try - { - Statement statement_ = connectionSensitive_.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE); - ResultSet rs = statement_.executeQuery ("SELECT * FROM " + JDRSTest.RSTEST_SENSITIVE ); - for(int i=0; i<11; i++) - rs.next(); - int before = rs.getInt(1); - - Statement statement2_ = connectionSensitive_.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE); - ResultSet rs1 = statement2_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_SENSITIVE ); - rs1.absolute(1); - rs1.updateInt(1, 154); - rs1.updateRow(); - rs1.close(); - statement2_.close(); - - int after = rs.getInt(1); - rs.close(); - statement_.close(); - assertCondition(after == before || after == 154); - } - catch (Exception e) - { - failed(e, "Unexpected Exception - New testcase created by toolbox 5/15/2003"); - } - } } - -/** -Should show changes made to the database while ResultSet is open if TYPE_SCROLL_INSENSITIVE and CONCUR_UPDATEABLE -cursor sensitivity connection property is equal to sensitive -Note: If the concurrency is updateable, the toolbox automatically sets the type to TYPE_SCROLL_SENSITIVE -Toolbox opens a scrollable sensitive cursor -**/ - public void Var012 () - { - if (checkJdbc20 ()) { - try - { - Statement statement_ = connectionSensitive_.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE); - ResultSet rs = statement_.executeQuery ("SELECT * FROM " + JDRSTest.RSTEST_SENSITIVE ); - rs.absolute(12); - rs.getInt(1); - - Statement statement2_ = connectionSensitive_.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); - ResultSet rs1 = statement2_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_SENSITIVE ); - rs1.absolute(12); - rs1.updateInt(1, 154); - rs1.updateRow(); - rs1.close(); - statement2_.close(); - - rs.beforeFirst(); - rs.absolute(12); - int after = rs.getInt(1); - rs.close (); - statement_.close(); - assertCondition( after == 154, "after is " + after + ", after should be 154"); + } + + /** + * Should show changes made to the database while ResultSet is open if + * TYPE_SCROLL_INSENSITIVE and CONCUR_UPDATEABLE cursor sensitivity connection + * property is equal to sensitive Note: If the concurrency is updateable, the + * toolbox automatically sets the type to TYPE_SCROLL_SENSITIVE Toolbox opens a + * scrollable sensitive cursor + **/ + public void Var012() { + if (checkJdbc20()) { + JDSerializeFile serializeFile = null; + try { + serializeFile = new JDSerializeFile(connectionSensitive_, JDRSTest.RSTEST_SENSITIVE); + Statement statement_ = connectionSensitive_.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, + ResultSet.CONCUR_UPDATABLE); + ResultSet rs = statement_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_SENSITIVE); + rs.absolute(12); + rs.getInt(1); + + Statement statement2_ = connectionSensitive_.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, + ResultSet.CONCUR_UPDATABLE); + ResultSet rs1 = statement2_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_SENSITIVE); + rs1.absolute(12); + rs1.updateInt(1, 154); + rs1.updateRow();/* serialized */ + rs1.close(); + statement2_.close(); + + rs.beforeFirst(); + rs.absolute(12); + int after = rs.getInt(1); + rs.close(); + statement_.close(); + assertCondition(after == 154, "after is " + after + ", after should be 154"); + } catch (Exception e) { + failed(e, "Unexpected Exception - New testcase created by toolbox 5/15/2003"); + } finally { + if (serializeFile != null) { + try { + serializeFile.close(); + } catch (SQLException e) { + e.printStackTrace(); + } + } } - catch (Exception e) - { - failed(e, "Unexpected Exception - New testcase created by toolbox 5/15/2003"); + } + } + + /** + * Should show changes made to the database while ResultSet is open if + * TYPE_SCROLL_SENSITIVE and CONCUR_UPDATEABLE cursor sensitivity property is + * equal to sensitive Note: Toolbox opens a scrollable sensitive cursor + **/ + public void Var013() { + if (checkJdbc20()) { + JDSerializeFile serializeFile = null; + try { + serializeFile = new JDSerializeFile(connectionSensitive_, JDRSTest.RSTEST_SENSITIVE); + Statement statement_ = connectionSensitive_.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, + ResultSet.CONCUR_UPDATABLE); + ResultSet rs = statement_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_SENSITIVE); + rs.absolute(13); + rs.getInt(1); + + Statement statement2_ = connectionSensitive_.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, + ResultSet.CONCUR_UPDATABLE); + ResultSet rs1 = statement2_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_SENSITIVE); + rs1.absolute(13); + rs1.updateInt(1, 154); + rs1.updateRow();/* serialized */ + rs1.close(); + statement2_.close(); + + rs.beforeFirst(); + rs.absolute(13); + int after = rs.getInt(1); + rs.close(); + statement_.close(); + assertCondition(after == 154, "after is " + after + ", after should be 154"); + } catch (Exception e) { + failed(e, "Unexpected Exception - New testcase created by toolbox 5/15/2003"); + } finally { + if (serializeFile != null) { + try { + serializeFile.close(); + } catch (SQLException e) { + e.printStackTrace(); + } + } } - } } - -/** -Should show changes made to the database while ResultSet is open if TYPE_SCROLL_SENSITIVE and CONCUR_UPDATEABLE -cursor sensitivity property is equal to sensitive -Note: Toolbox opens a scrollable sensitive cursor -**/ - public void Var013 () - { - if (checkJdbc20 ()) { - try - { - Statement statement_ = connectionSensitive_.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); - ResultSet rs = statement_.executeQuery ("SELECT * FROM " + JDRSTest.RSTEST_SENSITIVE ); - rs.absolute(13); - rs.getInt(1); - - Statement statement2_ = connectionSensitive_.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE); - ResultSet rs1 = statement2_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_SENSITIVE ); - rs1.absolute(13); - rs1.updateInt(1, 154); - rs1.updateRow(); - rs1.close(); - statement2_.close(); - - rs.beforeFirst(); - rs.absolute(13); - int after = rs.getInt(1); - rs.close (); - statement_.close(); - assertCondition( after == 154, "after is " + after + ", after should be 154"); + } + + /** + * Should throw an exception if try to see if changes are made while the + * ResultSet is open if TYPE_FORWARD_ONLY and CONCUR_UPDATEABLE cursor + * sensitivity property is equal to sensitive Note: Toolbox opens a + * non-scrollable asensitive cursor + **/ + public void Var014() { + if (checkJdbc20()) { + Statement statement = null; + ResultSet rs = null; + JDSerializeFile serializeFile = null; + try { + serializeFile = new JDSerializeFile(connectionSensitive_, JDRSTest.RSTEST_SENSITIVE); + statement = connectionSensitive_.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE); + rs = statement.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_SENSITIVE); + rs.next(); + rs.getInt(1); + + Statement statement2 = connectionSensitive_.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, + ResultSet.CONCUR_UPDATABLE); + ResultSet rs1 = statement2.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_SENSITIVE); + rs1.absolute(1); + rs1.updateInt(1, 154); + rs1.updateRow();/* serialized */ + rs1.close(); + statement2.close(); + + rs.beforeFirst(); + rs.next(); + rs.close(); + statement.close(); + failed("Didn't throw Exception - New testcase created by toolbox 5/15/2003."); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + try { + rs.close(); + } catch (Exception c) { + } + try { + statement.close(); + } catch (Exception c) { + } + } finally { + if (serializeFile != null) { + try { + serializeFile.close(); + } catch (SQLException e) { + e.printStackTrace(); + } + } } - catch (Exception e) - { - failed(e, "Unexpected Exception - New testcase created by toolbox 5/15/2003"); + } + } + + /** + * Might/Might Not show changes that are made while the ResultSet is open if + * TYPE_FORWARD_ONLY and CONCUR_READ_ONLY cursor sensitivity property is equal + * to asensitive Toolbox opens a non-scrollable asensitive cursor + **/ + public void Var015() { + if (checkJdbc20()) { + JDSerializeFile serializeFile = null; + try { + serializeFile = new JDSerializeFile(connectionAsensitive_, JDRSTest.RSTEST_SENSITIVE); + Statement statement_ = connectionAsensitive_.createStatement(ResultSet.TYPE_FORWARD_ONLY, + ResultSet.CONCUR_READ_ONLY); + ResultSet rs = statement_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_SENSITIVE); + for (int i = 0; i < 15; i++) + rs.next(); + int before = rs.getInt(1); + + Statement statement2_ = connectionAsensitive_.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, + ResultSet.CONCUR_UPDATABLE); + ResultSet rs1 = statement2_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_SENSITIVE); + rs1.absolute(1); + rs1.updateInt(1, 154); + rs1.updateRow();/* serialized */ + rs1.close(); + statement2_.close(); + + int after = rs.getInt(1); + rs.close(); + statement_.close(); + assertCondition(after == before || after == 154); + } catch (Exception e) { + failed(e, "Unexpected Exception - New testcase created by toolbox 5/15/2003"); + } finally { + if (serializeFile != null) { + try { + serializeFile.close(); + } catch (SQLException e) { + e.printStackTrace(); + } + } } - } } - -/** -Should throw an exception if try to see if changes are made while the ResultSet is open if TYPE_FORWARD_ONLY and CONCUR_UPDATEABLE -cursor sensitivity property is equal to sensitive -Note: Toolbox opens a non-scrollable asensitive cursor -**/ - public void Var014 () - { - if (checkJdbc20 ()) - { - Statement statement_ = null; - ResultSet rs = null; - try - { - statement_ = connectionSensitive_.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE); - rs = statement_.executeQuery ("SELECT * FROM " + JDRSTest.RSTEST_SENSITIVE ); - rs.next(); - rs.getInt(1); - - Statement statement2_ = connectionSensitive_.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE); - ResultSet rs1 = statement2_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_SENSITIVE ); - rs1.absolute(1); - rs1.updateInt(1, 154); - rs1.updateRow(); - rs1.close(); - statement2_.close(); - - rs.beforeFirst(); - rs.next(); - failed("Didn't throw Exception - New testcase created by toolbox 5/15/2003."); - } - catch (Exception e) - { - assertExceptionIsInstanceOf(e, "java.sql.SQLException"); - try { - rs.close(); - statement_.close(); - } - catch(Exception c) { - } - } + } + + /** + * Might/Might Not show changes made to the database while ResultSet is open if + * TYPE_SCROLL_INSENSITIVE and CONCUR_UPDATEABLE cursor sensitivity connection + * property is equal to asensitive Note: If the concurrency is updateable, the + * toolbox automatically sets the type to TYPE_SCROLL_SENSITIVE Toolbox opens a + * scrollable asensitive cursor + **/ + public void Var016() { + if (checkJdbc20()) { + JDSerializeFile serializeFile = null; + try { + serializeFile = new JDSerializeFile(connectionAsensitive_, JDRSTest.RSTEST_SENSITIVE); + Statement statement_ = connectionAsensitive_.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, + ResultSet.CONCUR_UPDATABLE); + ResultSet rs = statement_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_SENSITIVE); + rs.absolute(16); + int before = rs.getInt(1); + + Statement statement2_ = connectionAsensitive_.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, + ResultSet.CONCUR_UPDATABLE); + ResultSet rs1 = statement2_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_SENSITIVE); + rs1.absolute(16); + rs1.updateInt(1, 154); + rs1.updateRow();/* serialized */ + rs1.close(); + statement2_.close(); + + rs.beforeFirst(); + rs.absolute(16); + int after = rs.getInt(1); + rs.close(); + statement_.close(); + assertCondition(after == 154 || after == before); + } catch (Exception e) { + failed(e, "Unexpected Exception - New testcase created by toolbox 5/15/2003"); + } finally { + if (serializeFile != null) { + try { + serializeFile.close(); + } catch (SQLException e) { + e.printStackTrace(); + } } + } } - -/** -Might/Might Not show changes that are made while the ResultSet is open if TYPE_FORWARD_ONLY and CONCUR_READ_ONLY -cursor sensitivity property is equal to asensitive -Toolbox opens a non-scrollable asensitive cursor -**/ - public void Var015 () - { - if (checkJdbc20 ()) - { - try - { - Statement statement_ = connectionAsensitive_.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY); - ResultSet rs = statement_.executeQuery ("SELECT * FROM " + JDRSTest.RSTEST_SENSITIVE ); - for (int i =0; i<15 ; i++) - rs.next(); - int before = rs.getInt(1); - - Statement statement2_ = connectionAsensitive_.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); - ResultSet rs1 = statement2_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_SENSITIVE ); - rs1.absolute(1); - rs1.updateInt(1, 154); - rs1.updateRow(); - rs1.close(); - statement2_.close(); - - int after = rs.getInt(1); - rs.close(); - statement_.close(); - assertCondition(after == before || after == 154); - } - catch (Exception e) - { - failed(e, "Unexpected Exception - New testcase created by toolbox 5/15/2003"); - } + } + + /** + * Might/Might Not show changes made to the database while ResultSet is open if + * TYPE_SCROLL_SENSITIVE and CONCUR_UPDATEABLE cursor sensitivity property is + * equal to asensitive open -> CURSOR_SCROLLABLE_ASENSITIVE + **/ + public void Var017() { + if (checkJdbc20()) { + JDSerializeFile serializeFile = null; + try { + serializeFile = new JDSerializeFile(connectionAsensitive_, JDRSTest.RSTEST_SENSITIVE); + Statement statement_ = connectionAsensitive_.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, + ResultSet.CONCUR_UPDATABLE); + ResultSet rs = statement_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_SENSITIVE); + rs.absolute(17); + int before = rs.getInt(1); + + Statement statement2_ = connectionAsensitive_.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, + ResultSet.CONCUR_UPDATABLE); + ResultSet rs1 = statement2_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_SENSITIVE); + rs1.absolute(17); + rs1.updateInt(1, 154); + rs1.updateRow();/* serialized */ + rs1.close(); + statement2_.close(); + + rs.beforeFirst(); + rs.absolute(17); + int after = rs.getInt(1); + rs.close(); + statement_.close(); + assertCondition(after == 154 || after == before); + } catch (Exception e) { + failed(e, "Unexpected Exception - New testcase created by toolbox 5/15/2003"); + } finally { + if (serializeFile != null) { + try { + serializeFile.close(); + } catch (SQLException e) { + e.printStackTrace(); + } } + } } - -/** -Might/Might Not show changes made to the database while ResultSet is open if TYPE_SCROLL_INSENSITIVE and CONCUR_UPDATEABLE -cursor sensitivity connection property is equal to asensitive -Note: If the concurrency is updateable, the toolbox automatically sets the type to TYPE_SCROLL_SENSITIVE -Toolbox opens a scrollable asensitive cursor -**/ - public void Var016 () - { - if (checkJdbc20 ()) - { - try - { - Statement statement_ = connectionAsensitive_.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE); - ResultSet rs = statement_.executeQuery ("SELECT * FROM " + JDRSTest.RSTEST_SENSITIVE ); - rs.absolute(16); - int before = rs.getInt(1); - - Statement statement2_ = connectionAsensitive_.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); - ResultSet rs1 = statement2_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_SENSITIVE ); - rs1.absolute(16); - rs1.updateInt(1, 154); - rs1.updateRow(); - rs1.close(); - statement2_.close(); - - rs.beforeFirst(); - rs.absolute(16); - int after = rs.getInt(1); - rs.close (); - statement_.close(); - assertCondition( after == 154 || after == before); - } - catch (Exception e) - { - failed(e, "Unexpected Exception - New testcase created by toolbox 5/15/2003"); - } + } + + /** + * Should throw an exception if try to see if changes are made while the + * ResultSet is open if TYPE_FORWARD_ONLY and CONCUR_UPDATEABLE cursor + * sensitivity property is equal to asensitive Note: Toolbox opens a + * nonscrollable asensitive cursor + **/ + public void Var018() { + if (checkJdbc20()) { + Statement statement = null; + ResultSet rs = null; + JDSerializeFile serializeFile = null; + try { + serializeFile = new JDSerializeFile(connectionAsensitive_, JDRSTest.RSTEST_SENSITIVE); + statement = connectionAsensitive_.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE); + rs = statement.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_SENSITIVE); + for (int i = 0; i < 18; i++) + rs.next(); + rs.getInt(1); + + Statement statement2_ = connectionAsensitive_.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, + ResultSet.CONCUR_UPDATABLE); + ResultSet rs1 = statement2_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_SENSITIVE); + rs1.absolute(1); + rs1.updateInt(1, 154); + rs1.updateRow(); /* serialized */ + rs1.close(); + statement2_.close(); + + rs.beforeFirst(); + rs.next(); + rs.close(); + statement.close(); + failed("Didn't throw Exception - New testcase created by toolbox 5/15/2003."); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + try { + rs.close(); + } catch (Exception c) { } - } - -/** -Might/Might Not show changes made to the database while ResultSet is open if TYPE_SCROLL_SENSITIVE and CONCUR_UPDATEABLE -cursor sensitivity property is equal to asensitive -open -> CURSOR_SCROLLABLE_ASENSITIVE -**/ - public void Var017 () - { - if (checkJdbc20 ()) - { - try - { - Statement statement_ = connectionAsensitive_.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); - ResultSet rs = statement_.executeQuery ("SELECT * FROM " + JDRSTest.RSTEST_SENSITIVE ); - rs.absolute(17); - int before = rs.getInt(1); - - Statement statement2_ = connectionAsensitive_.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE); - ResultSet rs1 = statement2_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_SENSITIVE ); - rs1.absolute(17); - rs1.updateInt(1, 154); - rs1.updateRow(); - rs1.close(); - statement2_.close(); - - rs.beforeFirst(); - rs.absolute(17); - int after = rs.getInt(1); - rs.close (); - statement_.close(); - assertCondition( after == 154 || after == before); - } - catch (Exception e) - { - failed(e, "Unexpected Exception - New testcase created by toolbox 5/15/2003"); - } + try { + statement.close(); + } catch (Exception c) { } - } - -/** -Should throw an exception if try to see if changes are made while the ResultSet is open if TYPE_FORWARD_ONLY and CONCUR_UPDATEABLE -cursor sensitivity property is equal to asensitive -Note: Toolbox opens a nonscrollable asensitive cursor -**/ - public void Var018 () - { - if (checkJdbc20 ()) - { - Statement statement_ = null; - ResultSet rs = null; - try - { - statement_ = connectionAsensitive_.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE); - rs = statement_.executeQuery ("SELECT * FROM " + JDRSTest.RSTEST_SENSITIVE ); - for(int i=0; i<18; i++) - rs.next(); - rs.getInt(1); - - Statement statement2_ = connectionAsensitive_.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE); - ResultSet rs1 = statement2_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_SENSITIVE ); - rs1.absolute(1); - rs1.updateInt(1, 154); - rs1.updateRow(); - rs1.close(); - statement2_.close(); - - rs.beforeFirst(); - rs.next(); - failed("Didn't throw Exception - New testcase created by toolbox 5/15/2003."); - } - catch (Exception e) - { - assertExceptionIsInstanceOf(e, "java.sql.SQLException"); - try - { - rs.close(); - statement_.close(); - } - catch (Exception c) {} - } + } finally { + if (serializeFile != null) { + try { + serializeFile.close(); + } catch (SQLException e) { + e.printStackTrace(); + } } - } - -/** -Shouldn't show changes made to the database while ResultSet is open if TYPE_SCROLL_INSENSITIVE and CONCUR_READ_ONLY -cursor sensitivity property is equal to asensitive -Toolbox opens a scrollable insensitive cursor -**/ - public void Var019 () - { - if (checkJdbc20 ()) { - try - { - Statement statement_ = connectionAsensitive_.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); - ResultSet rs = statement_.executeQuery ("SELECT * FROM " + JDRSTest.RSTEST_SENSITIVE ); - rs.absolute(19); - int before = rs.getInt(1); - - Statement statement2_ = connectionAsensitive_.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE); - ResultSet rs1 = statement2_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_SENSITIVE ); - rs1.absolute(19); - rs1.updateInt(1, 154); - rs1.updateRow(); - rs1.close(); - statement2_.close(); - - rs.beforeFirst(); - rs.absolute(19); - int after = rs.getInt(1); - rs.close (); - statement_.close(); - assertCondition( after == before , "after is " + after + ", after should be " + before); } - catch (Exception e) - { - failed(e, "Unexpected Exception - New testcase created by toolbox 5/15/2003"); + } + } + + /** + * Shouldn't show changes made to the database while ResultSet is open if + * TYPE_SCROLL_INSENSITIVE and CONCUR_READ_ONLY cursor sensitivity property is + * equal to asensitive Toolbox opens a scrollable insensitive cursor + **/ + public void Var019() { + if (checkJdbc20()) { + JDSerializeFile serializeFile = null; + try { + serializeFile = new JDSerializeFile(connectionAsensitive_, JDRSTest.RSTEST_SENSITIVE); + Statement statement_ = connectionAsensitive_.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, + ResultSet.CONCUR_READ_ONLY); + ResultSet rs = statement_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_SENSITIVE); + rs.absolute(19); + int before = rs.getInt(1); + + Statement statement2_ = connectionAsensitive_.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, + ResultSet.CONCUR_UPDATABLE); + ResultSet rs1 = statement2_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_SENSITIVE); + rs1.absolute(19); + rs1.updateInt(1, 154); + rs1.updateRow(); /* serialized */ + rs1.close(); + statement2_.close(); + + rs.beforeFirst(); + rs.absolute(19); + int after = rs.getInt(1); + rs.close(); + statement_.close(); + assertCondition(after == before, "after is " + after + ", after should be " + before); + } catch (Exception e) { + failed(e, "Unexpected Exception - New testcase created by toolbox 5/15/2003"); + } finally { + if (serializeFile != null) { + try { + serializeFile.close(); + } catch (SQLException e) { + e.printStackTrace(); + } + } } - } } - - -/** -Shouldn't show changes made to the database while ResultSet is open if TYPE_SCROLL_INSENSITIVE and CONCUR_READ_ONLY -cursor sensitivity connection property is equal to sensitive -Note: Toolbox opens a scrollable insensitive cursor -**/ - public void Var020 () - { - if (checkJdbc20 ()) { - try - { - Statement statement_ = connectionSensitive_.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); - ResultSet rs = statement_.executeQuery ("SELECT * FROM " + JDRSTest.RSTEST_SENSITIVE ); - rs.absolute(20); - int before = rs.getInt(1); - - Statement statement2_ = connectionSensitive_.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); - ResultSet rs1 = statement2_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_SENSITIVE ); - rs1.absolute(20); - rs1.updateInt(1, 154); - rs1.updateRow(); - rs1.close(); - statement2_.close(); - - rs.beforeFirst(); - rs.absolute(20); - int after = rs.getInt(1); - rs.close (); - statement_.close(); - assertCondition( after == before, "after is " + after + ", after should be " + before); + } + + /** + * Shouldn't show changes made to the database while ResultSet is open if + * TYPE_SCROLL_INSENSITIVE and CONCUR_READ_ONLY cursor sensitivity connection + * property is equal to sensitive Note: Toolbox opens a scrollable insensitive + * cursor + **/ + public void Var020() { + if (checkJdbc20()) { + JDSerializeFile serializeFile = null; + try { + serializeFile = new JDSerializeFile(connectionSensitive_, JDRSTest.RSTEST_SENSITIVE); + Statement statement_ = connectionSensitive_.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, + ResultSet.CONCUR_READ_ONLY); + ResultSet rs = statement_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_SENSITIVE); + rs.absolute(20); + int before = rs.getInt(1); + + Statement statement2_ = connectionSensitive_.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, + ResultSet.CONCUR_UPDATABLE); + ResultSet rs1 = statement2_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_SENSITIVE); + rs1.absolute(20); + rs1.updateInt(1, 154); + rs1.updateRow(); /* serialized */ + rs1.close(); + statement2_.close(); + + rs.beforeFirst(); + rs.absolute(20); + int after = rs.getInt(1); + rs.close(); + statement_.close(); + assertCondition(after == before, "after is " + after + ", after should be " + before); + } catch (Exception e) { + failed(e, "Unexpected Exception - New testcase created by toolbox 5/15/2003"); + } finally { + if (serializeFile != null) { + try { + serializeFile.close(); + } catch (SQLException e) { + e.printStackTrace(); + } + } } - catch (Exception e) - { - failed(e, "Unexpected Exception - New testcase created by toolbox 5/15/2003"); + } + } + + /** + * Shouldn't show changes made to the database while ResultSet is open if + * TYPE_SCROLL_INSENSITIVE and CONCUR_READ_ONLY cursor sensitivity connection + * property is equal to insensitive Note: Toolbox opens a scrollable insensitive + * cursor + **/ + public void Var021() { + if (checkJdbc20()) { + JDSerializeFile serializeFile = null; + try { + serializeFile = new JDSerializeFile(connectionInsensitive_, JDRSTest.RSTEST_SENSITIVE); + Statement statement_ = connectionInsensitive_.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, + ResultSet.CONCUR_READ_ONLY); + ResultSet rs = statement_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_SENSITIVE); + rs.absolute(21); + int before = rs.getInt(1); + + Statement statement2_ = connectionInsensitive_.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, + ResultSet.CONCUR_UPDATABLE); + ResultSet rs1 = statement2_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_SENSITIVE); + rs1.absolute(21); + rs1.updateInt(1, 154); + rs1.updateRow(); /* serialized */ + rs1.close(); + statement2_.close(); + + rs.beforeFirst(); + rs.absolute(21); + int after = rs.getInt(1); + rs.close(); + statement_.close(); + assertCondition(after == before, "after is " + after + ", after should be " + before); + } catch (Exception e) { + failed(e, "Unexpected Exception - New testcase created by toolbox 5/15/2003"); + } finally { + if (serializeFile != null) { + try { + serializeFile.close(); + } catch (SQLException e) { + e.printStackTrace(); + } + } } - } } - -/** -Shouldn't show changes made to the database while ResultSet is open if TYPE_SCROLL_INSENSITIVE and CONCUR_READ_ONLY -cursor sensitivity connection property is equal to insensitive -Note: Toolbox opens a scrollable insensitive cursor -**/ - public void Var021 () - { - if (checkJdbc20 ()) { - try - { - Statement statement_ = connectionInsensitive_.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); - ResultSet rs = statement_.executeQuery ("SELECT * FROM " + JDRSTest.RSTEST_SENSITIVE ); - rs.absolute(21); - int before = rs.getInt(1); - - Statement statement2_ = connectionInsensitive_.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); - ResultSet rs1 = statement2_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_SENSITIVE ); - rs1.absolute(21); - rs1.updateInt(1, 154); - rs1.updateRow(); - rs1.close(); - statement2_.close(); - - rs.beforeFirst(); - rs.absolute(21); - int after = rs.getInt(1); - rs.close (); - statement_.close(); - assertCondition( after == before, "after is " + after + ", after should be " + before); + } + + /** + * Exeption should be thrown if try to use absolute() to move from one row to + * the next row if TYPE_FORWARD_ONLY + **/ + public void Var022() { + if (checkJdbc20()) { + Statement statement = null; + ResultSet rs = null; + try { + statement = connectionDefault_.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY); + rs = statement.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_SENSITIVE); + + rs.absolute(1); + rs.absolute(2); + rs.close(); + statement.close(); + failed("Didn't throw SQLException - New testcase created by toolbox 5/15/2003"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + try { + rs.close(); + } catch (Exception c) { + } + try { + statement.close(); + } catch (Exception c) { + } } - catch (Exception e) - { - failed(e, "Unexpected Exception - New testcase created by toolbox 5/15/2003"); + } + } + + /** + * The result set should be able to scroll forward if TYPE_FORWARD_ONLY Note: + * Toolbox opens a nonscrollable asensitive cursor + **/ + public void Var023() { + if (checkJdbc20()) { + try { + Statement statement_ = connectionDefault_.createStatement(ResultSet.TYPE_FORWARD_ONLY, + ResultSet.CONCUR_UPDATABLE); + ResultSet rs = statement_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_SENSITIVE); + + boolean success1 = rs.next(); + boolean success2 = rs.next(); + rs.close(); + statement_.close(); + assertCondition(success1 == true && success2 == true); + } catch (Exception e) { + failed(e, "Unexpected Exception - New testcase created by toolbox 5/15/2003"); } - } } - -/** -Exeption should be thrown if try to use absolute() to move from one row to the next row if TYPE_FORWARD_ONLY -**/ - public void Var022 () - { - if (checkJdbc20 ()) - { - Statement statement_ = null; - ResultSet rs = null; - try - { - statement_ = connectionDefault_.createStatement (ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY); - rs = statement_.executeQuery ("SELECT * FROM " + JDRSTest.RSTEST_SENSITIVE ); - - rs.absolute(1); - rs.absolute(2); - rs.close (); - failed("Didn't throw SQLException - New testcase created by toolbox 5/15/2003"); - } - catch (Exception e) - { - assertExceptionIsInstanceOf(e, "java.sql.SQLException"); - try - { - rs.close(); - statement_.close(); - } - catch (Exception c) {} - } - } + } + + /** + * Should throw an exception if try to see if changes are made while the + * ResultSet is open if TYPE_FORWARD_ONLY and CONCUR_UPDATEABLE cursor + * sensitivity property is equal to insensitive Note: Toolbox opens a + * non-scrollable asensitive cursor + **/ + public void Var024() { + if (checkJdbc20()) { + notApplicable("V5R1 or earlier variation"); } - -/** -The result set should be able to scroll forward if TYPE_FORWARD_ONLY -Note: Toolbox opens a nonscrollable asensitive cursor -**/ - public void Var023 () - { - if (checkJdbc20 ()) - { - try - { - Statement statement_ = connectionDefault_.createStatement (ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE); - ResultSet rs = statement_.executeQuery ("SELECT * FROM " + JDRSTest.RSTEST_SENSITIVE ); - - boolean success1 = rs.next(); - boolean success2 = rs.next(); - rs.close (); - statement_.close(); - assertCondition (success1 == true && success2 == true); - } - catch (Exception e) - { - failed (e, "Unexpected Exception - New testcase created by toolbox 5/15/2003"); - } - } - } - -/** -Should throw an exception if try to see if changes are made while the ResultSet is open if TYPE_FORWARD_ONLY and CONCUR_UPDATEABLE -cursor sensitivity property is equal to insensitive -Note: Toolbox opens a non-scrollable asensitive cursor -**/ - public void Var024 () - { - if (checkJdbc20 ()) { - notApplicable("V5R1 or earlier variation"); - } + } + + /** + * Might/Might not show changes that are made while the ResultSet is open if + * TYPE_FORWARD_ONLY and CONCUR_UPDATEABLE cursor sensitivity property is equal + * to insensitive Toolbox opens a non-scrollable asensitive cursor + **/ + public void Var025() { + if (checkJdbc20()) { + notApplicable("V5R1 or earlier variation."); } - -/** -Might/Might not show changes that are made while the ResultSet is open if TYPE_FORWARD_ONLY and CONCUR_UPDATEABLE -cursor sensitivity property is equal to insensitive -Toolbox opens a non-scrollable asensitive cursor -**/ - public void Var025 () - { - if (checkJdbc20 ()) { - notApplicable("V5R1 or earlier variation."); - } + } + + /** + * Might/Might not show changes made to the database while ResultSet is open if + * TYPE_SCROLL_INSENSITIVE and CONCUR_UPDATEABLE Note: If the concurrency is + * updateable, the toolbox automatically sets the type to TYPE_SCROLL_SENSITIVE + * Toolbox opens a scrollable asensitive cursor + **/ + public void Var026() { + if (checkJdbc20()) { + notApplicable("V5R1 or earlier variation."); } - -/** -Might/Might not show changes made to the database while ResultSet is open if TYPE_SCROLL_INSENSITIVE and CONCUR_UPDATEABLE -Note: If the concurrency is updateable, the toolbox automatically sets the type to TYPE_SCROLL_SENSITIVE -Toolbox opens a scrollable asensitive cursor -**/ - public void Var026 () - { - if (checkJdbc20 ()) { - notApplicable("V5R1 or earlier variation."); - } + } + + /** + * Might/Might not show changes made to the database while ResultSet is open if + * TYPE_SCROLL_INSENSITIVE and CONCUR_READ_ONLY Note: Toolbox opens a scrollable + * asensitive cursor + **/ + public void Var027() { + if (checkJdbc20()) { + notApplicable("V5R1 or earlier variation."); } - -/** -Might/Might not show changes made to the database while ResultSet is open if TYPE_SCROLL_INSENSITIVE and CONCUR_READ_ONLY -Note: Toolbox opens a scrollable asensitive cursor -**/ - public void Var027 () - { - if (checkJdbc20 ()) { - notApplicable("V5R1 or earlier variation."); - } + } + + /** + * Might/Might not show changes made to the database while ResultSet is open if + * TYPE_SCROLL_INSENSITIVE and CONCUR_UPDATEABLE cursor sensitivity connection + * property is equal to insensitive Note: If the concurrency is updateable, the + * toolbox automatically sets the type to TYPE_SCROLL_SENSITIVE Toolbox opens a + * scrollable asensitive cursor + **/ + public void Var028() { + if (checkJdbc20()) { + notApplicable("V5R1 or earlier variation."); } - -/** -Might/Might not show changes made to the database while ResultSet is open if TYPE_SCROLL_INSENSITIVE and CONCUR_UPDATEABLE -cursor sensitivity connection property is equal to insensitive -Note: If the concurrency is updateable, the toolbox automatically sets the type to TYPE_SCROLL_SENSITIVE -Toolbox opens a scrollable asensitive cursor -**/ - public void Var028 () - { - if (checkJdbc20 ()) { - notApplicable("V5R1 or earlier variation."); - } + } + + /** + * Might/Might not show changes made to the database while ResultSet is open if + * TYPE_SCROLL_INSENSITIVE and CONCUR_UPDATEABLE cursor sensitivity connection + * property is equal to sensitive Note: If the concurrency is updateable, the + * toolbox automatically sets the type to TYPE_SCROLL_SENSITIVE Toolbox opens a + * scrollable asensitive cursor + **/ + public void Var029() { + if (checkJdbc20()) { + notApplicable("V5R1 or earlier variation."); } - - -/** -Might/Might not show changes made to the database while ResultSet is open if TYPE_SCROLL_INSENSITIVE and CONCUR_UPDATEABLE -cursor sensitivity connection property is equal to sensitive -Note: If the concurrency is updateable, the toolbox automatically sets the type to TYPE_SCROLL_SENSITIVE -Toolbox opens a scrollable asensitive cursor -**/ - public void Var029 () - { - if (checkJdbc20 ()) { - notApplicable("V5R1 or earlier variation."); - } + } + + /** + * Might/Might not show changes made to the database while ResultSet is open if + * TYPE_SCROLL_INSENSITIVE and CONCUR_READ_ONLY cursor sensitivity property is + * equal to asensitive Toolbox opens a scrollable asensitive cursor + **/ + public void Var030() { + if (checkJdbc20()) { + notApplicable("V5R1 or earlier variation."); } - -/** -Might/Might not show changes made to the database while ResultSet is open if TYPE_SCROLL_INSENSITIVE and CONCUR_READ_ONLY -cursor sensitivity property is equal to asensitive -Toolbox opens a scrollable asensitive cursor -**/ - public void Var030 () - { - if (checkJdbc20 ()) { - notApplicable("V5R1 or earlier variation."); - } + } + + /** + * Might/Might not show changes made to the database while ResultSet is open if + * TYPE_SCROLL_INSENSITIVE and CONCUR_READ_ONLY cursor sensitivity connection + * property is equal to sensitive Note: Toolbox opens a scrollable asensitive + * cursor + **/ + public void Var031() { + if (checkJdbc20()) { + notApplicable("V5R1 or earlier variation."); } - -/** -Might/Might not show changes made to the database while ResultSet is open if TYPE_SCROLL_INSENSITIVE and CONCUR_READ_ONLY -cursor sensitivity connection property is equal to sensitive -Note: Toolbox opens a scrollable asensitive cursor -**/ - public void Var031 () - { - if (checkJdbc20 ()) { - notApplicable("V5R1 or earlier variation."); - } + } + + /** + * Might/Might not show changes made to the database while ResultSet is open if + * TYPE_SCROLL_INSENSITIVE and CONCUR_READ_ONLY cursor sensitivity connection + * property is equal to insensitive Note: Toolbox opens a scrollable asensitive + * cursor + **/ + public void Var032() { + if (checkJdbc20()) { + notApplicable("V5R1 or earlier variation."); } - -/** -Might/Might not show changes made to the database while ResultSet is open if TYPE_SCROLL_INSENSITIVE and CONCUR_READ_ONLY -cursor sensitivity connection property is equal to insensitive -Note: Toolbox opens a scrollable asensitive cursor -**/ - public void Var032 () - { - if (checkJdbc20 ()) { - notApplicable("V5R1 or earlier variation."); - } + } + + /** + * Might/Might not show changes made to the database while ResultSet is open if + * TYPE_SCROLL_SENSITIVE and CONCUR_UPDATEABLE Note: Toolbox opens a scrollable + * asensitive cursor + **/ + public void Var033() { + if (checkJdbc20()) { + notApplicable("V5R1 or earlier variation."); } + } + + /** + * Might/Might not show changes made to the database while ResultSet is open if + * TYPE_SCROLL_SENSITIVE and CONCUR_READ_ONLY Note: If the concurrency is READ + * ONLY, the toolbox changes the TYPE to INSENSITVE and issues an SQLWarning + * Toolbox opens a scrollable asensitive cursor + **/ + public void Var034() { + if (checkJdbc20()) { + notApplicable("V5R1 or earlier variation."); -/** -Might/Might not show changes made to the database while ResultSet is open if TYPE_SCROLL_SENSITIVE and CONCUR_UPDATEABLE -Note: Toolbox opens a scrollable asensitive cursor -**/ - public void Var033 () - { - if (checkJdbc20 ()) { - notApplicable("V5R1 or earlier variation."); - } } - -/** -Might/Might not show changes made to the database while ResultSet is open if TYPE_SCROLL_SENSITIVE and CONCUR_READ_ONLY -Note: If the concurrency is READ ONLY, the toolbox changes the TYPE to INSENSITVE and issues an SQLWarning -Toolbox opens a scrollable asensitive cursor -**/ - public void Var034 () - { - if (checkJdbc20 ()) { - notApplicable("V5R1 or earlier variation."); - - } + } + + /** + * Might/Might not show changes made to the database while ResultSet is open if + * TYPE_SCROLL_SENSITIVE and CONCUR_UPDATEABLE cursor sensitivity property is + * equal to insensitive Note: Toolbox opens a scrollable asensitive cursor + **/ + public void Var035() { + if (checkJdbc20()) { + notApplicable("V5R1 or earlier variation."); } -/** -Might/Might not show changes made to the database while ResultSet is open if TYPE_SCROLL_SENSITIVE and CONCUR_UPDATEABLE -cursor sensitivity property is equal to insensitive -Note: Toolbox opens a scrollable asensitive cursor -**/ - public void Var035 () - { - if (checkJdbc20 ()) { - notApplicable("V5R1 or earlier variation."); - } + } + + /** + * Might/Might not show changes made to the database while ResultSet is open if + * TYPE_SCROLL_SENSITIVE and CONCUR_UPDATEABLE cursor sensitivity property is + * equal to sensitive Note: Toolbox opens a scrollable asensitive cursor + **/ + public void Var036() { + if (checkJdbc20()) { + notApplicable("V5R1 or earlier variation."); } - -/** -Might/Might not show changes made to the database while ResultSet is open if TYPE_SCROLL_SENSITIVE and CONCUR_UPDATEABLE -cursor sensitivity property is equal to sensitive -Note: Toolbox opens a scrollable asensitive cursor -**/ - public void Var036 () - { - if (checkJdbc20 ()) { - notApplicable("V5R1 or earlier variation."); - } + } + + /** + * Test with use of the with NC clause for scroll insensitive cursors + **/ + public void Var037() { + if (checkJdbc20()) { + + try (Statement statement_ = connectionSensitive_.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, + ResultSet.CONCUR_READ_ONLY)) { + ResultSet rs = statement_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_SENSITIVE + " with nc"); + rs.close(); + // Just make sure the query succeeds + assertCondition(true); + } catch (Exception e) { + failed(e, "Unexpected Exception - New testcase created by native driver 10/22/2003"); + } } -/** -Test with use of the with NC clause for scroll insensitive cursors -**/ - public void Var037() { - if (checkJdbc20 ()) { - - try { - Statement statement_ = connectionSensitive_.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); - ResultSet rs = statement_.executeQuery ("SELECT * FROM " + JDRSTest.RSTEST_SENSITIVE+" with nc" ); - rs.close(); - // Just make sure the query succeeds - assertCondition(true); - } catch (Exception e) { - failed(e, "Unexpected Exception - New testcase created by native driver 10/22/2003"); - } - } - + } + + /** + * Test with use of the with NC clause for scroll insensitive cursors + **/ + public void Var038() { + if (checkJdbc20()) { + try (PreparedStatement stmt = connectionSensitive_.prepareStatement( + "SELECT * FROM " + JDRSTest.RSTEST_SENSITIVE + " with nc", ResultSet.TYPE_SCROLL_INSENSITIVE, + ResultSet.CONCUR_READ_ONLY)) { + ResultSet rs = stmt.executeQuery(); + rs.close(); + // Just make sure the query succeeds + assertCondition(true); + } catch (Exception e) { + failed(e, "Unexpected Exception - New testcase created by native driver 10/22/2003"); + } } - -/** -Test with use of the with NC clause for scroll insensitive cursors -**/ - public void Var038() { - if (checkJdbc20 ()) { - try { - PreparedStatement stmt = connectionSensitive_.prepareStatement("SELECT * FROM " + JDRSTest.RSTEST_SENSITIVE+" with nc", ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); - ResultSet rs = stmt.executeQuery (); - rs.close(); - // Just make sure the query succeeds - assertCondition(true); - } catch (Exception e) { - failed(e, "Unexpected Exception - New testcase created by native driver 10/22/2003"); - } - } - - } - -/** -Test with use of the with fetch first clause for scroll insensitive cursors -**/ - public void Var039() { - if (checkJdbc20 ()) { - try { - Statement statement_ = connectionSensitive_.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); - ResultSet rs = statement_.executeQuery ("SELECT * FROM " + JDRSTest.RSTEST_SENSITIVE+" fetch first 10 rows only " ); - rs.close(); - // Just make sure the query succeeds - assertCondition(true); - } catch (Exception e) { - failed(e, "Unexpected Exception - New testcase created by native driver 10/22/2003"); - } - } + } + + /** + * Test with use of the with fetch first clause for scroll insensitive cursors + **/ + public void Var039() { + if (checkJdbc20()) { + try (Statement statement_ = connectionSensitive_.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, + ResultSet.CONCUR_READ_ONLY)) { + ResultSet rs = statement_ + .executeQuery("SELECT * FROM " + JDRSTest.RSTEST_SENSITIVE + " fetch first 10 rows only "); + rs.close(); + // Just make sure the query succeeds + assertCondition(true); + } catch (Exception e) { + failed(e, "Unexpected Exception - New testcase created by native driver 10/22/2003"); + } } - - -/** -Test with use of the optimize for all rows for scroll insensitive cursors -**/ - public void Var040() { - if (checkJdbc20 ()) { - try { - Statement statement_ = connectionSensitive_.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); - ResultSet rs = statement_.executeQuery ("SELECT * FROM " + JDRSTest.RSTEST_SENSITIVE+" optimize for all rows " ); - rs.close(); - // Just make sure the query succeeds - assertCondition(true); - } catch (Exception e) { - failed(e, "Unexpected Exception - New testcase created by native driver 08/03/2004"); - } - } + } + + /** + * Test with use of the optimize for all rows for scroll insensitive cursors + **/ + public void Var040() { + if (checkJdbc20()) { + try (Statement statement_ = connectionSensitive_.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, + ResultSet.CONCUR_READ_ONLY)) { + ResultSet rs = statement_ + .executeQuery("SELECT * FROM " + JDRSTest.RSTEST_SENSITIVE + " optimize for all rows "); + rs.close(); + // Just make sure the query succeeds + assertCondition(true); + } catch (Exception e) { + failed(e, "Unexpected Exception - New testcase created by native driver 08/03/2004"); + } } - -/** -Test with use of the optimize for all rows for scroll insensitive cursors -**/ - public void Var041() { - if (checkJdbc20 ()) { - try { - PreparedStatement statement_ = connectionSensitive_.prepareStatement("SELECT * FROM " + JDRSTest.RSTEST_SENSITIVE+" optimize for all rows ", ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); - ResultSet rs = statement_.executeQuery (); - rs.close(); - // Just make sure the query succeeds - assertCondition(true); - } catch (Exception e) { - failed(e, "Unexpected Exception - New testcase created by native driver 08/03/2004"); - } - } + } + + /** + * Test with use of the optimize for all rows for scroll insensitive cursors + **/ + public void Var041() { + if (checkJdbc20()) { + try (PreparedStatement statement_ = connectionSensitive_.prepareStatement( + "SELECT * FROM " + JDRSTest.RSTEST_SENSITIVE + " optimize for all rows ", ResultSet.TYPE_SCROLL_INSENSITIVE, + ResultSet.CONCUR_READ_ONLY)) { + ResultSet rs = statement_.executeQuery(); + rs.close(); + // Just make sure the query succeeds + assertCondition(true); + } catch (Exception e) { + failed(e, "Unexpected Exception - New testcase created by native driver 08/03/2004"); + } } + } - - -} +} diff --git a/src/test/JD/RS/JDRSDataCompression.java b/src/test/JD/RS/JDRSDataCompression.java index 18b1b44f..66ba6ad8 100644 --- a/src/test/JD/RS/JDRSDataCompression.java +++ b/src/test/JD/RS/JDRSDataCompression.java @@ -163,6 +163,8 @@ protected void cleanup () cleanupTable(s, TABLE_NAME); cleanupTable(s, RLE_TABLE); + s.close(); + c.close(); } diff --git a/src/test/JD/RS/JDRSDeleteRow.java b/src/test/JD/RS/JDRSDeleteRow.java index b4ac3835..1df99627 100644 --- a/src/test/JD/RS/JDRSDeleteRow.java +++ b/src/test/JD/RS/JDRSDeleteRow.java @@ -18,6 +18,7 @@ import test.JDRSTest; import test.JDTestcase; +import test.JD.JDSerializeFile; import java.io.FileOutputStream; import java.sql.ResultSet; @@ -59,6 +60,7 @@ public static void main(String args[]) throws Exception { private Statement statement_; private Statement statement2_; private ResultSet rs_; + private JDSerializeFile serializeUpdateFile_; @@ -89,12 +91,15 @@ protected void setup () { if (connection_ != null) connection_.close(); - select_ = "SELECT * FROM " + JDRSTest.RSTEST_UPDATE; + select_ = "SELECT * FROM " + JDRSTest.RSTEST_UPDATE+" A ORDER BY RRN(A)"; if (isJdbc20 ()) { // SQL400 - driver neutral... String url = baseURL_; connection_ = testDriver_.getConnection (url,systemObject_.getUserId(),encryptedPassword_,"JDRSDeleteRow"); connection_.setAutoCommit(false); // @C1A + serializeUpdateFile_ = new JDSerializeFile(connection_, JDRSTest.RSTEST_UPDATE); + connection_.commit(); + statement_ = connection_.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); statement2_ = connection_.createStatement (ResultSet.TYPE_SCROLL_INSENSITIVE, @@ -102,7 +107,8 @@ protected void setup () // Clear any existing rows. statement_.executeUpdate ("DELETE FROM " + JDRSTest.RSTEST_UPDATE); - + connection_.commit(); + // Create a few different rows. The number of loops is arbitrary. for (int i = 1; i < 198; ++i) statement_.executeUpdate ("INSERT INTO " + JDRSTest.RSTEST_UPDATE @@ -126,6 +132,10 @@ protected void cleanup () if (isJdbc20 ()) { rs_.close (); statement_.close (); + connection_.commit(); + serializeUpdateFile_.close(); + connection_.commit(); + connection_.close (); } } @@ -139,9 +149,8 @@ protected void cleanup () public void Var001() { if (checkJdbc20 ()) { - try { - Statement s = connection_.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, - ResultSet.CONCUR_UPDATABLE); + try (Statement s = connection_.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, + ResultSet.CONCUR_UPDATABLE)) { ResultSet rs = s.executeQuery ("SELECT * FROM " + JDRSTest.RSTEST_UPDATE + " FOR UPDATE"); rs.next (); @@ -164,11 +173,10 @@ public void Var001() public void Var002() { if (checkJdbc20 ()) { - try { - Statement s = connection_.createStatement (ResultSet.TYPE_SCROLL_INSENSITIVE, - ResultSet.CONCUR_READ_ONLY); + try (Statement s = connection_.createStatement (ResultSet.TYPE_SCROLL_INSENSITIVE, + ResultSet.CONCUR_READ_ONLY); ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_UPDATE); + + JDRSTest.RSTEST_UPDATE)) { rs.next (); rs.deleteRow (); failed ("Didn't throw SQLException"); @@ -226,6 +234,7 @@ public void Var004() **/ public void Var005() { + StringBuffer sb = new StringBuffer(); if (checkJdbc20 ()) { try { rs_.beforeFirst (); @@ -238,7 +247,7 @@ public void Var005() rs_.first (); rs_.deleteRow (); - + sb.append("After query is "+select_); ResultSet rs2 = statement2_.executeQuery (select_); int rowCountAfter = 0; Vector keysAfter = new Vector (); @@ -252,16 +261,20 @@ public void Var005() int deletedRow = 0; for (int i = 0; i < rowCountBefore; ++i) { if (i < deletedRow) { - if (! keysBefore.elementAt (i).equals (keysAfter.elementAt (i))) + if (! keysBefore.elementAt (i).equals (keysAfter.elementAt (i))) { + sb.append("\nMismatch at index("+i+") before="+keysBefore.elementAt (i)+" after="+keysAfter.elementAt (i)); success = false; + } } else if (i > deletedRow) { - if (! keysBefore.elementAt (i).equals (keysAfter.elementAt (i-1))) + if (! keysBefore.elementAt (i).equals (keysAfter.elementAt (i-1))) { + sb.append("\nMismatch at index("+i+") before="+keysBefore.elementAt (i)+" after(-1)="+keysAfter.elementAt (i-1)); success = false; + } } } - - assertCondition (success && (rowCountAfter == (rowCountBefore - 1))); + sb.append("\nrowCountAfter="+rowCountAfter+" rowCountBefore="+rowCountBefore); + assertCondition (success && (rowCountAfter == (rowCountBefore - 1)),sb); } catch (Exception e) { failed (e, "Unexpected Exception"); @@ -302,7 +315,7 @@ public void Var006() int deletedRow = 3; String s1, s2; - + StringBuffer sb = new StringBuffer(); for (int i = 0; i < rowCountBefore; ++i) { s1 = keysBefore.elementAt(i).toString(); @@ -312,7 +325,7 @@ public void Var006() // if (! keysBefore.elementAt (i).equals (keysAfter.elementAt (i))) if(! s1.equals(s2)){ - output_.println(" "+i+". "+s2+" sb "+s1); + sb.append("\n at offset "+i+". "+s2+" sb "+s1); success = false; } } @@ -321,13 +334,13 @@ else if (i > deletedRow) { s2 = keysAfter.elementAt(i-1).toString(); if(! s1.equals(s2)){ - output_.println(" "+i+". "+s2+" sb "+s1); + sb.append("\n at offset "+i+". "+s2+" sb "+s1); success = false; } } } - assertCondition (success && (rowCountAfter == (rowCountBefore - 1))); + assertCondition (success && (rowCountAfter == (rowCountBefore - 1)), sb); } catch (Exception e) { failed (e, "Unexpected Exception"); @@ -394,47 +407,52 @@ else if (i > deletedRow) { public void Var008() { if (checkJdbc20 ()) { - try { - Statement s = connection_.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, - ResultSet.CONCUR_UPDATABLE); - ResultSet rs1 = s.executeQuery (select_ - + " AS TESTCORR FOR UPDATE"); - - rs1.beforeFirst (); - int rowCountBefore = 0; - Vector keysBefore = new Vector (); - while (rs1.next ()) { - ++rowCountBefore; - keysBefore.addElement (rs1.getString ("C_KEY")); - } - - rs1.absolute (81); - rs1.deleteRow (); - rs1.close (); - - ResultSet rs2 = statement2_.executeQuery (select_); - int rowCountAfter = 0; - Vector keysAfter = new Vector (); - while (rs2.next ()) { - ++rowCountAfter; - keysAfter.addElement (rs2.getString ("C_KEY")); - } - rs2.close (); - - boolean success = true; - int deletedRow = 80; - for (int i = 0; i < rowCountBefore; ++i) { - if (i < deletedRow) { - if (! keysBefore.elementAt (i).equals (keysAfter.elementAt (i))) - success = false; - } - else if (i > deletedRow) { - if (! keysBefore.elementAt (i).equals (keysAfter.elementAt (i-1))) - success = false; - } - } - - assertCondition (success && (rowCountAfter == (rowCountBefore - 1))); + + + + try { + + try (Statement s = connection_.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, + ResultSet.CONCUR_UPDATABLE)) { + ResultSet rs1 = s.executeQuery (select_ + + " FOR UPDATE"); + + rs1.beforeFirst (); + int rowCountBefore = 0; + Vector keysBefore = new Vector (); + while (rs1.next ()) { + ++rowCountBefore; + keysBefore.addElement (rs1.getString ("C_KEY")); + } + + rs1.absolute (81); + rs1.deleteRow (); + rs1.close (); + + ResultSet rs2 = statement2_.executeQuery (select_); + int rowCountAfter = 0; + Vector keysAfter = new Vector (); + while (rs2.next ()) { + ++rowCountAfter; + keysAfter.addElement (rs2.getString ("C_KEY")); + } + rs2.close (); + + boolean success = true; + int deletedRow = 80; + for (int i = 0; i < rowCountBefore; ++i) { + if (i < deletedRow) { + if (! keysBefore.elementAt (i).equals (keysAfter.elementAt (i))) + success = false; + } + else if (i > deletedRow) { + if (! keysBefore.elementAt (i).equals (keysAfter.elementAt (i-1))) + success = false; + } + } + + assertCondition (success && (rowCountAfter == (rowCountBefore - 1))); + } } catch (Exception e) { failed (e, "Unexpected Exception"); @@ -451,7 +469,9 @@ else if (i > deletedRow) { public void Var009() { if (checkJdbc20 ()) { - try { + + try { + Statement statement = connection_.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); if (isToolboxDriver()) @@ -492,11 +512,14 @@ else if (i > deletedRow) { success = false; } } - + rs.close(); + statement.close(); assertCondition (success && (rowCountAfter == (rowCountBefore - 1))); } catch (Exception e) { failed (e, "Unexpected Exception"); + } finally { + } } } diff --git a/src/test/JD/RS/JDRSFetchSize.java b/src/test/JD/RS/JDRSFetchSize.java index d8ed0f4a..26be0d53 100644 --- a/src/test/JD/RS/JDRSFetchSize.java +++ b/src/test/JD/RS/JDRSFetchSize.java @@ -279,9 +279,8 @@ public void Var006 () public void Var007 () { if (checkJdbc20 ()) { - try { - Statement s = connection_.createStatement (); - ResultSet rs = s.executeQuery ("SELECT * FROM QIWS.QCUSTCDT"); + try (Statement s = connection_.createStatement (); + ResultSet rs = s.executeQuery ("SELECT * FROM QIWS.QCUSTCDT")) { rs.setFetchSize (-1); failed ("Didn't throw SQLException"); } catch (Exception e) { @@ -299,11 +298,11 @@ public void Var007 () public void Var008 () { if (checkJdbc20 ()) { - try { - Statement s = connection_.createStatement (); + try (Statement s = connection_.createStatement ()) { s.setMaxRows (12); - ResultSet rs = s.executeQuery ("SELECT * FROM QIWS.QCUSTCDT"); - rs.setFetchSize (13); + try (ResultSet rs = s.executeQuery ("SELECT * FROM QIWS.QCUSTCDT")) { + rs.setFetchSize (13); + } failed ("Didn't throw SQLException"); } catch (Exception e) { assertExceptionIsInstanceOf (e, "java.sql.SQLException"); diff --git a/src/test/JD/RS/JDRSFindColumn.java b/src/test/JD/RS/JDRSFindColumn.java index 2fe1cf83..a80247e9 100644 --- a/src/test/JD/RS/JDRSFindColumn.java +++ b/src/test/JD/RS/JDRSFindColumn.java @@ -11,7 +11,6 @@ // /////////////////////////////////////////////////////////////////////////////// - package test.JD.RS; import com.ibm.as400.access.AS400; @@ -26,724 +25,568 @@ import java.util.Hashtable; import java.util.Vector; - - /** -Testcase JDRSFindColumn. This tests the following -methods of the JDBC ResultSet class: - -
    -
  • findColumn() -
-**/ -public class JDRSFindColumn -extends JDTestcase { + * Testcase JDRSFindColumn. This tests the following methods of the JDBC + * ResultSet class: + * + *
    + *
  • findColumn() + *
+ **/ +public class JDRSFindColumn extends JDTestcase { public static void main(String args[]) throws Exception { - String[] newArgs = new String[args.length+2]; - newArgs[0] = "-tc"; - newArgs[1] = "JDRSFindColumn"; - for (int i = 0; i < args.length; i++) { - newArgs[2+i]=args[i]; - } - test.JDRSTest.main(newArgs); - } - - - - // Private data. - private DatabaseMetaData dmd_; - private Statement statement_; - - - -/** -Constructor. -**/ - public JDRSFindColumn (AS400 systemObject, - Hashtable> namesAndVars, - int runMode, - FileOutputStream fileOutputStream, - - String password) - { - super (systemObject, "JDRSFindColumn", - namesAndVars, runMode, fileOutputStream, - password); - } - - - -/** -Performs setup needed before running variations. - -@exception Exception If an exception occurs. -**/ - protected void setup () - throws Exception - { - if (connection_ != null) connection_.close(); - - connection_ = testDriver_.getConnection (baseURL_, userId_, encryptedPassword_,"JDRSFindColumn"); - dmd_ = connection_.getMetaData (); - statement_ = connection_.createStatement (); - } - - - -/** -Performs cleanup needed after running variations. - -@exception Exception If an exception occurs. -**/ - protected void cleanup () - throws Exception - { - statement_.close (); - connection_.close (); - } - - - -/** -findColumn() - Should thrown an exception on a closed result set. -**/ - public void Var001 () - { - try { - ResultSet rs = statement_.executeQuery ("SELECT * FROM QIWS.QCUSTCDT"); - rs.close (); - rs.findColumn ("LSTNAM"); - failed ("Didn't throw SQLException"); - } - catch (Exception e) { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } - - - -/** -findColumn() - Should thrown an exception when null is passed. -**/ - public void Var002 () - { - try { - ResultSet rs = statement_.executeQuery ("SELECT * FROM QIWS.QCUSTCDT"); - rs.findColumn (null); - failed ("Didn't throw SQLException for null column"); - } - catch (Exception e) { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } - - - -/** -findColumn() - Should thrown an exception when an empty -string is passed. -**/ - public void Var003 () - { - try { - ResultSet rs = statement_.executeQuery ("SELECT * FROM QIWS.QCUSTCDT"); - rs.findColumn (""); - failed ("Didn't throw SQLException for empty string"); - } - catch (Exception e) { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } - - - -/** -findColumn() - Should thrown an exception when an non-existent -column name is passed. -**/ - public void Var004 () - { - try { - ResultSet rs = statement_.executeQuery ("SELECT * FROM QIWS.QCUSTCDT"); - rs.findColumn ("JIM"); - failed ("Didn't throw SQLException for not existing column"); - } - catch (Exception e) { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } - - - -/** -findColumn() - Should return the correct column when it is -the first. -**/ - public void Var005() - { - try { - ResultSet rs = statement_.executeQuery ("SELECT CUSNUM,LSTNAM,INIT FROM QIWS.QCUSTCDT"); - int i = rs.findColumn ("CUSNUM"); - rs.close (); - assertCondition (i == 1); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - - - -/** -findColumn() - Should return the correct column when it is -the last. -**/ - public void Var006() - { - try { - ResultSet rs = statement_.executeQuery ("SELECT CUSNUM,LSTNAM,INIT FROM QIWS.QCUSTCDT"); - int i = rs.findColumn ("INIT"); - rs.close (); - assertCondition (i == 3); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - - - -/** -findColumn() - Should return the correct column when it is -neither the first nor last on a "simple" result set. -**/ - public void Var007() - { - try { - ResultSet rs = statement_.executeQuery ("SELECT CUSNUM,LSTNAM,INIT FROM QIWS.QCUSTCDT"); - int i = rs.findColumn ("LSTNAM"); - rs.close (); - assertCondition (i == 2); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - - - -/** -findColumn() - Should return the correct column when it is -in a different case. -**/ - public void Var008() - { - try { - ResultSet rs = statement_.executeQuery ("SELECT CUSNUM,LSTNAM,INIT FROM QIWS.QCUSTCDT"); - int i = rs.findColumn ("LsTnAm"); - rs.close (); - assertCondition (i == 2, "found column = "+i+" sb 2 "); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - - - -/** -findColumn() - Should thrown an exception when null is passed -on a "simple" result set. -**/ - public void Var009 () - { - try { - ResultSet rs = dmd_.getTableTypes (); - rs.findColumn (null); - failed ("Didn't throw SQLException"); - } - catch (Exception e) { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } - - - -/** -findColumn() - Should thrown an exception when an empty -string is passed on a "simple" result set. -**/ - public void Var010 () - { - try { - ResultSet rs = dmd_.getTableTypes (); - rs.findColumn (""); - failed ("Didn't throw SQLException"); - } - catch (Exception e) { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } - - - -/** -findColumn() - Should thrown an exception when an non-existent -column name is passed on a "simple" result set. -**/ - public void Var011 () - { - try { - ResultSet rs = dmd_.getTableTypes (); - rs.findColumn ("JIM"); - failed ("Didn't throw SQLException"); - } - catch (Exception e) { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } - - - -/** -findColumn() - Should return the correct column when it is -the only on a "simple" result set. -**/ - public void Var012() - { - try { - ResultSet rs = dmd_.getTableTypes (); - int i = rs.findColumn ("TABLE_TYPE"); - rs.close (); - assertCondition (i == 1); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - - - -/** -findColumn() - Should return the correct column when it is -in a different case on a "simple" result set. -**/ - public void Var013() - { - try { - ResultSet rs = dmd_.getTableTypes (); - int i = rs.findColumn ("tAbLe_TyPe"); - rs.close (); - assertCondition (i == 1); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - - - -/** -findColumn() - Should thrown an exception when null is passed -on a "mapped" result set. -**/ - public void Var014 () - { - try { - ResultSet rs = dmd_.getColumns (null, "QIWS", - "QCUSTCDT", "%"); - rs.findColumn (null); - failed ("Didn't throw SQLException"); - } - catch (Exception e) { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } - - - -/** -findColumn() - Should thrown an exception when an empty -string is passed on a "mapped" result set. -**/ - public void Var015 () - { - try { - ResultSet rs = dmd_.getColumns (null, "QIWS", - "QCUSTCDT", "%"); - rs.findColumn (""); - failed ("Didn't throw SQLException"); - } - catch (Exception e) { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } - - - -/** -findColumn() - Should thrown an exception when an non-existent -column name is passed on a "mapped" result set. -**/ - public void Var016 () - { - try { - ResultSet rs = dmd_.getColumns (null, "QIWS", - "QCUSTCDT", "%"); - rs.findColumn ("JIM"); - failed ("Didn't throw SQLException"); - } - catch (Exception e) { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } - - - -/** -findColumn() - Should return the correct column when it is -the first on a "mapped" result set. -**/ - public void Var017 () - { - try { - ResultSet rs = dmd_.getColumns (null, "QIWS", - "QCUSTCDT", "%"); - int i = rs.findColumn ("TABLE_CAT"); - rs.close (); - assertCondition (i == 1); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - - - -/** -findColumn() - Should return the correct column when it is -the last on a "mapped" result set. -**/ - public void Var018 () - { - try { - ResultSet rs = dmd_.getColumns (null, "QIWS", - "QCUSTCDT", "%"); - int i = rs.findColumn ("IS_NULLABLE"); - rs.close (); - assertCondition (i == 18); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - - - -/** -findColumn() - Should return the correct column when it is -neither the first nor last on a "mapped" result set. -**/ - public void Var019() - { - try { - ResultSet rs = dmd_.getColumns (null, "QIWS", - "QCUSTCDT", "%"); - int i = rs.findColumn ("BUFFER_LENGTH"); - rs.close (); - assertCondition (i == 8); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - - - -/** -findColumn() - Should return the correct column when it is -in a different case on a "mapped" result set. -**/ - public void Var020() - { - try { - ResultSet rs = dmd_.getColumns (null, "QIWS", - "QCUSTCDT", "%"); - int i = rs.findColumn ("rEMaRKs"); - rs.close (); - assertCondition (i == 12); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - -/** -findColumn() - Should return the correct column when it is -the first and lowercase -**/ - public void Var021() - { - if (getDriver() == JDTestDriver.DRIVER_NATIVE) { - try { - ResultSet rs = statement_.executeQuery ("SELECT CUSNUM as \"col1\",LSTNAM as \"col2\", INIT as \"col3\" FROM QIWS.QCUSTCDT"); - int i = rs.findColumn ("col1"); - rs.close (); - assertCondition (i == 1); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } else { - notApplicable("Need to add support for case insensitive column name search"); - } - } - - - -/** -findColumn() - Should return the correct column when it is -the last and lower case. -**/ - public void Var022() - { - if (getDriver() == JDTestDriver.DRIVER_NATIVE) { - try { - ResultSet rs = statement_.executeQuery ("SELECT CUSNUM as \"col1\",LSTNAM as \"col2\", INIT as \"col3\" FROM QIWS.QCUSTCDT"); - int i = rs.findColumn ("col3"); - rs.close (); - assertCondition (i == 3); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } else { - notApplicable("Need to add support for case insensitive column name search"); - } - } - - - -/** -findColumn() - Should return the correct column when it is -neither the first nor last on a "simple" result set -**/ - public void Var023() - { - if (getDriver() == JDTestDriver.DRIVER_NATIVE) { - try { - ResultSet rs = statement_.executeQuery ("SELECT CUSNUM as \"col1\",LSTNAM as \"col2\", INIT as \"col3\" FROM QIWS.QCUSTCDT"); - int i = rs.findColumn ("col2"); - rs.close (); - assertCondition (i == 2); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } else { - notApplicable("Need to add support for case insensitive column name search"); - } - } - - -/** -findColumn() - Should return the correct column when it is -the first and lowercase and the second column queried -**/ - public void Var024() - { - if (getDriver() == JDTestDriver.DRIVER_NATIVE) { - try { - ResultSet rs = statement_.executeQuery ("SELECT CUSNUM as \"col1\",LSTNAM as \"col2\", INIT as \"col3\" FROM QIWS.QCUSTCDT"); - int j = rs.findColumn ("col3"); - int i = rs.findColumn ("col1"); - rs.close (); - assertCondition (i == 1 && j == 3 ); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } else { - notApplicable("Need to add support for case insensitive column name search"); - } - } - - - -/** -findColumn() - Should return the correct column when it is -the last and lower case and the second column queried. -**/ - public void Var025() - { - if (getDriver() == JDTestDriver.DRIVER_NATIVE) { - try { - ResultSet rs = statement_.executeQuery ("SELECT CUSNUM as \"col1\",LSTNAM as \"col2\", INIT as \"col3\" FROM QIWS.QCUSTCDT"); - int j = rs.findColumn ("col2"); - int i = rs.findColumn ("col3"); - rs.close (); - assertCondition (j == 2 && i == 3); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } else { - notApplicable("Need to add support for case insensitive column name search"); - } - } - - - -/** -findColumn() - Should return the correct column when it is -neither the first nor last on a "simple" result set and the second column queried -**/ - public void Var026() - { - if (getDriver() == JDTestDriver.DRIVER_NATIVE) { - try { - ResultSet rs = statement_.executeQuery ("SELECT CUSNUM as \"col1\",LSTNAM as \"col2\", INIT as \"col3\" FROM QIWS.QCUSTCDT"); - int j = rs.findColumn ("col1"); - int i = rs.findColumn ("col2"); - rs.close (); - assertCondition (j == 1 && i == 2); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } else { - notApplicable("Need to add support for case insensitive column name search"); - } - } - - - -/** -findColumn() - Should return the first column on a case insensitive search -**/ - public void Var027() - { - if (getDriver() == JDTestDriver.DRIVER_NATIVE) { - try { - ResultSet rs = statement_.executeQuery ("SELECT CUSNUM as \"One\",LSTNAM as \"ONe\", INIT as \"ONE\" FROM QIWS.QCUSTCDT"); - int j = rs.findColumn ("one"); - int i = rs.findColumn ("one"); - rs.close (); - assertCondition (j == 1 && i == 1); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } else { - notApplicable("Need to add support for case insensitive column name search"); - } - } - - -/** -findColumn() - Find the right columns using a case sensitive search -- the native driver does different stuff on the first time lookup - so variations 28-30 are almost the same -**/ - public void Var028() - { - try { - ResultSet rs = statement_.executeQuery ("SELECT CUSNUM as \"One\",LSTNAM as \"ONe\", INIT as \"ONE\" FROM QIWS.QCUSTCDT"); - int i = rs.findColumn ("\"One\""); - int j = rs.findColumn ("\"ONe\""); - int k = rs.findColumn ("\"ONE\""); - rs.close (); - assertCondition (i == 1 && j == 2 && k == 3 ); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - -/** -findColumn() - Find the right columns using a case sensitive search -- the native driver does different stuff on the first time lookup - so variations 28-30 are almost the same -**/ - public void Var029() - { - try { - ResultSet rs = statement_.executeQuery ("SELECT CUSNUM as \"One\",LSTNAM as \"ONe\", INIT as \"ONE\" FROM QIWS.QCUSTCDT"); - int j = rs.findColumn ("\"ONe\""); - int i = rs.findColumn ("\"One\""); - int k = rs.findColumn ("\"ONE\""); - rs.close (); - assertCondition (i == 1 && j == 2 && k == 3 ); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - - -/** -findColumn() - Find the right columns using a case sensitive search -- the native driver does different stuff on the first time lookup - so variations 28-30 are almost the same -**/ - public void Var030() - { - try { - ResultSet rs = statement_.executeQuery ("SELECT CUSNUM as \"One\",LSTNAM as \"ONe\", INIT as \"ONE\" FROM QIWS.QCUSTCDT"); - int k = rs.findColumn ("\"ONE\""); - int i = rs.findColumn ("\"One\""); - int j = rs.findColumn ("\"ONe\""); - rs.close (); - assertCondition (i == 1 && j == 2 && k == 3 ); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - -/** - * findColumn -- Don't find a column using a case sensitive search - */ - public void Var031() - { - ResultSet rs = null; - try { - rs = statement_.executeQuery ("SELECT CUSNUM as \"One\",LSTNAM as \"ONe\", INIT as \"ONE\" FROM QIWS.QCUSTCDT"); - int i = rs.findColumn ("\"one\""); - failed ("Didn't throw SQLException but got "+i); - } - catch (Exception e) { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - try { - if (rs != null) rs.close(); - } catch (Exception e) {} - - } - -/** - * findColumn -- Don't find a column using a case sensitive search (on second try) - */ - public void Var032() - { - ResultSet rs = null; - try { - rs = statement_.executeQuery ("SELECT CUSNUM as \"One\",LSTNAM as \"ONe\", INIT as \"ONE\" FROM QIWS.QCUSTCDT"); - int j = rs.findColumn ("\"ONe\""); - int i = rs.findColumn ("\"one\""); - failed ("Didn't throw SQLException but got "+i+" and "+j); - } - catch (Exception e) { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - try { - if (rs != null) rs.close(); - } catch (Exception e) {} - - } - - - - + String[] newArgs = new String[args.length + 2]; + newArgs[0] = "-tc"; + newArgs[1] = "JDRSFindColumn"; + for (int i = 0; i < args.length; i++) { + newArgs[2 + i] = args[i]; + } + test.JDRSTest.main(newArgs); + } + + // Private data. + private DatabaseMetaData dmd_; + private Statement statement_; + + /** + * Constructor. + **/ + public JDRSFindColumn(AS400 systemObject, Hashtable> namesAndVars, int runMode, + FileOutputStream fileOutputStream, + + String password) { + super(systemObject, "JDRSFindColumn", namesAndVars, runMode, fileOutputStream, password); + } + + /** + * Performs setup needed before running variations. + * + * @exception Exception If an exception occurs. + **/ + protected void setup() throws Exception { + if (connection_ != null) + connection_.close(); + + connection_ = testDriver_.getConnection(baseURL_, userId_, encryptedPassword_, "JDRSFindColumn"); + dmd_ = connection_.getMetaData(); + statement_ = connection_.createStatement(); + } + + /** + * Performs cleanup needed after running variations. + * + * @exception Exception If an exception occurs. + **/ + protected void cleanup() throws Exception { + statement_.close(); + connection_.close(); + } + + /** + * findColumn() - Should thrown an exception on a closed result set. + **/ + public void Var001() { + try { + ResultSet rs = statement_.executeQuery("SELECT * FROM QIWS.QCUSTCDT"); + rs.close(); + rs.findColumn("LSTNAM"); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } + } + + /** + * findColumn() - Should thrown an exception when null is passed. + **/ + public void Var002() { + try (ResultSet rs = statement_.executeQuery("SELECT * FROM QIWS.QCUSTCDT")) { + rs.findColumn(null); + failed("Didn't throw SQLException for null column"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } + } + + /** + * findColumn() - Should thrown an exception when an empty string is passed. + **/ + public void Var003() { + try (ResultSet rs = statement_.executeQuery("SELECT * FROM QIWS.QCUSTCDT")) { + rs.findColumn(""); + failed("Didn't throw SQLException for empty string"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } + } + + /** + * findColumn() - Should thrown an exception when an non-existent column name is + * passed. + **/ + public void Var004() { + try (ResultSet rs = statement_.executeQuery("SELECT * FROM QIWS.QCUSTCDT")) { + rs.findColumn("JIM"); + failed("Didn't throw SQLException for not existing column"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } + } + + /** + * findColumn() - Should return the correct column when it is the first. + **/ + public void Var005() { + try { + ResultSet rs = statement_.executeQuery("SELECT CUSNUM,LSTNAM,INIT FROM QIWS.QCUSTCDT"); + int i = rs.findColumn("CUSNUM"); + rs.close(); + assertCondition(i == 1); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + + /** + * findColumn() - Should return the correct column when it is the last. + **/ + public void Var006() { + try { + ResultSet rs = statement_.executeQuery("SELECT CUSNUM,LSTNAM,INIT FROM QIWS.QCUSTCDT"); + int i = rs.findColumn("INIT"); + rs.close(); + assertCondition(i == 3); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + + /** + * findColumn() - Should return the correct column when it is neither the first + * nor last on a "simple" result set. + **/ + public void Var007() { + try { + ResultSet rs = statement_.executeQuery("SELECT CUSNUM,LSTNAM,INIT FROM QIWS.QCUSTCDT"); + int i = rs.findColumn("LSTNAM"); + rs.close(); + assertCondition(i == 2); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + + /** + * findColumn() - Should return the correct column when it is in a different + * case. + **/ + public void Var008() { + try { + ResultSet rs = statement_.executeQuery("SELECT CUSNUM,LSTNAM,INIT FROM QIWS.QCUSTCDT"); + int i = rs.findColumn("LsTnAm"); + rs.close(); + assertCondition(i == 2, "found column = " + i + " sb 2 "); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + + /** + * findColumn() - Should thrown an exception when null is passed on a "simple" + * result set. + **/ + public void Var009() { + try (ResultSet rs = dmd_.getTableTypes()) { + rs.findColumn(null); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } + } + + /** + * findColumn() - Should thrown an exception when an empty string is passed on a + * "simple" result set. + **/ + public void Var010() { + try (ResultSet rs = dmd_.getTableTypes()) { + rs.findColumn(""); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } + } + + /** + * findColumn() - Should thrown an exception when an non-existent column name is + * passed on a "simple" result set. + **/ + public void Var011() { + try (ResultSet rs = dmd_.getTableTypes()) { + rs.findColumn("JIM"); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } + } + + /** + * findColumn() - Should return the correct column when it is the only on a + * "simple" result set. + **/ + public void Var012() { + try { + ResultSet rs = dmd_.getTableTypes(); + int i = rs.findColumn("TABLE_TYPE"); + rs.close(); + assertCondition(i == 1); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + + /** + * findColumn() - Should return the correct column when it is in a different + * case on a "simple" result set. + **/ + public void Var013() { + try { + ResultSet rs = dmd_.getTableTypes(); + int i = rs.findColumn("tAbLe_TyPe"); + rs.close(); + assertCondition(i == 1); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + + /** + * findColumn() - Should thrown an exception when null is passed on a "mapped" + * result set. + **/ + public void Var014() { + try (ResultSet rs = dmd_.getColumns(null, "QIWS", "QCUSTCDT", "%")) { + rs.findColumn(null); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } + } + + /** + * findColumn() - Should thrown an exception when an empty string is passed on a + * "mapped" result set. + **/ + public void Var015() { + try (ResultSet rs = dmd_.getColumns(null, "QIWS", "QCUSTCDT", "%")) { + rs.findColumn(""); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } + } + + /** + * findColumn() - Should thrown an exception when an non-existent column name is + * passed on a "mapped" result set. + **/ + public void Var016() { + try (ResultSet rs = dmd_.getColumns(null, "QIWS", "QCUSTCDT", "%")) { + rs.findColumn("JIM"); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } + } + + /** + * findColumn() - Should return the correct column when it is the first on a + * "mapped" result set. + **/ + public void Var017() { + try { + ResultSet rs = dmd_.getColumns(null, "QIWS", "QCUSTCDT", "%"); + int i = rs.findColumn("TABLE_CAT"); + rs.close(); + assertCondition(i == 1); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + + /** + * findColumn() - Should return the correct column when it is the last on a + * "mapped" result set. + **/ + public void Var018() { + try { + ResultSet rs = dmd_.getColumns(null, "QIWS", "QCUSTCDT", "%"); + int i = rs.findColumn("IS_NULLABLE"); + rs.close(); + assertCondition(i == 18); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + + /** + * findColumn() - Should return the correct column when it is neither the first + * nor last on a "mapped" result set. + **/ + public void Var019() { + try { + ResultSet rs = dmd_.getColumns(null, "QIWS", "QCUSTCDT", "%"); + int i = rs.findColumn("BUFFER_LENGTH"); + rs.close(); + assertCondition(i == 8); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + + /** + * findColumn() - Should return the correct column when it is in a different + * case on a "mapped" result set. + **/ + public void Var020() { + try { + ResultSet rs = dmd_.getColumns(null, "QIWS", "QCUSTCDT", "%"); + int i = rs.findColumn("rEMaRKs"); + rs.close(); + assertCondition(i == 12); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + + /** + * findColumn() - Should return the correct column when it is the first and + * lowercase + **/ + public void Var021() { + if (getDriver() == JDTestDriver.DRIVER_NATIVE) { + try { + ResultSet rs = statement_ + .executeQuery("SELECT CUSNUM as \"col1\",LSTNAM as \"col2\", INIT as \"col3\" FROM QIWS.QCUSTCDT"); + int i = rs.findColumn("col1"); + rs.close(); + assertCondition(i == 1); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } else { + notApplicable("Need to add support for case insensitive column name search"); + } + } + + /** + * findColumn() - Should return the correct column when it is the last and lower + * case. + **/ + public void Var022() { + if (getDriver() == JDTestDriver.DRIVER_NATIVE) { + try { + ResultSet rs = statement_ + .executeQuery("SELECT CUSNUM as \"col1\",LSTNAM as \"col2\", INIT as \"col3\" FROM QIWS.QCUSTCDT"); + int i = rs.findColumn("col3"); + rs.close(); + assertCondition(i == 3); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } else { + notApplicable("Need to add support for case insensitive column name search"); + } + } + + /** + * findColumn() - Should return the correct column when it is neither the first + * nor last on a "simple" result set + **/ + public void Var023() { + if (getDriver() == JDTestDriver.DRIVER_NATIVE) { + try { + ResultSet rs = statement_ + .executeQuery("SELECT CUSNUM as \"col1\",LSTNAM as \"col2\", INIT as \"col3\" FROM QIWS.QCUSTCDT"); + int i = rs.findColumn("col2"); + rs.close(); + assertCondition(i == 2); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } else { + notApplicable("Need to add support for case insensitive column name search"); + } + } + + /** + * findColumn() - Should return the correct column when it is the first and + * lowercase and the second column queried + **/ + public void Var024() { + if (getDriver() == JDTestDriver.DRIVER_NATIVE) { + try { + ResultSet rs = statement_ + .executeQuery("SELECT CUSNUM as \"col1\",LSTNAM as \"col2\", INIT as \"col3\" FROM QIWS.QCUSTCDT"); + int j = rs.findColumn("col3"); + int i = rs.findColumn("col1"); + rs.close(); + assertCondition(i == 1 && j == 3); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } else { + notApplicable("Need to add support for case insensitive column name search"); + } + } + + /** + * findColumn() - Should return the correct column when it is the last and lower + * case and the second column queried. + **/ + public void Var025() { + if (getDriver() == JDTestDriver.DRIVER_NATIVE) { + try { + ResultSet rs = statement_ + .executeQuery("SELECT CUSNUM as \"col1\",LSTNAM as \"col2\", INIT as \"col3\" FROM QIWS.QCUSTCDT"); + int j = rs.findColumn("col2"); + int i = rs.findColumn("col3"); + rs.close(); + assertCondition(j == 2 && i == 3); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } else { + notApplicable("Need to add support for case insensitive column name search"); + } + } + + /** + * findColumn() - Should return the correct column when it is neither the first + * nor last on a "simple" result set and the second column queried + **/ + public void Var026() { + if (getDriver() == JDTestDriver.DRIVER_NATIVE) { + try { + ResultSet rs = statement_ + .executeQuery("SELECT CUSNUM as \"col1\",LSTNAM as \"col2\", INIT as \"col3\" FROM QIWS.QCUSTCDT"); + int j = rs.findColumn("col1"); + int i = rs.findColumn("col2"); + rs.close(); + assertCondition(j == 1 && i == 2); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } else { + notApplicable("Need to add support for case insensitive column name search"); + } + } + + /** + * findColumn() - Should return the first column on a case insensitive search + **/ + public void Var027() { + if (getDriver() == JDTestDriver.DRIVER_NATIVE) { + try { + ResultSet rs = statement_ + .executeQuery("SELECT CUSNUM as \"One\",LSTNAM as \"ONe\", INIT as \"ONE\" FROM QIWS.QCUSTCDT"); + int j = rs.findColumn("one"); + int i = rs.findColumn("one"); + rs.close(); + assertCondition(j == 1 && i == 1); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } else { + notApplicable("Need to add support for case insensitive column name search"); + } + } + + /** + * findColumn() - Find the right columns using a case sensitive search -- the + * native driver does different stuff on the first time lookup so variations + * 28-30 are almost the same + **/ + public void Var028() { + try { + ResultSet rs = statement_ + .executeQuery("SELECT CUSNUM as \"One\",LSTNAM as \"ONe\", INIT as \"ONE\" FROM QIWS.QCUSTCDT"); + int i = rs.findColumn("\"One\""); + int j = rs.findColumn("\"ONe\""); + int k = rs.findColumn("\"ONE\""); + rs.close(); + assertCondition(i == 1 && j == 2 && k == 3); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + + /** + * findColumn() - Find the right columns using a case sensitive search -- the + * native driver does different stuff on the first time lookup so variations + * 28-30 are almost the same + **/ + public void Var029() { + try { + ResultSet rs = statement_ + .executeQuery("SELECT CUSNUM as \"One\",LSTNAM as \"ONe\", INIT as \"ONE\" FROM QIWS.QCUSTCDT"); + int j = rs.findColumn("\"ONe\""); + int i = rs.findColumn("\"One\""); + int k = rs.findColumn("\"ONE\""); + rs.close(); + assertCondition(i == 1 && j == 2 && k == 3); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + + /** + * findColumn() - Find the right columns using a case sensitive search -- the + * native driver does different stuff on the first time lookup so variations + * 28-30 are almost the same + **/ + public void Var030() { + try { + ResultSet rs = statement_ + .executeQuery("SELECT CUSNUM as \"One\",LSTNAM as \"ONe\", INIT as \"ONE\" FROM QIWS.QCUSTCDT"); + int k = rs.findColumn("\"ONE\""); + int i = rs.findColumn("\"One\""); + int j = rs.findColumn("\"ONe\""); + rs.close(); + assertCondition(i == 1 && j == 2 && k == 3); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + + /** + * findColumn -- Don't find a column using a case sensitive search + */ + public void Var031() { + try (ResultSet rs = statement_ + .executeQuery("SELECT CUSNUM as \"One\",LSTNAM as \"ONe\", INIT as \"ONE\" FROM QIWS.QCUSTCDT")) { + int i = rs.findColumn("\"one\""); + failed("Didn't throw SQLException but got " + i); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } + + } + + /** + * findColumn -- Don't find a column using a case sensitive search (on second + * try) + */ + public void Var032() { + try (ResultSet rs = statement_ + .executeQuery("SELECT CUSNUM as \"One\",LSTNAM as \"ONe\", INIT as \"ONE\" FROM QIWS.QCUSTCDT")) { + int j = rs.findColumn("\"ONe\""); + int i = rs.findColumn("\"one\""); + failed("Didn't throw SQLException but got " + i + " and " + j); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } + + } } - - - diff --git a/src/test/JD/RS/JDRSFirst.java b/src/test/JD/RS/JDRSFirst.java index d9aa3fb5..bc9de528 100644 --- a/src/test/JD/RS/JDRSFirst.java +++ b/src/test/JD/RS/JDRSFirst.java @@ -18,6 +18,7 @@ import test.JDRSTest; import test.JDTestcase; +import test.JD.JDSerializeFile; import java.io.FileOutputStream; import java.sql.Connection; @@ -25,7 +26,7 @@ import java.sql.PreparedStatement; import java.sql.ResultSet; - +import java.sql.SQLException; import java.sql.SQLWarning; import java.sql.Statement; import java.util.Hashtable; @@ -203,9 +204,8 @@ public void Var002 () public void Var003 () { if (checkJdbc20 ()) { - try { - ResultSet rs = statement_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_POS); + try (ResultSet rs = statement_.executeQuery ("SELECT * FROM " + + JDRSTest.RSTEST_POS)) { statement_.cancel (); rs.first (); failed ("Didn't throw SQLException"); @@ -224,11 +224,10 @@ public void Var003 () public void Var004 () { if (checkJdbc20 ()) { - try { - Statement s = connection_.createStatement (ResultSet.TYPE_FORWARD_ONLY, - ResultSet.CONCUR_READ_ONLY); + try (Statement s = connection_.createStatement (ResultSet.TYPE_FORWARD_ONLY, + ResultSet.CONCUR_READ_ONLY); ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_POS); + + JDRSTest.RSTEST_POS)) { rs.first (); failed ("Didn't throw SQLException"); } @@ -639,7 +638,9 @@ public void Var020 () public void Var021 () { if (checkJdbc20 ()) { - try { + JDSerializeFile serializeFile = null; + try { + serializeFile = new JDSerializeFile(connection_, JDRSTest.RSTEST_POS); // Update each value. ResultSet rs = statement_.executeQuery ("SELECT * FROM " + JDRSTest.RSTEST_POS + " FOR UPDATE OF VALUE"); @@ -663,6 +664,14 @@ public void Var021 () } catch (Exception e) { failed (e, "Unexpected Exception"); + } finally { + if (serializeFile != null) { + try { + serializeFile.close(); + } catch (SQLException e) { + e.printStackTrace(); + } + } } } } @@ -748,9 +757,8 @@ public void Var024 () public void Var025 () { if (checkJdbc20 ()) { - try { - ResultSet rs = statement_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_POS); + try (ResultSet rs = statement_.executeQuery ("SELECT * FROM " + + JDRSTest.RSTEST_POS)) { statement_.cancel (); rs.isFirst (); failed ("Didn't throw SQLException"); @@ -1450,11 +1458,9 @@ public void Var054 () if (checkJdbc20 ()) { if (checkNative()) { StringBuffer sb = new StringBuffer(); + boolean passed=true; String sql = "Select 'A' from sysibm.sysdummy1 UNION Select 'B' from sysibm.sysdummy1 UNION SELECT 'C' from sysibm.sysdummy1"; - try { - boolean passed=true; - ResultSet rs = statementNoPrefetch_.executeQuery (sql); - + try (ResultSet rs = statementNoPrefetch_.executeQuery (sql)) { boolean fetch1 = rs.next(); if (!fetch1) { passed=false; sb.append("fetch1 returned "+fetch1+"\n"); } @@ -1558,9 +1564,8 @@ public void Var062 () public void Var063 () { if (checkJdbc20 ()) { - try { - ResultSet rs = statementNoPrefetch_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_POS); + try (ResultSet rs = statementNoPrefetch_.executeQuery ("SELECT * FROM " + + JDRSTest.RSTEST_POS)) { statementNoPrefetch_.cancel (); rs.first (); failed ("Didn't throw SQLException"); @@ -1579,11 +1584,10 @@ public void Var063 () public void Var064 () { if (checkJdbc20 ()) { - try { - Statement s = connectionNoPrefetch_.createStatement (ResultSet.TYPE_FORWARD_ONLY, - ResultSet.CONCUR_READ_ONLY); + try (Statement s = connectionNoPrefetch_.createStatement (ResultSet.TYPE_FORWARD_ONLY, + ResultSet.CONCUR_READ_ONLY); ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_POS); + + JDRSTest.RSTEST_POS)) { rs.first (); failed ("Didn't throw SQLException"); } @@ -1994,7 +1998,9 @@ public void Var080 () public void Var081 () { if (checkJdbc20 ()) { - try { + JDSerializeFile serializeFile = null; + try { + serializeFile = new JDSerializeFile(connection_, JDRSTest.RSTEST_POS); // Update each value. ResultSet rs = statementNoPrefetch_.executeQuery ("SELECT * FROM " + JDRSTest.RSTEST_POS + " FOR UPDATE OF VALUE"); @@ -2018,6 +2024,14 @@ public void Var081 () } catch (Exception e) { failed (e, "Unexpected Exception"); + } finally { + if (serializeFile != null) { + try { + serializeFile.close(); + } catch (SQLException e) { + e.printStackTrace(); + } + } } } } @@ -2103,9 +2117,8 @@ public void Var084 () public void Var085 () { if (checkJdbc20 ()) { - try { - ResultSet rs = statementNoPrefetch_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_POS); + try (ResultSet rs = statementNoPrefetch_.executeQuery ("SELECT * FROM " + + JDRSTest.RSTEST_POS)) { statementNoPrefetch_.cancel (); rs.isFirst (); failed ("Didn't throw SQLException"); diff --git a/src/test/JD/RS/JDRSGetArray.java b/src/test/JD/RS/JDRSGetArray.java index 936c12f4..173b5903 100644 --- a/src/test/JD/RS/JDRSGetArray.java +++ b/src/test/JD/RS/JDRSGetArray.java @@ -101,7 +101,7 @@ protected void setup () ResultSet.CONCUR_UPDATABLE); } statement_.executeUpdate ("INSERT INTO " + JDRSTest.RSTEST_GET - + " (C_KEY) VALUES ('DUMMY_ROW')"); + + " (C_KEY) VALUES ('DUMMYROW_GA')"); resultSetQuery_ = "SELECT * FROM " + JDRSTest.RSTEST_GET + " FOR UPDATE"; rs_ = statement_.executeQuery (resultSetQuery_); @@ -135,8 +135,7 @@ protected void cleanup () public void Var001() { if (checkJdbc20 ()) { - try { - Statement s = connection_.createStatement (); + try (Statement s = connection_.createStatement ()) { ResultSet rs = s.executeQuery ("SELECT * FROM " + JDRSTest.RSTEST_GET); rs.next (); @@ -426,7 +425,7 @@ public void Var015() { if (checkJdbc20 ()) { try { - rs_ = JDRSTest.position (driver_, statement_, resultSetQuery_, rs_, "DUMMY_ROW"); + rs_ = JDRSTest.position (driver_, statement_, resultSetQuery_, rs_, "DUMMYROW_GA"); rs_.deleteRow (); Array v = rs_.getArray ("C_INTEGER"); failed ("Didn't throw SQLException" +v); @@ -793,11 +792,10 @@ public void Var034 () { if (checkJdbc20 ()) { if (checkDatalinkSupport ()) { - try { - Statement s = connection_.createStatement (ResultSet.TYPE_SCROLL_INSENSITIVE, - ResultSet.CONCUR_READ_ONLY); + try (Statement s = connection_.createStatement (ResultSet.TYPE_SCROLL_INSENSITIVE, + ResultSet.CONCUR_READ_ONLY); ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_GETDL); + + JDRSTest.RSTEST_GETDL)) { JDRSTest.position (rs, "LOB_FULL"); Array v = rs.getArray ("C_DATALINK"); failed ("Didn't throw SQLException" +v); @@ -858,10 +856,9 @@ public void Var036 () public void Var037 () { if (checkDecFloatSupport()) { - try { - Statement s = connection_.createStatement (); - ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP16); + try (Statement s = connection_.createStatement (); + ResultSet rs = s.executeQuery ("SELECT * FROM " + + JDRSTest.RSTEST_GETDFP16)) { rs.next(); Array v = rs.getArray (1); failed ("Didn't throw SQLException "+v); @@ -880,10 +877,9 @@ public void Var037 () public void Var038 () { if (checkDecFloatSupport()) { - try { - Statement s = connection_.createStatement (); - ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP34); + try (Statement s = connection_.createStatement (); + ResultSet rs = s.executeQuery ("SELECT * FROM " + + JDRSTest.RSTEST_GETDFP34)) { rs.next(); Array v = rs.getArray (1); failed ("Didn't throw SQLException "+v); @@ -902,9 +898,8 @@ public void Var038 () public void Var039 () { if (checkBooleanSupport()) { - try { - ResultSet rs = statement_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_BOOLEAN); + try (ResultSet rs = statement_.executeQuery ("SELECT * FROM " + + JDRSTest.RSTEST_BOOLEAN)) { JDRSTest.position0 (rs, "BOOLEAN_TRUE"); Array v = rs.getArray ("C_BOOLEAN"); failed ("Didn't throw SQLException"+v); @@ -922,9 +917,8 @@ public void Var039 () public void Var040 () { if (checkBooleanSupport()) { - try { - ResultSet rs = statement_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_BOOLEAN); + try (ResultSet rs = statement_.executeQuery ("SELECT * FROM " + + JDRSTest.RSTEST_BOOLEAN)) { JDRSTest.position0 (rs, "BOOLEAN_FALSE"); Array v = rs.getArray ("C_BOOLEAN"); failed ("Didn't throw SQLException"+v); @@ -941,9 +935,8 @@ public void Var040 () public void Var041() { if (checkBooleanSupport()) { - try { - ResultSet rs = statement_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_BOOLEAN); + try (ResultSet rs = statement_.executeQuery ("SELECT * FROM " + + JDRSTest.RSTEST_BOOLEAN)) { JDRSTest.position0 (rs, "BOOLEAN_NULL"); Array v = rs.getArray ("C_BOOLEAN"); failed ("Didn't throw SQLException"+v); diff --git a/src/test/JD/RS/JDRSGetAsciiStream.java b/src/test/JD/RS/JDRSGetAsciiStream.java index 28ea4d68..cd00b2c0 100644 --- a/src/test/JD/RS/JDRSGetAsciiStream.java +++ b/src/test/JD/RS/JDRSGetAsciiStream.java @@ -20,6 +20,7 @@ import test.JDTestDriver; import test.JDTestcase; import test.Testcase; +import test.JD.JDSerializeFile; import test.JD.JDTestUtilities; import java.io.FileOutputStream; @@ -119,7 +120,7 @@ protected void setup () statement_ = connection_.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); statement_.executeUpdate ("INSERT INTO " + JDRSTest.RSTEST_GET - + " (C_KEY) VALUES ('DUMMY_ROW')"); + + " (C_KEY) VALUES ('DUMMYROW_GAS')"); // Force LOB locators. connection2_ = testDriver_.getConnection (url + ";lob threshold=0",systemObject_.getUserId(),encryptedPassword_,"JDRSGetAsciiStream3"); @@ -212,13 +213,13 @@ protected static boolean compareBeginsWithBytes (InputStream i, byte[] b, String **/ public void Var001() { - try { - Statement s = connection_.createStatement (); + try (Statement s = connection_.createStatement ()) { ResultSet rs = s.executeQuery ("SELECT * FROM " + JDRSTest.RSTEST_GET); rs.next (); rs.close (); - rs.getAsciiStream (1); + InputStream v = rs.getAsciiStream (1); + v.close(); failed ("Didn't throw SQLException"); } catch (Exception e) { @@ -234,10 +235,10 @@ public void Var001() **/ public void Var002() { - try { - ResultSet rs = statement0_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_GET); + try (ResultSet rs = statement0_.executeQuery ("SELECT * FROM " + + JDRSTest.RSTEST_GET)) { InputStream v = rs.getAsciiStream (1); + v.close(); failed ("Didn't throw SQLException "+v); } catch (Exception e) { @@ -253,11 +254,11 @@ public void Var002() **/ public void Var003() { - try { - ResultSet rs = statement0_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_GET); + try (ResultSet rs = statement0_.executeQuery ("SELECT * FROM " + + JDRSTest.RSTEST_GET)) { rs.next (); InputStream v = rs.getAsciiStream (100); + v.close(); failed ("Didn't throw SQLException"+v); } catch (Exception e) { @@ -273,11 +274,11 @@ public void Var003() **/ public void Var004() { - try { - ResultSet rs = statement0_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_GET); + try (ResultSet rs = statement0_.executeQuery ("SELECT * FROM " + + JDRSTest.RSTEST_GET)) { rs.next (); InputStream v = rs.getAsciiStream (0); + v.close(); failed ("Didn't throw SQLException"+v); } catch (Exception e) { @@ -293,11 +294,11 @@ public void Var004() **/ public void Var005() { - try { - ResultSet rs = statement0_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_GET); + try (ResultSet rs = statement0_.executeQuery ("SELECT * FROM " + + JDRSTest.RSTEST_GET)) { rs.next (); InputStream v = rs.getAsciiStream (-1); + v.close(); failed ("Didn't throw SQLException"+v); } catch (Exception e) { @@ -313,9 +314,8 @@ public void Var005() public void Var006() { sb.setLength(0); - try { - ResultSet rs = statement0_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_GET); + try (ResultSet rs = statement0_.executeQuery ("SELECT * FROM " + + JDRSTest.RSTEST_GET)) { JDRSTest.position0 (rs, "CHAR_FULL"); InputStream v = rs.getAsciiStream (12); if( getDriver() == JDTestDriver.DRIVER_NATIVE && // @K2 @@ -325,6 +325,8 @@ public void Var006() else // @K2 assertCondition (compare ( // @K2 v, "Toolbox for Java ", "8859_1",sb),sb); // @K2 + v.close(); + } catch (Exception e) { failed (e, "Unexpected Exception"); @@ -339,11 +341,12 @@ public void Var006() **/ public void Var007() { - try { - ResultSet rs = statement0_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_GET); + try (ResultSet rs = statement0_.executeQuery ("SELECT * FROM " + + JDRSTest.RSTEST_GET)) { rs.next (); - rs.getAsciiStream (null); + InputStream v = rs.getAsciiStream (null); + v.close(); + failed ("Didn't throw SQLException"); } catch (Exception e) { @@ -359,11 +362,12 @@ public void Var007() **/ public void Var008() { - try { - ResultSet rs = statement0_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_GET); + try (ResultSet rs = statement0_.executeQuery ("SELECT * FROM " + + JDRSTest.RSTEST_GET)) { rs.next (); - rs.getAsciiStream (""); + InputStream v = rs.getAsciiStream (""); + v.close(); + failed ("Didn't throw SQLException"); } catch (Exception e) { @@ -379,11 +383,11 @@ public void Var008() **/ public void Var009() { - try { - ResultSet rs = statement0_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_GET); + try (ResultSet rs = statement0_.executeQuery ("SELECT * FROM " + + JDRSTest.RSTEST_GET)) { rs.next (); - rs.getAsciiStream ("INVALID"); + InputStream v = rs.getAsciiStream ("INVALID"); + v.close(); failed ("Didn't throw SQLException"); } catch (Exception e) { @@ -399,9 +403,8 @@ public void Var009() public void Var010() { sb.setLength(0); - try { - ResultSet rs = statement0_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_GET); + try (ResultSet rs = statement0_.executeQuery ("SELECT * FROM " + + JDRSTest.RSTEST_GET)) { JDRSTest.position0 (rs, "CHAR_FULL"); InputStream v = rs.getAsciiStream ("C_CHAR_50"); if( getDriver() == JDTestDriver.DRIVER_NATIVE && // @K2 @@ -410,7 +413,9 @@ public void Var010() v, "Toolbox for Java ".getBytes("8859_1"),sb),sb); // @K2 else // @K2 assertCondition (compare ( // @K2 + v, "Toolbox for Java ", "8859_1",sb),sb); // @K2 + v.close(); } catch (Exception e) { failed (e, "Unexpected Exception"); @@ -440,6 +445,7 @@ public void Var011() else // @K2 check = compare (v, "World Peace", "8859_1",sb); // @K2 rs.close(); + v.close(); assertCondition(check,sb); } catch (Exception e) { @@ -458,12 +464,14 @@ public void Var012() sb.setLength(0); if (checkJdbc20 ()) { - try { + JDSerializeFile serializeFile = null; + try { + serializeFile = new JDSerializeFile(connection_, JDRSTest.RSTEST_GET); ResultSet rs = statement_.executeQuery ("SELECT * FROM " + JDRSTest.RSTEST_GET + " FOR UPDATE"); JDRSTest.position (rs, "UPDATE_SANDBOX"); rs.updateString ("C_CHAR_50", "New Planet"); - rs.updateRow (); + rs.updateRow (); /* serialized */ InputStream v = rs.getAsciiStream ("C_CHAR_50"); boolean check; // @K2 if( getDriver() == JDTestDriver.DRIVER_NATIVE && // @K2 @@ -478,12 +486,21 @@ else if (getDriver() == JDTestDriver.DRIVER_JCC) { if (!check) { sVal = rs.getString("C_CHAR_50"); } + v.close(); rs.close(); assertCondition(check, "\nExpected 'New Planet ' "+ "\nGot '"+sVal+"'"+sb); } catch (Exception e) { failed (e, "Unexpected Exception"); + } finally { + if (serializeFile != null) { + try { + serializeFile.close(); + } catch (SQLException e) { + e.printStackTrace(); + } + } } } } @@ -515,7 +532,9 @@ public void Var013() check = compareBeginsWithBytes( v, "El Nino".getBytes("8859_1"),sb); // @K2 else // @K2 check = compare (v, "El Nino", "8859_1",sb); // @K2 + v.close(); rs.close(); + assertCondition(check,sb); } catch (Exception e) { @@ -539,7 +558,9 @@ public void Var014() notApplicable("JCC does not support moveToInserRow"); return; } - try { + JDSerializeFile serializeFile = null; + try { + serializeFile = new JDSerializeFile(connection_, JDRSTest.RSTEST_GET); ResultSet rs = statement_.executeQuery ("SELECT * FROM " + JDRSTest.RSTEST_GET + " FOR UPDATE"); rs.moveToInsertRow (); @@ -552,11 +573,20 @@ public void Var014() check = compareBeginsWithBytes( v, "Year 2000 Problem".getBytes("8859_1"),sb); // @K2 else // @K2 check = compare (v, "Year 2000 Problem", "8859_1",sb); // @K2 + v.close(); rs.close(); assertCondition(check,sb); } catch (Exception e) { failed (e, "Unexpected Exception"); + } finally { + if (serializeFile != null) { + try { + serializeFile.close(); + } catch (SQLException e) { + e.printStackTrace(); + } + } } } } @@ -577,9 +607,11 @@ public void Var015() try { rs = statement_.executeQuery ("SELECT * FROM " + JDRSTest.RSTEST_GET + " FOR UPDATE"); - JDRSTest.position (rs, "DUMMY_ROW"); + JDRSTest.position (rs, "DUMMYROW_GAS"); rs.deleteRow (); InputStream v = rs.getAsciiStream ("C_VARCHAR_50"); + v.close(); + failed ("Didn't throw SQLException but got v"+v); } catch (Exception e) { @@ -602,11 +634,11 @@ public void Var015() **/ public void Var016 () { - try { - ResultSet rs = statement0_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_GET); + try (ResultSet rs = statement0_.executeQuery ("SELECT * FROM " + + JDRSTest.RSTEST_GET)) { JDRSTest.position0 (rs, "CHAR_NULL"); InputStream v = rs.getAsciiStream ("C_VARCHAR_50"); + if (v != null) v.close(); assertCondition (v == null); } catch (Exception e) { @@ -623,13 +655,14 @@ public void Var017 () { sb.setLength(0); sb.append(" -- Updated 12/14/2011 Since a smallint can be converted to string, it can be converted to ASCII stream"); - try { - ResultSet rs = statement0_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_GET); + try (ResultSet rs = statement0_.executeQuery ("SELECT * FROM " + + JDRSTest.RSTEST_GET)) { JDRSTest.position0 (rs, "NUMBER_POS"); InputStream v = rs.getAsciiStream ("C_SMALLINT"); - assertCondition(compare(v, "198", "8859_1", sb),sb); + assertCondition(compare(v, "198", "8859_1", sb),sb); + v.close(); + } catch (Exception e) { @@ -649,13 +682,14 @@ public void Var018 () sb.setLength(0); sb.append(" -- Updated 12/14/2011 Since a integer can be converted to string, it can be converted to ASCII stream"); - try { - ResultSet rs = statement0_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_GET); + try (ResultSet rs = statement0_.executeQuery ("SELECT * FROM " + + JDRSTest.RSTEST_GET)) { JDRSTest.position0 (rs, "NUMBER_NEG"); InputStream v = rs.getAsciiStream ("C_INTEGER"); assertCondition(compare(v, "-98765", "8859_1", sb),sb); + v.close(); + } catch (Exception e) { failed (e, "Unexpected Exception"+sb); @@ -673,13 +707,14 @@ public void Var019 () sb.setLength(0); sb.append(" -- Updated 12/14/2011 Since a real can be converted to string, it can be converted to ASCII stream"); - try { - ResultSet rs = statement0_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_GET); + try (ResultSet rs = statement0_.executeQuery ("SELECT * FROM " + + JDRSTest.RSTEST_GET)) { JDRSTest.position0 (rs, "NUMBER_POS"); InputStream v = rs.getAsciiStream ("C_REAL"); assertCondition(compare(v, "4.4", "8859_1", sb),sb); + v.close(); + } catch (Exception e) { failed (e, "Unexpected Exception"+sb); @@ -696,12 +731,13 @@ public void Var020 () sb.setLength(0); sb.append(" -- Updated 12/14/2011 Since a float can be converted to string, it can be converted to ASCII stream"); - try { - ResultSet rs = statement0_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_GET); + try (ResultSet rs = statement0_.executeQuery ("SELECT * FROM " + + JDRSTest.RSTEST_GET)) { JDRSTest.position0 (rs, "NUMBER_NEG"); InputStream v = rs.getAsciiStream ("C_FLOAT"); assertCondition(compare(v, "-5.55", "8859_1", sb),sb); + v.close(); + } catch (Exception e) { @@ -720,12 +756,13 @@ public void Var021 () sb.setLength(0); sb.append(" -- Updated 12/14/2011 Since a double can be converted to string, it can be converted to ASCII stream"); - try { - ResultSet rs = statement0_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_GET); + try (ResultSet rs = statement0_.executeQuery ("SELECT * FROM " + + JDRSTest.RSTEST_GET)) { JDRSTest.position0 (rs, "NUMBER_POS"); InputStream v = rs.getAsciiStream ("C_DOUBLE"); assertCondition(compare(v, "6.666", "8859_1", sb),sb); + v.close(); + } catch (Exception e) { @@ -745,12 +782,13 @@ public void Var022 () { sb.setLength(0); - try { - ResultSet rs = statement0_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_GET); + try (ResultSet rs = statement0_.executeQuery ("SELECT * FROM " + + JDRSTest.RSTEST_GET)) { JDRSTest.position0 (rs, "NUMBER_POS"); InputStream v = rs.getAsciiStream("C_DECIMAL_50"); //@F1A assertCondition(compare(v, "7", "8859_1", sb), "update 01/04/2012 for native driver "+sb.toString()); //@F1A + v.close(); + } catch (Exception e) { failed(e, "Unexpected Exception update 01/04/2012 for native driver"); //@F1A @@ -767,13 +805,14 @@ public void Var023 () sb.setLength(0); sb.append(" updated 01/04/2012 for native driver"); - try { - ResultSet rs = statement0_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_GET); + try (ResultSet rs = statement0_.executeQuery ("SELECT * FROM " + + JDRSTest.RSTEST_GET)) { JDRSTest.position0 (rs, "NUMBER_NEG"); InputStream v = rs.getAsciiStream("C_NUMERIC_105"); assertCondition(compare(v, "-10.10105", "8859_1",sb)); //@F1A + v.close(); + } catch (Exception e) { failed(e, "Unexpected Exception updated 01/04/2012 for native driver "); //@F1A @@ -788,9 +827,8 @@ public void Var024 () { sb.setLength(0); - try { - ResultSet rs = statement0_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_GET); + try (ResultSet rs = statement0_.executeQuery ("SELECT * FROM " + + JDRSTest.RSTEST_GET)) { JDRSTest.position0 (rs, "CHAR_EMPTY"); InputStream v = rs.getAsciiStream ("C_CHAR_50"); if( getDriver() == JDTestDriver.DRIVER_NATIVE && // @K2 @@ -799,6 +837,8 @@ public void Var024 () " ".getBytes("8859_1"),sb),sb); // @K2 else // @K2 assertCondition (compare (v, " ", "8859_1",sb),sb); // @K2 + v.close(); + } catch (Exception e) { failed (e, "Unexpected Exception"); @@ -814,9 +854,8 @@ public void Var025 () { sb.setLength(0); - try { - ResultSet rs = statement0_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_GET); + try (ResultSet rs = statement0_.executeQuery ("SELECT * FROM " + + JDRSTest.RSTEST_GET)) { JDRSTest.position0 (rs, "CHAR_FULL"); InputStream v = rs.getAsciiStream ("C_CHAR_50"); if( getDriver() == JDTestDriver.DRIVER_NATIVE && // @K2 @@ -825,6 +864,8 @@ public void Var025 () "Toolbox for Java ".getBytes("8859_1"),sb),sb); // @K2 else // @K2 assertCondition (compare (v, "Toolbox for Java ", "8859_1",sb),sb); // @K2 + v.close(); + } catch (Exception e) { failed (e, "Unexpected Exception"); @@ -840,9 +881,8 @@ public void Var026 () { sb.setLength(0); - try { - ResultSet rs = statement0_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_GET); + try (ResultSet rs = statement0_.executeQuery ("SELECT * FROM " + + JDRSTest.RSTEST_GET)) { JDRSTest.position0 (rs, "CHAR_EMPTY"); InputStream v = rs.getAsciiStream ("C_VARCHAR_50"); if( getDriver() == JDTestDriver.DRIVER_NATIVE && // @K2 @@ -850,6 +890,8 @@ public void Var026 () assertCondition( compareBeginsWithBytes( v, "".getBytes("8859_1"),sb),sb); // @K2 else // @K2 assertCondition (compare (v, "", "8859_1",sb),sb); + v.close(); + } catch (Exception e) { failed (e, "Unexpected Exception"); @@ -865,9 +907,8 @@ public void Var027 () { sb.setLength(0); - try { - ResultSet rs = statement0_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_GET); + try (ResultSet rs = statement0_.executeQuery ("SELECT * FROM " + + JDRSTest.RSTEST_GET)) { JDRSTest.position0 (rs, "CHAR_FULL"); InputStream v = rs.getAsciiStream ("C_VARCHAR_50"); if( getDriver() == JDTestDriver.DRIVER_NATIVE && // @K2 @@ -875,6 +916,8 @@ public void Var027 () assertCondition( compareBeginsWithBytes( v, "Java Toolbox".getBytes("8859_1"),sb),sb); // @K2 else // @K2 assertCondition (compare (v, "Java Toolbox", "8859_1",sb),sb); + v.close(); + } catch (Exception e) { failed (e, "Unexpected Exception"); @@ -890,15 +933,16 @@ public void Var028 () { sb.setLength(0); - try { - ResultSet rs = statement0_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_GET); + try (ResultSet rs = statement0_.executeQuery ("SELECT * FROM " + + JDRSTest.RSTEST_GET)) { JDRSTest.position0 (rs, "BINARY_NOTRANS"); InputStream v = rs.getAsciiStream ("C_BINARY_20"); sb.setLength(0); if(isToolboxDriver()) //@F1A assertCondition(compare(v, "456C6576656E2020202020202020202020202020", "8859_1",sb),sb); //@F1A else assertCondition( compareBeginsWithBytes( v, "Eleven ".getBytes("8859_1"),sb),sb); // @K2 + v.close(); + } catch (Exception e) { failed (e, "Unexpected Exception"); @@ -914,14 +958,15 @@ public void Var029 () { sb.setLength(0); - try { - ResultSet rs = statement0_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_GET); + try (ResultSet rs = statement0_.executeQuery ("SELECT * FROM " + + JDRSTest.RSTEST_GET)) { JDRSTest.position0 (rs, "BINARY_NOTRANS"); InputStream v = rs.getAsciiStream ("C_VARBINARY_20"); if(isToolboxDriver()) //@F1A assertCondition(compare(v, "5477656C7665", "8859_1",sb),sb); //@F1A else assertCondition( compareBeginsWithBytes( v, "Twelve".getBytes("8859_1"),sb),sb); // @K2 + v.close(); + } catch (Exception e) { failed (e, "Unexpected Exception"); @@ -940,15 +985,18 @@ public void Var030 () if (checkLobSupport ()) { try { + boolean passed; ResultSet rs = statement0_.executeQuery ("SELECT * FROM " + JDRSTest.RSTEST_GET); JDRSTest.position0 (rs, "LOB_FULL"); InputStream v = rs.getAsciiStream ("C_CLOB"); - if(getDriver() == JDTestDriver.DRIVER_NATIVE && // @K2 - true) // @K2 - assertCondition( compareBeginsWithBytes( v, JDRSTest.CLOB_FULL.getBytes("8859_1"),sb),sb); // @K2 + if(getDriver() == JDTestDriver.DRIVER_NATIVE ) // @K2 + passed = compareBeginsWithBytes( v, JDRSTest.CLOB_FULL.getBytes("8859_1"),sb); // @K2 else // @K2 - assertCondition (compare (v, JDRSTest.CLOB_FULL, "8859_1",sb),""+sb); + passed = compare (v, JDRSTest.CLOB_FULL, "8859_1",sb); + v.close(); + rs.close(); + assertCondition(passed, sb); } catch (Exception e) { failed (e, "Unexpected Exception"); @@ -984,6 +1032,8 @@ public void Var031 () check = compareBeginsWithBytes( v, JDRSTest.CLOB_FULL.getBytes("8859_1"),sb); // @K2 else // @K2 check = compare (v, JDRSTest.CLOB_FULL, "8859_1",sb); // @K2 + v.close(); + rs.close(); assertCondition(check,sb); } @@ -1003,9 +1053,8 @@ public void Var032 () { sb.setLength(0); if (checkLobSupport ()) { - try { - ResultSet rs = statement0_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_GET); + try (ResultSet rs = statement0_.executeQuery ("SELECT * FROM " + + JDRSTest.RSTEST_GET)) { JDRSTest.position0 (rs, "LOB_FULL"); InputStream v = rs.getAsciiStream ("C_DBCLOB"); if(getDriver() == JDTestDriver.DRIVER_NATIVE && // @K2 @@ -1013,6 +1062,8 @@ public void Var032 () assertCondition( compareBeginsWithBytes( v, JDRSTest.DBCLOB_FULL.getBytes("8859_1"),sb),sb); // @K2 else // @K2 assertCondition (compare (v, JDRSTest.DBCLOB_FULL, "8859_1",sb),sb); // @K2 + v.close(); + } catch (Exception e) { failed (e, "Unexpected Exception"); @@ -1049,6 +1100,8 @@ public void Var033 () check = compareBeginsWithBytes( v, JDRSTest.DBCLOB_FULL.getBytes("8859_1"),sb); // @K2 else // @K2 check = compare (v, JDRSTest.DBCLOB_FULL, "8859_1",sb);// @K2 + v.close(); + rs.close(); assertCondition(check,sb); } @@ -1067,17 +1120,21 @@ public void Var033 () public void Var034 () { sb.setLength(0); - sb.append("getAsciiStream from BLOB"); + sb.append("getAsciiStream from BLOB querying "+JDRSTest.RSTEST_GET+" for row LOB_FULL for column C_BLOB\n"); if (checkLobSupport ()) { try { ResultSet rs = statement0_.executeQuery ("SELECT * FROM " + JDRSTest.RSTEST_GET); JDRSTest.position0 (rs, "LOB_FULL"); InputStream v = rs.getAsciiStream ("C_BLOB"); - if(isToolboxDriver()) //@K1A - assertCondition(compare(v, JDRSTest.BLOB_FULL, true, sb),"PATH 1 "+sb); //@K1A - else assertCondition( compareBeginsWithBytes( v, JDRSTest.BLOB_FULL,sb),"PATH 3 "+sb); // @K2 - + boolean passed; + if(isToolboxDriver()) + passed = compare(v, JDRSTest.BLOB_FULL, true, sb); + else + passed = compareBeginsWithBytes( v, JDRSTest.BLOB_FULL,sb); + v.close(); + rs.close(); + assertCondition(passed, sb); } catch (Exception e) { failed (e, "Unexpected Exception"); @@ -1124,6 +1181,8 @@ public void Var035 () sb.append("Path 3:"); check = compareBeginsWithBytes( v, JDRSTest.BLOB_FULL, sb); // @K2 } + v.close(); + rs.close(); assertCondition(check,sb ); } @@ -1142,15 +1201,16 @@ public void Var036 () { sb.setLength(0); sb.append(" -- Updated 12/14/2011 Since a date can be converted to string, it can be converted to ASCII stream"); - try { - ResultSet rs = statement0_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_GET); + try (ResultSet rs = statement0_.executeQuery ("SELECT * FROM " + + JDRSTest.RSTEST_GET)) { JDRSTest.position0 (rs, "DATE_1998"); InputStream v = rs.getAsciiStream ("C_DATE"); if(isToolboxDriver()) //@K1A assertCondition(compare(v, "04/08/98", "8859_1",sb),sb); //@K1A else //@K1A assertCondition(compare(v, "1998-04-08", "8859_1", sb),sb); //@K1A + v.close(); + } catch (Exception e) { failed(e, "Unexpected Exception"); //@K1A @@ -1166,16 +1226,17 @@ public void Var037 () { sb.setLength(0); sb.append(" -- Updated 12/14/2011 Since a time can be converted to string, it can be converted to ASCII stream"); - try { - ResultSet rs = statement0_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_GET); + try (ResultSet rs = statement0_.executeQuery ("SELECT * FROM " + + JDRSTest.RSTEST_GET)) { JDRSTest.position0 (rs, "DATE_1998"); InputStream v = rs.getAsciiStream ("C_TIME"); String expected = "08:14:03"; if (getDriver() == JDTestDriver.DRIVER_NATIVE) { expected = "08.14.03"; } - assertCondition (compare (v, expected, "8859_1", sb),sb); + assertCondition (compare (v, expected, "8859_1", sb),sb); + v.close(); + } catch (Exception e) { @@ -1192,16 +1253,17 @@ public void Var038 () { sb.setLength(0); sb.append(" -- Updated 12/14/2011 Since a time can be converted to string, it can be converted to ASCII stream"); - try { - ResultSet rs = statement0_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_GET); + try (ResultSet rs = statement0_.executeQuery ("SELECT * FROM " + + JDRSTest.RSTEST_GET)) { JDRSTest.position0 (rs, "DATE_1998"); InputStream v = rs.getAsciiStream ("C_TIMESTAMP"); String expected = "1998-11-18 03:13:42.987654"; if (getDriver() == JDTestDriver.DRIVER_NATIVE) { expected = "1998-11-18-03.13.42.987654"; } - assertCondition (compare (v, expected, "8859_1", sb),sb); + assertCondition (compare (v, expected, "8859_1", sb),sb); + v.close(); + } catch (Exception e) { @@ -1227,10 +1289,9 @@ public void Var039 () return; } if (checkDatalinkSupport ()) { - try { - Statement s = connection_.createStatement (); + try (Statement s = connection_.createStatement (); ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_GETDL); + + JDRSTest.RSTEST_GETDL)) { JDRSTest.position0 (rs, "LOB_FULL"); InputStream v = rs.getAsciiStream ("C_DATALINK"); @@ -1240,7 +1301,9 @@ public void Var039 () failed ("Didn't throw SQLException"); else // Note the case... AS/400 DB does its own thing here... - assertCondition (compare (v, JDRSTest.LOB_FULL_DATALINK_UPPER_DOMAIN, "8859_1",sb),sb); + assertCondition (compare (v, JDRSTest.LOB_FULL_DATALINK_UPPER_DOMAIN, "8859_1",sb),sb); + v.close(); + } catch (Exception e) { @@ -1260,17 +1323,18 @@ public void Var039 () public void Var040 () { if (checkDatalinkSupport ()) { - try { - Statement s = connection_.createStatement (); - ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_GETDL); + try (Statement s = connection_.createStatement (); + ResultSet rs = s.executeQuery ("SELECT * FROM " + + JDRSTest.RSTEST_GETDL)) { JDRSTest.position0 (rs, "LOB_EMPTY"); InputStream v = rs.getAsciiStream ("C_DATALINK"); if (getDriver () == JDTestDriver.DRIVER_NATIVE && true && isJDK14 ) //@K1C failed ("Didn't throw SQLException"); else - assertCondition (compare (v, "", "8859_1",sb),sb); + assertCondition (compare (v, "", "8859_1",sb),sb); + v.close(); + } catch (Exception e) { @@ -1296,9 +1360,8 @@ public void Var041 () return; } if (checkLobSupport ()) { - try { - ResultSet rs = statement0_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_GET); + try (ResultSet rs = statement0_.executeQuery ("SELECT * FROM " + + JDRSTest.RSTEST_GET)) { JDRSTest.position0 (rs, "LOB_EMPTY"); InputStream v = rs.getAsciiStream ("C_DISTINCT"); if( getDriver() == JDTestDriver.DRIVER_NATIVE && // @K2 @@ -1310,6 +1373,8 @@ else if (getDriver() == JDTestDriver.DRIVER_JCC) { } else assertCondition (compare (v, " ", "8859_1",sb),sb); + v.close(); + } catch (Exception e) { failed (e, "Unexpected Exception"); @@ -1325,12 +1390,13 @@ else if (getDriver() == JDTestDriver.DRIVER_JCC) { public void Var042 () { if (checkBigintSupport()) { - try { - ResultSet rs = statement0_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_GET); + try (ResultSet rs = statement0_.executeQuery ("SELECT * FROM " + + JDRSTest.RSTEST_GET)) { JDRSTest.position0 (rs, "NUMBER_POS"); InputStream v = rs.getAsciiStream ("C_BIGINT"); assertCondition(compare(v, "12374321", "8859_1",sb),sb); //@K1A + v.close(); + } catch (Exception e) { failed(e, "Unexpected Exception updated 01/04/2012 for native driver"); //@K1A @@ -1347,15 +1413,16 @@ public void Var043 () sb.append(" -- Updated 12/14/2011 Since a DFP16 can be converted to string, it can be converted to ASCII stream"); if (checkDecFloatSupport()) { - try { - Statement s = connection_.createStatement (); - ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP16); + try (Statement s = connection_.createStatement (); + ResultSet rs = s.executeQuery ("SELECT * FROM " + + JDRSTest.RSTEST_GETDFP16+" A WHERE RRN(A) = 1")) { rs.next(); InputStream v = rs.getAsciiStream (1); String expected="1.1"; - assertCondition (compare (v, expected, "8859_1", sb),sb); + assertCondition (compare (v, expected, "8859_1", sb),sb); + v.close(); + } catch (Exception e) { @@ -1376,14 +1443,15 @@ public void Var044 () sb.append(" -- Updated 12/14/2011 Since a DFP34 can be converted to string, it can be converted to ASCII stream"); if (checkDecFloatSupport()) { - try { - Statement s = connection_.createStatement (); - ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP34); + try (Statement s = connection_.createStatement (); + ResultSet rs = s.executeQuery ("SELECT * FROM " + + JDRSTest.RSTEST_GETDFP34+" A WHERE RRN(A) = 1")) { rs.next(); InputStream v = rs.getAsciiStream (1); String expected="1.1"; - assertCondition (compare (v, expected, "8859_1", sb),sb); + assertCondition (compare (v, expected, "8859_1", sb),sb); + v.close(); + } catch (Exception e) { @@ -1411,6 +1479,7 @@ public void Var045 () InputStream v = rs.getAsciiStream ("C_XML"); if (expected == null ) { if (v != null) { + v.close(); sb.append("For row "+i+" Expected null but got '"+v+"'\n"); } } else { @@ -1419,7 +1488,7 @@ public void Var045 () passed = false; } - + v.close(); } i++; } @@ -1493,13 +1562,14 @@ public void Var048 () if (checkBooleanSupport()) { sb.setLength(0); - try { - ResultSet rs = statement0_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_BOOLEAN); + try (ResultSet rs = statement0_.executeQuery ("SELECT * FROM " + + JDRSTest.RSTEST_BOOLEAN)) { JDRSTest.position0 (rs, "BOOLEAN_TRUE"); InputStream v = rs.getAsciiStream ("C_BOOLEAN"); sb.setLength(0); assertCondition(compare(v, JDRSTest.BOOLEAN_TRUE_STRING, "8859_1",sb),sb); //@F1A + v.close(); + } catch (Exception e) { failed (e, "Unexpected Exception"); @@ -1518,13 +1588,14 @@ public void Var049 () if (checkBooleanSupport()) { sb.setLength(0); - try { - ResultSet rs = statement0_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_BOOLEAN); + try (ResultSet rs = statement0_.executeQuery ("SELECT * FROM " + + JDRSTest.RSTEST_BOOLEAN)) { JDRSTest.position0 (rs, "BOOLEAN_FALSE"); InputStream v = rs.getAsciiStream ("C_BOOLEAN"); sb.setLength(0); assertCondition(compare(v, JDRSTest.BOOLEAN_FALSE_STRING, "8859_1",sb),sb); //@F1A + v.close(); + } catch (Exception e) { failed (e, "Unexpected Exception"); @@ -1540,13 +1611,14 @@ public void Var050 () if (checkBooleanSupport()) { sb.setLength(0); - try { - ResultSet rs = statement0_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_BOOLEAN); + try (ResultSet rs = statement0_.executeQuery ("SELECT * FROM " + + JDRSTest.RSTEST_BOOLEAN)) { JDRSTest.position0 (rs, "BOOLEAN_NULL"); InputStream v = rs.getAsciiStream ("C_BOOLEAN"); if (v != null) { sb.append("Got "+v+" sb null"); + v.close(); + } assertCondition(v == null,sb); //@F1A diff --git a/src/test/JD/RS/JDRSGetBigDecimal.java b/src/test/JD/RS/JDRSGetBigDecimal.java index cacc32ef..291ddf0d 100644 --- a/src/test/JD/RS/JDRSGetBigDecimal.java +++ b/src/test/JD/RS/JDRSGetBigDecimal.java @@ -109,9 +109,9 @@ protected void setup () ResultSet.CONCUR_UPDATABLE); } statement_.executeUpdate ("INSERT INTO " + JDRSTest.RSTEST_GET - + " (C_KEY) VALUES ('DUMMY_ROW')"); + + " (C_KEY) VALUES ('DUMMYROW_GDB')"); statement_.executeUpdate ("INSERT INTO " + JDRSTest.RSTEST_GET - + " (C_KEY) VALUES ('DUMMY_ROW2')"); + + " (C_KEY) VALUES ('DUMMYROW_GDB2')"); rsQuery_ = "SELECT * FROM " + JDRSTest.RSTEST_GET + " FOR UPDATE"; rs_ = statement_.executeQuery (rsQuery_); @@ -146,8 +146,7 @@ protected void cleanup () public void Var001() { if (checkJdbc20 ()) { - try { - Statement s = connection_.createStatement (); + try (Statement s = connection_.createStatement ()) { ResultSet rs = s.executeQuery ("SELECT * FROM " + JDRSTest.RSTEST_GET); rs.next (); @@ -170,8 +169,7 @@ public void Var001() @SuppressWarnings("deprecation") public void Var002() { - try { - Statement s = connection_.createStatement (); + try (Statement s = connection_.createStatement ()) { ResultSet rs = s.executeQuery ("SELECT * FROM " + JDRSTest.RSTEST_GET); rs.next (); @@ -213,9 +211,8 @@ public void Var003() @SuppressWarnings("deprecation") public void Var004() { - try { - ResultSet rs = statement0_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_GET); + try (ResultSet rs = statement0_.executeQuery ("SELECT * FROM " + + JDRSTest.RSTEST_GET)) { BigDecimal v = rs.getBigDecimal ("C_NUMERIC_105", 3); failed ("Didn't throw SQLException " +v); } @@ -253,9 +250,8 @@ public void Var005() @SuppressWarnings("deprecation") public void Var006() { - try { - ResultSet rs = statement0_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_GET); + try (ResultSet rs = statement0_.executeQuery ("SELECT * FROM " + + JDRSTest.RSTEST_GET)) { rs.next (); BigDecimal v = rs.getBigDecimal (100, 3); failed ("Didn't throw SQLException "+v); @@ -294,9 +290,8 @@ public void Var007() @SuppressWarnings("deprecation") public void Var008() { - try { - ResultSet rs = statement0_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_GET); + try (ResultSet rs = statement0_.executeQuery ("SELECT * FROM " + + JDRSTest.RSTEST_GET)) { rs.next (); BigDecimal v = rs.getBigDecimal (0, 2); failed ("Didn't throw SQLException "+v); @@ -335,9 +330,8 @@ public void Var009() @SuppressWarnings("deprecation") public void Var010() { - try { - ResultSet rs = statement0_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_GET); + try (ResultSet rs = statement0_.executeQuery ("SELECT * FROM " + + JDRSTest.RSTEST_GET)) { rs.next (); BigDecimal v = rs.getBigDecimal (-1, 1); failed ("Didn't throw SQLException "+v); @@ -374,9 +368,8 @@ public void Var011() @SuppressWarnings("deprecation") public void Var012() { - try { - ResultSet rs = statement0_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_GET); + try (ResultSet rs = statement0_.executeQuery ("SELECT * FROM " + + JDRSTest.RSTEST_GET)) { JDRSTest.position0 (rs, "NUMBER_POS"); BigDecimal v = rs.getBigDecimal (8, 3); double expected = 8.889; @@ -471,9 +464,8 @@ public void Var015() @SuppressWarnings("deprecation") public void Var016() { - try { - ResultSet rs = statement0_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_GET); + try (ResultSet rs = statement0_.executeQuery ("SELECT * FROM " + + JDRSTest.RSTEST_GET)) { JDRSTest.position0 (rs, "NUMBER_POS"); rs.getBigDecimal ("", 3); failed ("Didn't throw SQLException"); @@ -512,9 +504,8 @@ public void Var017() @SuppressWarnings("deprecation") public void Var018() { - try { - ResultSet rs = statement0_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_GET); + try (ResultSet rs = statement0_.executeQuery ("SELECT * FROM " + + JDRSTest.RSTEST_GET)) { rs.next (); rs.getBigDecimal ("INVALID", 1); failed ("Didn't throw SQLException"); @@ -551,9 +542,8 @@ public void Var019() @SuppressWarnings("deprecation") public void Var020() { - try { - ResultSet rs = statement0_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_GET); + try (ResultSet rs = statement0_.executeQuery ("SELECT * FROM " + + JDRSTest.RSTEST_GET)) { JDRSTest.position0 (rs, "NUMBER_POS"); BigDecimal v = rs.getBigDecimal ("C_NUMERIC_105", 2); assertCondition (v.doubleValue () == 10.10); @@ -576,9 +566,8 @@ public void Var021() notApplicable("LUW does not throw exception when scale is -1"); return; } - try { - ResultSet rs = statement0_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_GET); + try (ResultSet rs = statement0_.executeQuery ("SELECT * FROM " + + JDRSTest.RSTEST_GET)) { rs.next (); BigDecimal v = rs.getBigDecimal ("C_NUMERIC_105", -1); failed ("Didn't throw SQLException but got "+v); @@ -596,9 +585,8 @@ public void Var021() @SuppressWarnings("deprecation") public void Var022() { - try { - ResultSet rs = statement0_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_GET); + try (ResultSet rs = statement0_.executeQuery ("SELECT * FROM " + + JDRSTest.RSTEST_GET)) { JDRSTest.position0 (rs, "NUMBER_POS"); BigDecimal v = rs.getBigDecimal ("C_NUMERIC_105", 0); assertCondition ((v.doubleValue () == 10) && (v.scale () == 0)); @@ -616,9 +604,8 @@ public void Var022() @SuppressWarnings("deprecation") public void Var023() { - try { - ResultSet rs = statement0_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_GET); + try (ResultSet rs = statement0_.executeQuery ("SELECT * FROM " + + JDRSTest.RSTEST_GET)) { JDRSTest.position0 (rs, "NUMBER_POS"); BigDecimal v = rs.getBigDecimal ("C_NUMERIC_105", 3); assertCondition ((v.doubleValue () == 10.101) && (v.scale () == 3)); @@ -823,7 +810,7 @@ public void Var032() if (checkJdbc20 ()) { try { - rs_ = JDRSTest.position (driver_,statement_,rsQuery_, rs_, "DUMMY_ROW"); + rs_ = JDRSTest.position (driver_,statement_,rsQuery_, rs_, "DUMMYROW_GDB"); rs_.deleteRow (); BigDecimal v = rs_.getBigDecimal ("C_DECIMAL_105"); failed ("Didn't throw SQLException "+v); @@ -848,7 +835,7 @@ public void Var033() if (checkJdbc20 ()) { try { - rs_ = JDRSTest.position (driver_,statement_,rsQuery_, rs_, "DUMMY_ROW2"); + rs_ = JDRSTest.position (driver_,statement_,rsQuery_, rs_, "DUMMYROW_GDB2"); rs_.deleteRow (); BigDecimal v = rs_.getBigDecimal ("C_DECIMAL_105", 4); failed ("Didn't throw SQLException "+v ); @@ -885,9 +872,8 @@ public void Var034 () @SuppressWarnings("deprecation") public void Var035 () { - try { - ResultSet rs = statement0_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_GET); + try (ResultSet rs = statement0_.executeQuery ("SELECT * FROM " + + JDRSTest.RSTEST_GET)) { JDRSTest.position0 (rs, "NUMBER_NULL"); BigDecimal v = rs.getBigDecimal ("C_NUMERIC_105", 3); assertCondition (v == null, "Should be null but got "+v); @@ -926,9 +912,8 @@ public void Var036 () @SuppressWarnings("deprecation") public void Var037 () { - try { - ResultSet rs = statement0_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_GET); + try (ResultSet rs = statement0_.executeQuery ("SELECT * FROM " + + JDRSTest.RSTEST_GET)) { JDRSTest.position0 (rs, "NUMBER_NEG"); BigDecimal v = rs.getBigDecimal ("C_SMALLINT", 0); @@ -950,9 +935,8 @@ public void Var037 () @SuppressWarnings("deprecation") public void Var038 () { - try { - ResultSet rs = statement0_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_GET); + try (ResultSet rs = statement0_.executeQuery ("SELECT * FROM " + + JDRSTest.RSTEST_GET)) { JDRSTest.position0 (rs, "NUMBER_NEG"); BigDecimal v = rs.getBigDecimal ("C_SMALLINT", 3); @@ -993,9 +977,8 @@ public void Var039 () @SuppressWarnings("deprecation") public void Var040 () { - try { - ResultSet rs = statement0_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_GET); + try (ResultSet rs = statement0_.executeQuery ("SELECT * FROM " + + JDRSTest.RSTEST_GET)) { JDRSTest.position0 (rs, "NUMBER_POS"); BigDecimal v = rs.getBigDecimal ("C_INTEGER", 0); assertCondition ((v.doubleValue () == 98765) && (v.scale () == 0)); @@ -1013,9 +996,8 @@ public void Var040 () @SuppressWarnings("deprecation") public void Var041 () { - try { - ResultSet rs = statement0_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_GET); + try (ResultSet rs = statement0_.executeQuery ("SELECT * FROM " + + JDRSTest.RSTEST_GET)) { JDRSTest.position0 (rs, "NUMBER_POS"); BigDecimal v = rs.getBigDecimal ("C_INTEGER", 3); assertCondition ((v.doubleValue () == 98765) && (v.scale () == 3)); @@ -1052,9 +1034,8 @@ public void Var042 () @SuppressWarnings("deprecation") public void Var043 () { - try { - ResultSet rs = statement0_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_GET); + try (ResultSet rs = statement0_.executeQuery ("SELECT * FROM " + + JDRSTest.RSTEST_GET)) { JDRSTest.position0 (rs, "NUMBER_NEG"); BigDecimal v = rs.getBigDecimal ("C_REAL", 0); assertCondition ((v.doubleValue () == -4) && (v.scale () == 0)); @@ -1072,9 +1053,8 @@ public void Var043 () @SuppressWarnings("deprecation") public void Var044 () { - try { - ResultSet rs = statement0_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_GET); + try (ResultSet rs = statement0_.executeQuery ("SELECT * FROM " + + JDRSTest.RSTEST_GET)) { JDRSTest.position0 (rs, "NUMBER_NEG"); BigDecimal v = rs.getBigDecimal ("C_REAL", 3); assertCondition ((v.doubleValue () == -4.4) && (v.scale () == 3)); @@ -1111,9 +1091,8 @@ public void Var045 () @SuppressWarnings("deprecation") public void Var046 () { - try { - ResultSet rs = statement0_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_GET); + try (ResultSet rs = statement0_.executeQuery ("SELECT * FROM " + + JDRSTest.RSTEST_GET)) { JDRSTest.position0 (rs, "NUMBER_POS"); BigDecimal v = rs.getBigDecimal ("C_FLOAT", 0); double expected = 6; @@ -1137,9 +1116,8 @@ public void Var046 () @SuppressWarnings("deprecation") public void Var047 () { - try { - ResultSet rs = statement0_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_GET); + try (ResultSet rs = statement0_.executeQuery ("SELECT * FROM " + + JDRSTest.RSTEST_GET)) { JDRSTest.position0 (rs, "NUMBER_POS"); BigDecimal v = rs.getBigDecimal ("C_FLOAT", 3); assertCondition ((v.doubleValue () == 5.55) && (v.scale () == 3)); @@ -1176,9 +1154,8 @@ public void Var048 () @SuppressWarnings("deprecation") public void Var049 () { - try { - ResultSet rs = statement0_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_GET); + try (ResultSet rs = statement0_.executeQuery ("SELECT * FROM " + + JDRSTest.RSTEST_GET)) { JDRSTest.position0 (rs, "NUMBER_NEG"); BigDecimal v = rs.getBigDecimal ("C_DOUBLE", 0); double expected = -7; @@ -1202,9 +1179,8 @@ public void Var049 () @SuppressWarnings("deprecation") public void Var050 () { - try { - ResultSet rs = statement0_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_GET); + try (ResultSet rs = statement0_.executeQuery ("SELECT * FROM " + + JDRSTest.RSTEST_GET)) { JDRSTest.position0 (rs, "NUMBER_NEG"); BigDecimal v = rs.getBigDecimal ("C_DOUBLE", 3); assertCondition ((v.doubleValue () == -6.666) && (v.scale () == 3)); @@ -1241,9 +1217,8 @@ public void Var051 () @SuppressWarnings("deprecation") public void Var052 () { - try { - ResultSet rs = statement0_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_GET); + try (ResultSet rs = statement0_.executeQuery ("SELECT * FROM " + + JDRSTest.RSTEST_GET)) { JDRSTest.position0 (rs, "NUMBER_POS"); BigDecimal v = rs.getBigDecimal ("C_DECIMAL_50", 0); assertCondition ((v.doubleValue () == 7) && (v.scale () == 0)); @@ -1261,9 +1236,8 @@ public void Var052 () @SuppressWarnings("deprecation") public void Var053 () { - try { - ResultSet rs = statement0_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_GET); + try (ResultSet rs = statement0_.executeQuery ("SELECT * FROM " + + JDRSTest.RSTEST_GET)) { JDRSTest.position0 (rs, "NUMBER_POS"); BigDecimal v = rs.getBigDecimal ("C_DECIMAL_50", 3); assertCondition ((v.doubleValue () == 7) && (v.scale () == 3)); @@ -2333,7 +2307,7 @@ public void Var101 () try { ResultSet rs = statement0_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP16); + + JDRSTest.RSTEST_GETDFP16); int i = 0; while (rs.next()) { BigDecimal v = rs.getBigDecimal (1); @@ -2382,7 +2356,7 @@ public void Var102 () try { ResultSet rs = statement0_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP34); + + JDRSTest.RSTEST_GETDFP34); int i = 0; while (rs.next()) { BigDecimal v = rs.getBigDecimal (1); @@ -2430,7 +2404,7 @@ public void Var103 () try { Statement s = connection_.createStatement (); ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP16NAN); + + JDRSTest.RSTEST_GETDFP16NAN); rs.next(); BigDecimal v = rs.getBigDecimal (1); failed ("Didn't throw SQLException "+v); @@ -2451,7 +2425,7 @@ public void Var104 () try { Statement s = connection_.createStatement (); ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP16NNAN); + + JDRSTest.RSTEST_GETDFP16NNAN); rs.next(); BigDecimal v = rs.getBigDecimal (1); failed ("Didn't throw SQLException "+v); @@ -2472,7 +2446,7 @@ public void Var105 () try { Statement s = connection_.createStatement (); ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP16INF); + + JDRSTest.RSTEST_GETDFP16INF); rs.next(); BigDecimal v = rs.getBigDecimal (1); failed ("Didn't throw SQLException "+v); @@ -2493,7 +2467,7 @@ public void Var106 () try { Statement s = connection_.createStatement (); ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP16NINF); + + JDRSTest.RSTEST_GETDFP16NINF); rs.next(); BigDecimal v = rs.getBigDecimal (1); failed ("Didn't throw SQLException "+v); @@ -2535,7 +2509,7 @@ public void Var108 () try { Statement s = connection_.createStatement (); ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP34NNAN); + + JDRSTest.RSTEST_GETDFP34NNAN); rs.next(); BigDecimal v = rs.getBigDecimal (1); failed ("Didn't throw SQLException "+v); @@ -2556,7 +2530,7 @@ public void Var109 () try { Statement s = connection_.createStatement (); ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP34INF); + + JDRSTest.RSTEST_GETDFP34INF); rs.next(); BigDecimal v = rs.getBigDecimal (1); failed ("Didn't throw SQLException "+v); @@ -2577,7 +2551,7 @@ public void Var110 () try { Statement s = connection_.createStatement (); ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP34NINF); + + JDRSTest.RSTEST_GETDFP34NINF); rs.next(); BigDecimal v = rs.getBigDecimal (1); failed ("Didn't throw SQLException "+v); diff --git a/src/test/JD/RS/JDRSGetBinaryStream.java b/src/test/JD/RS/JDRSGetBinaryStream.java index 0dd66839..51b0bc12 100644 --- a/src/test/JD/RS/JDRSGetBinaryStream.java +++ b/src/test/JD/RS/JDRSGetBinaryStream.java @@ -19,6 +19,7 @@ import test.JDRSTest; import test.JDTestDriver; import test.JDTestcase; +import test.JD.JDSerializeFile; import java.io.FileOutputStream; import java.io.InputStream; @@ -26,7 +27,7 @@ import java.sql.DataTruncation; import java.sql.ResultSet; - +import java.sql.SQLException; import java.sql.SQLWarning; import java.sql.Statement; import java.util.Hashtable; @@ -124,7 +125,7 @@ protected void setup () statement_ = connection_.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); statement_.executeUpdate ("INSERT INTO " + JDRSTest.RSTEST_GET - + " (C_KEY) VALUES ('DUMMY_ROW')"); + + " (C_KEY) VALUES ('DUMMYROW_GBS')"); // Force LOB locators. connection2_ = testDriver_.getConnection (url + ";lob threshold=0","JDRSGetBinaryStream1"); @@ -433,7 +434,9 @@ public void Var011() public void Var012() { if (checkJdbc20 ()) { - try { + JDSerializeFile serializeFile = null; + try { + serializeFile = new JDSerializeFile(connection_, JDRSTest.RSTEST_GET); ResultSet rs = statement_.executeQuery ("SELECT * FROM " + JDRSTest.RSTEST_GET + " FOR UPDATE"); JDRSTest.position (rs, "UPDATE_SANDBOX"); @@ -442,7 +445,7 @@ public void Var012() (byte) 0xAB, (byte) 0xBC, (byte) 0xCD, (byte) 0xDE, (byte) 0xEF, (byte) 0xFF, (byte) 0x00, (byte) 0xFF, (byte) 0x00, (byte) 0xFF }; rs.updateBytes ("C_BINARY_20", test); - rs.updateRow (); + rs.updateRow (); /* serialized */ InputStream v = rs.getBinaryStream ("C_BINARY_20"); boolean check; // @K2 sb.setLength(0); sb.setLength(0); @@ -452,11 +455,20 @@ public void Var012() check = compareBeginsWithBytes( v, test,sb); // @K2 else // @K2 check = compare (v, test,sb); // @K2 + v.close(); rs.close(); assertCondition(check,sb); } catch (Exception e) { failed (e, "Unexpected Exception"); + } finally { + if (serializeFile != null) { + try { + serializeFile.close(); + } catch (SQLException e) { + e.printStackTrace(); + } + } } } } @@ -506,7 +518,9 @@ public void Var013() public void Var014() { if (checkJdbc20 ()) { - try { + JDSerializeFile serializeFile = null; + try { + serializeFile = new JDSerializeFile(connection_, JDRSTest.RSTEST_GET); if (getDriver() == JDTestDriver.DRIVER_JCC) { notApplicable("JCC does not support moveToInserRow"); return; @@ -531,6 +545,14 @@ public void Var014() } catch (Exception e) { failed (e, "Unexpected Exception"); + } finally { + if (serializeFile != null) { + try { + serializeFile.close(); + } catch (SQLException e) { + e.printStackTrace(); + } + } } } } @@ -551,7 +573,7 @@ public void Var015() try { rs = statement_.executeQuery ("SELECT * FROM " + JDRSTest.RSTEST_GET + " FOR UPDATE"); - JDRSTest.position (rs, "DUMMY_ROW"); + JDRSTest.position (rs, "DUMMYROW_GBS"); rs.deleteRow (); InputStream v = rs.getBinaryStream ("C_VARBINARY_20"); failed ("Didn't throw SQLException"+v); @@ -1131,7 +1153,7 @@ public void Var040 () try { Statement s = connection_.createStatement (); ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP16); + + JDRSTest.RSTEST_GETDFP16); rs.next(); InputStream v = rs.getBinaryStream (1); failed ("Didn't throw SQLException "+v); @@ -1153,7 +1175,7 @@ public void Var041 () try { Statement s = connection_.createStatement (); ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP34); + + JDRSTest.RSTEST_GETDFP34); rs.next(); InputStream v = rs.getBinaryStream (1); failed ("Didn't throw SQLException "+v); diff --git a/src/test/JD/RS/JDRSGetBlob.java b/src/test/JD/RS/JDRSGetBlob.java index 61329db4..17c3d10c 100644 --- a/src/test/JD/RS/JDRSGetBlob.java +++ b/src/test/JD/RS/JDRSGetBlob.java @@ -19,6 +19,7 @@ import test.JDRSTest; import test.JDTestDriver; import test.JDTestcase; +import test.JD.JDSerializeFile; import java.io.FileOutputStream; import java.sql.Blob; @@ -26,6 +27,7 @@ import java.sql.DataTruncation; import java.sql.ResultSet; +import java.sql.SQLException; import java.sql.SQLWarning; import java.sql.Statement; import java.util.Hashtable; @@ -113,7 +115,7 @@ protected void setup () statement_ = connection_.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); statement_.executeUpdate ("INSERT INTO " + JDRSTest.RSTEST_GET - + " (C_KEY) VALUES ('DUMMY_ROW')"); + + " (C_KEY) VALUES ('DUMMYROW_GBLOB')"); // Force LOB locators. connection2_ = testDriver_.getConnection (url + ";lob threshold=0","JDRSGetBlob1"); @@ -435,7 +437,9 @@ public void Var012() StringBuffer sb = new StringBuffer(); if (checkJdbc20 ()) { - try { + JDSerializeFile serializeFile = null; + try { + serializeFile = new JDSerializeFile(connection_, JDRSTest.RSTEST_GET); ResultSet rs = statement_.executeQuery ("SELECT * FROM " + JDRSTest.RSTEST_GET + " FOR UPDATE"); JDRSTest.position (rs, "UPDATE_SANDBOX"); @@ -444,12 +448,22 @@ public void Var012() (byte) 0xAB, (byte) 0xBC, (byte) 0xCD, (byte) 0xDE, (byte) 0xEF, (byte) 0xFF, (byte) 0x00, (byte) 0xFF, (byte) 0x00, (byte) 0xFF}; rs.updateBytes ("C_BINARY_20", test); - rs.updateRow (); + rs.updateRow (); /* serialized */ Blob v = rs.getBlob ("C_BINARY_20"); - assertCondition (compare (v, test,sb),sb); + boolean passed = compare (v, test,sb); + rs.close(); + assertCondition (passed,sb); } catch (Exception e) { failed (e, "Unexpected Exception"); + } finally { + if (serializeFile != null) { + try { + serializeFile.close(); + } catch (SQLException e) { + e.printStackTrace(); + } + } } } } @@ -476,7 +490,9 @@ public void Var013() byte[] test = new byte[] { (byte) 0xBC, (byte) 0xCD}; rs.updateBytes ("C_VARBINARY_20", test); Blob v = rs.getBlob ("C_VARBINARY_20"); - assertCondition (compare (v, test,sb),sb); + boolean passed = compare (v, test,sb); + rs.close(); + assertCondition (passed,sb); } catch (Exception e) { failed (e, "Unexpected Exception"); @@ -495,7 +511,9 @@ public void Var014() StringBuffer sb = new StringBuffer(); if (checkJdbc20 ()) { - try { + JDSerializeFile serializeFile = null; + try { + serializeFile = new JDSerializeFile(connection_, JDRSTest.RSTEST_GET); if (getDriver() == JDTestDriver.DRIVER_JCC) { notApplicable("JCC does not support moveToInserRow"); return; @@ -508,10 +526,20 @@ public void Var014() rs.updateBytes ("C_VARBINARY_20", test); rs.insertRow (); Blob v = rs.getBlob ("C_VARBINARY_20"); - assertCondition (compare (v, test,sb),sb); + boolean passed = compare (v, test,sb); + rs.close(); + assertCondition (passed,sb); } catch (Exception e) { failed (e, "Unexpected Exception"); + } finally { + if (serializeFile != null) { + try { + serializeFile.close(); + } catch (SQLException e) { + e.printStackTrace(); + } + } } } } @@ -531,9 +559,10 @@ public void Var015() try { ResultSet rs = statement_.executeQuery ("SELECT * FROM " + JDRSTest.RSTEST_GET + " FOR UPDATE"); - JDRSTest.position (rs, "DUMMY_ROW"); + JDRSTest.position (rs, "DUMMYROW_GBLOB"); rs.deleteRow (); Blob v = rs.getBlob ("C_VARBINARY_20"); + rs.close(); failed ("Didn't throw SQLException" +v); } catch (Exception e) { @@ -554,6 +583,7 @@ public void Var016 () + JDRSTest.RSTEST_GET); JDRSTest.position (rs, "CHAR_NULL"); Blob v = rs.getBlob ("C_VARBINARY_20"); + rs.close(); assertCondition (v == null); } catch (Exception e) { @@ -575,6 +605,7 @@ public void Var017 () + JDRSTest.RSTEST_GET); JDRSTest.position (rs, "NUMBER_NEG"); Blob v = rs.getBlob ("C_SMALLINT"); + rs.close(); failed ("Didn't throw SQLException" +v); } catch (Exception e) { @@ -596,6 +627,7 @@ public void Var018 () + JDRSTest.RSTEST_GET); JDRSTest.position (rs, "NUMBER_POS"); Blob v = rs.getBlob ("C_INTEGER"); + rs.close(); failed ("Didn't throw SQLException" +v); } catch (Exception e) { @@ -612,9 +644,8 @@ public void Var018 () public void Var019 () { if (checkJdbc20 ()) { - try { - ResultSet rs = statement0_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_GET); + try (ResultSet rs = statement0_.executeQuery ("SELECT * FROM " + + JDRSTest.RSTEST_GET)) { JDRSTest.position (rs, "NUMBER_NEG"); Blob v = rs.getBlob ("C_REAL"); failed ("Didn't throw SQLException" +v); @@ -1126,7 +1157,7 @@ public void Var040 () try { Statement s = connection_.createStatement (); ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP16); + + JDRSTest.RSTEST_GETDFP16); rs.next(); Blob v = rs.getBlob (1); failed ("Didn't throw SQLException "+v); @@ -1148,7 +1179,7 @@ public void Var041 () try { Statement s = connection_.createStatement (); ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP34); + + JDRSTest.RSTEST_GETDFP34); rs.next(); Blob v = rs.getBlob (1); failed ("Didn't throw SQLException "+v); diff --git a/src/test/JD/RS/JDRSGetBoolean.java b/src/test/JD/RS/JDRSGetBoolean.java index bc1786b0..dd6d851e 100644 --- a/src/test/JD/RS/JDRSGetBoolean.java +++ b/src/test/JD/RS/JDRSGetBoolean.java @@ -123,7 +123,7 @@ protected void setup () statement_ = connection_.createStatement(); } statement_.executeUpdate ("INSERT INTO " + JDRSTest.RSTEST_GET - + " (C_KEY) VALUES ('DUMMY_ROW')"); + + " (C_KEY) VALUES ('DUMMYROW_GBOOL')"); statementQuery_ = "SELECT * FROM " + JDRSTest.RSTEST_GET + " FOR UPDATE"; rs_ = statement_.executeQuery (statementQuery_); @@ -457,7 +457,7 @@ public void Var015() return; } try { - JDRSTest.position (rs_, "DUMMY_ROW"); + JDRSTest.position (rs_, "DUMMYROW_GBOOL"); rs_.deleteRow (); boolean v = rs_.getBoolean ("C_SMALLINT"); failed ("Didn't throw SQLException"+v); @@ -1347,7 +1347,7 @@ public void Var056 () try { Statement s = connection_.createStatement (); ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP16); + + JDRSTest.RSTEST_GETDFP16); rs.next(); boolean v = rs.getBoolean (1); if (isToolboxDriver() || @@ -1389,7 +1389,7 @@ public void Var057 () try { Statement s = connection_.createStatement (); ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP34); + + JDRSTest.RSTEST_GETDFP34); rs.next(); boolean v = rs.getBoolean (1); if (isToolboxDriver() || diff --git a/src/test/JD/RS/JDRSGetByte.java b/src/test/JD/RS/JDRSGetByte.java index 8d6307b2..7cec8aab 100644 --- a/src/test/JD/RS/JDRSGetByte.java +++ b/src/test/JD/RS/JDRSGetByte.java @@ -912,7 +912,7 @@ public void Var041 () try { Statement s = connection_.createStatement (); sql = "SELECT * FROM " - + JDRSTest.RSTEST_DFP16; + + JDRSTest.RSTEST_GETDFP16; ResultSet rs = s.executeQuery (sql); rs.next(); byte v = rs.getByte (1); @@ -937,7 +937,7 @@ public void Var042 () try { Statement s = connection_.createStatement (); ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP16); + + JDRSTest.RSTEST_GETDFP16); while (rs.next()) { byte v = rs.getByte (1); values += v+", "; @@ -964,7 +964,7 @@ public void Var043 () try { Statement s = connection_.createStatement (); ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP34); + + JDRSTest.RSTEST_GETDFP34); rs.next(); byte v = rs.getByte (1); s.close(); @@ -989,7 +989,7 @@ public void Var044 () try { Statement s = connection_.createStatement (); ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP34); + + JDRSTest.RSTEST_GETDFP34); while (rs.next()) { byte v = rs.getByte (1); values += v+", "; diff --git a/src/test/JD/RS/JDRSGetBytes.java b/src/test/JD/RS/JDRSGetBytes.java index 77ba58ad..dfcba28a 100644 --- a/src/test/JD/RS/JDRSGetBytes.java +++ b/src/test/JD/RS/JDRSGetBytes.java @@ -19,6 +19,7 @@ import java.sql.DataTruncation; import java.sql.DatabaseMetaData; import java.sql.ResultSet; +import java.sql.SQLException; import java.sql.SQLWarning; import java.sql.Statement; import java.util.Hashtable; @@ -29,6 +30,7 @@ import test.JDRSTest; import test.JDTestDriver; import test.JDTestcase; +import test.JD.JDSerializeFile; import test.JD.JDTestUtilities; /** @@ -100,7 +102,7 @@ protected void setup() throws Exception { statement_ = connection_.createStatement(); } statement_.executeUpdate("INSERT INTO " + JDRSTest.RSTEST_GET - + " (C_KEY) VALUES ('DUMMY_ROW')"); + + " (C_KEY) VALUES ('DUMMYROW_GBYTES')"); statementQuery_ = "SELECT * FROM " + JDRSTest.RSTEST_GET + " FOR UPDATE"; rs_ = statement_.executeQuery(statementQuery_); } @@ -311,7 +313,9 @@ public void Var011() { **/ public void Var012() { if (checkJdbc20()) { + JDSerializeFile serializeFile = null; try { + serializeFile = new JDSerializeFile(connection_, JDRSTest.RSTEST_GET); JDRSTest.position(rs_, "UPDATE_SANDBOX"); byte[] test = new byte[] { (byte) 0x01, (byte) 0x12, (byte) 0x34, (byte) 0x45, (byte) 0x50, (byte) 0x56, (byte) 0x67, (byte) 0x78, @@ -319,11 +323,19 @@ public void Var012() { (byte) 0xDE, (byte) 0xEF, (byte) 0xFF, (byte) 0x00, (byte) 0xFF, (byte) 0x00, (byte) 0xFF }; rs_.updateBytes("C_BINARY_20", test); - rs_.updateRow(); + rs_.updateRow(); /* serialized */ byte[] v = rs_.getBytes("C_BINARY_20"); assertCondition(areEqual(v, test)); } catch (Exception e) { failed(e, "Unexpected Exception"); + } finally { + if (serializeFile != null) { + try { + serializeFile.close(); + } catch (SQLException e) { + e.printStackTrace(); + } + } } } } @@ -385,7 +397,7 @@ public void Var015() { return; } try { - JDRSTest.position(rs_, "DUMMY_ROW"); + JDRSTest.position(rs_, "DUMMYROW_GBYTES"); rs_.deleteRow(); byte[] v = rs_.getBytes("C_VARBINARY_20"); failed("Didn't throw SQLException " + v); @@ -1550,7 +1562,7 @@ public void Var044() { if (checkDecFloatSupport()) { try { Statement s = connection_.createStatement(); - ResultSet rs = s.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_DFP16); + ResultSet rs = s.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_GETDFP16); rs.next(); byte[] v = rs.getBytes(1); if ((!isToolboxDriver())) @@ -1579,7 +1591,7 @@ public void Var045() { if (checkDecFloatSupport()) { try { Statement s = connection_.createStatement(); - ResultSet rs = s.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_DFP34); + ResultSet rs = s.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_GETDFP34); rs.next(); byte[] v = rs.getBytes(1); if ((!isToolboxDriver())) diff --git a/src/test/JD/RS/JDRSGetCharacterStream.java b/src/test/JD/RS/JDRSGetCharacterStream.java index 822352f5..63924a0b 100644 --- a/src/test/JD/RS/JDRSGetCharacterStream.java +++ b/src/test/JD/RS/JDRSGetCharacterStream.java @@ -20,6 +20,7 @@ import test.JDReflectionUtil; import test.JDTestDriver; import test.JDTestcase; +import test.JD.JDSerializeFile; import java.io.FileOutputStream; @@ -117,7 +118,7 @@ protected void setup() throws Exception { statement1_ = connection_.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); statement_.executeUpdate("INSERT INTO " + JDRSTest.RSTEST_GET - + " (C_KEY) VALUES ('DUMMY_ROW')"); + + " (C_KEY) VALUES ('DUMMYROW_GCS')"); // Force LOB locators. connection2_ = testDriver_.getConnection(url + ";lob threshold=0", @@ -376,13 +377,15 @@ public void Var011() { **/ public void Var012() { if (checkLevel()) { + JDSerializeFile serializeFile = null; try { + serializeFile = new JDSerializeFile(connection_, JDRSTest.RSTEST_GET); sb.setLength(0); ResultSet rs = statement1_.executeQuery( "SELECT * FROM " + JDRSTest.RSTEST_GET + " FOR UPDATE"); JDRSTest.position(rs, "UPDATE_SANDBOX"); rs.updateString("C_CHAR_50", "New Planet"); - rs.updateRow(); + rs.updateRow(); /* serialized */ Reader v = (Reader) JDReflectionUtil.callMethod_OS(rs, methodName, "C_CHAR_50"); boolean check; @@ -395,6 +398,14 @@ public void Var012() { assertCondition(check, sb); } catch (Exception e) { failed(e, "Unexpected Exception"); + } finally { + if (serializeFile != null) { + try { + serializeFile.close(); + } catch (SQLException e) { + e.printStackTrace(); + } + } } } } @@ -467,7 +478,7 @@ public void Var015() { try { rs = statement1_.executeQuery( "SELECT * FROM " + JDRSTest.RSTEST_GET + " FOR UPDATE"); - JDRSTest.position(rs, "DUMMY_ROW"); + JDRSTest.position(rs, "DUMMYROW_GCS"); rs.deleteRow(); Reader v = (Reader) JDReflectionUtil.callMethod_OS(rs, methodName, "C_VARCHAR_50"); @@ -1199,7 +1210,7 @@ public void Var045() { if (checkDecFloatSupport() && checkLevel()) { try { Statement s = connection_.createStatement(); - ResultSet rs = s.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_DFP16); + ResultSet rs = s.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_GETDFP16); rs.next(); Reader v = (Reader) JDReflectionUtil.callMethod_O(rs, methodName, 1); String expected = "1.1"; @@ -1219,7 +1230,7 @@ public void Var046() { sb.setLength(0); try { Statement s = connection_.createStatement(); - ResultSet rs = s.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_DFP34); + ResultSet rs = s.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_GETDFP34); rs.next(); Reader v = (Reader) JDReflectionUtil.callMethod_O(rs, methodName, 1); String expected = "1.1"; diff --git a/src/test/JD/RS/JDRSGetClob.java b/src/test/JD/RS/JDRSGetClob.java index 233abdd5..967e12b9 100644 --- a/src/test/JD/RS/JDRSGetClob.java +++ b/src/test/JD/RS/JDRSGetClob.java @@ -20,6 +20,7 @@ import test.JDReflectionUtil; import test.JDTestDriver; import test.JDTestcase; +import test.JD.JDSerializeFile; import java.io.FileOutputStream; @@ -114,7 +115,7 @@ protected void setup() throws Exception { statement_ = connection_.createStatement( ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); statement_.executeUpdate("INSERT INTO " + JDRSTest.RSTEST_GET - + " (C_KEY) VALUES ('DUMMY_ROW')"); + + " (C_KEY) VALUES ('DUMMYROW_GCLOB')"); statement1_ = connection_.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); @@ -414,13 +415,15 @@ public void Var011() { **/ public void Var012() { if (checkLevel()) { + JDSerializeFile serializeFile = null; try { + serializeFile = new JDSerializeFile(connection_, JDRSTest.RSTEST_GET); ResultSet rs = statement1_.executeQuery( "SELECT * FROM " + JDRSTest.RSTEST_GET + " FOR UPDATE"); JDRSTest.position(rs, "UPDATE_SANDBOX"); String test = "The new and improved AS/400 Toolbox for Java."; rs.updateString("C_VARCHAR_50", test); - rs.updateRow(); + rs.updateRow(); /* serialized */ Object v = JDReflectionUtil.callMethod_OS(rs, methodName, "C_VARCHAR_50"); boolean check = compare(v, test); @@ -428,6 +431,14 @@ public void Var012() { assertCondition(check); } catch (Exception e) { failed(e, "Unexpected Exception"); + } finally { + if (serializeFile != null) { + try { + serializeFile.close(); + } catch (SQLException e) { + e.printStackTrace(); + } + } } } } @@ -500,7 +511,7 @@ public void Var015() { try { rs = statement1_.executeQuery( "SELECT * FROM " + JDRSTest.RSTEST_GET + " FOR UPDATE"); - JDRSTest.position(rs, "DUMMY_ROW"); + JDRSTest.position(rs, "DUMMYROW_GCLOB"); rs.deleteRow(); Object v = JDReflectionUtil.callMethod_OS(rs, methodName, "C_VARCHAR_50"); @@ -1193,7 +1204,7 @@ public void Var046() { StringBuffer sb = new StringBuffer(); try { Statement s = connection_.createStatement(); - ResultSet rs = s.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_DFP16); + ResultSet rs = s.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_GETDFP16); rs.next(); Object v = JDReflectionUtil.callMethod_O(rs, methodName, 1); String expected = "1.1"; @@ -1213,7 +1224,7 @@ public void Var047() { StringBuffer sb = new StringBuffer(); try { Statement s = connection_.createStatement(); - ResultSet rs = s.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_DFP34); + ResultSet rs = s.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_GETDFP34); rs.next(); Object v = JDReflectionUtil.callMethod_O(rs, methodName, 1); String expected = "1.1"; diff --git a/src/test/JD/RS/JDRSGetDate.java b/src/test/JD/RS/JDRSGetDate.java index 8be6efd1..66a11793 100644 --- a/src/test/JD/RS/JDRSGetDate.java +++ b/src/test/JD/RS/JDRSGetDate.java @@ -121,7 +121,7 @@ protected void setup () ResultSet.CONCUR_UPDATABLE); } statement_.executeUpdate ("INSERT INTO " + JDRSTest.RSTEST_GET - + " (C_KEY) VALUES ('DUMMY_ROW')"); + + " (C_KEY) VALUES ('DUMMYROW_GDATE')"); rsQuery_ = "SELECT * FROM " + JDRSTest.RSTEST_GET + " FOR UPDATE"; rs_ = statement_.executeQuery (rsQuery_); @@ -186,7 +186,7 @@ private void reconnect (String properties) ResultSet.CONCUR_UPDATABLE); } statement_.executeUpdate ("INSERT INTO " + JDRSTest.RSTEST_GET - + " (C_KEY) VALUES ('DUMMY_ROW')"); + + " (C_KEY) VALUES ('DUMMYROW_GDATE')"); rs_ = statement_.executeQuery ("SELECT * FROM " + JDRSTest.RSTEST_GET + " FOR UPDATE"); } @@ -524,7 +524,7 @@ public void Var016() } if (checkJdbc20 ()) { try { - JDRSTest.position (rs_, "DUMMY_ROW"); + JDRSTest.position (rs_, "DUMMYROW_GDATE"); rs_.deleteRow (); Date v = rs_.getDate ("C_DATE"); failed ("Didn't throw SQLException"+v); @@ -1717,7 +1717,7 @@ public void Var067 () try { Statement s = connection_.createStatement (); ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP16); + + JDRSTest.RSTEST_GETDFP16); rs.next(); Date v = rs.getDate (1); failed ("Didn't throw SQLException "+v); @@ -1739,7 +1739,7 @@ public void Var068 () try { Statement s = connection_.createStatement (); ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP34); + + JDRSTest.RSTEST_GETDFP34); rs.next(); Date v = rs.getDate (1); failed ("Didn't throw SQLException "+v); diff --git a/src/test/JD/RS/JDRSGetDouble.java b/src/test/JD/RS/JDRSGetDouble.java index 027722bf..82af968d 100644 --- a/src/test/JD/RS/JDRSGetDouble.java +++ b/src/test/JD/RS/JDRSGetDouble.java @@ -1002,7 +1002,7 @@ public void Var043 () if (getDriver() == JDTestDriver.DRIVER_JCC) { notApplicable("JCC doesn't support getting double from DECFLOAT -- Invalid data conversion: Wrong result column type for requested conversion."); } else { - testDfp(JDRSTest.RSTEST_DFP16, JDRSTest.VALUES_DFP16_DOUBLE, statement0_, "getDouble"); + testDfp(JDRSTest.RSTEST_GETDFP16, JDRSTest.VALUES_DFP16_DOUBLE, statement0_, "getDouble"); } } @@ -1015,7 +1015,7 @@ public void Var044 () if (getDriver() == JDTestDriver.DRIVER_JCC) { notApplicable("JCC doesn't support getting double from DECFLOAT -- Invalid data conversion: Wrong result column type for requested conversion."); } else { - testDfp(JDRSTest.RSTEST_DFP34, JDRSTest.VALUES_DFP34_DOUBLE, statement0_, "getDouble"); + testDfp(JDRSTest.RSTEST_GETDFP34, JDRSTest.VALUES_DFP34_DOUBLE, statement0_, "getDouble"); } } @@ -1032,7 +1032,7 @@ public void Var045 () try { Statement s = connection_.createStatement (); ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP16NAN); + + JDRSTest.RSTEST_GETDFP16NAN); rs.next(); double v = rs.getDouble (1); String vString = ""+v; @@ -1057,7 +1057,7 @@ public void Var046 () try { Statement s = connection_.createStatement (); ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP16NNAN); + + JDRSTest.RSTEST_GETDFP16NNAN); rs.next(); String v = ""+rs.getDouble (1); assertCondition(v.equals("NaN"), "Expected -NaN got "+v); @@ -1081,7 +1081,7 @@ public void Var047 () try { Statement s = connection_.createStatement (); ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP16INF); + + JDRSTest.RSTEST_GETDFP16INF); rs.next(); double v = rs.getDouble (1); assertCondition(v == Double.POSITIVE_INFINITY, "Expected Infinity got "+v); @@ -1105,7 +1105,7 @@ public void Var048 () try { Statement s = connection_.createStatement (); ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP16NINF); + + JDRSTest.RSTEST_GETDFP16NINF); rs.next(); double v = rs.getDouble (1); assertCondition(v == Double.NEGATIVE_INFINITY, "Expected -Infinity got "+v); @@ -1153,7 +1153,7 @@ public void Var050 () try { Statement s = connection_.createStatement (); ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP34NNAN); + + JDRSTest.RSTEST_GETDFP34NNAN); rs.next(); String v = ""+rs.getDouble (1); assertCondition(v.equals("NaN"), "Expected NaN got "+v); @@ -1177,7 +1177,7 @@ public void Var051 () try { Statement s = connection_.createStatement (); ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP34INF); + + JDRSTest.RSTEST_GETDFP34INF); rs.next(); double v = rs.getDouble (1); @@ -1202,7 +1202,7 @@ public void Var052 () try { Statement s = connection_.createStatement (); ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP34NINF); + + JDRSTest.RSTEST_GETDFP34NINF); rs.next(); double v = rs.getDouble (1); assertCondition(v == Double.NEGATIVE_INFINITY, "Expected -Infinity got "+v); diff --git a/src/test/JD/RS/JDRSGetFloat.java b/src/test/JD/RS/JDRSGetFloat.java index 961fc358..96f01f54 100644 --- a/src/test/JD/RS/JDRSGetFloat.java +++ b/src/test/JD/RS/JDRSGetFloat.java @@ -110,7 +110,7 @@ protected void setup () ResultSet.CONCUR_UPDATABLE); } statement_.executeUpdate ("INSERT INTO " + JDRSTest.RSTEST_GET - + " (C_KEY) VALUES ('DUMMY_ROW')"); + + " (C_KEY) VALUES ('DUMMY_GETFLOAT')"); statementQuery_ = "SELECT * FROM " + JDRSTest.RSTEST_GET + " FOR UPDATE"; rs_ = statement_.executeQuery (statementQuery_); @@ -454,7 +454,7 @@ public void Var015() if (checkJdbc20 ()) { try { - rs_ = JDRSTest.position (driver_, statement_, statementQuery_, rs_, "DUMMY_ROW"); + rs_ = JDRSTest.position (driver_, statement_, statementQuery_, rs_, "DUMMY_GETFLOAT"); rs_.deleteRow (); float v = rs_.getFloat ("C_FLOAT"); failed ("Didn't throw SQLException on deleted row but got "+v); @@ -984,7 +984,7 @@ public void Var041 () try { ResultSet rs = statement0_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP16); + + JDRSTest.RSTEST_GETDFP16); int i = 0; while (rs.next()) { double v = rs.getFloat (1); @@ -1027,7 +1027,7 @@ public void Var042 () try { ResultSet rs = statement0_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP34); + + JDRSTest.RSTEST_GETDFP34); int i = 0; while (rs.next()) { double v = rs.getFloat (1); @@ -1073,7 +1073,7 @@ public void Var043 () try { Statement s = connection_.createStatement (); ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP16NAN); + + JDRSTest.RSTEST_GETDFP16NAN); rs.next(); float v = rs.getFloat (1); String vString = ""+v; @@ -1098,7 +1098,7 @@ public void Var044 () try { Statement s = connection_.createStatement (); ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP16NNAN); + + JDRSTest.RSTEST_GETDFP16NNAN); rs.next(); String v = ""+rs.getFloat (1); assertCondition(v.equals("NaN"), "Expected -NaN got "+v); @@ -1122,7 +1122,7 @@ public void Var045 () try { Statement s = connection_.createStatement (); ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP16INF); + + JDRSTest.RSTEST_GETDFP16INF); rs.next(); float v = rs.getFloat (1); assertCondition(v == Float.POSITIVE_INFINITY, "Expected Infinity got "+v); @@ -1146,7 +1146,7 @@ public void Var046 () try { Statement s = connection_.createStatement (); ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP16NINF); + + JDRSTest.RSTEST_GETDFP16NINF); rs.next(); float v = rs.getFloat (1); assertCondition(v == Float.NEGATIVE_INFINITY, "Expected -Infinity got "+v); @@ -1194,7 +1194,7 @@ public void Var048 () try { Statement s = connection_.createStatement (); ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP34NNAN); + + JDRSTest.RSTEST_GETDFP34NNAN); rs.next(); String v = ""+rs.getFloat (1); assertCondition(v.equals("NaN"), "Expected NaN got "+v); @@ -1218,7 +1218,7 @@ public void Var049 () try { Statement s = connection_.createStatement (); ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP34INF); + + JDRSTest.RSTEST_GETDFP34INF); rs.next(); float v = rs.getFloat (1); @@ -1243,7 +1243,7 @@ public void Var050 () try { Statement s = connection_.createStatement (); ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP34NINF); + + JDRSTest.RSTEST_GETDFP34NINF); rs.next(); float v = rs.getFloat (1); assertCondition(v == Float.NEGATIVE_INFINITY, "Expected -Infinity got "+v); diff --git a/src/test/JD/RS/JDRSGetInt.java b/src/test/JD/RS/JDRSGetInt.java index c66ff112..0440a2cc 100644 --- a/src/test/JD/RS/JDRSGetInt.java +++ b/src/test/JD/RS/JDRSGetInt.java @@ -919,7 +919,7 @@ public void Var040() **/ public void Var057 () { - testDfp(JDRSTest.RSTEST_DFP16, JDRSTest.VALUES_DFP16_INT, statement0_, "getInt"); + testDfp(JDRSTest.RSTEST_GETDFP16, JDRSTest.VALUES_DFP16_INT, statement0_, "getInt"); } @@ -929,7 +929,7 @@ public void Var057 () public void Var058 () { - testDfp(JDRSTest.RSTEST_DFP34, JDRSTest.VALUES_DFP34_INT, statement0_, "getInt"); + testDfp(JDRSTest.RSTEST_GETDFP34, JDRSTest.VALUES_DFP34_INT, statement0_, "getInt"); } diff --git a/src/test/JD/RS/JDRSGetLong.java b/src/test/JD/RS/JDRSGetLong.java index cb8d2240..4aca8f7c 100644 --- a/src/test/JD/RS/JDRSGetLong.java +++ b/src/test/JD/RS/JDRSGetLong.java @@ -898,7 +898,7 @@ public void Var040() **/ public void Var041 () { - testDfp(JDRSTest.RSTEST_DFP16, JDRSTest.VALUES_DFP16_LONG, statement0_, "getLong"); + testDfp(JDRSTest.RSTEST_GETDFP16, JDRSTest.VALUES_DFP16_LONG, statement0_, "getLong"); } @@ -911,7 +911,7 @@ public void Var042 () notApplicable("Jcc doesn't throw exception for DFP34"); return; } - testDfp(JDRSTest.RSTEST_DFP34, JDRSTest.VALUES_DFP34_LONG, statement0_, "getLong"); + testDfp(JDRSTest.RSTEST_GETDFP34, JDRSTest.VALUES_DFP34_LONG, statement0_, "getLong"); } diff --git a/src/test/JD/RS/JDRSGetNString.java b/src/test/JD/RS/JDRSGetNString.java index 462bf8df..90acc2c4 100644 --- a/src/test/JD/RS/JDRSGetNString.java +++ b/src/test/JD/RS/JDRSGetNString.java @@ -112,11 +112,6 @@ protected void setup () } } } - // Re-Create a couple tables that were created in the JDRSTest test driver. - // Several testcases use these tables (including this testcase). They need to be - // recreated due to changes along the way. - JDRSTest.createAndPopulateTable(JDRSTest.RSTEST_DFP16, "C1 DECFLOAT(16)", JDRSTest.VALUES_DFP16, statement0_); - JDRSTest.createAndPopulateTable(JDRSTest.RSTEST_DFP34, "C1 DECFLOAT(34)", JDRSTest.VALUES_DFP34, statement0_); } @@ -174,7 +169,7 @@ private void reconnect (String properties) statement_ = connection_.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); statement_.executeUpdate ("INSERT INTO " + JDRSTest.RSTEST_GET - + " (C_KEY) VALUES ('DUMMY_ROW')"); + + " (C_KEY) VALUES ('DUMMROW_GNSTRING')"); rs_ = statement_.executeQuery ("SELECT * FROM " + JDRSTest.RSTEST_GET + " FOR UPDATE"); } @@ -499,7 +494,7 @@ public void Var015() return; } try { - JDRSTest.position (rs_, "DUMMY_ROW"); + JDRSTest.position (rs_, "DUMMROW_GNSTRING"); rs_.deleteRow (); String v = (String) JDReflectionUtil.callMethod_OS(rs_, "getNString", "C_VARCHAR_50"); failed ("Didn't throw SQLException but returned"+v); @@ -2243,7 +2238,7 @@ public void Var073 () try { ResultSet rs = statement0_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP16); + + JDRSTest.RSTEST_GETDFP16); int i = 0; while (rs.next()) { String v = (String) JDReflectionUtil.callMethod_O(rs, "getNString", 1); @@ -2291,7 +2286,7 @@ public void Var074 () try { ResultSet rs = statement0_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP34); + + JDRSTest.RSTEST_GETDFP34); int i = 0; while (rs.next()) { @@ -2339,10 +2334,12 @@ public void Var075 () try { Statement s = connection_.createStatement (); ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP16NAN); + + JDRSTest.RSTEST_GETDFP16NAN); rs.next(); String v = (String) JDReflectionUtil.callMethod_O(rs, "getNString", 1); + rs.close(); + s.close(); assertCondition(v.equals("NaN"), "Expected NaN got "+v); } catch (Exception e) { @@ -2365,10 +2362,12 @@ public void Var076 () try { Statement s = connection_.createStatement (); ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP16NNAN); + + JDRSTest.RSTEST_GETDFP16NNAN); rs.next(); String v = (String) JDReflectionUtil.callMethod_O(rs, "getNString", 1); + rs.close(); + s.close(); assertCondition(v.equals("-NaN"), "Expected -NaN got "+v); } catch (Exception e) { @@ -2391,10 +2390,12 @@ public void Var077 () try { Statement s = connection_.createStatement (); ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP16INF); + + JDRSTest.RSTEST_GETDFP16INF); rs.next(); String v = (String) JDReflectionUtil.callMethod_O(rs, "getNString", 1); + rs.close(); + s.close(); assertCondition(v.equals("Infinity"), "Expected Infinity got "+v); } catch (Exception e) { @@ -2417,7 +2418,7 @@ public void Var078 () try { Statement s = connection_.createStatement (); ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP16NINF); + + JDRSTest.RSTEST_GETDFP16NINF); rs.next(); String v = (String) JDReflectionUtil.callMethod_O(rs, "getNString", 1); @@ -2469,7 +2470,7 @@ public void Var080 () try { Statement s = connection_.createStatement (); ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP34NNAN); + + JDRSTest.RSTEST_GETDFP34NNAN); rs.next(); String v = (String) JDReflectionUtil.callMethod_O(rs, "getNString", 1); @@ -2495,7 +2496,7 @@ public void Var081 () try { Statement s = connection_.createStatement (); ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP34INF); + + JDRSTest.RSTEST_GETDFP34INF); rs.next(); String v = (String) JDReflectionUtil.callMethod_O(rs, "getNString", 1); @@ -2522,10 +2523,12 @@ public void Var082 () try { Statement s = connection_.createStatement (); ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP34NINF); + + JDRSTest.RSTEST_GETDFP34NINF); rs.next(); String v = (String) JDReflectionUtil.callMethod_O(rs, "getNString", 1); + rs.close(); + s.close(); assertCondition(v.equals("-Infinity"), "Expected -Infinity got "+v); } catch (Exception e) { @@ -2553,6 +2556,7 @@ public void Var083 () rs.next(); String s = (String) JDReflectionUtil.callMethod_OS(rs, "getNString", "C_XML"); String expected = JDRSTest.SAMPLE_XML1_OUTXML; + rs.close(); assertCondition (s.equals (expected), "got \""+s+"\" sb \""+expected+"\""); } catch (Exception e) { failed (e, "Unexpected Exception"); @@ -2606,6 +2610,7 @@ public void Var086() { .executeQuery("SELECT * FROM " + JDRSTest.RSTEST_BOOLEAN); JDRSTest.position0(rs, "BOOLEAN_FALSE"); String s = (String) JDReflectionUtil.callMethod_OS(rs, "getNString", "C_BOOLEAN"); + rs.close(); assertCondition(JDRSTest.BOOLEAN_FALSE_STRING.equals(s), JDRSTest.BOOLEAN_FALSE_STRING+" != " + s); } catch (Exception e) { failed(e, "Unexpected Exception"); @@ -2624,6 +2629,7 @@ public void Var087() { JDRSTest.position0(rs, "BOOLEAN_TRUE"); String s = (String) JDReflectionUtil.callMethod_OS(rs, "getNString", "C_BOOLEAN"); + rs.close(); assertCondition(JDRSTest.BOOLEAN_TRUE_STRING.equals(s), JDRSTest.BOOLEAN_TRUE_STRING+" != " + s); } catch (Exception e) { failed(e, "Unexpected Exception"); @@ -2641,6 +2647,7 @@ public void Var088() { .executeQuery("SELECT * FROM " + JDRSTest.RSTEST_BOOLEAN); JDRSTest.position0(rs, "BOOLEAN_NULL"); String s = (String) JDReflectionUtil.callMethod_OS(rs, "getNString", "C_BOOLEAN"); + rs.close(); assertCondition(s == null); } catch (Exception e) { failed(e, "Unexpected Exception"); diff --git a/src/test/JD/RS/JDRSGetObject.java b/src/test/JD/RS/JDRSGetObject.java index 0bbfd784..f2b1acc1 100644 --- a/src/test/JD/RS/JDRSGetObject.java +++ b/src/test/JD/RS/JDRSGetObject.java @@ -122,7 +122,7 @@ protected void setup () statement_ = connection_.createStatement (); } statement_.executeUpdate ("INSERT INTO " + JDRSTest.RSTEST_GET - + " (C_KEY) VALUES ('DUMMY_ROW')"); + + " (C_KEY) VALUES ('DUMMYROW_GETOBJECT')"); statementQuery_ = "SELECT * FROM " + JDRSTest.RSTEST_GET + " FOR UPDATE"; rs_ = statement_.executeQuery (statementQuery_); @@ -534,7 +534,7 @@ public void Var019() return; } try { - rs_ = JDRSTest.position (driver_, statement_, statementQuery_, rs_, "DUMMY_ROW"); + rs_ = JDRSTest.position (driver_, statement_, statementQuery_, rs_, "DUMMYROW_GETOBJECT"); rs_.deleteRow (); Object v = rs_.getObject ("C_VARCHAR_50"); failed ("Didn't throw SQLException"+v); @@ -1051,7 +1051,7 @@ public void Var043 () try { ResultSet rs = statement0_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP16); + + JDRSTest.RSTEST_GETDFP16); int i = 0; while (rs.next()) { Object v = rs.getObject (1); @@ -1102,7 +1102,7 @@ public void Var044 () try { ResultSet rs = statement0_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP34); + + JDRSTest.RSTEST_GETDFP34); int i = 0; while (rs.next()) { Object v = rs.getObject (1); diff --git a/src/test/JD/RS/JDRSGetObject41.java b/src/test/JD/RS/JDRSGetObject41.java index da1de01f..10ac0c20 100644 --- a/src/test/JD/RS/JDRSGetObject41.java +++ b/src/test/JD/RS/JDRSGetObject41.java @@ -112,7 +112,7 @@ protected void setup () statement_ = connection_.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); statement_.executeUpdate("INSERT INTO " + JDRSTest.RSTEST_GET - + " (C_KEY) VALUES ('DUMMY_ROW')"); + + " (C_KEY) VALUES ('DUMMYROW_GETOBJ41')"); rs_ = statement_ .executeQuery("SELECT * FROM " + JDRSTest.RSTEST_GET + " FOR UPDATE"); diff --git a/src/test/JD/RS/JDRSGetObjectUDT.java b/src/test/JD/RS/JDRSGetObjectUDT.java index 3c496d7f..18ce6e79 100644 --- a/src/test/JD/RS/JDRSGetObjectUDT.java +++ b/src/test/JD/RS/JDRSGetObjectUDT.java @@ -120,7 +120,7 @@ protected void setup () statement_ = connection_.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); statement_.executeUpdate ("INSERT INTO " + JDRSTest.RSTEST_GET - + " (C_KEY) VALUES ('DUMMY_ROW')"); + + " (C_KEY) VALUES ('DUMMYROW_GETOBJU')"); rs_ = statement_.executeQuery ("SELECT * FROM " + JDRSTest.RSTEST_GET + " FOR UPDATE"); } @@ -598,7 +598,7 @@ public void Var019() return; } try { - JDRSTest.position (rs_, "DUMMY_ROW"); + JDRSTest.position (rs_, "DUMMYROW_GETOBJU"); rs_.deleteRow (); Object v = rs_.getObject ("C_VARCHAR_50", map_); failed ("Didn't throw SQLException v="+v); diff --git a/src/test/JD/RS/JDRSGetRef.java b/src/test/JD/RS/JDRSGetRef.java index 4f4984e8..edbe5828 100644 --- a/src/test/JD/RS/JDRSGetRef.java +++ b/src/test/JD/RS/JDRSGetRef.java @@ -98,7 +98,7 @@ protected void setup () statement_ = connection_.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); statement_.executeUpdate ("INSERT INTO " + JDRSTest.RSTEST_GET - + " (C_KEY) VALUES ('DUMMY_ROW')"); + + " (C_KEY) VALUES ('DUMMYROW_GETREF')"); rs_ = statement_.executeQuery ("SELECT * FROM " + JDRSTest.RSTEST_GET + " FOR UPDATE"); } @@ -433,7 +433,7 @@ public void Var015() return; } try { - JDRSTest.position (rs_, "DUMMY_ROW"); + JDRSTest.position (rs_, "DUMMYROW_GETREF"); rs_.deleteRow (); Ref v = rs_.getRef ("C_INTEGER"); failed ("Didn't throw SQLException"+v); @@ -949,7 +949,7 @@ public void Var041 () try { Statement s = connection_.createStatement (); ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP16); + + JDRSTest.RSTEST_GETDFP16); rs.next(); Ref v = rs.getRef (1); failed ("Didn't throw SQLException "+v); @@ -971,7 +971,7 @@ public void Var042 () try { Statement s = connection_.createStatement (); ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP34); + + JDRSTest.RSTEST_GETDFP34); rs.next(); Ref v = rs.getRef (1); failed ("Didn't throw SQLException "+v); diff --git a/src/test/JD/RS/JDRSGetRowId.java b/src/test/JD/RS/JDRSGetRowId.java index b325d1d0..8c3d38ce 100644 --- a/src/test/JD/RS/JDRSGetRowId.java +++ b/src/test/JD/RS/JDRSGetRowId.java @@ -84,7 +84,7 @@ protected void setup() throws Exception { statement_ = connection_.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); statement_.executeUpdate("INSERT INTO " + JDRSTest.RSTEST_GET - + " (C_KEY) VALUES ('DUMMY_ROW')"); + + " (C_KEY) VALUES ('DUMMYROW_GETROWID')"); rs_ = statement_ .executeQuery("SELECT * FROM " + JDRSTest.RSTEST_GET + " FOR UPDATE"); } @@ -347,7 +347,7 @@ public void Var009() { if (checkDecFloatSupport()) { try { Statement s = connection_.createStatement(); - ResultSet rs = s.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_DFP16); + ResultSet rs = s.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_GETDFP16); rs.next(); Object v = JDReflectionUtil.callMethod_O(rs, "getRowId", 1); @@ -369,7 +369,7 @@ public void Var010() { if (checkDecFloatSupport()) { try { Statement s = connection_.createStatement(); - ResultSet rs = s.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_DFP34); + ResultSet rs = s.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_GETDFP34); rs.next(); Object v = JDReflectionUtil.callMethod_O(rs, "getRowId", 1); diff --git a/src/test/JD/RS/JDRSGetSQLXML.java b/src/test/JD/RS/JDRSGetSQLXML.java index d078e52d..123a7829 100644 --- a/src/test/JD/RS/JDRSGetSQLXML.java +++ b/src/test/JD/RS/JDRSGetSQLXML.java @@ -20,6 +20,7 @@ import test.JDReflectionUtil; import test.JDTestDriver; import test.JDTestcase; +import test.JD.JDSerializeFile; import test.JD.JDTestUtilities; import java.io.FileOutputStream; @@ -116,7 +117,7 @@ protected void setup() throws Exception { } statement_.executeUpdate("INSERT INTO " + JDRSTest.RSTEST_GETX - + " (C_KEY) VALUES ('DUMMY_ROW')"); + + " (C_KEY) VALUES ('DUMMYROW_GETSQLXML')"); // Force LOB locators. connection2_ = testDriver_.getConnection (url + ";lob threshold=0",systemObject_.getUserId(), encryptedPassword_); @@ -597,7 +598,9 @@ public void Var017() { public void Var018() { if (checkJdbc40()) { + JDSerializeFile serializeFile = null; try { + serializeFile = new JDSerializeFile(connection_, JDRSTest.RSTEST_GET); message = new StringBuffer(); ResultSet rs = statement1_.executeQuery( "SELECT * FROM " + JDRSTest.RSTEST_GETXML + " FOR UPDATE"); @@ -605,7 +608,7 @@ public void Var018() { rs.next(); String test = JDRSTest.SAMPLE_XML2; rs.updateString("C_CLOB0037", test); - rs.updateRow(); + rs.updateRow(); /* serialized */ Object v = JDReflectionUtil.callMethod_OS(rs, "getSQLXML", "C_CLOB0037"); boolean trim = false; @@ -617,6 +620,14 @@ public void Var018() { assertCondition(check, message.toString()); } catch (Exception e) { failed(e, "Unexpected Exception"); + } finally { + if (serializeFile != null) { + try { + serializeFile.close(); + } catch (SQLException e) { + e.printStackTrace(); + } + } } } } @@ -1483,7 +1494,7 @@ public void Var052() { if (checkJdbc40()) { try { Statement s = connection_.createStatement(); - ResultSet rs = s.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_DFP16); + ResultSet rs = s.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_GETDFP16); rs.next(); Object v = JDReflectionUtil.callMethod_O(rs, "getSQLXML", 1); failed("Didn't throw SQLException " + v); @@ -1500,7 +1511,7 @@ public void Var053() { if (checkJdbc40()) { try { Statement s = connection_.createStatement(); - ResultSet rs = s.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_DFP34); + ResultSet rs = s.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_GETDFP34); rs.next(); Object v = JDReflectionUtil.callMethod_O(rs, "getSQLXML", 1); failed("Didn't throw SQLException " + v); diff --git a/src/test/JD/RS/JDRSGetShort.java b/src/test/JD/RS/JDRSGetShort.java index c6e14f58..c9c6e733 100644 --- a/src/test/JD/RS/JDRSGetShort.java +++ b/src/test/JD/RS/JDRSGetShort.java @@ -894,7 +894,7 @@ public void Var040() **/ public void Var041 () { - testDfp(JDRSTest.RSTEST_DFP16, JDRSTest.VALUES_DFP16_SHORT, statement0_, "getShort"); + testDfp(JDRSTest.RSTEST_GETDFP16, JDRSTest.VALUES_DFP16_SHORT, statement0_, "getShort"); } @@ -903,7 +903,7 @@ public void Var041 () **/ public void Var042 () { - testDfp(JDRSTest.RSTEST_DFP34, JDRSTest.VALUES_DFP34_SHORT, statement0_, "getShort"); + testDfp(JDRSTest.RSTEST_GETDFP34, JDRSTest.VALUES_DFP34_SHORT, statement0_, "getShort"); } diff --git a/src/test/JD/RS/JDRSGetString.java b/src/test/JD/RS/JDRSGetString.java index 16b5256e..cda4721b 100644 --- a/src/test/JD/RS/JDRSGetString.java +++ b/src/test/JD/RS/JDRSGetString.java @@ -188,7 +188,7 @@ private void reconnect (String properties) ResultSet.CONCUR_UPDATABLE); } statementQuery_ = "INSERT INTO " + JDRSTest.RSTEST_GET - + " (C_KEY) VALUES ('DUMMY_ROW')"; + + " (C_KEY) VALUES ('DUMMYROW_GETSTRING')"; statement_.executeUpdate (statementQuery_); statementQuery_ = "SELECT * FROM " + JDRSTest.RSTEST_GET + " FOR UPDATE"; rs_ = statement_.executeQuery (statementQuery_); @@ -490,7 +490,7 @@ public void Var015() return; } try { - rs_ = JDRSTest.position (driver_, statement_, statementQuery_, rs_, "DUMMY_ROW"); + rs_ = JDRSTest.position (driver_, statement_, statementQuery_, rs_, "DUMMYROW_GETSTRING"); rs_.deleteRow (); String v = rs_.getString ("C_VARCHAR_50"); failed ("Didn't throw SQLException but returned"+v); @@ -2023,7 +2023,7 @@ public void Var073 () try { ResultSet rs = statement0_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP16); + + JDRSTest.RSTEST_GETDFP16); int i = 0; while (rs.next()) { String v = rs.getString (1); @@ -2067,7 +2067,7 @@ public void Var074 () try { ResultSet rs = statement0_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP34); + + JDRSTest.RSTEST_GETDFP34); int i = 0; while (rs.next()) { String v = rs.getString (1); @@ -2110,7 +2110,7 @@ public void Var075 () try { Statement s = connection_.createStatement (); ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP16NAN); + + JDRSTest.RSTEST_GETDFP16NAN); rs.next(); String v = rs.getString (1); s.close(); @@ -2136,7 +2136,7 @@ public void Var076 () try { Statement s = connection_.createStatement (); ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP16NNAN); + + JDRSTest.RSTEST_GETDFP16NNAN); rs.next(); String v = rs.getString (1); s.close(); @@ -2162,9 +2162,10 @@ public void Var077 () try { Statement s = connection_.createStatement (); ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP16INF); + + JDRSTest.RSTEST_GETDFP16INF); rs.next(); String v = rs.getString (1); + rs.close(); s.close(); assertCondition(v.equals("Infinity"), "Expected Infinity got "+v); } @@ -2188,9 +2189,10 @@ public void Var078 () try { Statement s = connection_.createStatement (); ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP16NINF); + + JDRSTest.RSTEST_GETDFP16NINF); rs.next(); String v = rs.getString (1); + rs.close(); s.close(); assertCondition(v.equals("-Infinity"), "Expected -Infinity got "+v); } @@ -2240,7 +2242,7 @@ public void Var080 () try { Statement s = connection_.createStatement (); ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP34NNAN); + + JDRSTest.RSTEST_GETDFP34NNAN); rs.next(); String v = rs.getString (1); s.close(); @@ -2266,7 +2268,7 @@ public void Var081 () try { Statement s = connection_.createStatement (); ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP34INF); + + JDRSTest.RSTEST_GETDFP34INF); rs.next(); String v = rs.getString (1); s.close(); @@ -2292,7 +2294,7 @@ public void Var082 () try { Statement s = connection_.createStatement (); ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP34NINF); + + JDRSTest.RSTEST_GETDFP34NINF); rs.next(); String v = rs.getString (1); s.close(); diff --git a/src/test/JD/RS/JDRSGetStringBIDI.java b/src/test/JD/RS/JDRSGetStringBIDI.java index 00f4b620..c03c1e3a 100644 --- a/src/test/JD/RS/JDRSGetStringBIDI.java +++ b/src/test/JD/RS/JDRSGetStringBIDI.java @@ -16,6 +16,7 @@ import java.io.FileOutputStream; +import java.sql.Connection; import java.sql.ResultSet; import java.sql.Statement; import java.util.Hashtable; import java.util.Vector; @@ -49,6 +50,7 @@ public static void main(String args[]) throws Exception { // Private data. private String properties_ = "NOTSET"; // private static String table_ = JDRSTest.COLLECTION + ".JDRSGSBIDI"; + private Connection noBidiConnection_ = null; /** * Constructor. @@ -67,6 +69,7 @@ public JDRSGetStringBIDI(AS400 systemObject, Hashtable> na * If an exception occurs. **/ protected void setup() throws Exception { + noBidiConnection_ = testDriver_.getConnection (baseURL_,systemObject_.getUserId(), encryptedPassword_); reconnect(""); // table_ = JDRSTest.COLLECTION + ".JDRSGSBIDI"; } @@ -81,8 +84,13 @@ protected void cleanup() throws Exception { connection_.commit(); // @E1A connection_.close(); connection_ = null; + if (noBidiConnection_ != null) { + noBidiConnection_.close(); + noBidiConnection_ = null; + } } + /** * Reconnects with different properties, if needed. * @@ -112,9 +120,17 @@ public void testCcsid(int var, String properties, String ccsid, String dataType String sql; String table = JDRSTest.COLLECTION + ".JDRSGSB" +var+"C"+ ccsid; - Statement stmt = connection_.createStatement(); - initTable(stmt, table , "(KEY int, C1 " + dataType + ")", sb); + if (noBidiConnection_ == null) { + noBidiConnection_ = testDriver_.getConnection (baseURL_,systemObject_.getUserId(), encryptedPassword_); + } + Statement stmt2 = noBidiConnection_.createStatement(); + initTable(stmt2, table , "(KEY int, C1 " + dataType + ")", sb); + noBidiConnection_.commit(); + stmt2.close(); + + Statement stmt = connection_.createStatement(); + for (int i = 0; i < values.length; i++) { sql = "INSERT INTO " + table + " VALUES(" + i + "," + values[i][0] + ")"; @@ -157,7 +173,7 @@ public void testCcsid(int var, String properties, String ccsid, String dataType } i++; } - + rs.close(); stmt.close(); assertCondition(passed,sb); diff --git a/src/test/JD/RS/JDRSGetTime.java b/src/test/JD/RS/JDRSGetTime.java index 6a6bfa1d..ab84b14b 100644 --- a/src/test/JD/RS/JDRSGetTime.java +++ b/src/test/JD/RS/JDRSGetTime.java @@ -18,6 +18,8 @@ import test.JDRSTest; import test.JDTestDriver; import test.JDTestcase; +import test.JD.JDSerializeFile; + import java.io.FileOutputStream; import java.sql.ResultSet; @@ -95,7 +97,7 @@ protected void setup() throws Exception { statement_ = connection_.createStatement(); } statement_.executeUpdate("INSERT INTO " + JDRSTest.RSTEST_GET - + " (C_KEY) VALUES ('DUMMY_ROW')"); + + " (C_KEY) VALUES ('DUMMYROW_GETTIME')"); statementQuery_ = "SELECT * FROM " + JDRSTest.RSTEST_GET + " FOR UPDATE"; rs_ = statement_.executeQuery(statementQuery_); } @@ -315,15 +317,25 @@ public void Var012() { **/ public void Var013() { if (checkJdbc20()) { + JDSerializeFile serializeFile = null; try { + serializeFile = new JDSerializeFile(connection_, JDRSTest.RSTEST_GET); rs_ = JDRSTest.position(driver_, statement_, statementQuery_, rs_, "UPDATE_SANDBOX"); rs_.updateTime("C_TIME", Time.valueOf("04:04:13")); - rs_.updateRow(); + rs_.updateRow(); /* serialized */ Time v = rs_.getTime("C_TIME"); assertCondition(v.toString().equals("04:04:13")); } catch (Exception e) { failed(e, "Unexpected Exception"); + } finally { + if (serializeFile != null) { + try { + serializeFile.close(); + } catch (SQLException e) { + e.printStackTrace(); + } + } } } } @@ -382,7 +394,7 @@ public void Var016() { } try { rs_ = JDRSTest.position(driver_, statement_, statementQuery_, rs_, - "DUMMY_ROW"); + "DUMMYROW_GETTIME"); rs_.deleteRow(); Time v = rs_.getTime("C_TIME"); failed("Didn't throw SQLException" + v); @@ -825,7 +837,7 @@ public void Var041() { if (checkDecFloatSupport()) { try { Statement s = connection_.createStatement(); - ResultSet rs = s.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_DFP16); + ResultSet rs = s.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_GETDFP16); rs.next(); Time v = rs.getTime(1); failed("Didn't throw SQLException " + v); @@ -842,7 +854,7 @@ public void Var042() { if (checkDecFloatSupport()) { try { Statement s = connection_.createStatement(); - ResultSet rs = s.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_DFP34); + ResultSet rs = s.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_GETDFP34); rs.next(); Time v = rs.getTime(1); failed("Didn't throw SQLException " + v); diff --git a/src/test/JD/RS/JDRSGetTimestamp.java b/src/test/JD/RS/JDRSGetTimestamp.java index ef768c2d..afce9ae2 100644 --- a/src/test/JD/RS/JDRSGetTimestamp.java +++ b/src/test/JD/RS/JDRSGetTimestamp.java @@ -22,6 +22,7 @@ import test.JDTestDriver; import test.JDTestcase; import test.JTOpenTestEnvironment; +import test.JD.JDSerializeFile; import java.io.FileOutputStream; @@ -100,7 +101,7 @@ protected void setup() throws Exception { statement_ = connection_.createStatement(); } statement_.executeUpdate("INSERT INTO " + JDRSTest.RSTEST_GET - + " (C_KEY) VALUES ('DUMMY_ROW')"); + + " (C_KEY) VALUES ('DUMMYROW_GETTS')"); statementQuery_ = "SELECT * FROM " + JDRSTest.RSTEST_GET + " FOR UPDATE"; rs_ = statement_.executeQuery(statementQuery_); @@ -322,16 +323,27 @@ public void Var012() { **/ public void Var013() { if (checkJdbc20()) { + JDSerializeFile serializeFile = null; try { + serializeFile = new JDSerializeFile(connection_, JDRSTest.RSTEST_GET); rs_ = JDRSTest.position(driver_, statement_, statementQuery_, rs_, "UPDATE_SANDBOX"); rs_.updateTimestamp("C_TIMESTAMP", Timestamp.valueOf("1969-11-18 03:15:13.000000")); - rs_.updateRow(); + rs_.updateRow(); /* serialized */ Timestamp v = rs_.getTimestamp("C_TIMESTAMP"); assertCondition(v.toString().equals("1969-11-18 03:15:13.0")); } catch (Exception e) { failed(e, "Unexpected Exception"); + } finally { + if (serializeFile != null) { + try { + serializeFile.close(); + } catch (SQLException e) { + e.printStackTrace(); + } + } + } } } @@ -392,7 +404,7 @@ public void Var016() { } try { rs_ = JDRSTest.position(driver_, statement_, statementQuery_, rs_, - "DUMMY_ROW"); + "DUMMYROW_GETTS"); rs_.deleteRow(); Timestamp v = rs_.getTimestamp("C_TIMESTAMP"); failed("Didn't throw SQLException" + v); @@ -852,7 +864,7 @@ public void Var041() { if (checkDecFloatSupport()) { try { Statement s = connection_.createStatement(); - ResultSet rs = s.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_DFP16); + ResultSet rs = s.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_GETDFP16); rs.next(); Timestamp v = rs.getTimestamp(1); failed("Didn't throw SQLException " + v); @@ -869,7 +881,7 @@ public void Var042() { if (checkDecFloatSupport()) { try { Statement s = connection_.createStatement(); - ResultSet rs = s.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_DFP34); + ResultSet rs = s.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_GETDFP34); rs.next(); Timestamp v = rs.getTimestamp(1); failed("Didn't throw SQLException " + v); diff --git a/src/test/JD/RS/JDRSGetURL.java b/src/test/JD/RS/JDRSGetURL.java index 91d0d1b0..9f8f81ae 100644 --- a/src/test/JD/RS/JDRSGetURL.java +++ b/src/test/JD/RS/JDRSGetURL.java @@ -85,7 +85,7 @@ protected void setup() throws Exception { statement_ = connection_.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); statement_.executeUpdate("INSERT INTO " + JDRSTest.RSTEST_GET - + " (C_KEY) VALUES ('DUMMY_ROW')"); + + " (C_KEY) VALUES ('DUMMYROW_GURL')"); rs_ = statement_ .executeQuery("SELECT * FROM " + JDRSTest.RSTEST_GET + " FOR UPDATE"); } @@ -657,7 +657,7 @@ public void Var031() { if (checkDecFloatSupport()) { try { Statement s = connection_.createStatement(); - ResultSet rs = s.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_DFP16); + ResultSet rs = s.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_GETDFP16); rs.next(); URL v = rs.getURL(1); failed("Didn't throw SQLException " + v); @@ -675,7 +675,7 @@ public void Var032() { try { Statement s = connection_.createStatement(); ResultSet rs = s.executeQuery( - "SELECT * FROM " + JDRSTest.RSTEST_DFP34 + " where C1 is NOT NULL"); + "SELECT * FROM " + JDRSTest.RSTEST_GETDFP34 + " where C1 is NOT NULL"); rs.next(); URL v = rs.getURL(1); failed("Didn't throw SQLException call getURL on a DFP34 " + v); diff --git a/src/test/JD/RS/JDRSGetUnicodeStream.java b/src/test/JD/RS/JDRSGetUnicodeStream.java index 3e18a945..bd8bbe11 100644 --- a/src/test/JD/RS/JDRSGetUnicodeStream.java +++ b/src/test/JD/RS/JDRSGetUnicodeStream.java @@ -20,6 +20,7 @@ import test.JDTestDriver; import test.JDTestcase; import test.Testcase; +import test.JD.JDSerializeFile; import java.io.FileOutputStream; import java.io.InputStream; @@ -27,7 +28,7 @@ import java.sql.DataTruncation; import java.sql.ResultSet; - +import java.sql.SQLException; import java.sql.SQLWarning; import java.sql.Statement; import java.util.Hashtable; import java.util.Vector; @@ -105,7 +106,7 @@ protected void setup() throws Exception { statement_ = connection_.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); statement_.executeUpdate("INSERT INTO " + JDRSTest.RSTEST_GET - + " (C_KEY) VALUES ('DUMMY_ROW')"); + + " (C_KEY) VALUES ('DUMMYROW_GUNISTR')"); rs_ = statement_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_GET + " FOR UPDATE"); } @@ -388,10 +389,12 @@ public void Var012() { if (checkJdbc20()) { sb.setLength(0); + JDSerializeFile serializeFile = null; try { + serializeFile = new JDSerializeFile(connection_, JDRSTest.RSTEST_GET); JDRSTest.position(rs_, "UPDATE_SANDBOX"); rs_.updateString("C_CHAR_50", "New Planet"); - rs_.updateRow(); + rs_.updateRow(); /* serialized */ InputStream v = rs_.getUnicodeStream("C_CHAR_50"); if (getDriver() == JDTestDriver.DRIVER_NATIVE && // @K2 true) // @K2 @@ -405,9 +408,18 @@ public void Var012() { "UnicodeBigUnmarked",sb),sb); // @B0C } catch (Exception e) { failed(e, "Unexpected Exception"); + } finally { + if (serializeFile != null) { + try { + serializeFile.close(); + } catch (SQLException e) { + e.printStackTrace(); + } + } + } } } - } + /** * getUnicodeStream() - Should work when the current row is the insert row, @@ -481,7 +493,7 @@ public void Var015() { return; } try { - JDRSTest.position(rs_, "DUMMY_ROW"); + JDRSTest.position(rs_, "DUMMYROW_GUNISTR"); rs_.deleteRow(); InputStream v = rs_.getUnicodeStream("C_VARCHAR_50"); failed("Didn't throw SQLException" + v); @@ -1217,7 +1229,7 @@ public void Var045() { sb.setLength(0); try { Statement s = connection_.createStatement(); - ResultSet rs = s.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_DFP16); + ResultSet rs = s.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_GETDFP16); rs.next(); InputStream v = rs.getUnicodeStream(1); String expected = "1.1"; @@ -1240,7 +1252,7 @@ public void Var046() { sb.setLength(0); try { Statement s = connection_.createStatement(); - ResultSet rs = s.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_DFP34); + ResultSet rs = s.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_GETDFP34); rs.next(); InputStream v = rs.getUnicodeStream(1); String expected = "1.1"; diff --git a/src/test/JD/RS/JDRSRefreshRow.java b/src/test/JD/RS/JDRSRefreshRow.java index 412b0373..ce429437 100644 --- a/src/test/JD/RS/JDRSRefreshRow.java +++ b/src/test/JD/RS/JDRSRefreshRow.java @@ -28,6 +28,7 @@ import test.JDRSTest; import test.JDTestDriver; import test.JDTestcase; +import test.JD.JDSerializeFile; @@ -625,7 +626,11 @@ public void Var019() public void Var020() { if (checkJdbc20 ()) { - try { + JDSerializeFile serializeFile = null; + try { + serializeFile = new JDSerializeFile(connection_, JDRSTest.RSTEST_POS); + + statement3_.executeUpdate ("UPDATE " + JDRSTest.RSTEST_POS + " SET VALUE='lightning fast.' WHERE ID=61"); ResultSet rs = statement3_.executeQuery ("SELECT * FROM " @@ -633,12 +638,21 @@ public void Var020() rs.absolute (61); rs.updateString ("VALUE", "quite slow."); rs.refreshRow (); - rs.updateRow (); + rs.updateRow (); /* serialized */ String s = rs.getString ("VALUE"); rs.close (); assertCondition (s.equals ("lightning fast.")); } catch (Exception e) { failed (e, "Unexpected Exception"); + } finally { + if (serializeFile != null) { + try { + serializeFile.close(); + } catch (SQLException e) { + e.printStackTrace(); + } + } + } } } @@ -652,7 +666,11 @@ public void Var020() public void Var021() { if (checkJdbc20 ()) { - try { + JDSerializeFile serializeFile = null; + try { + serializeFile = new JDSerializeFile(connection_, JDRSTest.RSTEST_POS); + + statement3_.executeUpdate ("UPDATE " + JDRSTest.RSTEST_POS + " SET VALUE='Y2K compliant' WHERE ID=59"); ResultSet rs = statement3_.executeQuery ("SELECT * FROM " @@ -661,12 +679,21 @@ public void Var021() rs.updateString ("VALUE", "the year 2002."); rs.refreshRow (); rs.updateString ("VALUE", "again in 2005."); - rs.updateRow (); + rs.updateRow (); /* serialized */ String s = rs.getString ("VALUE"); rs.close (); assertCondition (s.equals ("again in 2005.")); } catch (Exception e) { failed (e, "Unexpected Exception"); + } finally { + if (serializeFile != null) { + try { + serializeFile.close(); + } catch (SQLException e) { + e.printStackTrace(); + } + } + } } } diff --git a/src/test/JD/RS/JDRSStress.java b/src/test/JD/RS/JDRSStress.java index f6d99230..dcb233b7 100644 --- a/src/test/JD/RS/JDRSStress.java +++ b/src/test/JD/RS/JDRSStress.java @@ -29,6 +29,7 @@ import test.JDTestDriver; import test.JDTestcase; import test.JobLogUtil; +import test.JD.JDSerializeFile; @@ -69,6 +70,7 @@ public static void main(String args[]) throws Exception { // 01/05/2016 // Dropped to 10 seconds in order to get though group test run protected int randomRunTime = 10; + String fileSuffix=""; /** Constructor. **/ @@ -656,7 +658,7 @@ public String runTest2(Connection connection, int columns, int rows, long testId long originalTestId = testId; JDRSSQLTypeInfo thisTestInfo[] = new JDRSSQLTypeInfo[columns]; String label = ""; - String tablename = JDRSTest.COLLECTION + ".JDRS" + columns + "x" + testId; + String tablename = JDRSTest.COLLECTION + ".JDRS" + columns + "x" + testId+fileSuffix; String tableDefinition = "("; for (int i = 0; i < columns; i++) { int typeId = (int) (testId % typeInfo.length); @@ -680,8 +682,11 @@ public String runTest2(Connection connection, int columns, int rows, long testId // // Create the table // - - initTable(statement, tablename, tableDefinition, sb); + JDSerializeFile serializeFile = null; + try { + serializeFile = new JDSerializeFile(connection, tablename); + + initTable(statement, tablename, tableDefinition, sb , false ); // // Insert values into the table @@ -914,8 +919,10 @@ public String runTest2(Connection connection, int columns, int rows, long testId rs.close(); if (usePreparedStatement) { - if (pStmt != null) + if (pStmt != null) { pStmt.close(); + pStmt = null; + } } try { @@ -941,11 +948,21 @@ public String runTest2(Connection connection, int columns, int rows, long testId } lastSql[0] = ""; statement.close(); + if (pStmt != null) pStmt.close(); if (failCount == 0) { return null; } else { return failMessage + "\n" + tableDefinition; } + } finally { + if (serializeFile != null) { + try { + serializeFile.close(); + } catch (Exception e) { + e.printStackTrace(); + } + } + } } /** diff --git a/src/test/JD/RS/JDRSStressDirectMap.java b/src/test/JD/RS/JDRSStressDirectMap.java index fc0fa924..b635f58d 100644 --- a/src/test/JD/RS/JDRSStressDirectMap.java +++ b/src/test/JD/RS/JDRSStressDirectMap.java @@ -53,6 +53,7 @@ public JDRSStressDirectMap (AS400 systemObject, password); connectionProperties = ";direct map=true;date format=iso;time format=jis"; directMap=true; + fileSuffix="A"; } } diff --git a/src/test/JD/RS/JDRSStressNoBlockPSDirectMap.java b/src/test/JD/RS/JDRSStressNoBlockPSDirectMap.java index 857e745e..2d832bc7 100644 --- a/src/test/JD/RS/JDRSStressNoBlockPSDirectMap.java +++ b/src/test/JD/RS/JDRSStressNoBlockPSDirectMap.java @@ -56,6 +56,7 @@ public JDRSStressNoBlockPSDirectMap (AS400 systemObject, usePreparedStatement=true; directMap=true; noBlocking=true; + fileSuffix="B"; } } diff --git a/src/test/JD/RS/JDRSStressPS.java b/src/test/JD/RS/JDRSStressPS.java index 0f37cda8..c0851c9b 100644 --- a/src/test/JD/RS/JDRSStressPS.java +++ b/src/test/JD/RS/JDRSStressPS.java @@ -55,6 +55,7 @@ public JDRSStressPS (AS400 systemObject, namesAndVars, runMode, fileOutputStream, password); usePreparedStatement=true; + fileSuffix="C"; } } diff --git a/src/test/JD/RS/JDRSStressPSBatch.java b/src/test/JD/RS/JDRSStressPSBatch.java index 25e96bf7..900c4f52 100644 --- a/src/test/JD/RS/JDRSStressPSBatch.java +++ b/src/test/JD/RS/JDRSStressPSBatch.java @@ -55,6 +55,7 @@ public JDRSStressPSBatch (AS400 systemObject, password); usePreparedStatement=true; useBatching = true; + fileSuffix="D"; } } diff --git a/src/test/JD/RS/JDRSStressPSDirectMap.java b/src/test/JD/RS/JDRSStressPSDirectMap.java index d32ec55e..bc7cee74 100644 --- a/src/test/JD/RS/JDRSStressPSDirectMap.java +++ b/src/test/JD/RS/JDRSStressPSDirectMap.java @@ -54,6 +54,7 @@ public JDRSStressPSDirectMap (AS400 systemObject, connectionProperties = ";direct map=true;date format=iso;time format=jis"; usePreparedStatement=true; directMap=true; + fileSuffix="E"; } } diff --git a/src/test/JD/RS/JDRSStressScroll.java b/src/test/JD/RS/JDRSStressScroll.java index 1e313aa8..9971d502 100644 --- a/src/test/JD/RS/JDRSStressScroll.java +++ b/src/test/JD/RS/JDRSStressScroll.java @@ -55,6 +55,7 @@ public JDRSStressScroll (AS400 systemObject, namesAndVars, runMode, fileOutputStream, password); useScrollableCursor=true; + fileSuffix="F"; } } diff --git a/src/test/JD/RS/JDRSStressScrollDirectMap.java b/src/test/JD/RS/JDRSStressScrollDirectMap.java index 112f364f..fa1898fd 100644 --- a/src/test/JD/RS/JDRSStressScrollDirectMap.java +++ b/src/test/JD/RS/JDRSStressScrollDirectMap.java @@ -59,6 +59,7 @@ public JDRSStressScrollDirectMap (AS400 systemObject, // Only run tests for shorter time since direct map doesn't really // take effect for scrollable cursors randomRunTime=5; + fileSuffix="G"; } } diff --git a/src/test/JD/RS/JDRSStressScrollPS.java b/src/test/JD/RS/JDRSStressScrollPS.java index 0c7fe041..e2e3f3d7 100644 --- a/src/test/JD/RS/JDRSStressScrollPS.java +++ b/src/test/JD/RS/JDRSStressScrollPS.java @@ -11,52 +11,43 @@ // /////////////////////////////////////////////////////////////////////////////// - package test.JD.RS; import com.ibm.as400.access.AS400; import java.io.FileOutputStream; -import java.util.Hashtable; import java.util.Vector; - - +import java.util.Hashtable; +import java.util.Vector; /** -Testcase JDRSStress. This tests various combinations of datatypes in a -table. There is one generic testcase that is run. Specific testcases -are created for error condition that needed to be fixed. Otherwise, -the test will run for a specific amount of time to try to detect errors. -**/ -public class JDRSStressScrollPS -extends JDRSStress -{ + * Testcase JDRSStress. This tests various combinations of datatypes in a table. + * There is one generic testcase that is run. Specific testcases are created for + * error condition that needed to be fixed. Otherwise, the test will run for a + * specific amount of time to try to detect errors. + **/ +public class JDRSStressScrollPS extends JDRSStress { public static void main(String args[]) throws Exception { - String[] newArgs = new String[args.length+2]; - newArgs[0] = "-tc"; - newArgs[1] = "JDRSStressScrollPS"; - for (int i = 0; i < args.length; i++) { - newArgs[2+i]=args[i]; - } - test.JDRSStressTest.main(newArgs); - } - -/** -Constructor. -**/ - public JDRSStressScrollPS (AS400 systemObject, - Hashtable> namesAndVars, - int runMode, - FileOutputStream fileOutputStream, - - String password) - { - super (systemObject, "JDRSStressScrollPS", - namesAndVars, runMode, fileOutputStream, - password); - usePreparedStatement=true; - useScrollableCursor=true; + String[] newArgs = new String[args.length + 2]; + newArgs[0] = "-tc"; + newArgs[1] = "JDRSStressScrollPS"; + for (int i = 0; i < args.length; i++) { + newArgs[2 + i] = args[i]; } + test.JDRSStressTest.main(newArgs); + } + + /** + * Constructor. + **/ + public JDRSStressScrollPS(AS400 systemObject, Hashtable> namesAndVars, int runMode, + FileOutputStream fileOutputStream, + + String password) { + super(systemObject, "JDRSStressScrollPS", namesAndVars, runMode, fileOutputStream, password); + usePreparedStatement = true; + useScrollableCursor = true; + fileSuffix = "H"; + } } - diff --git a/src/test/JD/RS/JDRSStressScrollPSDirectMap.java b/src/test/JD/RS/JDRSStressScrollPSDirectMap.java index c6f7b98f..74cfb3be 100644 --- a/src/test/JD/RS/JDRSStressScrollPSDirectMap.java +++ b/src/test/JD/RS/JDRSStressScrollPSDirectMap.java @@ -60,7 +60,7 @@ public JDRSStressScrollPSDirectMap (AS400 systemObject, // Only run tests for shorter time since direct map doesn't really // take effect for scrollable cursors randomRunTime=5; - + fileSuffix="I"; } } diff --git a/src/test/JD/RS/JDRSStressUpdatePS.java b/src/test/JD/RS/JDRSStressUpdatePS.java index 327c17b6..81a812e9 100644 --- a/src/test/JD/RS/JDRSStressUpdatePS.java +++ b/src/test/JD/RS/JDRSStressUpdatePS.java @@ -52,7 +52,8 @@ public JDRSStressUpdatePS (AS400 systemObject, namesAndVars, runMode, fileOutputStream, password); usePreparedStatement=true; - forUpdate=true; + forUpdate=true; + fileSuffix="J"; } } diff --git a/src/test/JD/RS/JDRSStressUpdatePSDirectMap.java b/src/test/JD/RS/JDRSStressUpdatePSDirectMap.java index a5da9aa5..c03b7f27 100644 --- a/src/test/JD/RS/JDRSStressUpdatePSDirectMap.java +++ b/src/test/JD/RS/JDRSStressUpdatePSDirectMap.java @@ -58,6 +58,7 @@ public JDRSStressUpdatePSDirectMap (AS400 systemObject, // Only run tests for shorter time since direct map doesn't really // take effect for updatable randomRunTime=5; + fileSuffix="K"; } diff --git a/src/test/JD/RS/JDRSUpdateAsciiStream.java b/src/test/JD/RS/JDRSUpdateAsciiStream.java index 57480981..cce4fe86 100644 --- a/src/test/JD/RS/JDRSUpdateAsciiStream.java +++ b/src/test/JD/RS/JDRSUpdateAsciiStream.java @@ -35,6 +35,7 @@ import test.JDRSTest; import test.JDTestDriver; import test.JDTestcase; +import test.JD.JDSerializeFile; import test.JD.JDWeirdInputStream; @@ -70,6 +71,7 @@ public static void main(String args[]) throws Exception { private Statement statement_; private Statement statement2_; private ResultSet rs_; + private JDSerializeFile serializeUpdateFile_; @@ -111,11 +113,13 @@ protected void setup () connection_.setAutoCommit(false); // @C1A statement_ = connection_.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); + statement2_ = connection_.createStatement (ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); - + serializeUpdateFile_ = new JDSerializeFile(statement_, JDRSTest.RSTEST_UPDATE); + connection_.commit(); statement_.executeUpdate ("INSERT INTO " + JDRSTest.RSTEST_UPDATE - + " (C_KEY) VALUES ('DUMMY_ROW')"); + + " (C_KEY) VALUES ('DUMMY_UPDAS')"); statement_.executeUpdate ("INSERT INTO " + JDRSTest.RSTEST_UPDATE + " (C_KEY) VALUES ('" + key_ + "')"); @@ -136,6 +140,7 @@ protected void cleanup () if(isJdbc20 ()) { rs_.close (); + serializeUpdateFile_.close(); statement_.close (); connection_.commit(); // @C1A connection_.close (); @@ -221,7 +226,7 @@ public void Var003() { JDRSTest.position (rs_, null); rs_.updateAsciiStream ("C_VARCHAR_50", stringToAsciiStream ("Buenos Aires"), 12); - rs_.updateRow(); + rs_.updateRow(); /* exception */ failed ("Didn't throw SQLException when cursor not pointing to a row"); } catch(Exception e) @@ -622,10 +627,10 @@ public void Var019() { try { - JDRSTest.position (rs_, "DUMMY_ROW"); + JDRSTest.position (rs_, "DUMMY_UPDAS"); rs_.deleteRow (); rs_.updateAsciiStream ("C_VARCHAR_50", stringToAsciiStream ("Venice"), 6); - rs_.updateRow(); + rs_.updateRow(); /* exception */ failed ("Didn't throw SQLException"); } catch(Exception e) @@ -2307,10 +2312,14 @@ public void Var072 () Statement s = connection_.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP16+" FOR UPDATE "); + + JDRSTest.RSTEST_UPDDFP16+" FOR UPDATE "); rs.next(); - rs.updateAsciiStream(1, stringToAsciiStream ("Hannover"), 8 ); - rs.updateRow(); + InputStream stream = stringToAsciiStream ("Hannover"); + rs.updateAsciiStream(1, stream, 8 ); + rs.updateRow(); /* exception */ + stream.close(); + rs.close(); + s.close(); failed ("Didn't throw SQLException "); } catch (Exception e) { @@ -2339,10 +2348,10 @@ public void Var073 () Statement s = connection_.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP34+" FOR UPDATE "); + + JDRSTest.RSTEST_UPDDFP34+" FOR UPDATE "); rs.next(); rs.updateAsciiStream(1, stringToAsciiStream ("Hannover"), 8 ); - rs.updateRow(); + rs.updateRow(); /* exception */ failed ("Didn't throw SQLException for 'Hannover' "); } catch (Exception e) { diff --git a/src/test/JD/RS/JDRSUpdateBigDecimal.java b/src/test/JD/RS/JDRSUpdateBigDecimal.java index e1ab4944..e58e2d54 100644 --- a/src/test/JD/RS/JDRSUpdateBigDecimal.java +++ b/src/test/JD/RS/JDRSUpdateBigDecimal.java @@ -32,6 +32,7 @@ import test.JDTestDriver; import test.JDTestcase; import test.JVMInfo; +import test.JD.JDSerializeFile; @@ -74,6 +75,7 @@ public static void main(String args[]) throws Exception { private Statement statementCommaSeparator2_; private Statement statementCommaSeparator2f_; private ResultSet rsCommaSeparator_ = null ; + private JDSerializeFile serializeUpdateFile_; private boolean tableUpdated = false; int jdk_ = 0; @@ -117,7 +119,8 @@ protected void setup () + ";data truncation=true"; connection_ = testDriver_.getConnection (url,systemObject_.getUserId(), encryptedPassword_); connection_.setAutoCommit(false); // @C1A - + serializeUpdateFile_ = new JDSerializeFile(connection_, JDRSTest.RSTEST_UPDATE); + connection_.commit(); @@ -159,9 +162,9 @@ protected void setupRs() { if (! tableUpdated) { statement_.executeUpdate ("INSERT INTO " + JDRSTest.RSTEST_UPDATE - + " (C_KEY) VALUES ('DUMMY_ROW')"); + + " (C_KEY) VALUES ('DUMMY_UPDBD')"); statement_.executeUpdate ("INSERT INTO " + JDRSTest.RSTEST_UPDATE - + " (C_KEY) VALUES ('DUMMY_ROW1')"); + + " (C_KEY) VALUES ('DUMMY_UPDBD1')"); statement_.executeUpdate ("INSERT INTO " + JDRSTest.RSTEST_UPDATE + " (C_KEY) VALUES ('" + key_ + "')"); tableUpdated = true; @@ -208,9 +211,9 @@ protected void setupRsCommaSeparator() { if (!tableUpdated) { statementCommaSeparator_.executeUpdate ("INSERT INTO " + JDRSTest.RSTEST_UPDATE - + " (C_KEY) VALUES ('DUMMY_ROW')"); + + " (C_KEY) VALUES ('DUMMY_UPDBD')"); statementCommaSeparator_.executeUpdate ("INSERT INTO " + JDRSTest.RSTEST_UPDATE - + " (C_KEY) VALUES ('DUMMY_ROW1')"); + + " (C_KEY) VALUES ('DUMMY_UPDBD1')"); statementCommaSeparator_.executeUpdate ("INSERT INTO " + JDRSTest.RSTEST_UPDATE + " (C_KEY) VALUES ('" + key_ + "')"); tableUpdated = true; @@ -243,6 +246,7 @@ protected void cleanup () statement2f_.close (); } connection_.commit(); // @C1A + serializeUpdateFile_.close(); connection_.close (); if (rsCommaSeparator_ != null) { rsCommaSeparator_.close (); @@ -683,7 +687,7 @@ public void Var018() setupRs(); if (checkJdbc20 ()) { try { - JDRSTest.position (rs_, "DUMMY_ROW"); + JDRSTest.position (rs_, "DUMMY_UPDBD"); rs_.deleteRow (); rs_.updateBigDecimal ("C_DECIMAL_105", new BigDecimal ("-544.3")); failed ("Didn't throw SQLException"); @@ -1691,7 +1695,7 @@ public void Var055() if (checkJdbc20 ()) { if (checkBigintSupport()) { try { - String tableName = JDRSTest.COLLECTION +".JDPSBD055"; + String tableName = JDRSTest.COLLECTION +".JDRSBD055"; initTable(statement_, tableName," (c1 DECIMAL(12,10))"); statement_.executeUpdate("INSERT INTO "+tableName+" values(0.00000016)"); @@ -1701,7 +1705,7 @@ public void Var055() ResultSet rs = ps.executeQuery(); rs.next(); rs.updateBigDecimal (1, new BigDecimal ("0.00000017")); - rs.updateRow(); + rs.updateRow(); /* unique table */ rs.close(); rs = ps.executeQuery(); @@ -1749,7 +1753,7 @@ public void Var056() if (checkBigintSupport()) { try { - String tableName = JDRSTest.COLLECTION +".JDPSBD056"; + String tableName = JDRSTest.COLLECTION +".JDRSBD056"; initTable(statement_, tableName," (c1 DECIMAL(14,2))"); statement_.executeUpdate("INSERT INTO "+tableName+" values(1600000000)"); @@ -1762,7 +1766,7 @@ public void Var056() bd = new BigDecimal (new BigInteger("17"),-8 ); rs.updateBigDecimal (1, bd); - rs.updateRow(); + rs.updateRow(); /* unique table */ rs.close(); rs = ps.executeQuery(); @@ -1802,7 +1806,7 @@ public void Var057() if (checkBigintSupport()) { try { - String tableName = JDRSTest.COLLECTION +".JDPSBD057"; + String tableName = JDRSTest.COLLECTION +".JDRSBD057"; initTable(statement_, tableName," (c1 NUMERIC(12,10))"); statement_.executeUpdate("INSERT INTO "+tableName+" values(0.00000016)"); @@ -1811,8 +1815,8 @@ public void Var057() ResultSet rs = ps.executeQuery(); rs.next(); rs.updateBigDecimal (1, new BigDecimal ("0.00000017")); - rs.updateRow(); - rs.close(); + rs.updateRow(); /* unique table */ + rs.close(); rs = ps.executeQuery(); rs.next(); @@ -1859,7 +1863,7 @@ public void Var058() if (checkBigintSupport()) { try { - String tableName = JDRSTest.COLLECTION +".JDPSBD058"; + String tableName = JDRSTest.COLLECTION +".JDRSBD058"; initTable(statement_, tableName, " (c1 NUMERIC(14,2))"); statement_.executeUpdate("INSERT INTO "+tableName+" values(1600000000)"); @@ -1870,7 +1874,7 @@ public void Var058() BigDecimal bd; bd = new BigDecimal (new BigInteger("17"),-8 ); rs.updateBigDecimal (1, bd); - rs.updateRow(); + rs.updateRow(); /* unique table */ rs.close(); @@ -1894,7 +1898,11 @@ public void Var058() public void dfpTest(String table, String value, String expected) { setupRs(); if (checkDecFloatSupport()) { + try { + + + Statement s = connection_.createStatement( ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); ResultSet rs = s @@ -1907,7 +1915,7 @@ public void dfpTest(String table, String value, String expected) { bd = null; } rs.updateBigDecimal(1, bd); - rs.updateRow(); + rs.updateRow(); /* serialized */ ResultSet rs2 = statement2f_.executeQuery("SELECT * FROM " + table); rs2.next(); @@ -1921,6 +1929,11 @@ public void dfpTest(String table, String value, String expected) { "Got " + v + " from "+ value +" sb " + expected); } catch (Exception e) { failed(e, "Unexpected Exception"); + } finally { + + + + } } } @@ -1929,153 +1942,153 @@ public void dfpTest(String table, String value, String expected) { /** * updateBigDecimal -- set DFP16 to different values and retrieve */ - public void Var059 () { dfpTest(JDRSTest.RSTEST_DFP16, "4533.43", "4533.43"); } - public void Var060 () { dfpTest(JDRSTest.RSTEST_DFP16, "1234567890123456", "1234567890123456");} - public void Var061 () { dfpTest(JDRSTest.RSTEST_DFP16, "-1234567890123456", "-1234567890123456");} - public void Var062 () { dfpTest(JDRSTest.RSTEST_DFP16, "+1234567890123456","1234567890123456");} + public void Var059 () { dfpTest(JDRSTest.RSTEST_UPDDFP16, "4533.43", "4533.43"); } + public void Var060 () { dfpTest(JDRSTest.RSTEST_UPDDFP16, "1234567890123456", "1234567890123456");} + public void Var061 () { dfpTest(JDRSTest.RSTEST_UPDDFP16, "-1234567890123456", "-1234567890123456");} + public void Var062 () { dfpTest(JDRSTest.RSTEST_UPDDFP16, "+1234567890123456","1234567890123456");} public void Var063 () { - dfpTest(JDRSTest.RSTEST_DFP16, "+1234567890123456E28","1.234567890123456E+43"); + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+1234567890123456E28","1.234567890123456E+43"); } public void Var064 () { - dfpTest(JDRSTest.RSTEST_DFP16, "+1234567890123456E+28","1.234567890123456E+43"); + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+1234567890123456E+28","1.234567890123456E+43"); } public void Var065 () { - dfpTest(JDRSTest.RSTEST_DFP16, "+123456789012345.6E+29","1.234567890123456E+43"); + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+123456789012345.6E+29","1.234567890123456E+43"); } public void Var066 () { - dfpTest(JDRSTest.RSTEST_DFP16, "+12345678901234.56E+30","1.234567890123456E+43"); + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+12345678901234.56E+30","1.234567890123456E+43"); } public void Var067 () { - dfpTest(JDRSTest.RSTEST_DFP16, "+1234567890123.456E+31","1.234567890123456E+43"); + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+1234567890123.456E+31","1.234567890123456E+43"); } public void Var068 () { - dfpTest(JDRSTest.RSTEST_DFP16, "+123456789012.3456E+32","1.234567890123456E+43"); + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+123456789012.3456E+32","1.234567890123456E+43"); } public void Var069 () { - dfpTest(JDRSTest.RSTEST_DFP16, "+12345678901.23456E+33","1.234567890123456E+43"); + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+12345678901.23456E+33","1.234567890123456E+43"); } public void Var070 () { - dfpTest(JDRSTest.RSTEST_DFP16, "+1234567890.123456E+34","1.234567890123456E+43"); + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+1234567890.123456E+34","1.234567890123456E+43"); } public void Var071 () { - dfpTest(JDRSTest.RSTEST_DFP16, "+123456789.0123456E+35","1.234567890123456E+43"); + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+123456789.0123456E+35","1.234567890123456E+43"); } public void Var072 () { - dfpTest(JDRSTest.RSTEST_DFP16, "+12345678.90123456E+36","1.234567890123456E+43"); + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+12345678.90123456E+36","1.234567890123456E+43"); } public void Var073 () { - dfpTest(JDRSTest.RSTEST_DFP16, "+1234567.890123456E+37","1.234567890123456E+43"); + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+1234567.890123456E+37","1.234567890123456E+43"); } public void Var074 () { - dfpTest(JDRSTest.RSTEST_DFP16, "+123456.7890123456E+38","1.234567890123456E+43"); + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+123456.7890123456E+38","1.234567890123456E+43"); } public void Var075 () { - dfpTest(JDRSTest.RSTEST_DFP16, "+12345.67890123456E+39","1.234567890123456E+43"); + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+12345.67890123456E+39","1.234567890123456E+43"); } public void Var076 () { - dfpTest(JDRSTest.RSTEST_DFP16, "+1234.567890123456E+40","1.234567890123456E+43"); + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+1234.567890123456E+40","1.234567890123456E+43"); } public void Var077 () { - dfpTest(JDRSTest.RSTEST_DFP16, "+123.4567890123456E+41","1.234567890123456E+43"); + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+123.4567890123456E+41","1.234567890123456E+43"); } public void Var078 () { - dfpTest(JDRSTest.RSTEST_DFP16, "+12.34567890123456E+42","1.234567890123456E+43"); + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+12.34567890123456E+42","1.234567890123456E+43"); } public void Var079 () { - dfpTest(JDRSTest.RSTEST_DFP16, "+1.234567890123456E+43","1.234567890123456E+43"); + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+1.234567890123456E+43","1.234567890123456E+43"); } public void Var080 () { - dfpTest(JDRSTest.RSTEST_DFP16, "+.1234567890123456E+44","1.234567890123456E+43"); + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+.1234567890123456E+44","1.234567890123456E+43"); } public void Var081 () { - dfpTest(JDRSTest.RSTEST_DFP16, "+0.1234567890123456E+44","1.234567890123456E+43"); + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+0.1234567890123456E+44","1.234567890123456E+43"); } public void Var082 () { - dfpTest(JDRSTest.RSTEST_DFP16, "+0.01234567890123456E+45","1.234567890123456E+43"); + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+0.01234567890123456E+45","1.234567890123456E+43"); } public void Var083 () { - dfpTest(JDRSTest.RSTEST_DFP16, "-1234567890123456E28","-1.234567890123456E+43"); + dfpTest(JDRSTest.RSTEST_UPDDFP16, "-1234567890123456E28","-1.234567890123456E+43"); } - public void Var084 () { dfpTest(JDRSTest.RSTEST_DFP16, "1E0", "1");} - public void Var085 () { dfpTest(JDRSTest.RSTEST_DFP16, "1.1", "1.1");} - public void Var086 () { dfpTest(JDRSTest.RSTEST_DFP16, "1.1E0", "1.1");} - public void Var087 () { dfpTest(JDRSTest.RSTEST_DFP16, null, null);} + public void Var084 () { dfpTest(JDRSTest.RSTEST_UPDDFP16, "1E0", "1");} + public void Var085 () { dfpTest(JDRSTest.RSTEST_UPDDFP16, "1.1", "1.1");} + public void Var086 () { dfpTest(JDRSTest.RSTEST_UPDDFP16, "1.1E0", "1.1");} + public void Var087 () { dfpTest(JDRSTest.RSTEST_UPDDFP16, null, null);} /** * updateBigDecimal - set DFP34 to different values and retrieve */ - public void Var088 () { dfpTest(JDRSTest.RSTEST_DFP34, "4533.43", "4533.43"); } - public void Var089 () { dfpTest(JDRSTest.RSTEST_DFP34, "1234567890123456", "1234567890123456");} - public void Var090 () { dfpTest(JDRSTest.RSTEST_DFP34, "-1234567890123456", "-1234567890123456");} - public void Var091 () { dfpTest(JDRSTest.RSTEST_DFP34, "+1234567890123456","1234567890123456");} + public void Var088 () { dfpTest(JDRSTest.RSTEST_UPDDFP34, "4533.43", "4533.43"); } + public void Var089 () { dfpTest(JDRSTest.RSTEST_UPDDFP34, "1234567890123456", "1234567890123456");} + public void Var090 () { dfpTest(JDRSTest.RSTEST_UPDDFP34, "-1234567890123456", "-1234567890123456");} + public void Var091 () { dfpTest(JDRSTest.RSTEST_UPDDFP34, "+1234567890123456","1234567890123456");} public void Var092 () { - dfpTest(JDRSTest.RSTEST_DFP34, "+1234567890123456E28","1.234567890123456E+43"); + dfpTest(JDRSTest.RSTEST_UPDDFP34, "+1234567890123456E28","1.234567890123456E+43"); } public void Var093 () { - dfpTest(JDRSTest.RSTEST_DFP34, "+1234567890123456E+28","1.234567890123456E+43"); + dfpTest(JDRSTest.RSTEST_UPDDFP34, "+1234567890123456E+28","1.234567890123456E+43"); } public void Var094 () { - dfpTest(JDRSTest.RSTEST_DFP34, "+123456789012345.6E+29","1.234567890123456E+43"); + dfpTest(JDRSTest.RSTEST_UPDDFP34, "+123456789012345.6E+29","1.234567890123456E+43"); } public void Var095 () { - dfpTest(JDRSTest.RSTEST_DFP34, "+12345678901234.56E+30","1.234567890123456E+43"); + dfpTest(JDRSTest.RSTEST_UPDDFP34, "+12345678901234.56E+30","1.234567890123456E+43"); } public void Var096 () { - dfpTest(JDRSTest.RSTEST_DFP34, "+1234567890123.456E+31","1.234567890123456E+43"); + dfpTest(JDRSTest.RSTEST_UPDDFP34, "+1234567890123.456E+31","1.234567890123456E+43"); } public void Var097 () { - dfpTest(JDRSTest.RSTEST_DFP34, "+123456789012.3456E+32","1.234567890123456E+43"); + dfpTest(JDRSTest.RSTEST_UPDDFP34, "+123456789012.3456E+32","1.234567890123456E+43"); } public void Var098 () { - dfpTest(JDRSTest.RSTEST_DFP34, "+12345678901.23456E+33","1.234567890123456E+43"); + dfpTest(JDRSTest.RSTEST_UPDDFP34, "+12345678901.23456E+33","1.234567890123456E+43"); } public void Var099 () { - dfpTest(JDRSTest.RSTEST_DFP34, "+1234567890.123456E+34","1.234567890123456E+43"); + dfpTest(JDRSTest.RSTEST_UPDDFP34, "+1234567890.123456E+34","1.234567890123456E+43"); } public void Var100 () { - dfpTest(JDRSTest.RSTEST_DFP34, "+123456789.0123456E+35","1.234567890123456E+43"); + dfpTest(JDRSTest.RSTEST_UPDDFP34, "+123456789.0123456E+35","1.234567890123456E+43"); } public void Var101 () { - dfpTest(JDRSTest.RSTEST_DFP34, "+12345678.90123456E+36","1.234567890123456E+43"); + dfpTest(JDRSTest.RSTEST_UPDDFP34, "+12345678.90123456E+36","1.234567890123456E+43"); } public void Var102 () { - dfpTest(JDRSTest.RSTEST_DFP34, "+1234567.890123456E+37","1.234567890123456E+43"); + dfpTest(JDRSTest.RSTEST_UPDDFP34, "+1234567.890123456E+37","1.234567890123456E+43"); } public void Var103 () { - dfpTest(JDRSTest.RSTEST_DFP34, "+123456.7890123456E+38","1.234567890123456E+43"); + dfpTest(JDRSTest.RSTEST_UPDDFP34, "+123456.7890123456E+38","1.234567890123456E+43"); } public void Var104 () { - dfpTest(JDRSTest.RSTEST_DFP34, "+12345.67890123456E+39","1.234567890123456E+43"); + dfpTest(JDRSTest.RSTEST_UPDDFP34, "+12345.67890123456E+39","1.234567890123456E+43"); } public void Var105 () { - dfpTest(JDRSTest.RSTEST_DFP34, "+1234.567890123456E+40","1.234567890123456E+43"); + dfpTest(JDRSTest.RSTEST_UPDDFP34, "+1234.567890123456E+40","1.234567890123456E+43"); } public void Var106 () { - dfpTest(JDRSTest.RSTEST_DFP34, "+123.4567890123456E+41","1.234567890123456E+43"); + dfpTest(JDRSTest.RSTEST_UPDDFP34, "+123.4567890123456E+41","1.234567890123456E+43"); } public void Var107 () { - dfpTest(JDRSTest.RSTEST_DFP34, "+12.34567890123456E+42","1.234567890123456E+43"); + dfpTest(JDRSTest.RSTEST_UPDDFP34, "+12.34567890123456E+42","1.234567890123456E+43"); } public void Var108 () { - dfpTest(JDRSTest.RSTEST_DFP34, "+1.234567890123456E+43","1.234567890123456E+43"); + dfpTest(JDRSTest.RSTEST_UPDDFP34, "+1.234567890123456E+43","1.234567890123456E+43"); } public void Var109 () { - dfpTest(JDRSTest.RSTEST_DFP34, "+.1234567890123456E+44","1.234567890123456E+43"); + dfpTest(JDRSTest.RSTEST_UPDDFP34, "+.1234567890123456E+44","1.234567890123456E+43"); } public void Var110 () { - dfpTest(JDRSTest.RSTEST_DFP34, "+0.1234567890123456E+44","1.234567890123456E+43"); + dfpTest(JDRSTest.RSTEST_UPDDFP34, "+0.1234567890123456E+44","1.234567890123456E+43"); } public void Var111 () { - dfpTest(JDRSTest.RSTEST_DFP34, "+0.01234567890123456E+45","1.234567890123456E+43"); + dfpTest(JDRSTest.RSTEST_UPDDFP34, "+0.01234567890123456E+45","1.234567890123456E+43"); } public void Var112 () { - dfpTest(JDRSTest.RSTEST_DFP34, "-1234567890123456E28","-1.234567890123456E+43"); + dfpTest(JDRSTest.RSTEST_UPDDFP34, "-1234567890123456E28","-1.234567890123456E+43"); } - public void Var113 () { dfpTest(JDRSTest.RSTEST_DFP34, "1E0", "1");} - public void Var114 () { dfpTest(JDRSTest.RSTEST_DFP34, "1.1", "1.1");} - public void Var115 () { dfpTest(JDRSTest.RSTEST_DFP34, "1.1E0", "1.1");} - public void Var116 () { dfpTest(JDRSTest.RSTEST_DFP34, null, null);} + public void Var113 () { dfpTest(JDRSTest.RSTEST_UPDDFP34, "1E0", "1");} + public void Var114 () { dfpTest(JDRSTest.RSTEST_UPDDFP34, "1.1", "1.1");} + public void Var115 () { dfpTest(JDRSTest.RSTEST_UPDDFP34, "1.1E0", "1.1");} + public void Var116 () { dfpTest(JDRSTest.RSTEST_UPDDFP34, null, null);} @@ -2813,7 +2826,7 @@ public void Var143() if (checkJdbc20 ()) { if (checkBigintSupport()) { try { - String tableName = JDRSTest.COLLECTION +".JDPSBD143"; + String tableName = JDRSTest.COLLECTION +".JDRSBD143"; initTable(statementCommaSeparator_, tableName, " (c1 DECIMAL(12 , 10))"); statementCommaSeparator_.executeUpdate("INSERT INTO "+tableName+" values(0.00000016)"); @@ -2823,7 +2836,7 @@ public void Var143() ResultSet rs = ps.executeQuery(); rs.next(); rs.updateBigDecimal (1, new BigDecimal ("0.00000017")); - rs.updateRow(); + rs.updateRow(); /* unique file */ rs.close(); rs = ps.executeQuery(); @@ -2871,7 +2884,7 @@ public void Var144() if (checkBigintSupport()) { try { - String tableName = JDRSTest.COLLECTION +".JDPSBD144"; + String tableName = JDRSTest.COLLECTION +".JDRSBD144"; initTable(statementCommaSeparator_,tableName," (c1 DECIMAL(14 , 2))"); statementCommaSeparator_.executeUpdate("INSERT INTO "+tableName+" values(1600000000)"); @@ -2884,7 +2897,7 @@ public void Var144() bd = new BigDecimal (new BigInteger("17"),-8 ); rs.updateBigDecimal (1, bd); - rs.updateRow(); + rs.updateRow(); /* unique file */ rs.close(); rs = ps.executeQuery(); @@ -2923,7 +2936,7 @@ public void Var145() if (checkBigintSupport()) { try { - String tableName = JDRSTest.COLLECTION +".JDPSBD145"; + String tableName = JDRSTest.COLLECTION +".JDRSBD145"; initTable(statementCommaSeparator_,tableName," (c1 NUMERIC(12 , 10))"); statementCommaSeparator_.executeUpdate("INSERT INTO "+tableName+" values(0.00000016)"); @@ -2932,7 +2945,7 @@ public void Var145() ResultSet rs = ps.executeQuery(); rs.next(); rs.updateBigDecimal (1, new BigDecimal ("0.00000017")); - rs.updateRow(); + rs.updateRow(); /* unique file */ rs.close(); rs = ps.executeQuery(); @@ -2980,7 +2993,7 @@ public void Var146() if (checkBigintSupport()) { try { - String tableName = JDRSTest.COLLECTION +".JDPSBD146"; + String tableName = JDRSTest.COLLECTION +".JDRSBD146"; initTable(statementCommaSeparator_,tableName," (c1 NUMERIC(14 , 2))"); statementCommaSeparator_.executeUpdate("INSERT INTO "+tableName+" values(1600000000)"); @@ -2991,7 +3004,7 @@ public void Var146() BigDecimal bd; bd = new BigDecimal (new BigInteger("17"),-8 ); rs.updateBigDecimal (1, bd); - rs.updateRow(); + rs.updateRow(); /* unique file */ rs.close(); @@ -3017,7 +3030,10 @@ public void dfpTestCommaSeparator(String table, String value, String expected) { if (checkDecFloatSupport()) { setupRsCommaSeparator(); - try { + + try { + + Statement s = connectionCommaSeparator_.createStatement( ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); ResultSet rs = s @@ -3030,12 +3046,12 @@ public void dfpTestCommaSeparator(String table, String value, String expected) { bd = null; } rs.updateBigDecimal(1, bd); - rs.updateRow(); - + rs.updateRow(); /* serialized */ ResultSet rs2 = statementCommaSeparator2f_.executeQuery("SELECT * FROM " + table); rs2.next(); String v = rs2.getString(1); rs2.close(); + rs.close(); s.close(); try { connectionCommaSeparator_.commit(); @@ -3052,153 +3068,153 @@ public void dfpTestCommaSeparator(String table, String value, String expected) { /** * updateBigDecimal -- set DFP16 to different values and retrieve */ - public void Var147 () { dfpTestCommaSeparator(JDRSTest.RSTEST_DFP16, "4533.43", "4533,43"); } - public void Var148 () { dfpTestCommaSeparator(JDRSTest.RSTEST_DFP16, "1234567890123456", "1234567890123456");} - public void Var149 () { dfpTestCommaSeparator(JDRSTest.RSTEST_DFP16, "-1234567890123456", "-1234567890123456");} - public void Var150 () { dfpTestCommaSeparator(JDRSTest.RSTEST_DFP16, "+1234567890123456","1234567890123456");} + public void Var147 () { dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP16, "4533.43", "4533,43"); } + public void Var148 () { dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP16, "1234567890123456", "1234567890123456");} + public void Var149 () { dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP16, "-1234567890123456", "-1234567890123456");} + public void Var150 () { dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP16, "+1234567890123456","1234567890123456");} public void Var151 () { - dfpTestCommaSeparator(JDRSTest.RSTEST_DFP16, "+1234567890123456E28","1,234567890123456E+43"); + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP16, "+1234567890123456E28","1,234567890123456E+43"); } public void Var152 () { - dfpTestCommaSeparator(JDRSTest.RSTEST_DFP16, "+1234567890123456E+28","1,234567890123456E+43"); + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP16, "+1234567890123456E+28","1,234567890123456E+43"); } public void Var153 () { - dfpTestCommaSeparator(JDRSTest.RSTEST_DFP16, "+123456789012345.6E+29","1,234567890123456E+43"); + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP16, "+123456789012345.6E+29","1,234567890123456E+43"); } public void Var154 () { - dfpTestCommaSeparator(JDRSTest.RSTEST_DFP16, "+12345678901234.56E+30","1,234567890123456E+43"); + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP16, "+12345678901234.56E+30","1,234567890123456E+43"); } public void Var155 () { - dfpTestCommaSeparator(JDRSTest.RSTEST_DFP16, "+1234567890123.456E+31","1,234567890123456E+43"); + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP16, "+1234567890123.456E+31","1,234567890123456E+43"); } public void Var156 () { - dfpTestCommaSeparator(JDRSTest.RSTEST_DFP16, "+123456789012.3456E+32","1,234567890123456E+43"); + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP16, "+123456789012.3456E+32","1,234567890123456E+43"); } public void Var157 () { - dfpTestCommaSeparator(JDRSTest.RSTEST_DFP16, "+12345678901.23456E+33","1,234567890123456E+43"); + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP16, "+12345678901.23456E+33","1,234567890123456E+43"); } public void Var158 () { - dfpTestCommaSeparator(JDRSTest.RSTEST_DFP16, "+1234567890.123456E+34","1,234567890123456E+43"); + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP16, "+1234567890.123456E+34","1,234567890123456E+43"); } public void Var159 () { - dfpTestCommaSeparator(JDRSTest.RSTEST_DFP16, "+123456789.0123456E+35","1,234567890123456E+43"); + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP16, "+123456789.0123456E+35","1,234567890123456E+43"); } public void Var160 () { - dfpTestCommaSeparator(JDRSTest.RSTEST_DFP16, "+12345678.90123456E+36","1,234567890123456E+43"); + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP16, "+12345678.90123456E+36","1,234567890123456E+43"); } public void Var161 () { - dfpTestCommaSeparator(JDRSTest.RSTEST_DFP16, "+1234567.890123456E+37","1,234567890123456E+43"); + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP16, "+1234567.890123456E+37","1,234567890123456E+43"); } public void Var162 () { - dfpTestCommaSeparator(JDRSTest.RSTEST_DFP16, "+123456.7890123456E+38","1,234567890123456E+43"); + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP16, "+123456.7890123456E+38","1,234567890123456E+43"); } public void Var163 () { - dfpTestCommaSeparator(JDRSTest.RSTEST_DFP16, "+12345.67890123456E+39","1,234567890123456E+43"); + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP16, "+12345.67890123456E+39","1,234567890123456E+43"); } public void Var164 () { - dfpTestCommaSeparator(JDRSTest.RSTEST_DFP16, "+1234.567890123456E+40","1,234567890123456E+43"); + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP16, "+1234.567890123456E+40","1,234567890123456E+43"); } public void Var165 () { - dfpTestCommaSeparator(JDRSTest.RSTEST_DFP16, "+123.4567890123456E+41","1,234567890123456E+43"); + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP16, "+123.4567890123456E+41","1,234567890123456E+43"); } public void Var166 () { - dfpTestCommaSeparator(JDRSTest.RSTEST_DFP16, "+12.34567890123456E+42","1,234567890123456E+43"); + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP16, "+12.34567890123456E+42","1,234567890123456E+43"); } public void Var167 () { - dfpTestCommaSeparator(JDRSTest.RSTEST_DFP16, "+1.234567890123456E+43","1,234567890123456E+43"); + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP16, "+1.234567890123456E+43","1,234567890123456E+43"); } public void Var168 () { - dfpTestCommaSeparator(JDRSTest.RSTEST_DFP16, "+.1234567890123456E+44","1,234567890123456E+43"); + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP16, "+.1234567890123456E+44","1,234567890123456E+43"); } public void Var169 () { - dfpTestCommaSeparator(JDRSTest.RSTEST_DFP16, "+0.1234567890123456E+44","1,234567890123456E+43"); + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP16, "+0.1234567890123456E+44","1,234567890123456E+43"); } public void Var170 () { - dfpTestCommaSeparator(JDRSTest.RSTEST_DFP16, "+0.01234567890123456E+45","1,234567890123456E+43"); + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP16, "+0.01234567890123456E+45","1,234567890123456E+43"); } public void Var171 () { - dfpTestCommaSeparator(JDRSTest.RSTEST_DFP16, "-1234567890123456E28","-1,234567890123456E+43"); + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP16, "-1234567890123456E28","-1,234567890123456E+43"); } - public void Var172 () { dfpTestCommaSeparator(JDRSTest.RSTEST_DFP16, "1E0", "1");} - public void Var173 () { dfpTestCommaSeparator(JDRSTest.RSTEST_DFP16, "1.1", "1,1");} - public void Var174 () { dfpTestCommaSeparator(JDRSTest.RSTEST_DFP16, "1.1E0", "1,1");} - public void Var175 () { dfpTestCommaSeparator(JDRSTest.RSTEST_DFP16, null, null);} + public void Var172 () { dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP16, "1E0", "1");} + public void Var173 () { dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP16, "1.1", "1,1");} + public void Var174 () { dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP16, "1.1E0", "1,1");} + public void Var175 () { dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP16, null, null);} /** * updateBigDecimal - set DFP34 to different values and retrieve */ - public void Var176 () { dfpTestCommaSeparator(JDRSTest.RSTEST_DFP34, "4533.43", "4533,43"); } - public void Var177 () { dfpTestCommaSeparator(JDRSTest.RSTEST_DFP34, "1234567890123456", "1234567890123456");} - public void Var178 () { dfpTestCommaSeparator(JDRSTest.RSTEST_DFP34, "-1234567890123456", "-1234567890123456");} - public void Var179 () { dfpTestCommaSeparator(JDRSTest.RSTEST_DFP34, "+1234567890123456","1234567890123456");} + public void Var176 () { dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP34, "4533.43", "4533,43"); } + public void Var177 () { dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP34, "1234567890123456", "1234567890123456");} + public void Var178 () { dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP34, "-1234567890123456", "-1234567890123456");} + public void Var179 () { dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP34, "+1234567890123456","1234567890123456");} public void Var180 () { - dfpTestCommaSeparator(JDRSTest.RSTEST_DFP34, "+1234567890123456E28","1,234567890123456E+43"); + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP34, "+1234567890123456E28","1,234567890123456E+43"); } public void Var181 () { - dfpTestCommaSeparator(JDRSTest.RSTEST_DFP34, "+1234567890123456E+28","1,234567890123456E+43"); + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP34, "+1234567890123456E+28","1,234567890123456E+43"); } public void Var182 () { - dfpTestCommaSeparator(JDRSTest.RSTEST_DFP34, "+123456789012345.6E+29","1,234567890123456E+43"); + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP34, "+123456789012345.6E+29","1,234567890123456E+43"); } public void Var183 () { - dfpTestCommaSeparator(JDRSTest.RSTEST_DFP34, "+12345678901234.56E+30","1,234567890123456E+43"); + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP34, "+12345678901234.56E+30","1,234567890123456E+43"); } public void Var184 () { - dfpTestCommaSeparator(JDRSTest.RSTEST_DFP34, "+1234567890123.456E+31","1,234567890123456E+43"); + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP34, "+1234567890123.456E+31","1,234567890123456E+43"); } public void Var185 () { - dfpTestCommaSeparator(JDRSTest.RSTEST_DFP34, "+123456789012.3456E+32","1,234567890123456E+43"); + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP34, "+123456789012.3456E+32","1,234567890123456E+43"); } public void Var186 () { - dfpTestCommaSeparator(JDRSTest.RSTEST_DFP34, "+12345678901.23456E+33","1,234567890123456E+43"); + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP34, "+12345678901.23456E+33","1,234567890123456E+43"); } public void Var187 () { - dfpTestCommaSeparator(JDRSTest.RSTEST_DFP34, "+1234567890.123456E+34","1,234567890123456E+43"); + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP34, "+1234567890.123456E+34","1,234567890123456E+43"); } public void Var188 () { - dfpTestCommaSeparator(JDRSTest.RSTEST_DFP34, "+123456789.0123456E+35","1,234567890123456E+43"); + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP34, "+123456789.0123456E+35","1,234567890123456E+43"); } public void Var189 () { - dfpTestCommaSeparator(JDRSTest.RSTEST_DFP34, "+12345678.90123456E+36","1,234567890123456E+43"); + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP34, "+12345678.90123456E+36","1,234567890123456E+43"); } public void Var190 () { - dfpTestCommaSeparator(JDRSTest.RSTEST_DFP34, "+1234567.890123456E+37","1,234567890123456E+43"); + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP34, "+1234567.890123456E+37","1,234567890123456E+43"); } public void Var191 () { - dfpTestCommaSeparator(JDRSTest.RSTEST_DFP34, "+123456.7890123456E+38","1,234567890123456E+43"); + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP34, "+123456.7890123456E+38","1,234567890123456E+43"); } public void Var192 () { - dfpTestCommaSeparator(JDRSTest.RSTEST_DFP34, "+12345.67890123456E+39","1,234567890123456E+43"); + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP34, "+12345.67890123456E+39","1,234567890123456E+43"); } public void Var193 () { - dfpTestCommaSeparator(JDRSTest.RSTEST_DFP34, "+1234.567890123456E+40","1,234567890123456E+43"); + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP34, "+1234.567890123456E+40","1,234567890123456E+43"); } public void Var194 () { - dfpTestCommaSeparator(JDRSTest.RSTEST_DFP34, "+123.4567890123456E+41","1,234567890123456E+43"); + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP34, "+123.4567890123456E+41","1,234567890123456E+43"); } public void Var195 () { - dfpTestCommaSeparator(JDRSTest.RSTEST_DFP34, "+12.34567890123456E+42","1,234567890123456E+43"); + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP34, "+12.34567890123456E+42","1,234567890123456E+43"); } public void Var196 () { - dfpTestCommaSeparator(JDRSTest.RSTEST_DFP34, "+1.234567890123456E+43","1,234567890123456E+43"); + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP34, "+1.234567890123456E+43","1,234567890123456E+43"); } public void Var197 () { - dfpTestCommaSeparator(JDRSTest.RSTEST_DFP34, "+.1234567890123456E+44","1,234567890123456E+43"); + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP34, "+.1234567890123456E+44","1,234567890123456E+43"); } public void Var198 () { - dfpTestCommaSeparator(JDRSTest.RSTEST_DFP34, "+0.1234567890123456E+44","1,234567890123456E+43"); + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP34, "+0.1234567890123456E+44","1,234567890123456E+43"); } public void Var199 () { - dfpTestCommaSeparator(JDRSTest.RSTEST_DFP34, "+0.01234567890123456E+45","1,234567890123456E+43"); + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP34, "+0.01234567890123456E+45","1,234567890123456E+43"); } public void Var200 () { - dfpTestCommaSeparator(JDRSTest.RSTEST_DFP34, "-1234567890123456E28","-1,234567890123456E+43"); + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP34, "-1234567890123456E28","-1,234567890123456E+43"); } - public void Var201 () { dfpTestCommaSeparator(JDRSTest.RSTEST_DFP34, "1E0", "1");} - public void Var202 () { dfpTestCommaSeparator(JDRSTest.RSTEST_DFP34, "1.1", "1,1");} - public void Var203 () { dfpTestCommaSeparator(JDRSTest.RSTEST_DFP34, "1.1E0", "1,1");} - public void Var204 () { dfpTestCommaSeparator(JDRSTest.RSTEST_DFP34, null, null);} + public void Var201 () { dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP34, "1E0", "1");} + public void Var202 () { dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP34, "1.1", "1,1");} + public void Var203 () { dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP34, "1.1E0", "1,1");} + public void Var204 () { dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP34, null, null);} /** updateBigDecimal() - Update a BOOLEAN. diff --git a/src/test/JD/RS/JDRSUpdateBinaryStream.java b/src/test/JD/RS/JDRSUpdateBinaryStream.java index 5472668d..2941d6ce 100644 --- a/src/test/JD/RS/JDRSUpdateBinaryStream.java +++ b/src/test/JD/RS/JDRSUpdateBinaryStream.java @@ -29,6 +29,7 @@ import test.JDRSTest; import test.JDTestDriver; import test.JDTestcase; +import test.JD.JDSerializeFile; import test.JD.JDWeirdInputStream; /** @@ -57,6 +58,7 @@ public static void main(String args[]) throws Exception { private Statement statement_; private Statement statement2_; private ResultSet rs_; + private JDSerializeFile serializeUpdateFile_; /** * Constructor. @@ -86,10 +88,13 @@ protected void setup() throws Exception { + ";data truncation=true"; connection_ = testDriver_.getConnection(url, systemObject_.getUserId(), encryptedPassword_); connection_.setAutoCommit(false); // @C1A + serializeUpdateFile_ = new JDSerializeFile(connection_, JDRSTest.RSTEST_UPDATE); + connection_.commit(); + statement_ = connection_.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); statement2_ = connection_.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); - statement_.executeUpdate("INSERT INTO " + JDRSTest.RSTEST_UPDATE + " (C_KEY) VALUES ('DUMMY_ROW')"); + statement_.executeUpdate("INSERT INTO " + JDRSTest.RSTEST_UPDATE + " (C_KEY) VALUES ('DUMMYROW_RSUBSM')"); statement_.executeUpdate("INSERT INTO " + JDRSTest.RSTEST_UPDATE + " (C_KEY) VALUES ('" + key_ + "')"); rs_ = statement_.executeQuery(select_ + " FOR UPDATE"); @@ -105,6 +110,8 @@ protected void cleanup() throws Exception { if (isJdbc20()) { rs_.close(); statement_.close(); + serializeUpdateFile_.close(); + connection_.commit(); // @C1A connection_.close(); } @@ -115,8 +122,7 @@ protected void cleanup() throws Exception { **/ public void Var001() { if (checkJdbc20()) { - try { - Statement s = connection_.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); + try (Statement s = connection_.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE)) { ResultSet rs = s.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_UPDATE + " FOR UPDATE"); rs.next(); rs.close(); @@ -134,11 +140,11 @@ public void Var001() { **/ public void Var002() { if (checkJdbc20()) { - try { - Statement s = connection_.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); - ResultSet rs = s.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_UPDATE); - rs.next(); - rs.updateBinaryStream("C_VARBINARY_20", new ByteArrayInputStream(new byte[] { (byte) -12, (byte) -34 }), 2); + try (Statement s = connection_.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY)) { + try (ResultSet rs = s.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_UPDATE)) { + rs.next(); + rs.updateBinaryStream("C_VARBINARY_20", new ByteArrayInputStream(new byte[] { (byte) -12, (byte) -34 }), 2); + } failed("Didn't throw SQLException"); } catch (Exception e) { assertExceptionIsInstanceOf(e, "java.sql.SQLException"); @@ -156,7 +162,7 @@ public void Var003() { JDRSTest.position(rs_, null); rs_.updateBinaryStream("C_VARBINARY_20", new ByteArrayInputStream(new byte[] { (byte) 12, (byte) 34, (byte) 98 }), 3); - rs_.updateRow(); + rs_.updateRow(); /* exception */ failed("Didn't throw SQLException"); } catch (Exception e) { assertExceptionIsInstanceOf(e, "java.sql.SQLException"); @@ -215,11 +221,13 @@ public void Var006() { **/ public void Var007() { if (checkJdbc20()) { + try { + JDRSTest.position(rs_, key_); byte[] ba = new byte[] { (byte) 22, (byte) 4, (byte) 98, (byte) -2 }; rs_.updateBinaryStream(18, new ByteArrayInputStream(ba), ba.length); - rs_.updateRow(); + rs_.updateRow(); /* serialized */ ResultSet rs2 = statement2_.executeQuery(select_); JDRSTest.position(rs2, key_); byte[] v = rs2.getBytes("C_VARBINARY_20"); @@ -227,7 +235,9 @@ public void Var007() { assertCondition(areEqual(v, ba)); } catch (Exception e) { failed(e, "Unexpected Exception"); + } + } } @@ -289,11 +299,13 @@ public void Var010() { **/ public void Var011() { if (checkJdbc20()) { + try { + JDRSTest.position(rs_, key_); byte[] ba = new byte[] { (byte) -4, (byte) 98, (byte) 99 }; rs_.updateBinaryStream("C_VARBINARY_20", new ByteArrayInputStream(ba), 3); - rs_.updateRow(); + rs_.updateRow(); /* serialized */ ResultSet rs2 = statement2_.executeQuery(select_); JDRSTest.position(rs2, key_); byte[] v = rs2.getBytes("C_VARBINARY_20"); @@ -301,6 +313,7 @@ public void Var011() { assertCondition(areEqual(v, ba)); } catch (Exception e) { failed(e, "Unexpected Exception"); + } } } @@ -311,10 +324,12 @@ public void Var011() { **/ public void Var012() { if (checkJdbc20()) { + try { + JDRSTest.position(rs_, key_); rs_.updateBinaryStream("C_VARBINARY_20", null, 0); - rs_.updateRow(); + rs_.updateRow(); /* serialized */ ResultSet rs2 = statement2_.executeQuery(select_); JDRSTest.position(rs2, key_); byte[] v = rs2.getBytes("C_VARBINARY_20"); @@ -323,7 +338,7 @@ public void Var012() { assertCondition((v == null) && (wn == true)); } catch (Exception e) { failed(e, "Unexpected Exception"); - } + } } } @@ -366,14 +381,17 @@ public void Var014() { **/ public void Var015() { if (checkJdbc20()) { + try { + JDRSTest.position(rs_, key_); byte[] ba = new byte[] { (byte) 0, (byte) 56, (byte) 1, (byte) -1, (byte) 2, (byte) -2 }; rs_.updateBinaryStream("C_VARBINARY_20", new ByteArrayInputStream(ba), ba.length); - rs_.updateRow(); + rs_.updateRow(); /* serialized */ assertCondition(areEqual(rs_.getBytes("C_VARBINARY_20"), ba)); } catch (Exception e) { failed(e, "Unexpected Exception"); + } } } @@ -384,17 +402,20 @@ public void Var015() { **/ public void Var016() { if (checkJdbc20()) { + try { + JDRSTest.position(rs_, key_); byte[] ba = new byte[] { (byte) 0, (byte) 56, (byte) 1, (byte) -1, (byte) 2, (byte) -2 }; rs_.updateBinaryStream("C_VARBINARY_20", new ByteArrayInputStream(ba), ba.length); - rs_.updateRow(); + rs_.updateRow(); /* serialized */ rs_.beforeFirst(); JDRSTest.position(rs_, key_); byte[] v = rs_.getBytes("C_VARBINARY_20"); assertCondition(areEqual(ba, v)); } catch (Exception e) { failed(e, "Unexpected Exception"); + } } } @@ -441,7 +462,7 @@ public void Var018() { public void Var019() { if (checkJdbc20()) { try { - JDRSTest.position(rs_, "DUMMY_ROW"); + JDRSTest.position(rs_, "DUMMYROW_RSUBSM"); rs_.deleteRow(); byte[] ba = new byte[] { (byte) 121, (byte) 0, (byte) 2, (byte) -2 }; rs_.updateBinaryStream("C_VARBINARY_20", new ByteArrayInputStream(ba), ba.length); @@ -592,13 +613,15 @@ public void Var028() { **/ public void Var029() { if (checkJdbc20()) { + try { + JDRSTest.position(rs_, key_); byte[] ba = new byte[] { (byte) 44, (byte) 86, (byte) -1, (byte) 10, (byte) 20, (byte) 23, (byte) 77, (byte) 10, (byte) -1, (byte) 46, (byte) 11, (byte) 22, (byte) 43, (byte) 98, (byte) -6, (byte) 11, (byte) 11, (byte) 0, (byte) 0, (byte) 100 }; rs_.updateBinaryStream("C_BINARY_20", new ByteArrayInputStream(ba), ba.length); - rs_.updateRow(); + rs_.updateRow(); /* serialized */ ResultSet rs2 = statement2_.executeQuery(select_); JDRSTest.position(rs2, key_); byte[] v = rs2.getBytes("C_BINARY_20"); @@ -606,6 +629,7 @@ public void Var029() { assertCondition(areEqual(v, ba)); } catch (Exception e) { failed(e, "Unexpected Exception"); + } } } @@ -621,7 +645,7 @@ public void Var030() { expectedColumn = rs_.findColumn("C_BINARY_1"); rs_.updateBinaryStream("C_BINARY_1", new ByteArrayInputStream(new byte[] { (byte) 54, (byte) 64, (byte) 0 }), 3); - rs_.updateRow(); + rs_.updateRow(); /* exception */ failed("Didn't throw SQLException"); } catch (Exception e) { DataTruncation dt = (DataTruncation) e; @@ -638,11 +662,13 @@ public void Var030() { **/ public void Var031() { if (checkJdbc20()) { + try { + JDRSTest.position(rs_, key_); byte[] ba = new byte[] { (byte) -1, (byte) 86, (byte) 11, (byte) 0, (byte) 0, (byte) 100 }; rs_.updateBinaryStream("C_VARBINARY_20", new ByteArrayInputStream(ba), ba.length); - rs_.updateRow(); + rs_.updateRow(); /* serialized */ ResultSet rs2 = statement2_.executeQuery(select_); JDRSTest.position(rs2, key_); byte[] v = rs2.getBytes("C_VARBINARY_20"); @@ -737,11 +763,13 @@ public void Var035() { **/ public void Var036() { if (checkJdbc20()) { + try { + JDRSTest.position(rs_, key_); byte[] ba = new byte[0]; rs_.updateBinaryStream("C_VARBINARY_20", new ByteArrayInputStream(ba), 0); - rs_.updateRow(); + rs_.updateRow(); /* serialized */ ResultSet rs2 = statement2_.executeQuery(select_); JDRSTest.position(rs2, key_); byte[] v = rs2.getBytes("C_VARBINARY_20"); @@ -749,20 +777,23 @@ public void Var036() { assertCondition(areEqual(v, ba)); } catch (Exception e) { failed(e, "Unexpected Exception"); + } } - } +} /** * updateBinaryStream() - Update a VARBINARY, with single element array. **/ public void Var037() { if (checkJdbc20()) { + try { + JDRSTest.position(rs_, key_); byte[] ba = new byte[] { (byte) 0 }; rs_.updateBinaryStream("C_VARBINARY_20", new ByteArrayInputStream(ba), 1); - rs_.updateRow(); + rs_.updateRow(); /* serialized */ ResultSet rs2 = statement2_.executeQuery(select_); JDRSTest.position(rs2, key_); byte[] v = rs2.getBytes("C_VARBINARY_20"); @@ -788,7 +819,7 @@ public void Var038() { (byte) 10, (byte) -1, (byte) 46, (byte) 23, (byte) 77, (byte) 10, (byte) -1, (byte) 46, (byte) 11, (byte) 11, (byte) 0, (byte) 0, (byte) 100 }; rs_.updateBinaryStream("C_VARBINARY_20", new ByteArrayInputStream(ba), ba.length); - rs_.updateRow(); + rs_.updateRow(); /* exception */ failed("Didn't throw SQLException"); } catch (Exception e) { DataTruncation dt = (DataTruncation) e; @@ -827,8 +858,9 @@ public int read(byte[] buffer) throws IOException { }; } - InputStream r = new BadInputStream(); - rs_.updateBinaryStream("C_VARBINARY_20", r, 2); + try (InputStream r = new BadInputStream()) { + rs_.updateBinaryStream("C_VARBINARY_20", r, 2); + } failed("Didn't throw SQLException"); } catch (Exception e) { assertExceptionIsInstanceOf(e, "java.sql.SQLException"); @@ -878,13 +910,15 @@ public void Var041() { public void Var042() { if (checkJdbc20()) { if (checkLobSupport()) { + try { + JDRSTest.position(rs_, key_); byte[] ba = new byte[] { (byte) 98, (byte) 1 }; rs_.updateBinaryStream("C_BLOB", new ByteArrayInputStream(ba), 2); // if (getDriver() == JDTestDriver.DRIVER_NATIVE) { //@D1D - rs_.updateRow(); + rs_.updateRow(); /* serialized */ ResultSet rs2 = statement2_.executeQuery(select_); JDRSTest.position(rs2, key_); byte[] v = rs2.getBytes("C_BLOB"); @@ -1010,23 +1044,26 @@ public void Var049() { String added = "Added by native driver 10/11/2006 to test input stream that sometimes returns 0 bytes "; if (checkJdbc20()) { + try { + JDRSTest.position(rs_, key_); byte[] ba = new byte[] { (byte) 32, (byte) 33, (byte) 34, (byte) 35, (byte) 36, (byte) 37 }; - InputStream is = new JDWeirdInputStream("0102030"); - - // toolbox expects correct size - try { - rs_.updateBinaryStream(18, is, 6); - } catch (SQLException e) { - if (isToolboxDriver()) { - succeeded(); - return; - } else { - throw e; + try (InputStream is = new JDWeirdInputStream("0102030")) { + // toolbox expects correct size + try { + rs_.updateBinaryStream(18, is, 6); + } catch (SQLException e) { + if (isToolboxDriver()) { + succeeded(); + return; + } else { + throw e; + } } } - rs_.updateRow(); + + rs_.updateRow(); /* serialized */ ResultSet rs2 = statement2_.executeQuery(select_); JDRSTest.position(rs2, key_); byte[] v = rs2.getBytes("C_VARBINARY_20"); @@ -1034,6 +1071,7 @@ public void Var049() { assertCondition(areEqual(v, ba), "Not equal " + added); } catch (Exception e) { failed(e, "Unexpected Exception " + added); + } } } @@ -1045,24 +1083,27 @@ public void Var050() { String added = "Added by native driver 10/11/2006 to test input stream that sometimes returns 0 bytes "; if (checkJdbc20()) { + try { + JDRSTest.position(rs_, key_); byte[] ba = new byte[] { (byte) 32, (byte) 33, (byte) 34, (byte) 35, (byte) 36 }; - InputStream is = new JDWeirdInputStream("0102030"); - - // toolbox expects correct size - try { - rs_.updateBinaryStream(18, is, 5); - } catch (SQLException e) { - if (isToolboxDriver()) { - succeeded(); - return; - } else { - throw e; + try (InputStream is = new JDWeirdInputStream("0102030")) { + // toolbox expects correct size + try { + rs_.updateBinaryStream(18, is, 5); + } catch (SQLException e) { + if (isToolboxDriver()) { + succeeded(); + return; + } else { + throw e; + } } } - rs_.updateRow(); + + rs_.updateRow(); /* serialized */ ResultSet rs2 = statement2_.executeQuery(select_); JDRSTest.position(rs2, key_); byte[] v = rs2.getBytes("C_VARBINARY_20"); @@ -1070,6 +1111,7 @@ public void Var050() { assertCondition(areEqual(v, ba), "Not equal " + added); } catch (Exception e) { failed(e, "Unexpected Exception " + added); + } } } @@ -1079,9 +1121,8 @@ public void Var050() { **/ public void Var051() { if (checkDecFloatSupport()) { - try { - Statement s = connection_.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); - ResultSet rs = s.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_DFP16 + " FOR UPDATE "); + try (Statement s = connection_.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); + ResultSet rs = s.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_UPDDFP16 + " FOR UPDATE ")) { rs.next(); rs.updateBinaryStream(1, new ByteArrayInputStream(new byte[] { (byte) 50 }), 1); failed("Didn't throw SQLException "); @@ -1106,9 +1147,8 @@ public void Var051() { public void Var052() { if (checkDecFloatSupport()) { - try { - Statement s = connection_.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); - ResultSet rs = s.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_DFP34 + " FOR UPDATE "); + try (Statement s = connection_.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); + ResultSet rs = s.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_UPDDFP34 + " FOR UPDATE ")) { rs.next(); rs.updateBinaryStream(1, new ByteArrayInputStream(new byte[] { (byte) 50 }), 1); failed("Didn't throw SQLException "); diff --git a/src/test/JD/RS/JDRSUpdateBoolean.java b/src/test/JD/RS/JDRSUpdateBoolean.java index 6a8e492e..7f1e3015 100644 --- a/src/test/JD/RS/JDRSUpdateBoolean.java +++ b/src/test/JD/RS/JDRSUpdateBoolean.java @@ -17,6 +17,7 @@ import java.io.FileOutputStream; import java.math.BigDecimal; import java.sql.ResultSet; +import java.sql.SQLException; import java.sql.Statement; import java.util.Hashtable; import java.util.Vector; @@ -26,6 +27,7 @@ import test.JDRSTest; import test.JDTestDriver; import test.JDTestcase; +import test.JD.JDSerializeFile; @@ -60,6 +62,7 @@ public static void main(String args[]) throws Exception { private Statement statement_; private Statement statement2_; private ResultSet rs_; + private JDSerializeFile serializeUpdateFile_; @@ -100,13 +103,16 @@ protected void setup () + ";data truncation=true"; connection_ = testDriver_.getConnection (url,systemObject_.getUserId(), encryptedPassword_); connection_.setAutoCommit(false); // @C1A + serializeUpdateFile_ = new JDSerializeFile(connection_, JDRSTest.RSTEST_UPDATE); + connection_.commit(); + statement_ = connection_.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); statement2_ = connection_.createStatement (ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); statement_.executeUpdate ("INSERT INTO " + JDRSTest.RSTEST_UPDATE - + " (C_KEY) VALUES ('DUMMY_ROW')"); + + " (C_KEY) VALUES ('DUMMY_UPDBOOL')"); statement_.executeUpdate ("INSERT INTO " + JDRSTest.RSTEST_UPDATE + " (C_KEY) VALUES ('" + key_ + "')"); @@ -128,7 +134,10 @@ protected void cleanup () if (isJdbc20 ()) { rs_.close (); statement_.close (); + connection_.commit(); // @C1A + serializeUpdateFile_.close(); + connection_.commit(); connection_.close (); } } @@ -194,7 +203,7 @@ public void Var003() try { JDRSTest.position (rs_, null); rs_.updateBoolean ("C_SMALLINT", true); - rs_.updateRow(); + rs_.updateRow(); /* exception */ failed ("Didn't throw SQLException"); } catch (Exception e) { @@ -612,7 +621,7 @@ public void Var022() { if (checkJdbc20 ()) { try { - JDRSTest.position (rs_, "DUMMY_ROW"); + JDRSTest.position (rs_, "DUMMY_UPDBOOL"); rs_.deleteRow (); rs_.updateBoolean ("C_SMALLINT", false); failed ("Didn't throw SQLException"); @@ -1323,16 +1332,20 @@ public void Var052() public void Var053 () { if (checkDecFloatSupport ()) { + try { + + + Statement s = connection_.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP16+" FOR UPDATE "); + + JDRSTest.RSTEST_UPDDFP16+" FOR UPDATE "); rs.next(); rs.updateBoolean (1, true); - rs.updateRow (); + rs.updateRow (); /* serialized */ ResultSet rs2 = statement2_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP16); + + JDRSTest.RSTEST_UPDDFP16); rs2.next(); BigDecimal v = rs2.getBigDecimal (1); rs2.close (); @@ -1340,6 +1353,8 @@ public void Var053 () } catch (Exception e) { failed (e, "Unexpected Exception"); + + } } } @@ -1352,16 +1367,18 @@ public void Var053 () public void Var054 () { if (checkDecFloatSupport ()) { + try { + Statement s = connection_.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP16+" FOR UPDATE "); + + JDRSTest.RSTEST_UPDDFP16+" FOR UPDATE "); rs.next(); rs.updateBoolean (1, false); - rs.updateRow (); + rs.updateRow (); /* serialized */ ResultSet rs2 = statement2_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP16); + + JDRSTest.RSTEST_UPDDFP16); rs2.next(); BigDecimal v = rs2.getBigDecimal (1); rs2.close (); @@ -1369,6 +1386,7 @@ public void Var054 () } catch (Exception e) { failed (e, "Unexpected Exception"); + } } } @@ -1380,23 +1398,28 @@ public void Var054 () public void Var055 () { if (checkDecFloatSupport ()) { + try { - Statement s = connection_.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, + + Statement s = connection_.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP34+" FOR UPDATE "); + + JDRSTest.RSTEST_UPDDFP34+" FOR UPDATE "); rs.next(); rs.updateBoolean (1, true); - rs.updateRow (); + rs.updateRow (); /* serialized */ ResultSet rs2 = statement2_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP34); + + JDRSTest.RSTEST_UPDDFP34); rs2.next(); BigDecimal v = rs2.getBigDecimal (1); rs2.close (); + rs.close(); + s.close(); assertCondition (v.intValue() == 1); } catch (Exception e) { failed (e, "Unexpected Exception"); + } } } @@ -1409,24 +1432,28 @@ public void Var055 () public void Var056 () { if (checkDecFloatSupport ()) { + try { + Statement s = connection_.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP34+" FOR UPDATE "); + + JDRSTest.RSTEST_UPDDFP34+" FOR UPDATE "); rs.next(); rs.updateBoolean (1, false); - rs.updateRow (); + rs.updateRow (); /* serialized */ ResultSet rs2 = statement2_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP34); + + JDRSTest.RSTEST_UPDDFP34); rs2.next(); BigDecimal v = rs2.getBigDecimal (1); rs2.close (); + rs.close(); + s.close(); assertCondition (v.intValue() == 0); } catch (Exception e) { failed (e, "Unexpected Exception"); - } + } } } diff --git a/src/test/JD/RS/JDRSUpdateByte.java b/src/test/JD/RS/JDRSUpdateByte.java index 9ef995a2..6c57fa74 100644 --- a/src/test/JD/RS/JDRSUpdateByte.java +++ b/src/test/JD/RS/JDRSUpdateByte.java @@ -18,6 +18,7 @@ import java.math.BigDecimal; import java.sql.DataTruncation; import java.sql.ResultSet; + import java.sql.Statement; import java.util.Hashtable; import java.util.Vector; @@ -27,6 +28,7 @@ import test.JDRSTest; import test.JDTestDriver; import test.JDTestcase; +import test.JD.JDSerializeFile; @@ -61,6 +63,7 @@ public static void main(String args[]) throws Exception { private Statement statement_; private Statement statement2_; private ResultSet rs_; + private JDSerializeFile serializeUpdateFile_; @@ -101,13 +104,16 @@ protected void setup () + ";data truncation=true"; connection_ = testDriver_.getConnection (url,systemObject_.getUserId(), encryptedPassword_); connection_.setAutoCommit(false); // @C1A + serializeUpdateFile_ = new JDSerializeFile(connection_, JDRSTest.RSTEST_UPDATE); + connection_.commit(); + statement_ = connection_.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); statement2_ = connection_.createStatement (ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); statement_.executeUpdate ("INSERT INTO " + JDRSTest.RSTEST_UPDATE - + " (C_KEY) VALUES ('DUMMY_ROW')"); + + " (C_KEY) VALUES ('DUMMY_UPDBYTE')"); statement_.executeUpdate ("INSERT INTO " + JDRSTest.RSTEST_UPDATE + " (C_KEY) VALUES ('" + key_ + "')"); @@ -129,7 +135,9 @@ protected void cleanup () rs_.close (); statement_.close (); connection_.commit(); // @C1A - connection_.close (); + serializeUpdateFile_.close(); + connection_.commit(); + connection_.close (); } } @@ -150,6 +158,7 @@ public void Var001() rs.next (); rs.close (); rs.updateByte ("C_SMALLINT", (byte) 5); + s.close(); failed ("Didn't throw SQLException"); } catch (Exception e) { @@ -174,6 +183,8 @@ public void Var002() + JDRSTest.RSTEST_UPDATE); rs.next (); rs.updateByte ("C_SMALLINT", (byte) 5); + rs.close(); + s.close(); failed ("Didn't throw SQLException"); } catch (Exception e) { @@ -194,7 +205,7 @@ public void Var003() try { JDRSTest.position (rs_, null); rs_.updateByte ("C_SMALLINT", (byte) 6); - rs_.updateRow(); + rs_.updateRow(); /* exception */ failed ("Didn't throw SQLException"); } catch (Exception e) { @@ -495,7 +506,7 @@ public void Var017() { if (checkJdbc20 ()) { try { - JDRSTest.position (rs_, "DUMMY_ROW"); + JDRSTest.position (rs_, "DUMMY_UPDBYTE"); rs_.deleteRow (); rs_.updateByte ("C_SMALLINT", (byte) 2892); failed ("Didn't throw SQLException"); @@ -993,19 +1004,23 @@ public void Var039 () { String added = " -- DFP16 test added 01/10/2007 by native driver"; if (checkDecFloatSupport ()) { + try { + Statement s = connection_.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP16+" FOR UPDATE "); + + JDRSTest.RSTEST_UPDDFP16+" FOR UPDATE "); rs.next(); rs.updateByte (1, (byte) 33); - rs.updateRow (); + rs.updateRow (); /* serialized */ ResultSet rs2 = statement2_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP16); + + JDRSTest.RSTEST_UPDDFP16); rs2.next(); BigDecimal v = rs2.getBigDecimal (1); rs2.close (); + rs.close(); + s.close(); assertCondition (v.intValue() == 33, "expected 33, got "+v.intValue()+added ); } catch (Exception e) { @@ -1023,23 +1038,28 @@ public void Var040 () { String added = " -- DFP16 test added 01/10/2007 by native driver"; if (checkDecFloatSupport ()) { + try { + Statement s = connection_.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP34+" FOR UPDATE "); + + JDRSTest.RSTEST_UPDDFP34+" FOR UPDATE "); rs.next(); rs.updateByte (1, (byte) 40); - rs.updateRow (); + rs.updateRow (); /* serialized */ ResultSet rs2 = statement2_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP34); + + JDRSTest.RSTEST_UPDDFP34); rs2.next(); BigDecimal v = rs2.getBigDecimal (1); rs2.close (); + rs.close(); + s.close(); assertCondition (v.intValue() == 40, "got "+v.intValue()+" sb 40 "+added); } catch (Exception e) { failed (e, "Unexpected Exception"+added); + } } } diff --git a/src/test/JD/RS/JDRSUpdateBytes.java b/src/test/JD/RS/JDRSUpdateBytes.java index ce80f0c4..f65323ab 100644 --- a/src/test/JD/RS/JDRSUpdateBytes.java +++ b/src/test/JD/RS/JDRSUpdateBytes.java @@ -26,6 +26,7 @@ import test.JDRSTest; import test.JDTestDriver; import test.JDTestcase; +import test.JD.JDSerializeFile; @@ -60,6 +61,7 @@ public static void main(String args[]) throws Exception { private Statement statement_; private Statement statement2_; private ResultSet rs_; + private JDSerializeFile serializeUpdateFile_; @@ -100,13 +102,16 @@ protected void setup () + ";data truncation=true"; connection_ = testDriver_.getConnection (url,systemObject_.getUserId(), encryptedPassword_); connection_.setAutoCommit(false); // @C1A + serializeUpdateFile_ = new JDSerializeFile(connection_, JDRSTest.RSTEST_UPDATE); + connection_.commit(); + statement_ = connection_.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); statement2_ = connection_.createStatement (ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); statement_.executeUpdate ("INSERT INTO " + JDRSTest.RSTEST_UPDATE - + " (C_KEY) VALUES ('DUMMY_ROW')"); + + " (C_KEY) VALUES ('DUMMY_UPDBYTES')"); statement_.executeUpdate ("INSERT INTO " + JDRSTest.RSTEST_UPDATE + " (C_KEY) VALUES ('" + key_ + "')"); @@ -128,7 +133,9 @@ protected void cleanup () rs_.close (); statement_.close (); connection_.commit(); // @C1A - connection_.close (); + serializeUpdateFile_.close(); + connection_.commit(); + connection_.close (); } } @@ -141,14 +148,14 @@ protected void cleanup () public void Var001() { if (checkJdbc20 ()) { - try { - Statement s = connection_.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, - ResultSet.CONCUR_UPDATABLE); + try (Statement s = connection_.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, + ResultSet.CONCUR_UPDATABLE)) { ResultSet rs = s.executeQuery ("SELECT * FROM " + JDRSTest.RSTEST_UPDATE + " FOR UPDATE"); rs.next (); rs.close (); rs.updateBytes ("C_VARBINARY_20", new byte[] { (byte) 12, (byte) 34 }); + failed ("Didn't throw SQLException"); } catch (Exception e) { @@ -193,7 +200,7 @@ public void Var003() try { JDRSTest.position (rs_, null); rs_.updateBytes ("C_VARBINARY_20", new byte[] { (byte) 12, (byte) 34, (byte) 98 }); - rs_.updateRow(); + rs_.updateRow(); /* exception */ failed ("Didn't throw SQLException"); } catch (Exception e) { @@ -528,7 +535,7 @@ public void Var018() { if (checkJdbc20 ()) { try { - JDRSTest.position (rs_, "DUMMY_ROW"); + JDRSTest.position (rs_, "DUMMY_UPDBYTES"); rs_.deleteRow (); byte[] ba = new byte[] { (byte) 121, (byte) 0, (byte) 2, (byte) -2 }; rs_.updateBytes ("C_VARBINARY_20", ba); @@ -1093,10 +1100,10 @@ public void Var043() Statement s = connection_.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP16+" FOR UPDATE "); + + JDRSTest.RSTEST_UPDDFP16+" FOR UPDATE "); rs.next(); rs.updateBytes (1, new byte[] { (byte) 50 }); - rs.updateRow (); + rs.updateRow (); /* exception */ failed ("Didn't throw SQLException"); } catch (Exception e) { @@ -1116,10 +1123,12 @@ public void Var044() Statement s = connection_.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP34+" FOR UPDATE "); + + JDRSTest.RSTEST_UPDDFP34+" FOR UPDATE "); rs.next(); rs.updateBytes (1, new byte[] { (byte) 50 }); - rs.updateRow (); + rs.updateRow (); /* exception */ + rs.close(); + s.close(); failed ("Didn't throw SQLException"); } catch (Exception e) { diff --git a/src/test/JD/RS/JDRSUpdateCharacterStream.java b/src/test/JD/RS/JDRSUpdateCharacterStream.java index 02b02fa7..ca983010 100644 --- a/src/test/JD/RS/JDRSUpdateCharacterStream.java +++ b/src/test/JD/RS/JDRSUpdateCharacterStream.java @@ -33,6 +33,7 @@ import test.JDRSTest; import test.JDTestDriver; import test.JDTestcase; +import test.JD.JDSerializeFile; import test.JD.JDWeirdReader; @@ -68,6 +69,7 @@ public static void main(String args[]) throws Exception { private Statement statement_; private Statement statement2_; private ResultSet rs_; + private JDSerializeFile serializeUpdateFile_; @@ -108,13 +110,16 @@ protected void setup () + ";data truncation=true"; connection_ = testDriver_.getConnection (url,systemObject_.getUserId(), encryptedPassword_); connection_.setAutoCommit(false); // @C1A + serializeUpdateFile_ = new JDSerializeFile(connection_, JDRSTest.RSTEST_UPDATE); + connection_.commit(); + statement_ = connection_.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); statement2_ = connection_.createStatement (ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); statement_.executeUpdate ("INSERT INTO " + JDRSTest.RSTEST_UPDATE - + " (C_KEY) VALUES ('DUMMY_ROW')"); + + " (C_KEY) VALUES ('DUMMY_UPDCS')"); statement_.executeUpdate ("INSERT INTO " + JDRSTest.RSTEST_UPDATE + " (C_KEY) VALUES ('" + key_ + "')"); @@ -137,7 +142,9 @@ protected void cleanup () rs_.close (); statement_.close (); connection_.commit(); // @C1A - connection_.close (); + serializeUpdateFile_.close(); + connection_.commit(); + connection_.close (); } } @@ -210,7 +217,7 @@ public void Var003() { JDRSTest.position (rs_, null); rs_.updateCharacterStream ("C_VARCHAR_50", new StringReader ("Portland"), 8); - rs_.updateRow(); + rs_.updateRow(); /* exception */ failed ("Didn't throw SQLException"); } catch(Exception e) @@ -603,7 +610,7 @@ public void Var019() { try { - JDRSTest.position (rs_, "DUMMY_ROW"); + JDRSTest.position (rs_, "DUMMY_UPDCS"); rs_.deleteRow (); rs_.updateCharacterStream ("C_VARCHAR_50", new StringReader ("Ames"), 4); failed ("Didn't throw SQLException"); @@ -2188,10 +2195,10 @@ public void Var072 () Statement s = connection_.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP16+" FOR UPDATE "); + + JDRSTest.RSTEST_UPDDFP16+" FOR UPDATE "); rs.next(); rs.updateCharacterStream(1, new StringReader ("Hannover"), 8 ); - rs.updateRow(); + rs.updateRow(); /* exception */ failed ("Didn't throw SQLException "); } catch (Exception e) { @@ -2220,10 +2227,10 @@ public void Var073 () Statement s = connection_.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP34+" FOR UPDATE "); + + JDRSTest.RSTEST_UPDDFP34+" FOR UPDATE "); rs.next(); rs.updateCharacterStream(1, new StringReader ("Hannover"), 8 ); - rs.updateRow(); + rs.updateRow(); /* exception */ failed ("Didn't throw SQLException "); } catch (Exception e) { diff --git a/src/test/JD/RS/JDRSUpdateClob.java b/src/test/JD/RS/JDRSUpdateClob.java index 81fa6437..4714939c 100644 --- a/src/test/JD/RS/JDRSUpdateClob.java +++ b/src/test/JD/RS/JDRSUpdateClob.java @@ -20,6 +20,7 @@ import java.sql.DataTruncation; import java.sql.Date; import java.sql.ResultSet; +import java.sql.SQLException; import java.sql.Statement; import java.sql.Time; import java.sql.Timestamp; @@ -32,6 +33,7 @@ import test.JDRSTest; import test.JDTestDriver; import test.JDTestcase; +import test.JD.JDSerializeFile; @@ -66,6 +68,7 @@ public static void main(String args[]) throws Exception { private Statement statement_; private Statement statement2_; private ResultSet rs_; + private JDSerializeFile serializeUpdateFile_; @@ -106,13 +109,16 @@ protected void setup () + ";data truncation=true"; connection_ = testDriver_.getConnection (url,systemObject_.getUserId(), encryptedPassword_); connection_.setAutoCommit(false); // @C1A + serializeUpdateFile_ = new JDSerializeFile(connection_, JDRSTest.RSTEST_UPDATE); + connection_.commit(); + statement_ = connection_.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); statement2_ = connection_.createStatement (ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); statement_.executeUpdate ("INSERT INTO " + JDRSTest.RSTEST_UPDATE - + " (C_KEY) VALUES ('DUMMY_ROW')"); + + " (C_KEY) VALUES ('DUMMY_UPDCLOB')"); statement_.executeUpdate ("INSERT INTO " + JDRSTest.RSTEST_UPDATE + " (C_KEY) VALUES ('" + key_ + "')"); @@ -136,7 +142,9 @@ protected void cleanup () rs_.close (); statement_.close (); connection_.commit(); // @C1A - connection_.close (); + serializeUpdateFile_.close(); + connection_.commit(); + connection_.close (); } } @@ -211,7 +219,7 @@ public void Var003() { JDRSTest.position (rs_, null); rs_.updateClob ("C_VARCHAR_50", new JDLobTest.JDTestClob ("Portland")); - rs_.updateRow(); + rs_.updateRow(); /* exception */ failed ("Didn't throw SQLException"); } catch(Exception e) @@ -591,7 +599,7 @@ public void Var019() { try { - JDRSTest.position (rs_, "DUMMY_ROW"); + JDRSTest.position (rs_, "DUMMY_UPDCLOB"); rs_.deleteRow (); rs_.updateClob ("C_VARCHAR_50", new JDLobTest.JDTestClob ("Ames")); failed ("Didn't throw SQLException"); @@ -2079,18 +2087,19 @@ public void Var070 () if(checkDecFloatSupport()) { String value = "4533.43"; - try - { + + try { + Statement s = connection_.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP16+" FOR UPDATE "); + + JDRSTest.RSTEST_UPDDFP16+" FOR UPDATE "); rs.next(); rs.updateClob (1, new JDLobTest.JDTestClob (value)); - rs.updateRow (); + rs.updateRow (); /* serialized */ ResultSet rs2 = statement2_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP16); + + JDRSTest.RSTEST_UPDDFP16); rs2.next(); String v = rs2.getString (1); rs2.close (); @@ -2105,6 +2114,10 @@ public void Var070 () return; } failed (e, "Unexpected Exception"); + } finally { + + + } } } @@ -2120,18 +2133,19 @@ public void Var071 () if(checkDecFloatSupport()) { String value = "123456E700"; - try - { + + try { + Statement s = connection_.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP16+" FOR UPDATE "); + + JDRSTest.RSTEST_UPDDFP16+" FOR UPDATE "); rs.next(); rs.updateClob (1, new JDLobTest.JDTestClob (value)); - rs.updateRow (); + rs.updateRow (); /* serialized */ ResultSet rs2 = statement2_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP16); + + JDRSTest.RSTEST_UPDDFP16); rs2.next(); String v = rs2.getString (1); rs2.close (); @@ -2155,18 +2169,19 @@ public void Var072 () if(checkDecFloatSupport()) { String value = "Terre Haute"; - try - { + + try { + Statement s = connection_.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP16+" FOR UPDATE "); + + JDRSTest.RSTEST_UPDDFP16+" FOR UPDATE "); rs.next(); rs.updateClob (1, new JDLobTest.JDTestClob (value)); - rs.updateRow (); + rs.updateRow (); /* serialized */ ResultSet rs2 = statement2_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP16); + + JDRSTest.RSTEST_UPDDFP16); rs2.next(); String v = rs2.getString (1); rs2.close (); @@ -2176,6 +2191,7 @@ public void Var072 () { // e.printStackTrace(); assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } } @@ -2190,18 +2206,19 @@ public void Var073 () if(checkDecFloatSupport()) { String value = "4533.43"; - try - { + + try { + Statement s = connection_.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP34+" FOR UPDATE "); + + JDRSTest.RSTEST_UPDDFP34+" FOR UPDATE "); rs.next(); rs.updateClob (1, new JDLobTest.JDTestClob (value)); - rs.updateRow (); + rs.updateRow (); /* serialized */ ResultSet rs2 = statement2_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP34); + + JDRSTest.RSTEST_UPDDFP34); rs2.next(); String v = rs2.getString (1); rs2.close (); @@ -2216,6 +2233,7 @@ public void Var073 () return; } failed (e, "Unexpected Exception"); + } } } @@ -2232,18 +2250,19 @@ public void Var074 () { String value = "12345E7000 " ; - try - { + + try { + Statement s = connection_.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP34+" FOR UPDATE "); + + JDRSTest.RSTEST_UPDDFP34+" FOR UPDATE "); rs.next(); rs.updateClob (1, new JDLobTest.JDTestClob (value)); - rs.updateRow (); + rs.updateRow (); /* serialized */ ResultSet rs2 = statement2_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP34); + + JDRSTest.RSTEST_UPDDFP34); rs2.next(); String v = rs2.getString (1); rs2.close (); @@ -2253,6 +2272,7 @@ public void Var074 () { // e.printStackTrace(); assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } } @@ -2267,18 +2287,19 @@ public void Var075 () if(checkDecFloatSupport()) { String value = "Terre Haute"; - try - { + + try { + Statement s = connection_.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP34+" FOR UPDATE "); + + JDRSTest.RSTEST_UPDDFP34+" FOR UPDATE "); rs.next(); rs.updateClob (1, new JDLobTest.JDTestClob (value)); - rs.updateRow (); + rs.updateRow (); /* serialized */ ResultSet rs2 = statement2_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP34); + + JDRSTest.RSTEST_UPDDFP34); rs2.next(); String v = rs2.getString (1); rs2.close (); @@ -2288,7 +2309,7 @@ public void Var075 () { //e.printStackTrace(); assertExceptionIsInstanceOf(e, "java.sql.SQLException"); - } + } } } diff --git a/src/test/JD/RS/JDRSUpdateDB2Default.java b/src/test/JD/RS/JDRSUpdateDB2Default.java index 887d766a..b52d3053 100644 --- a/src/test/JD/RS/JDRSUpdateDB2Default.java +++ b/src/test/JD/RS/JDRSUpdateDB2Default.java @@ -26,6 +26,7 @@ import test.JDRSTest; import test.JDReflectionUtil; import test.JDTestcase; +import test.JD.JDSerializeFile; @@ -65,7 +66,8 @@ public static void main(String args[]) throws Exception { private Statement statement2_; private ResultSet rs_; private String url; - String methodName = "updateDB2Default"; + String methodName = "updateDB2Default"; + private JDSerializeFile serializeUpdateFile_; /** @@ -120,6 +122,9 @@ protected void setup () url += ";date format=iso;time format=iso"; //@A1A connection_ = testDriver_.getConnection (url,systemObject_.getUserId(), encryptedPassword_); connection_.setAutoCommit(false); // @C1A + serializeUpdateFile_ = new JDSerializeFile(connection_, JDRSTest.RSTEST_UPDATE); + connection_.commit(); + statement_ = connection_.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); statement2_ = connection_.createStatement (ResultSet.TYPE_SCROLL_INSENSITIVE, @@ -163,10 +168,10 @@ protected void setup () initTable(statement_, RSTEST_UPDTDB2DEF, buffer.toString()); statement_.executeUpdate ("INSERT INTO " + RSTEST_UPDTDB2DEF - + " (C_KEY) VALUES ('DUMMY_ROW')"); + + " (C_KEY) VALUES ('DUMMY_UPDDB2D')"); statement_.executeUpdate ("INSERT INTO " + RSTEST_UPDTDB2DEF - + " (C_KEY) VALUES ('DUMMY_ROW1')"); + + " (C_KEY) VALUES ('DUMMY_UPDDB2D1')"); String sql = "INSERT INTO " + RSTEST_UPDTDB2DEF + " VALUES ('JDRSUpdateDB2Default', " /* KEY */ @@ -205,6 +210,8 @@ protected void cleanup () throws Exception { + connection_.commit(); + serializeUpdateFile_.close(); connection_.commit(); connection_.close(); connection_ = testDriver_.getConnection (url,systemObject_.getUserId(), encryptedPassword_); @@ -215,7 +222,7 @@ protected void cleanup () rs_.close (); statement_.close (); connection_.commit(); // @C1A - connection_.close (); + connection_.close (); } @@ -589,7 +596,7 @@ public void Var014() } if (checkJdbc20 ()) { try { - JDRSTest.position (rs_, "DUMMY_ROW"); + JDRSTest.position (rs_, "DUMMY_UPDDB2D"); rs_.deleteRow (); JDReflectionUtil.callMethod_V(rs_, methodName, "C_VARCHAR_50"); //rs_.updateDB2Default ("C_VARCHAR_50"); diff --git a/src/test/JD/RS/JDRSUpdateDate.java b/src/test/JD/RS/JDRSUpdateDate.java index b63f0b87..8e12396b 100644 --- a/src/test/JD/RS/JDRSUpdateDate.java +++ b/src/test/JD/RS/JDRSUpdateDate.java @@ -28,6 +28,7 @@ import test.JDRSTest; import test.JDTestDriver; import test.JDTestcase; +import test.JD.JDSerializeFile; @@ -62,6 +63,7 @@ public static void main(String args[]) throws Exception { private Statement statement_; private Statement statement2_; private ResultSet rs_; + private JDSerializeFile serializeUpdateFile_; @@ -102,13 +104,15 @@ protected void setup () + ";data truncation=true"; connection_ = testDriver_.getConnection (url,systemObject_.getUserId(), encryptedPassword_); connection_.setAutoCommit(false); // @C1A + serializeUpdateFile_ = new JDSerializeFile(connection_, JDRSTest.RSTEST_UPDATE); + connection_.commit(); statement_ = connection_.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); statement2_ = connection_.createStatement (ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); statement_.executeUpdate ("INSERT INTO " + JDRSTest.RSTEST_UPDATE - + " (C_KEY) VALUES ('DUMMY_ROW')"); + + " (C_KEY) VALUES ('DUMMY_UPDDATE')"); statement_.executeUpdate ("INSERT INTO " + JDRSTest.RSTEST_UPDATE + " (C_KEY) VALUES ('" + key_ + "')"); @@ -130,7 +134,9 @@ protected void cleanup () rs_.close (); statement_.close (); connection_.commit(); // @C1A - connection_.close (); + serializeUpdateFile_.close(); + connection_.commit(); + connection_.close (); } } @@ -195,7 +201,7 @@ public void Var003() try { JDRSTest.position (rs_, null); rs_.updateDate ("C_DATE", new Date (19495934)); - rs_.updateRow(); + rs_.updateRow(); /* exception */ failed ("Didn't throw SQLException"); } catch (Exception e) { @@ -539,7 +545,7 @@ public void Var018() { if (checkJdbc20 ()) { try { - JDRSTest.position (rs_, "DUMMY_ROW"); + JDRSTest.position (rs_, "DUMMY_UPDDATE"); rs_.deleteRow (); rs_.updateDate ("C_DATE", new Date (143419495)); failed ("Didn't throw SQLException"); @@ -1029,7 +1035,7 @@ public void Var040 () Statement s = connection_.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP16+" FOR UPDATE "); + + JDRSTest.RSTEST_UPDDFP16+" FOR UPDATE "); rs.next(); rs.updateDate (1, new Date(1423449495)); failed ("Didn't throw SQLException"); @@ -1050,7 +1056,7 @@ public void Var041 () Statement s = connection_.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP34+" FOR UPDATE "); + + JDRSTest.RSTEST_UPDDFP34+" FOR UPDATE "); rs.next(); rs.updateDate (1, new Date(1423449495)); failed ("Didn't throw SQLException"); diff --git a/src/test/JD/RS/JDRSUpdateDouble.java b/src/test/JD/RS/JDRSUpdateDouble.java index 9bd42d17..74cc3d72 100644 --- a/src/test/JD/RS/JDRSUpdateDouble.java +++ b/src/test/JD/RS/JDRSUpdateDouble.java @@ -19,6 +19,7 @@ import java.sql.Connection; import java.sql.DataTruncation; import java.sql.ResultSet; +import java.sql.SQLException; import java.sql.Statement; import java.util.Hashtable; import java.util.Vector; @@ -28,6 +29,7 @@ import test.JDRSTest; import test.JDTestDriver; import test.JDTestcase; +import test.JD.JDSerializeFile; @@ -62,6 +64,7 @@ public static void main(String args[]) throws Exception { private Statement statement_; private Statement statement2_; private ResultSet rs_; + private JDSerializeFile serializeUpdateFile_; @@ -99,13 +102,16 @@ protected void setup () + ";data truncation=true"; connection_ = testDriver_.getConnection (url,systemObject_.getUserId(), encryptedPassword_); connection_.setAutoCommit(false); // @C1A + serializeUpdateFile_ = new JDSerializeFile(connection_, JDRSTest.RSTEST_UPDATE); + connection_.commit(); + statement_ = connection_.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); statement2_ = connection_.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY); statement_.executeUpdate ("INSERT INTO " + JDRSTest.RSTEST_UPDATE - + " (C_KEY) VALUES ('DUMMY_ROW')"); + + " (C_KEY) VALUES ('DUMMY_UPDDOUB')"); statement_.executeUpdate ("INSERT INTO " + JDRSTest.RSTEST_UPDATE + " (C_KEY) VALUES ('" + key_ + "')"); @@ -127,6 +133,8 @@ protected void cleanup () rs_.close (); statement_.close (); connection_.commit(); // @C1A + serializeUpdateFile_.close(); + connection_.commit(); connection_.close (); } } @@ -190,7 +198,7 @@ public void Var003() try { JDRSTest.position (rs_, null); rs_.updateDouble ("C_DOUBLE", 6); - rs_.updateRow(); + rs_.updateRow(); /* exception */ failed ("Didn't throw SQLException"); } catch (Exception e) { assertExceptionIsInstanceOf (e, "java.sql.SQLException"); @@ -476,7 +484,7 @@ public void Var017() { if (checkJdbc20 ()) { try { - JDRSTest.position (rs_, "DUMMY_ROW"); + JDRSTest.position (rs_, "DUMMY_UPDDOUB"); rs_.deleteRow (); rs_.updateDouble ("C_DOUBLE", 2892); failed ("Didn't throw SQLException"); @@ -1295,13 +1303,15 @@ public void Var050() public void dfpTest(String table, double value, String expected) { if (checkDecFloatSupport()) { + try { + Statement s = connection_.createStatement( ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); ResultSet rs = s.executeQuery("SELECT * FROM " + table + " FOR UPDATE "); rs.next(); rs.updateDouble(1, value); - rs.updateRow(); + rs.updateRow(); /* serialized */ ResultSet rs2 = statement2_.executeQuery("SELECT * FROM " + table); rs2.next(); @@ -1315,13 +1325,16 @@ public void dfpTest(String table, double value, String expected) { "from value "+value+ " for table "+table); } catch (Exception e) { failed(e, "Unexpected Exception"); + } } } public void dfpRoundTest(String roundingMode, String table, double value, String expected) { if (checkDecFloatSupport()) { + try { + String roundingModeProp = roundingMode; if(isToolboxDriver()) @@ -1336,11 +1349,10 @@ public void dfpRoundTest(String roundingMode, String table, double value, String Statement s = connection.createStatement( ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); - ResultSet rs = s - .executeQuery("SELECT * FROM " + table + " FOR UPDATE "); + ResultSet rs = s.executeQuery("SELECT * FROM " + table + " FOR UPDATE "); rs.next(); rs.updateDouble(1, value); - rs.updateRow(); + rs.updateRow(); /* serialized */ ResultSet rs2 = statement2_.executeQuery("SELECT * FROM " + table); rs2.next(); @@ -1355,6 +1367,7 @@ public void dfpRoundTest(String roundingMode, String table, double value, String "\nfor table "+table+" roundingMode = '"+roundingMode+"'"); } catch (Exception e) { failed(e, "Unexpected Exception for table "+table+" roundingMode = '"+roundingMode+"'"); + } } } @@ -1363,132 +1376,132 @@ public void dfpRoundTest(String roundingMode, String table, double value, String /** * updateDouble -- set a DFP16 value (normal) */ - public void Var051 () { dfpTest(JDRSTest.RSTEST_DFP16, 4533.43, "4533.43"); } + public void Var051 () { dfpTest(JDRSTest.RSTEST_UPDDFP16, 4533.43, "4533.43"); } /** * updateDouble -- set a DFP16 value (Nan) */ - public void Var052 () { dfpTest(JDRSTest.RSTEST_DFP16, Double.NaN, "NaN"); } + public void Var052 () { dfpTest(JDRSTest.RSTEST_UPDDFP16, Double.NaN, "NaN"); } /** * updateDouble -- set a DFP16 value (NEGATIVE_INFINITY) */ - public void Var053 () { dfpTest(JDRSTest.RSTEST_DFP16, Double.NEGATIVE_INFINITY, "-Infinity"); } + public void Var053 () { dfpTest(JDRSTest.RSTEST_UPDDFP16, Double.NEGATIVE_INFINITY, "-Infinity"); } /** * updateDouble -- set a DFP16 value (POSITIVE_INFINITY) */ - public void Var054 () { dfpTest(JDRSTest.RSTEST_DFP16, Double.POSITIVE_INFINITY, "Infinity"); } + public void Var054 () { dfpTest(JDRSTest.RSTEST_UPDDFP16, Double.POSITIVE_INFINITY, "Infinity"); } /** * updateDouble -- set a DFP16 value (MAX_VALUE) */ public void Var055 () { - dfpTest(JDRSTest.RSTEST_DFP16, Double.MAX_VALUE, "1.797693134862316E+308"); + dfpTest(JDRSTest.RSTEST_UPDDFP16, Double.MAX_VALUE, "1.797693134862316E+308"); } /** * updateDouble -- set a DFP16 value (MIN_VALUE) */ public void Var056 () { - dfpTest(JDRSTest.RSTEST_DFP16, Double.MIN_VALUE, "4.9E-324"); + dfpTest(JDRSTest.RSTEST_UPDDFP16, Double.MIN_VALUE, "4.9E-324"); } /** * updateDouble -- set a DFP16 positive with rounding mode "round half even" */ - public void Var057 () { dfpRoundTest("round half even", JDRSTest.RSTEST_DFP16, + public void Var057 () { dfpRoundTest("round half even", JDRSTest.RSTEST_UPDDFP16, 1.2345678901234555,"1.234567890123456"); } - public void Var058 () { dfpRoundTest("round half even", JDRSTest.RSTEST_DFP16, + public void Var058 () { dfpRoundTest("round half even", JDRSTest.RSTEST_UPDDFP16, 1.2345678901234545, "1.234567890123454"); } /** * updateDouble -- set a DFP16 negative with rounding mode "round half even" */ - public void Var059 () { dfpRoundTest("round half even", JDRSTest.RSTEST_DFP16, + public void Var059 () { dfpRoundTest("round half even", JDRSTest.RSTEST_UPDDFP16, -1.2345678901234555, "-1.234567890123456"); } - public void Var060 () { dfpRoundTest("round half even", JDRSTest.RSTEST_DFP16, + public void Var060 () { dfpRoundTest("round half even", JDRSTest.RSTEST_UPDDFP16, -1.2345678901234545, "-1.234567890123454"); } /** * updateDouble -- set a DFP16 positive with rounding mode "round half up" */ - public void Var061 () { dfpRoundTest("round half up", JDRSTest.RSTEST_DFP16, + public void Var061 () { dfpRoundTest("round half up", JDRSTest.RSTEST_UPDDFP16, 1.2345678901234555, "1.234567890123456"); } - public void Var062 () { dfpRoundTest("round half up", JDRSTest.RSTEST_DFP16, + public void Var062 () { dfpRoundTest("round half up", JDRSTest.RSTEST_UPDDFP16, 1.2345678901234545, "1.234567890123455"); } /** * updateDouble -- set a DFP16 negative with rounding mode "round half up" */ - public void Var063 () { dfpRoundTest("round half up", JDRSTest.RSTEST_DFP16, + public void Var063 () { dfpRoundTest("round half up", JDRSTest.RSTEST_UPDDFP16, -1.2345678901234555, "-1.234567890123456"); } - public void Var064 () { dfpRoundTest("round half up", JDRSTest.RSTEST_DFP16, + public void Var064 () { dfpRoundTest("round half up", JDRSTest.RSTEST_UPDDFP16, -1.2345678901234545, "-1.234567890123455"); } /** * updateDouble -- set a DFP16 positive with rounding mode "round down" */ - public void Var065 () { dfpRoundTest("round down", JDRSTest.RSTEST_DFP16, + public void Var065 () { dfpRoundTest("round down", JDRSTest.RSTEST_UPDDFP16, 1.2345678901234555, "1.234567890123455"); } - public void Var066 () { dfpRoundTest("round down", JDRSTest.RSTEST_DFP16, + public void Var066 () { dfpRoundTest("round down", JDRSTest.RSTEST_UPDDFP16, 1.2345678901234561, "1.234567890123456"); } /** * updateDouble -- set a DFP16 negative with rounding mode "round down" */ - public void Var067 () { dfpRoundTest("round down", JDRSTest.RSTEST_DFP16, + public void Var067 () { dfpRoundTest("round down", JDRSTest.RSTEST_UPDDFP16, -1.2345678901234555, "-1.234567890123455"); } - public void Var068 () { dfpRoundTest("round down", JDRSTest.RSTEST_DFP16, + public void Var068 () { dfpRoundTest("round down", JDRSTest.RSTEST_UPDDFP16, -1.2345678901234561, "-1.234567890123456"); } /** * updateDouble -- set a DFP16 positive with rounding mode "round ceiling" */ - public void Var069 () { dfpRoundTest("round ceiling", JDRSTest.RSTEST_DFP16, + public void Var069 () { dfpRoundTest("round ceiling", JDRSTest.RSTEST_UPDDFP16, 1.2345678901234555, "1.234567890123456"); } - public void Var070 () { dfpRoundTest("round ceiling", JDRSTest.RSTEST_DFP16, + public void Var070 () { dfpRoundTest("round ceiling", JDRSTest.RSTEST_UPDDFP16, 1.2345678901234545, "1.234567890123455"); } /** * updateDouble -- set a DFP16 negative with rounding mode "round ceiling" */ - public void Var071 () { dfpRoundTest("round ceiling", JDRSTest.RSTEST_DFP16, + public void Var071 () { dfpRoundTest("round ceiling", JDRSTest.RSTEST_UPDDFP16, -1.2345678901234555, "-1.234567890123455"); } - public void Var072 () { dfpRoundTest("round ceiling", JDRSTest.RSTEST_DFP16, + public void Var072 () { dfpRoundTest("round ceiling", JDRSTest.RSTEST_UPDDFP16, -1.2345678901234545, "-1.234567890123454"); } /** * updateDouble -- set a DFP16 positive with rounding mode "round floor" */ - public void Var073 () { dfpRoundTest("round floor", JDRSTest.RSTEST_DFP16, + public void Var073 () { dfpRoundTest("round floor", JDRSTest.RSTEST_UPDDFP16, 1.2345678901234555, "1.234567890123455"); } - public void Var074 () { dfpRoundTest("round floor", JDRSTest.RSTEST_DFP16, + public void Var074 () { dfpRoundTest("round floor", JDRSTest.RSTEST_UPDDFP16, 1.2345678901234545, "1.234567890123454"); } /** * updateDouble -- set a DFP16 negative with rounding mode "round floor" */ - public void Var075 () { dfpRoundTest("round floor", JDRSTest.RSTEST_DFP16, + public void Var075 () { dfpRoundTest("round floor", JDRSTest.RSTEST_UPDDFP16, -1.2345678901234555, "-1.234567890123456"); } - public void Var076 () { dfpRoundTest("round floor", JDRSTest.RSTEST_DFP16, + public void Var076 () { dfpRoundTest("round floor", JDRSTest.RSTEST_UPDDFP16, -1.2345678901234545, "-1.234567890123455"); } /** * updateDouble -- set a DFP16 positive with rounding mode "round half down" */ - public void Var077 () { dfpRoundTest("round half down", JDRSTest.RSTEST_DFP16, + public void Var077 () { dfpRoundTest("round half down", JDRSTest.RSTEST_UPDDFP16, 1.2345678901234565, "1.234567890123456"); } - public void Var078 () { dfpRoundTest("round half down", JDRSTest.RSTEST_DFP16, + public void Var078 () { dfpRoundTest("round half down", JDRSTest.RSTEST_UPDDFP16, 1.2345678901234545, "1.234567890123454"); } @@ -1496,56 +1509,56 @@ public void Var078 () { dfpRoundTest("round half down", JDRSTest.RSTEST_DFP16, /** * updateDouble -- set a DFP16 negative with rounding mode "round half down" */ - public void Var079 () { dfpRoundTest("round half down", JDRSTest.RSTEST_DFP16, + public void Var079 () { dfpRoundTest("round half down", JDRSTest.RSTEST_UPDDFP16, -1.2345678901234565, "-1.234567890123456"); } - public void Var080 () { dfpRoundTest("round half down", JDRSTest.RSTEST_DFP16, + public void Var080 () { dfpRoundTest("round half down", JDRSTest.RSTEST_UPDDFP16, -1.2345678901234545, "-1.234567890123454"); } /** * updateDouble -- set a DFP16 positive with rounding mode "round up" */ - public void Var081 () { dfpRoundTest("round up", JDRSTest.RSTEST_DFP16, + public void Var081 () { dfpRoundTest("round up", JDRSTest.RSTEST_UPDDFP16, 1.2345678901234555, "1.234567890123456"); } - public void Var082 () { dfpRoundTest("round up", JDRSTest.RSTEST_DFP16, + public void Var082 () { dfpRoundTest("round up", JDRSTest.RSTEST_UPDDFP16, 1.2345678901234545, "1.234567890123455"); } /** * updateDouble -- set a DFP16 negative with rounding mode "round up" */ - public void Var083 () { dfpRoundTest("round up", JDRSTest.RSTEST_DFP16, + public void Var083 () { dfpRoundTest("round up", JDRSTest.RSTEST_UPDDFP16, -1.2345678901234555, "-1.234567890123456"); } - public void Var084 () { dfpRoundTest("round up", JDRSTest.RSTEST_DFP16, + public void Var084 () { dfpRoundTest("round up", JDRSTest.RSTEST_UPDDFP16, -1.2345678901234545, "-1.234567890123455"); } /** * updateDouble -- set a DFP34 value (normal) */ - public void Var085 () { dfpTest(JDRSTest.RSTEST_DFP34, 4533.43, "4533.43"); } + public void Var085 () { dfpTest(JDRSTest.RSTEST_UPDDFP34, 4533.43, "4533.43"); } /** * updateDouble -- set a DFP34 value (Nan) */ - public void Var086 () { dfpTest(JDRSTest.RSTEST_DFP34, Double.NaN, "NaN"); } + public void Var086 () { dfpTest(JDRSTest.RSTEST_UPDDFP34, Double.NaN, "NaN"); } /** * updateDouble -- set a DFP34 value (NEGATIVE_INFINITY) */ - public void Var087 () { dfpTest(JDRSTest.RSTEST_DFP34, Double.NEGATIVE_INFINITY, "-Infinity"); } + public void Var087 () { dfpTest(JDRSTest.RSTEST_UPDDFP34, Double.NEGATIVE_INFINITY, "-Infinity"); } /** * updateDouble -- set a DFP34 value (POSITIVE_INFINITY) */ - public void Var088 () { dfpTest(JDRSTest.RSTEST_DFP34, Double.POSITIVE_INFINITY, "Infinity"); } + public void Var088 () { dfpTest(JDRSTest.RSTEST_UPDDFP34, Double.POSITIVE_INFINITY, "Infinity"); } /** * updateDouble -- set a DFP34 value (MAX_VALUE) */ public void Var089 () { - dfpTest(JDRSTest.RSTEST_DFP34, Double.MAX_VALUE, "1.7976931348623157E+308"); + dfpTest(JDRSTest.RSTEST_UPDDFP34, Double.MAX_VALUE, "1.7976931348623157E+308"); } @@ -1553,7 +1566,7 @@ public void Var089 () { * updateDouble -- set a DFP34 value (MIN_VALUE) */ public void Var090 () { - dfpTest(JDRSTest.RSTEST_DFP34, Double.MIN_VALUE, "4.9E-324"); + dfpTest(JDRSTest.RSTEST_UPDDFP34, Double.MIN_VALUE, "4.9E-324"); } /** @@ -1562,62 +1575,62 @@ public void Var090 () { * that accuracy. */ public void Var091 () { - dfpRoundTest("round half even", JDRSTest.RSTEST_DFP34, 5.552576577473519E-221, "5.552576577473519E-221"); + dfpRoundTest("round half even", JDRSTest.RSTEST_UPDDFP34, 5.552576577473519E-221, "5.552576577473519E-221"); } public void Var092 () { - dfpRoundTest("round half even", JDRSTest.RSTEST_DFP34, + dfpRoundTest("round half even", JDRSTest.RSTEST_UPDDFP34, -3.105034981303255E+231, "-3.105034981303255E+231"); } public void Var093 () { - dfpRoundTest("round half up", JDRSTest.RSTEST_DFP34, + dfpRoundTest("round half up", JDRSTest.RSTEST_UPDDFP34, 5.552576577473519E-221, "5.552576577473519E-221"); } public void Var094 () { - dfpRoundTest("round half up", JDRSTest.RSTEST_DFP34, + dfpRoundTest("round half up", JDRSTest.RSTEST_UPDDFP34, -3.105034981303255E+231, "-3.105034981303255E+231"); } public void Var095 () { - dfpRoundTest("round down", JDRSTest.RSTEST_DFP34, + dfpRoundTest("round down", JDRSTest.RSTEST_UPDDFP34, 5.552576577473519E-221, "5.552576577473519E-221"); } public void Var096 () { - dfpRoundTest("round down", JDRSTest.RSTEST_DFP34, + dfpRoundTest("round down", JDRSTest.RSTEST_UPDDFP34, -3.105034981303255E+231, "-3.105034981303255E+231"); } public void Var097 () { - dfpRoundTest("round ceiling", JDRSTest.RSTEST_DFP34, + dfpRoundTest("round ceiling", JDRSTest.RSTEST_UPDDFP34, 5.552576577473519E-221, "5.552576577473519E-221"); } public void Var098 () { - dfpRoundTest("round ceiling", JDRSTest.RSTEST_DFP34, + dfpRoundTest("round ceiling", JDRSTest.RSTEST_UPDDFP34, -3.105034981303255E+231, "-3.105034981303255E+231"); } public void Var099 () { - dfpRoundTest("round floor", JDRSTest.RSTEST_DFP34, + dfpRoundTest("round floor", JDRSTest.RSTEST_UPDDFP34, 5.552576577473519E-221, "5.552576577473519E-221"); } public void Var100 () { - dfpRoundTest("round floor", JDRSTest.RSTEST_DFP34, + dfpRoundTest("round floor", JDRSTest.RSTEST_UPDDFP34, -3.105034981303255E+231, "-3.105034981303255E+231"); } public void Var101 () { - dfpRoundTest("round half down", JDRSTest.RSTEST_DFP34, + dfpRoundTest("round half down", JDRSTest.RSTEST_UPDDFP34, 5.552576577473519E-221, "5.552576577473519E-221"); } public void Var102 () { - dfpRoundTest("round half down", JDRSTest.RSTEST_DFP34, + dfpRoundTest("round half down", JDRSTest.RSTEST_UPDDFP34, -3.105034981303255E+231, "-3.105034981303255E+231"); } public void Var103 () { - dfpRoundTest("round up", JDRSTest.RSTEST_DFP34, + dfpRoundTest("round up", JDRSTest.RSTEST_UPDDFP34, 5.552576577473519E-221, "5.552576577473519E-221"); } public void Var104 () { - dfpRoundTest("round up", JDRSTest.RSTEST_DFP34, + dfpRoundTest("round up", JDRSTest.RSTEST_UPDDFP34, -3.105034981303255E+231, "-3.105034981303255E+231"); } diff --git a/src/test/JD/RS/JDRSUpdateFloat.java b/src/test/JD/RS/JDRSUpdateFloat.java index 629d706f..8bf9711b 100644 --- a/src/test/JD/RS/JDRSUpdateFloat.java +++ b/src/test/JD/RS/JDRSUpdateFloat.java @@ -19,6 +19,7 @@ import java.sql.Connection; import java.sql.DataTruncation; import java.sql.ResultSet; +import java.sql.SQLException; import java.sql.Statement; import java.util.Hashtable; import java.util.Vector; @@ -28,6 +29,7 @@ import test.JDRSTest; import test.JDTestDriver; import test.JDTestcase; +import test.JD.JDSerializeFile; @@ -63,6 +65,7 @@ public static void main(String args[]) throws Exception { private Statement statement_; private Statement statement2_; private ResultSet rs_; + private JDSerializeFile serializeUpdateFile_; @@ -101,6 +104,9 @@ protected void setup () + ";data truncation=true"; connection_ = testDriver_.getConnection (url,systemObject_.getUserId(), encryptedPassword_); connection_.setAutoCommit(false); // @C1A + serializeUpdateFile_ = new JDSerializeFile(connection_, JDRSTest.RSTEST_UPDATE); + connection_.commit(); + statement_ = connection_.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); // @@ -112,7 +118,7 @@ protected void setup () ResultSet.CONCUR_READ_ONLY); statement_.executeUpdate ("INSERT INTO " + JDRSTest.RSTEST_UPDATE - + " (C_KEY) VALUES ('DUMMY_ROW')"); + + " (C_KEY) VALUES ('DUMMY_UPDFLOAT')"); statement_.executeUpdate ("INSERT INTO " + JDRSTest.RSTEST_UPDATE + " (C_KEY) VALUES ('" + key_ + "')"); @@ -142,7 +148,9 @@ protected void cleanup () rs_.close (); statement_.close (); connection_.commit(); // @C1A - connection_.close (); + serializeUpdateFile_.close(); + connection_.commit(); +connection_.close (); } } @@ -207,7 +215,7 @@ public void Var003() try { JDRSTest.position (rs_, null); rs_.updateFloat ("C_FLOAT", 6); - rs_.updateRow(); + rs_.updateRow(); /* exception */ failed ("Didn't throw SQLException"); } catch (Exception e) { @@ -507,7 +515,7 @@ public void Var017() { if (checkJdbc20 ()) { try { - JDRSTest.position (rs_, "DUMMY_ROW"); + JDRSTest.position (rs_, "DUMMY_UPDFLOAT"); rs_.deleteRow (); rs_.updateFloat ("C_FLOAT", 2892); failed ("Didn't throw SQLException"); @@ -1295,19 +1303,22 @@ public void Var048() public void dfpTest(String table, float value, String expected) { if (checkDecFloatSupport()) { + try { + Statement s = connection_.createStatement( ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); ResultSet rs = s .executeQuery("SELECT * FROM " + table + " FOR UPDATE "); rs.next(); rs.updateFloat(1, value); - rs.updateRow(); + rs.updateRow(); /* serialized */ ResultSet rs2 = statement2_.executeQuery("SELECT * FROM " + table); rs2.next(); String v = rs2.getString(1); rs2.close(); + rs.close(); s.close(); try { connection_.commit(); @@ -1318,13 +1329,16 @@ public void dfpTest(String table, float value, String expected) { "\n sb " + expected); } catch (Exception e) { failed(e, "Unexpected Exception"); + } } } public void dfpRoundTest(String roundingMode, String table, float value, String expected) { if (checkDecFloatSupport()) { + try { + String url = baseURL_ @@ -1338,17 +1352,20 @@ public void dfpRoundTest(String roundingMode, String table, float value, String .executeQuery("SELECT * FROM " + table + " FOR UPDATE "); rs.next(); rs.updateFloat(1, value); - rs.updateRow(); + rs.updateRow(); /* serialized */ ResultSet rs2 = statement2_.executeQuery("SELECT * FROM " + table); rs2.next(); String v = rs2.getString(1); rs2.close(); + rs.close(); s.close(); + connection.close(); assertCondition(v.equals(expected), "Got " + v + " sb " + expected +" from "+value); } catch (Exception e) { failed(e, "Unexpected Exception"); + } } } @@ -1356,135 +1373,135 @@ public void dfpRoundTest(String roundingMode, String table, float value, String /** * updateFloat -- set a DFP16 value (normal) */ - public void Var051 () { dfpTest(JDRSTest.RSTEST_DFP16, (float) 4533.43, "4533.43"); } + public void Var051 () { dfpTest(JDRSTest.RSTEST_UPDDFP16, (float) 4533.43, "4533.43"); } /** * updateFloat -- set a DFP16 value (Nan) */ - public void Var052 () { dfpTest(JDRSTest.RSTEST_DFP16, Float.NaN, "NaN"); } + public void Var052 () { dfpTest(JDRSTest.RSTEST_UPDDFP16, Float.NaN, "NaN"); } /** * updateFloat.-- set a DFP16 value (NEGATIVE_INFINITY) */ - public void Var053 () { dfpTest(JDRSTest.RSTEST_DFP16, Float.NEGATIVE_INFINITY, "-Infinity"); } + public void Var053 () { dfpTest(JDRSTest.RSTEST_UPDDFP16, Float.NEGATIVE_INFINITY, "-Infinity"); } /** * updateFloat -- set a DFP16 value (POSITIVE_INFINITY) */ - public void Var054 () { dfpTest(JDRSTest.RSTEST_DFP16, Float.POSITIVE_INFINITY, "Infinity"); } + public void Var054 () { dfpTest(JDRSTest.RSTEST_UPDDFP16, Float.POSITIVE_INFINITY, "Infinity"); } /** * updateFloat -- set a DFP16 value (MAX_VALUE) */ public void Var055 () { - dfpTest(JDRSTest.RSTEST_DFP16, Float.MAX_VALUE, "3.4028235E+38"); + dfpTest(JDRSTest.RSTEST_UPDDFP16, Float.MAX_VALUE, "3.4028235E+38"); } /** * updateFloat -- set a DFP16 value (MIN_VALUE) */ public void Var056 () { - dfpTest(JDRSTest.RSTEST_DFP16, Float.MIN_VALUE, "1.4E-45"); + dfpTest(JDRSTest.RSTEST_UPDDFP16, Float.MIN_VALUE, "1.4E-45"); } /** * updateFloat -- set a DFP16 positive with rounding mode "round half even" */ public void Var057 () { - dfpRoundTest("round half even", JDRSTest.RSTEST_DFP16, + dfpRoundTest("round half even", JDRSTest.RSTEST_UPDDFP16, 1.2345678901234545f, "1.2345679"); } - public void Var058 () { dfpRoundTest("round half even", JDRSTest.RSTEST_DFP16, + public void Var058 () { dfpRoundTest("round half even", JDRSTest.RSTEST_UPDDFP16, 1.2345678901234545f, "1.2345679"); } /** * updateFloat -- set a DFP16 negative with rounding mode "round half even" */ - public void Var059 () { dfpRoundTest("round half even", JDRSTest.RSTEST_DFP16, + public void Var059 () { dfpRoundTest("round half even", JDRSTest.RSTEST_UPDDFP16, -1.2345678901234555f, "-1.2345679"); } - public void Var060 () { dfpRoundTest("round half even", JDRSTest.RSTEST_DFP16, + public void Var060 () { dfpRoundTest("round half even", JDRSTest.RSTEST_UPDDFP16, -1.2345678901234545f, "-1.2345679"); } /** * updateFloat -- set a DFP16 positive with rounding mode "round half up" */ - public void Var061 () { dfpRoundTest("round half up", JDRSTest.RSTEST_DFP16, + public void Var061 () { dfpRoundTest("round half up", JDRSTest.RSTEST_UPDDFP16, 1.2345678901234555f, "1.2345679"); } - public void Var062 () { dfpRoundTest("round half up", JDRSTest.RSTEST_DFP16, + public void Var062 () { dfpRoundTest("round half up", JDRSTest.RSTEST_UPDDFP16, 1.2345678901234545f, "1.2345679"); } /** * updateFloat -- set a DFP16 negative with rounding mode "round half up" */ - public void Var063 () { dfpRoundTest("round half up", JDRSTest.RSTEST_DFP16, + public void Var063 () { dfpRoundTest("round half up", JDRSTest.RSTEST_UPDDFP16, -1.2345678901234555f, "-1.2345679"); } - public void Var064 () { dfpRoundTest("round half up", JDRSTest.RSTEST_DFP16, + public void Var064 () { dfpRoundTest("round half up", JDRSTest.RSTEST_UPDDFP16, -1.2345678901234545f, "-1.2345679"); } /** * updateFloat -- set a DFP16 positive with rounding mode "round down" */ - public void Var065 () { dfpRoundTest("round down", JDRSTest.RSTEST_DFP16, + public void Var065 () { dfpRoundTest("round down", JDRSTest.RSTEST_UPDDFP16, 1.2345678901234569f, "1.2345679"); } - public void Var066 () { dfpRoundTest("round down", JDRSTest.RSTEST_DFP16, + public void Var066 () { dfpRoundTest("round down", JDRSTest.RSTEST_UPDDFP16, 1.2345678901234561f, "1.2345679"); } /** * updateFloat -- set a DFP16 negative with rounding mode "round down" */ - public void Var067 () { dfpRoundTest("round down", JDRSTest.RSTEST_DFP16, + public void Var067 () { dfpRoundTest("round down", JDRSTest.RSTEST_UPDDFP16, -1.2345678901234569f, "-1.2345679"); } - public void Var068 () { dfpRoundTest("round down", JDRSTest.RSTEST_DFP16, + public void Var068 () { dfpRoundTest("round down", JDRSTest.RSTEST_UPDDFP16, -1.2345678901234561f, "-1.2345679"); } /** * updateFloat -- set a DFP16 positive with rounding mode "round ceiling" */ - public void Var069 () { dfpRoundTest("round ceiling", JDRSTest.RSTEST_DFP16, + public void Var069 () { dfpRoundTest("round ceiling", JDRSTest.RSTEST_UPDDFP16, 1.2345678901234555f, "1.2345679"); } - public void Var070 () { dfpRoundTest("round ceiling", JDRSTest.RSTEST_DFP16, + public void Var070 () { dfpRoundTest("round ceiling", JDRSTest.RSTEST_UPDDFP16, 1.2345678901234545f, "1.2345679"); } /** * updateFloat -- set a DFP16 negative with rounding mode "round ceiling" */ - public void Var071 () { dfpRoundTest("round ceiling", JDRSTest.RSTEST_DFP16, + public void Var071 () { dfpRoundTest("round ceiling", JDRSTest.RSTEST_UPDDFP16, -1.2345678901234555f, "-1.2345679"); } - public void Var072 () { dfpRoundTest("round ceiling", JDRSTest.RSTEST_DFP16, + public void Var072 () { dfpRoundTest("round ceiling", JDRSTest.RSTEST_UPDDFP16, -1.2345678901234545f, "-1.2345679"); } /** * updateFloat -- set a DFP16 positive with rounding mode "round floor" */ - public void Var073 () { dfpRoundTest("round floor", JDRSTest.RSTEST_DFP16, + public void Var073 () { dfpRoundTest("round floor", JDRSTest.RSTEST_UPDDFP16, 1.2345678901234555f, "1.2345679"); } - public void Var074 () { dfpRoundTest("round floor", JDRSTest.RSTEST_DFP16, + public void Var074 () { dfpRoundTest("round floor", JDRSTest.RSTEST_UPDDFP16, 1.2345678901234545f, "1.2345679"); } /** * updateFloat -- set a DFP16 negative with rounding mode "round floor" */ - public void Var075 () { dfpRoundTest("round floor", JDRSTest.RSTEST_DFP16, + public void Var075 () { dfpRoundTest("round floor", JDRSTest.RSTEST_UPDDFP16, -1.2345678901234555f, "-1.2345679"); } - public void Var076 () { dfpRoundTest("round floor", JDRSTest.RSTEST_DFP16, + public void Var076 () { dfpRoundTest("round floor", JDRSTest.RSTEST_UPDDFP16, -1.2345678901234545f, "-1.2345679"); } /** * updateFloat -- set a DFP16 positive with rounding mode "round half down" */ - public void Var077 () { dfpRoundTest("round half down", JDRSTest.RSTEST_DFP16, + public void Var077 () { dfpRoundTest("round half down", JDRSTest.RSTEST_UPDDFP16, 1.2345678901234555f, "1.2345679"); } - public void Var078 () { dfpRoundTest("round half down", JDRSTest.RSTEST_DFP16, + public void Var078 () { dfpRoundTest("round half down", JDRSTest.RSTEST_UPDDFP16, 1.2345678901234545f, "1.2345679"); } @@ -1492,159 +1509,159 @@ public void Var078 () { dfpRoundTest("round half down", JDRSTest.RSTEST_DFP16, /** * updateFloat -- set a DFP16 negative with rounding mode "round half down" */ - public void Var079 () { dfpRoundTest("round half down", JDRSTest.RSTEST_DFP16, + public void Var079 () { dfpRoundTest("round half down", JDRSTest.RSTEST_UPDDFP16, -1.2345678901234555f, "-1.2345679"); } - public void Var080 () { dfpRoundTest("round half down", JDRSTest.RSTEST_DFP16, + public void Var080 () { dfpRoundTest("round half down", JDRSTest.RSTEST_UPDDFP16, -1.2345678901234545f, "-1.2345679"); } /** * updateFloat -- set a DFP16 positive with rounding mode "round up" */ - public void Var081 () { dfpRoundTest("round up", JDRSTest.RSTEST_DFP16, + public void Var081 () { dfpRoundTest("round up", JDRSTest.RSTEST_UPDDFP16, 1.2345678901234555f, "1.2345679"); } - public void Var082 () { dfpRoundTest("round up", JDRSTest.RSTEST_DFP16, + public void Var082 () { dfpRoundTest("round up", JDRSTest.RSTEST_UPDDFP16, 1.2345678901234545f, "1.2345679"); } /** * updateFloat -- set a DFP16 negative with rounding mode "round up" */ - public void Var083 () { dfpRoundTest("round up", JDRSTest.RSTEST_DFP16, + public void Var083 () { dfpRoundTest("round up", JDRSTest.RSTEST_UPDDFP16, -1.2345678901234555f, "-1.2345679"); } - public void Var084 () { dfpRoundTest("round up", JDRSTest.RSTEST_DFP16, + public void Var084 () { dfpRoundTest("round up", JDRSTest.RSTEST_UPDDFP16, -1.2345678901234545f, "-1.2345679"); } /** * updateFloat -- set a DFP34 value (normal) */ - public void Var085 () { dfpTest(JDRSTest.RSTEST_DFP34, 4533.43f, "4533.43"); } + public void Var085 () { dfpTest(JDRSTest.RSTEST_UPDDFP34, 4533.43f, "4533.43"); } /** * updateFloat -- set a DFP34 value (Nan) */ - public void Var086 () { dfpTest(JDRSTest.RSTEST_DFP34, Float.NaN, "NaN"); } + public void Var086 () { dfpTest(JDRSTest.RSTEST_UPDDFP34, Float.NaN, "NaN"); } /** * updateFloat -- set a DFP34 value (NEGATIVE_INFINITY) */ - public void Var087 () { dfpTest(JDRSTest.RSTEST_DFP34, Float.NEGATIVE_INFINITY, "-Infinity"); } + public void Var087 () { dfpTest(JDRSTest.RSTEST_UPDDFP34, Float.NEGATIVE_INFINITY, "-Infinity"); } /** * updateFloat -- set a DFP34 value (POSITIVE_INFINITY) */ - public void Var088 () { dfpTest(JDRSTest.RSTEST_DFP34, Float.POSITIVE_INFINITY, "Infinity"); } + public void Var088 () { dfpTest(JDRSTest.RSTEST_UPDDFP34, Float.POSITIVE_INFINITY, "Infinity"); } /** * updateFloat -- set a DFP34 value (MAX_VALUE) */ public void Var089 () { - dfpTest(JDRSTest.RSTEST_DFP34, Float.MAX_VALUE, "3.4028235E+38"); + dfpTest(JDRSTest.RSTEST_UPDDFP34, Float.MAX_VALUE, "3.4028235E+38"); } /** * updateFloat -- set a DFP34 value (MIN_VALUE) */ public void Var090 () { - dfpTest(JDRSTest.RSTEST_DFP34, Float.MIN_VALUE, "1.4E-45"); + dfpTest(JDRSTest.RSTEST_UPDDFP34, Float.MIN_VALUE, "1.4E-45"); } /** * updateFloat -- set a DFP34 positive with rounding mode "round half even" */ - public void Var091 () { dfpRoundTest("round half even", JDRSTest.RSTEST_DFP34, + public void Var091 () { dfpRoundTest("round half even", JDRSTest.RSTEST_UPDDFP34, 1.2345678901234555f, "1.2345679"); } - public void Var092 () { dfpRoundTest("round half even", JDRSTest.RSTEST_DFP34, + public void Var092 () { dfpRoundTest("round half even", JDRSTest.RSTEST_UPDDFP34, 1.2345678901234545f, "1.2345679"); } /** * updateFloat -- set a DFP34 negative with rounding mode "round half even" */ - public void Var093 () { dfpRoundTest("round half even", JDRSTest.RSTEST_DFP34, + public void Var093 () { dfpRoundTest("round half even", JDRSTest.RSTEST_UPDDFP34, -1.2345678901234555f, "-1.2345679"); } - public void Var094 () { dfpRoundTest("round half even", JDRSTest.RSTEST_DFP34, + public void Var094 () { dfpRoundTest("round half even", JDRSTest.RSTEST_UPDDFP34, -1.2345678901234545f, "-1.2345679"); } /** * updateFloat -- set a DFP34 positive with rounding mode "round half up" */ - public void Var095 () { dfpRoundTest("round half up", JDRSTest.RSTEST_DFP34, + public void Var095 () { dfpRoundTest("round half up", JDRSTest.RSTEST_UPDDFP34, 1.2345678901234555f, "1.2345679"); } - public void Var096 () { dfpRoundTest("round half up", JDRSTest.RSTEST_DFP34, + public void Var096 () { dfpRoundTest("round half up", JDRSTest.RSTEST_UPDDFP34, 1.2345678901234545f, "1.2345679"); } /** * updateFloat -- set a DFP34 negative with rounding mode "round half up" */ - public void Var097 () { dfpRoundTest("round half up", JDRSTest.RSTEST_DFP34, + public void Var097 () { dfpRoundTest("round half up", JDRSTest.RSTEST_UPDDFP34, -1.2345678901234555f, "-1.2345679"); } - public void Var098 () { dfpRoundTest("round half up", JDRSTest.RSTEST_DFP34, + public void Var098 () { dfpRoundTest("round half up", JDRSTest.RSTEST_UPDDFP34, -1.2345678901234545f, "-1.2345679"); } /** * updateFloat -- set a DFP34 positive with rounding mode "round down" */ - public void Var099 () { dfpRoundTest("round down", JDRSTest.RSTEST_DFP34, + public void Var099 () { dfpRoundTest("round down", JDRSTest.RSTEST_UPDDFP34, 1.2345678901234569f, "1.2345679"); } - public void Var100 () { dfpRoundTest("round down", JDRSTest.RSTEST_DFP34, + public void Var100 () { dfpRoundTest("round down", JDRSTest.RSTEST_UPDDFP34, 1.2345678901234561f, "1.2345679"); } /** * updateFloat -- set a DFP34 negative with rounding mode "round down" */ - public void Var101 () { dfpRoundTest("round down", JDRSTest.RSTEST_DFP34, + public void Var101 () { dfpRoundTest("round down", JDRSTest.RSTEST_UPDDFP34, -1.2345678901234569f, "-1.2345679"); } - public void Var102 () { dfpRoundTest("round down", JDRSTest.RSTEST_DFP34, + public void Var102 () { dfpRoundTest("round down", JDRSTest.RSTEST_UPDDFP34, -1.2345678901234561f, "-1.2345679"); } /** * updateFloat -- set a DFP34 positive with rounding mode "round ceiling" */ - public void Var103 () { dfpRoundTest("round ceiling", JDRSTest.RSTEST_DFP34, + public void Var103 () { dfpRoundTest("round ceiling", JDRSTest.RSTEST_UPDDFP34, 1.2345678901234555f, "1.2345679"); } - public void Var104 () { dfpRoundTest("round ceiling", JDRSTest.RSTEST_DFP34, + public void Var104 () { dfpRoundTest("round ceiling", JDRSTest.RSTEST_UPDDFP34, 1.2345678901234545f, "1.2345679"); } /** * updateFloat -- set a DFP34 negative with rounding mode "round ceiling" */ - public void Var105 () { dfpRoundTest("round ceiling", JDRSTest.RSTEST_DFP34, + public void Var105 () { dfpRoundTest("round ceiling", JDRSTest.RSTEST_UPDDFP34, -1.2345678901234555f, "-1.2345679"); } - public void Var106 () { dfpRoundTest("round ceiling", JDRSTest.RSTEST_DFP34, + public void Var106 () { dfpRoundTest("round ceiling", JDRSTest.RSTEST_UPDDFP34, -1.2345678901234545f, "-1.2345679"); } /** * updateFloat -- set a DFP34 positive with rounding mode "round floor" */ - public void Var107 () { dfpRoundTest("round floor", JDRSTest.RSTEST_DFP34, + public void Var107 () { dfpRoundTest("round floor", JDRSTest.RSTEST_UPDDFP34, 1.2345678901234555f, "1.2345679"); } - public void Var108 () { dfpRoundTest("round floor", JDRSTest.RSTEST_DFP34, + public void Var108 () { dfpRoundTest("round floor", JDRSTest.RSTEST_UPDDFP34, 1.2345678901234545f, "1.2345679"); } /** * updateFloat -- set a DFP34 negative with rounding mode "round floor" */ - public void Var109 () { dfpRoundTest("round floor", JDRSTest.RSTEST_DFP34, + public void Var109 () { dfpRoundTest("round floor", JDRSTest.RSTEST_UPDDFP34, -1.2345678901234555f, "-1.2345679"); } - public void Var110 () { dfpRoundTest("round floor", JDRSTest.RSTEST_DFP34, + public void Var110 () { dfpRoundTest("round floor", JDRSTest.RSTEST_UPDDFP34, -1.2345678901234545f, "-1.2345679"); } /** * updateFloat -- set a DFP34 positive with rounding mode "round half down" */ - public void Var111 () { dfpRoundTest("round half down", JDRSTest.RSTEST_DFP34, + public void Var111 () { dfpRoundTest("round half down", JDRSTest.RSTEST_UPDDFP34, 1.2345678901234555f, "1.2345679"); } - public void Var112 () { dfpRoundTest("round half down", JDRSTest.RSTEST_DFP34, + public void Var112 () { dfpRoundTest("round half down", JDRSTest.RSTEST_UPDDFP34, 1.2345678901234545f, "1.2345679"); } @@ -1652,27 +1669,27 @@ public void Var112 () { dfpRoundTest("round half down", JDRSTest.RSTEST_DFP34, /** * updateFloat -- set a DFP34 negative with rounding mode "round half down" */ - public void Var113 () { dfpRoundTest("round half down", JDRSTest.RSTEST_DFP34, + public void Var113 () { dfpRoundTest("round half down", JDRSTest.RSTEST_UPDDFP34, -1.2345678901234555f, "-1.2345679"); } - public void Var114 () { dfpRoundTest("round half down", JDRSTest.RSTEST_DFP34, + public void Var114 () { dfpRoundTest("round half down", JDRSTest.RSTEST_UPDDFP34, -1.2345678901234545f, "-1.2345679"); } /** * updateFloat -- set a DFP34 positive with rounding mode "round up" */ - public void Var115 () { dfpRoundTest("round up", JDRSTest.RSTEST_DFP34, + public void Var115 () { dfpRoundTest("round up", JDRSTest.RSTEST_UPDDFP34, 1.2345678901234555f, "1.2345679"); } - public void Var116 () { dfpRoundTest("round up", JDRSTest.RSTEST_DFP34, + public void Var116 () { dfpRoundTest("round up", JDRSTest.RSTEST_UPDDFP34, 1.2345678901234545f, "1.2345679"); } /** * updateFloat -- set a DFP34 negative with rounding mode "round up" */ - public void Var117 () { dfpRoundTest("round up", JDRSTest.RSTEST_DFP34, + public void Var117 () { dfpRoundTest("round up", JDRSTest.RSTEST_UPDDFP34, -1.2345678901234555f, "-1.2345679"); } - public void Var118 () { dfpRoundTest("round up", JDRSTest.RSTEST_DFP34, + public void Var118 () { dfpRoundTest("round up", JDRSTest.RSTEST_UPDDFP34, -1.2345678901234545f, "-1.2345679"); } /** diff --git a/src/test/JD/RS/JDRSUpdateInt.java b/src/test/JD/RS/JDRSUpdateInt.java index 23e39c94..84ccf606 100644 --- a/src/test/JD/RS/JDRSUpdateInt.java +++ b/src/test/JD/RS/JDRSUpdateInt.java @@ -19,6 +19,7 @@ import java.sql.Connection; import java.sql.DataTruncation; import java.sql.ResultSet; +import java.sql.SQLException; import java.sql.Statement; import java.util.Hashtable; import java.util.Vector; @@ -28,6 +29,7 @@ import test.JDRSTest; import test.JDTestDriver; import test.JDTestcase; +import test.JD.JDSerializeFile; @@ -62,6 +64,7 @@ public static void main(String args[]) throws Exception { private Statement statement_; private Statement statement2_; private ResultSet rs_; + private JDSerializeFile serializeUpdateFile_; @@ -102,13 +105,16 @@ protected void setup () + ";data truncation=true"; connection_ = testDriver_.getConnection (url,systemObject_.getUserId(), encryptedPassword_); connection_.setAutoCommit(false); // @C1A + serializeUpdateFile_ = new JDSerializeFile(connection_, JDRSTest.RSTEST_UPDATE); + connection_.commit(); + statement_ = connection_.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); statement2_ = connection_.createStatement (ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); statement_.executeUpdate ("INSERT INTO " + JDRSTest.RSTEST_UPDATE - + " (C_KEY) VALUES ('DUMMY_ROW')"); + + " (C_KEY) VALUES ('DUMMY_UPDINT')"); statement_.executeUpdate ("INSERT INTO " + JDRSTest.RSTEST_UPDATE + " (C_KEY) VALUES ('" + key_ + "')"); @@ -130,6 +136,8 @@ protected void cleanup () rs_.close (); statement_.close (); connection_.commit(); // @C1A + serializeUpdateFile_.close(); + connection_.commit(); connection_.close (); } } @@ -195,7 +203,7 @@ public void Var003() try { JDRSTest.position (rs_, null); rs_.updateInt ("C_INTEGER", 6); - rs_.updateRow(); + rs_.updateRow(); /* exception */ failed ("Didn't throw SQLException"); } catch (Exception e) { @@ -495,7 +503,7 @@ public void Var017() { if (checkJdbc20 ()) { try { - JDRSTest.position (rs_, "DUMMY_ROW"); + JDRSTest.position (rs_, "DUMMY_UPDINT"); rs_.deleteRow (); rs_.updateInt ("C_INTEGER", 2892); failed ("Didn't throw SQLException"); @@ -1089,6 +1097,7 @@ public void Var041() public void dfpTest(String table, int value, String expected) { if (checkDecFloatSupport()) { + try { Statement s = connection_.createStatement( ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); @@ -1096,12 +1105,13 @@ public void dfpTest(String table, int value, String expected) { .executeQuery("SELECT * FROM " + table + " FOR UPDATE "); rs.next(); rs.updateInt(1, value); - rs.updateRow(); + rs.updateRow(); /* serialized */ ResultSet rs2 = statement2_.executeQuery("SELECT * FROM " + table); rs2.next(); String v = rs2.getString(1); rs2.close(); + rs.close(); s.close(); try { connection_.commit(); @@ -1109,6 +1119,7 @@ public void dfpTest(String table, int value, String expected) { assertCondition(v.equals(expected), "Got " + v + " sb " + expected); } catch (Exception e) { failed(e, "Unexpected Exception"); + } } } @@ -1117,12 +1128,12 @@ public void dfpTest(String table, int value, String expected) { /** * updateInt -- set a DFP16 value */ - public void Var042 () { dfpTest(JDRSTest.RSTEST_DFP16, 123456789, "123456789"); } + public void Var042 () { dfpTest(JDRSTest.RSTEST_UPDDFP16, 123456789, "123456789"); } /** * updateInt -- set a DFP16 value */ - public void Var043 () { dfpTest(JDRSTest.RSTEST_DFP34, 123456789, "123456789"); } + public void Var043 () { dfpTest(JDRSTest.RSTEST_UPDDFP34, 123456789, "123456789"); } /** * Check updating cursor via DRDA. See CLI PTF SE69885 @@ -1158,7 +1169,7 @@ public void Var044() { rs.next(); rs.updateInt(1, 99); sb.append("Updating row\n"); - rs.updateRow(); + rs.updateRow(); /* unique file */ rs.close(); c.commit(); @@ -1207,7 +1218,7 @@ public void Var045() { rs.next(); rs.updateInt(1, 99); sb.append("Updating row\n"); - rs.updateRow(); + rs.updateRow(); /* unique file */ rs.close(); connection_.commit(); diff --git a/src/test/JD/RS/JDRSUpdateLong.java b/src/test/JD/RS/JDRSUpdateLong.java index 7c0a733f..ad704549 100644 --- a/src/test/JD/RS/JDRSUpdateLong.java +++ b/src/test/JD/RS/JDRSUpdateLong.java @@ -18,6 +18,7 @@ import java.math.BigDecimal; import java.sql.DataTruncation; import java.sql.ResultSet; +import java.sql.SQLException; import java.sql.Statement; import java.util.Hashtable; import java.util.Vector; @@ -27,6 +28,7 @@ import test.JDRSTest; import test.JDTestDriver; import test.JDTestcase; +import test.JD.JDSerializeFile; @@ -61,6 +63,7 @@ public static void main(String args[]) throws Exception { private Statement statement_; private Statement statement2_; private ResultSet rs_; + private JDSerializeFile serializeUpdateFile_; @@ -101,13 +104,16 @@ protected void setup () + ";data truncation=true"; connection_ = testDriver_.getConnection (url,systemObject_.getUserId(), encryptedPassword_); connection_.setAutoCommit(false); // @C1A + serializeUpdateFile_ = new JDSerializeFile(connection_, JDRSTest.RSTEST_UPDATE); + connection_.commit(); + statement_ = connection_.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); statement2_ = connection_.createStatement (ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); statement_.executeUpdate ("INSERT INTO " + JDRSTest.RSTEST_UPDATE - + " (C_KEY) VALUES ('DUMMY_ROW')"); + + " (C_KEY) VALUES ('DUMMY_UPDLONG')"); statement_.executeUpdate ("INSERT INTO " + JDRSTest.RSTEST_UPDATE + " (C_KEY) VALUES ('" + key_ + "')"); @@ -129,6 +135,8 @@ protected void cleanup () rs_.close (); statement_.close (); connection_.commit(); // @C1A + serializeUpdateFile_.close(); + connection_.commit(); connection_.close (); } } @@ -194,7 +202,7 @@ public void Var003() try { JDRSTest.position (rs_, null); rs_.updateLong ("C_INTEGER", 6); - rs_.updateRow(); + rs_.updateRow(); /* exception */ failed ("Didn't throw SQLException"); } catch (Exception e) { @@ -494,7 +502,7 @@ public void Var017() { if (checkJdbc20 ()) { try { - JDRSTest.position (rs_, "DUMMY_ROW"); + JDRSTest.position (rs_, "DUMMY_UPDLONG"); rs_.deleteRow (); rs_.updateLong ("C_INTEGER", 2892); failed ("Didn't throw SQLException"); @@ -1119,6 +1127,7 @@ public void Var042() public void dfpTest(String table, long value, String expected) { if (checkDecFloatSupport()) { + try { Statement s = connection_.createStatement( ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); @@ -1126,7 +1135,7 @@ public void dfpTest(String table, long value, String expected) { .executeQuery("SELECT * FROM " + table + " FOR UPDATE "); rs.next(); rs.updateLong(1, value); - rs.updateRow(); + rs.updateRow(); /* serialized */ ResultSet rs2 = statement2_.executeQuery("SELECT * FROM " + table); rs2.next(); @@ -1139,20 +1148,20 @@ public void dfpTest(String table, long value, String expected) { assertCondition(v.equals(expected), "Got " + v + " sb " + expected); } catch (Exception e) { failed(e, "Unexpected Exception"); - } + } } - + } /** * updateInt -- set a DFP16 value */ - public void Var043 () { dfpTest(JDRSTest.RSTEST_DFP16, 123456789l, "123456789"); } + public void Var043 () { dfpTest(JDRSTest.RSTEST_UPDDFP16, 123456789l, "123456789"); } /** * updateInt -- set a DFP16 value */ - public void Var044 () { dfpTest(JDRSTest.RSTEST_DFP34, 123456789l, "123456789"); } + public void Var044 () { dfpTest(JDRSTest.RSTEST_UPDDFP34, 123456789l, "123456789"); } /** diff --git a/src/test/JD/RS/JDRSUpdateNCharacterStream.java b/src/test/JD/RS/JDRSUpdateNCharacterStream.java index 1ef86acb..11ec80c9 100644 --- a/src/test/JD/RS/JDRSUpdateNCharacterStream.java +++ b/src/test/JD/RS/JDRSUpdateNCharacterStream.java @@ -11,7 +11,6 @@ // /////////////////////////////////////////////////////////////////////////////// - package test.JD.RS; import java.io.FileOutputStream; @@ -35,2254 +34,1690 @@ import test.JDReflectionUtil; import test.JDTestDriver; import test.JDTestcase; +import test.JD.JDSerializeFile; import test.JD.JDWeirdReader; - - /** -Testcase JDRSUpdateNCharacterStream. This tests the following method -of the JDBC ResultSet class: - -
    -
  • updateNCharacterStream() -
-**/ -public class JDRSUpdateNCharacterStream -extends JDTestcase -{ + * Testcase JDRSUpdateNCharacterStream. This tests the following method of the + * JDBC ResultSet class: + * + *
    + *
  • updateNCharacterStream() + *
+ **/ +public class JDRSUpdateNCharacterStream extends JDTestcase { public static void main(String args[]) throws Exception { - String[] newArgs = new String[args.length+2]; - newArgs[0] = "-tc"; - newArgs[1] = "JDRSUpdateNCharacterStream"; - for (int i = 0; i < args.length; i++) { - newArgs[2+i]=args[i]; - } - test.JDRSTest.main(newArgs); - } + String[] newArgs = new String[args.length + 2]; + newArgs[0] = "-tc"; + newArgs[1] = "JDRSUpdateNCharacterStream"; + for (int i = 0; i < args.length; i++) { + newArgs[2 + i] = args[i]; + } + test.JDRSTest.main(newArgs); + } + // Private data. + private static final String key_ = "JDRSUpdateNCharacterStream"; + private static String select_ = "SELECT * FROM " + JDRSTest.RSTEST_UPDATE; + private Statement statement_; + private Statement statement2_; + private ResultSet rs_; + private JDSerializeFile serializeUpdateFile_; - // Private data. - private static final String key_ = "JDRSUpdateNCharacterStream"; - private static String select_ = "SELECT * FROM " - + JDRSTest.RSTEST_UPDATE; + /** + * Constructor. + **/ + public JDRSUpdateNCharacterStream(AS400 systemObject, Hashtable> namesAndVars, int runMode, + FileOutputStream fileOutputStream, - private Statement statement_; - private Statement statement2_; - private ResultSet rs_; + String password) { + super(systemObject, "JDRSUpdateNCharacterStream", namesAndVars, runMode, fileOutputStream, password); + } + /** + * Performs setup needed before running variations. + * + * @exception Exception If an exception occurs. + **/ + protected void setup() throws Exception { + if (connection_ != null) + connection_.close(); + select_ = "SELECT * FROM " + JDRSTest.RSTEST_UPDATE; + if (isJdbc40()) { + String url = baseURL_ - /** - Constructor. - **/ - public JDRSUpdateNCharacterStream (AS400 systemObject, - Hashtable> namesAndVars, - int runMode, - FileOutputStream fileOutputStream, - - String password) - { - super (systemObject, "JDRSUpdateNCharacterStream", - namesAndVars, runMode, fileOutputStream, - password); - } + + ";date format=iso" + ";data truncation=true"; + connection_ = testDriver_.getConnection(url, systemObject_.getUserId(), encryptedPassword_); + connection_.setAutoCommit(false); // @C1A + serializeUpdateFile_ = new JDSerializeFile(connection_, JDRSTest.RSTEST_UPDATE); + connection_.commit(); + statement_ = connection_.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); + statement2_ = connection_.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); + statement_.executeUpdate("INSERT INTO " + JDRSTest.RSTEST_UPDATE + " (C_KEY) VALUES ('DUMMY_UPDNCS')"); + statement_.executeUpdate("INSERT INTO " + JDRSTest.RSTEST_UPDATE + " (C_KEY) VALUES ('" + key_ + "')"); - /** - Performs setup needed before running variations. - - @exception Exception If an exception occurs. - **/ - protected void setup () - throws Exception - { - if (connection_ != null) connection_.close(); - select_ = "SELECT * FROM " + JDRSTest.RSTEST_UPDATE; - - if(isJdbc40 ()) - { - String url = baseURL_ - - - + ";date format=iso" - + ";data truncation=true"; - connection_ = testDriver_.getConnection (url,systemObject_.getUserId(), encryptedPassword_); - connection_.setAutoCommit(false); // @C1A - statement_ = connection_.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, - ResultSet.CONCUR_UPDATABLE); - statement2_ = connection_.createStatement (ResultSet.TYPE_SCROLL_INSENSITIVE, - ResultSet.CONCUR_READ_ONLY); - - statement_.executeUpdate ("INSERT INTO " + JDRSTest.RSTEST_UPDATE - + " (C_KEY) VALUES ('DUMMY_ROW')"); - statement_.executeUpdate ("INSERT INTO " + JDRSTest.RSTEST_UPDATE - + " (C_KEY) VALUES ('" + key_ + "')"); - - rs_ = statement_.executeQuery (select_ + " FOR UPDATE"); - } + rs_ = statement_.executeQuery(select_ + " FOR UPDATE"); } + } + /** + * Performs cleanup needed after running variations. + * + * @exception Exception If an exception occurs. + **/ + protected void cleanup() throws Exception { + if (isJdbc40()) { + rs_.close(); + statement_.close(); + connection_.commit(); // @C1A + serializeUpdateFile_.close(); + connection_.commit(); + connection_.close(); + } + } + /** + * updateNCharacterStream() - Should throw exception when the result set is + * closed. + **/ + public void Var001() { + if (checkJdbc40()) { + try { + Statement s = connection_.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); + ResultSet rs = s.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_UPDATE + " FOR UPDATE"); + rs.next(); + rs.close(); + s.close(); + JDReflectionUtil.callMethod_V(rs, "updateNCharacterStream", "C_VARCHAR_50", new StringReader("Juneau"), 6L); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } + } + } - /** - Performs cleanup needed after running variations. - - @exception Exception If an exception occurs. - **/ - protected void cleanup () - throws Exception - { - if(isJdbc40 ()) - { - rs_.close (); - statement_.close (); - connection_.commit(); // @C1A - connection_.close (); - } + /** + * updateNCharacterStream() - Should throw exception when the result set is not + * updatable. + **/ + public void Var002() { + if (checkJdbc40()) { + try { + Statement s = connection_.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); + ResultSet rs = s.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_UPDATE); + rs.next(); + JDReflectionUtil.callMethod_V(rs, "updateNCharacterStream", "C_VARCHAR_50", new StringReader("Tacoma"), 6L); + rs.close(); + s.close(); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } + } + /** + * updateNCharacterStream() - Should throw exception when cursor is not pointing + * to a row. + **/ + public void Var003() { + if (checkJdbc40()) { + try { + JDRSTest.position(rs_, null); + JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_VARCHAR_50", new StringReader("Portland"), 8L); + rs_.updateRow(); /* exception */ + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } + } + } + /** + * updateNCharacterStream() - Should throw an exception when the column is an + * invalid index. + **/ + public void Var004() { + if (checkJdbc40()) { + try { + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", 100, new StringReader("San Francisco"), 13L); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } + } + } - /** - updateNCharacterStream() - Should throw exception when the result set is - closed. - **/ - public void Var001() - { - if(checkJdbc40 ()) - { - try - { - Statement s = connection_.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, - ResultSet.CONCUR_UPDATABLE); - ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_UPDATE + " FOR UPDATE"); - rs.next (); - rs.close (); - JDReflectionUtil.callMethod_V(rs, "updateNCharacterStream", "C_VARCHAR_50", new StringReader ("Juneau"), 6L); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + /** + * updateNCharacterStream() - Should throw an exception when the column is 0. + **/ + public void Var005() { + if (checkJdbc40()) { + try { + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", 0, new StringReader("Boise"), 5L); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } + } + /** + * updateNCharacterStream() - Should throw an exception when the column is -1. + **/ + public void Var006() { + if (checkJdbc40()) { + try { + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", -1, new StringReader("Helena"), 6L); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } + } + } + /** + * updateNCharacterStream() - Should work when the column index is valid. + **/ + public void Var007() { + if (checkJdbc40()) { + try { + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", 14, new StringReader("Fargo"), 5L); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + String v = rs2.getString("C_VARCHAR_50"); + rs2.close(); + assertCondition(v.equals("Fargo")); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } - /** - updateNCharacterStream() - Should throw exception when the result set is - not updatable. - **/ - public void Var002() - { - if(checkJdbc40 ()) - { - try - { - Statement s = connection_.createStatement (ResultSet.TYPE_SCROLL_INSENSITIVE, - ResultSet.CONCUR_READ_ONLY); - ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_UPDATE); - rs.next (); - JDReflectionUtil.callMethod_V(rs, "updateNCharacterStream", "C_VARCHAR_50", new StringReader ("Tacoma"), 6L); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } + /** + * updateNCharacterStream() - Should throw an exception when the column name is + * null. + **/ + public void Var008() { + if (checkJdbc40()) { + if (getDriver() == JDTestDriver.DRIVER_JCC) { + notApplicable("JCC throws null pointer exception when column name is null "); + } else { + try { + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", null, new StringReader("Sioux Falls"), 11L); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); } + } } + } + /** + * updateNCharacterStream() - Should throw an exception when the column name is + * an empty string. + **/ + public void Var009() { + if (checkJdbc40()) { + try { + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "", new StringReader("Lincoln"), 7L); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } + } + } + /** + * updateNCharacterStream() - Should throw an exception when the column name is + * invalid. + **/ + public void Var010() { + if (checkJdbc40()) { + try { + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "INVALID", new StringReader("Colorado Springs"), + 16L); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } + } + } - /** - updateNCharacterStream() - Should throw exception when cursor is not pointing - to a row. - **/ - public void Var003() - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, null); - JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_VARCHAR_50", new StringReader ("Portland"), 8L); - rs_.updateRow(); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + /** + * updateNCharacterStream() - Should work when the column name is valid. + **/ + public void Var011() { + if (checkJdbc40()) { + try { + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_VARCHAR_50", new StringReader("Gillette"), 8L); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + String v = rs2.getString("C_VARCHAR_50"); + rs2.close(); + assertCondition(v.equals("Gillette")); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } } + } + /** + * updateNCharacterStream() - Should update to SQL NULL when the column value is + * null. + **/ + public void Var012() { + if (checkJdbc40()) { + try { + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_VARCHAR_50", null, 0L); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + String v = rs2.getString("C_VARCHAR_50"); + boolean wn = rs2.wasNull(); + rs2.close(); + assertCondition((v == null) && (wn == true)); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + /** + * updateNCharacterStream() - Should throw an exception when the length is + * invalid. + **/ + public void Var013() { + if (checkJdbc40()) { + try { + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_VARCHAR_50", new StringReader("Reno"), -1L); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } + } + } - /** - updateNCharacterStream() - Should throw an exception when the column - is an invalid index. - **/ - public void Var004() - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", 100, new StringReader ("San Francisco"), 13L); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + /** + * updateNCharacterStream() - Should be reflected by get, even if update has not + * yet been issued (i.e. update is still pending). + **/ + public void Var014() { + if (checkJdbc40()) { + try { + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_VARCHAR_50", new StringReader("Santa Fe"), 8L); + assertCondition(rs_.getString("C_VARCHAR_50").equals("Santa Fe")); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } } + } + /** + * updateNCharacterStream() - Should be reflected by get, after update has been + * issued, but cursor has not been repositioned. + **/ + public void Var015() { + if (checkJdbc40()) { + try { + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_VARCHAR_50", new StringReader("Phoenix"), 7L); + rs_.updateRow(); + assertCondition(rs_.getString("C_VARCHAR_50").equals("Phoenix")); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + /** + * updateNCharacterStream() - Should be reflected by get, after update has been + * issued and cursor has been repositioned. + **/ + public void Var016() { + if (checkJdbc40()) { + try { + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_VARCHAR_50", new StringReader("Austin"), 6L); + rs_.updateRow(); + rs_.beforeFirst(); + JDRSTest.position(rs_, key_); + String v = rs_.getString("C_VARCHAR_50"); + assertCondition(v.equals("Austin")); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } - /** - updateNCharacterStream() - Should throw an exception when the column - is 0. - **/ - public void Var005() - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", 0, new StringReader ("Boise"), 5L); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + /** + * updateNCharacterStream() - Should work when the current row is the insert + * row. + **/ + public void Var017() { + if (checkJdbc40()) { + try { + rs_.moveToInsertRow(); + rs_.updateString("C_KEY", "JDRSCharacterStream 1"); + JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_VARCHAR_50", new StringReader("Tulsa"), 5L); + rs_.insertRow(); + JDRSTest.position(rs_, "JDRSCharacterStream 1"); + assertCondition(rs_.getString("C_VARCHAR_50").equals("Tulsa")); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } } + } + /** + * updateNCharacterStream() - Should be reflected by get on insert row, even if + * insert has not yet been issued (i.e. insert is still pending). + **/ + public void Var018() { + if (checkJdbc40()) { + try { + rs_.moveToInsertRow(); + JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_VARCHAR_50", new StringReader("Lawrence"), 8L); + assertCondition(rs_.getString("C_VARCHAR_50").equals("Lawrence")); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + /** + * updateNCharacterStream() - Should throw an exception on a deleted row. + **/ + public void Var019() { + if (checkJdbc40()) { + try { + JDRSTest.position(rs_, "DUMMY_UPDNCS"); + rs_.deleteRow(); + JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_VARCHAR_50", new StringReader("Ames"), 4L); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } + } + } - /** - updateNCharacterStream() - Should throw an exception when the column - is -1. - **/ - public void Var006() - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", -1, new StringReader ("Helena"), 6L); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + /** + * updateNCharacterStream() - Update a SMALLINT. + **/ + public void Var020() { + if (checkJdbc40()) { + try { + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_SMALLINT", new StringReader("31"), 2L); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + short v = rs2.getShort("C_SMALLINT"); + rs2.close(); + assertCondition(v == 31); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } } + } + /** + * updateNCharacterStream() - Update a SMALLINT, when the integer is too big. + **/ + public void Var021() { + if (checkJdbc40()) { + try { + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_SMALLINT", new StringReader("224323"), 6L); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } + } + } + /** + * updateNCharacterStream() - Update a SMALLINT, when the string is not a + * number. + **/ + public void Var022() { + if (checkJdbc40()) { + try { + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_SMALLINT", new StringReader("Van Buren"), 9L); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } + } + } - /** - updateNCharacterStream() - Should work when the column index is valid. - **/ - public void Var007() - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", 14, new StringReader ("Fargo"), 5L); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - String v = rs2.getString ("C_VARCHAR_50"); - rs2.close (); - assertCondition (v.equals ("Fargo")); - } - catch(Exception e) - { - failed (e, "Unexpected Exception"); - } - } + /** + * updateNCharacterStream() - Update an INTEGER. + **/ + public void Var023() { + if (checkJdbc40()) { + try { + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_INTEGER", new StringReader("-12374"), 6L); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + int v = rs2.getInt("C_INTEGER"); + rs2.close(); + assertCondition(v == -12374); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } } + } + /** + * updateNCharacterStream() - Update an INTEGER, when the integer is too big. + **/ + public void Var024() { + if (checkJdbc40()) { + try { + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_INTEGER", new StringReader("435353487623"), + 12L); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } + } + } + /** + * updateNCharacterStream() - Update an INTEGER, when the string is not a + * number. + **/ + public void Var025() { + if (checkJdbc40()) { + try { + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_INTEGER", new StringReader("Baton Rouge"), 11L); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } + } + } - /** - updateNCharacterStream() - Should throw an exception when the column - name is null. - **/ - public void Var008() - { - if(checkJdbc40 ()) - { - if (getDriver() == JDTestDriver.DRIVER_JCC) { - notApplicable("JCC throws null pointer exception when column name is null "); - } else { - try - { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", null, new StringReader ("Sioux Falls"), 11L); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + /** + * updateNCharacterStream() - Update a REAL. + **/ + public void Var026() { + if (checkJdbc40()) { + try { + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_REAL", new StringReader("13.35"), 5L); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + float v = rs2.getFloat("C_REAL"); + rs2.close(); + assertCondition(v == 13.35f); + } catch (Exception e) { + failed(e, "Unexpected Exception"); } } + } + /** + * updateNCharacterStream() - Update a REAL, when the number is too big. + * + * Note: Given the new data truncation rules for JDBC, this testcase is expected + * to work without throwing a DataTruncation exception. + **/ + public void Var027() { + if (checkJdbc40()) { + try { + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_REAL", new StringReader("453433335.4437623"), + 17L); + rs_.updateRow(); + + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + float v = rs2.getFloat("C_REAL"); + rs2.close(); + // Does anyone have a good suggestion for what should be done here? + assertCondition(true, "" + v); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + /* + * failed ("Didn't throw SQLException"); } catch (Exception e) { DataTruncation + * dt = (DataTruncation)e; assertCondition ((dt.getIndex() == expectedColumn) && + * (dt.getParameter() == false) && (dt.getRead() == false) && (dt.getDataSize() + * == 15) && (dt.getTransferSize() == 10)); + * + * } } + */ + } - /** - updateNCharacterStream() - Should throw an exception when the column - name is an empty string. - **/ - public void Var009() - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "", new StringReader ("Lincoln"), 7L); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + /** + * updateNCharacterStream() - Update a REAL, when the string is not a number. + **/ + public void Var028() { + if (checkJdbc40()) { + try { + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_INTEGER", new StringReader("Edina"), 5L); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } + } + /** + * updateNCharacterStream() - Update a FLOAT. + **/ + public void Var029() { + if (checkJdbc40()) { + try { + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_FLOAT", new StringReader("9835.2"), 6L); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + float v = rs2.getFloat("C_FLOAT"); + rs2.close(); + assertCondition(v == 9835.2f); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + /** + * updateNCharacterStream() - Update a FLOAT, when the number is too big. + * + * Note: Given the new data truncation rules for JDBC, this testcase is expected + * to work without throwing a DataTruncation exception. + **/ + public void Var030() { + if (checkJdbc40()) { + try { + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_FLOAT", + new StringReader("453435.4434556337633"), 20L); + rs_.updateRow(); + + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + float v = rs2.getFloat("C_FLOAT"); + rs2.close(); + assertCondition((v > 453435) && (v < 453436)); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + /* + * failed ("Didn't throw SQLException"); } catch (Exception e) { DataTruncation + * dt = (DataTruncation)e; assertCondition ((dt.getIndex() == expectedColumn) && + * (dt.getParameter() == false) && (dt.getRead() == false) && (dt.getDataSize() + * == 19) && (dt.getTransferSize() == 17)); + * + * } } + */ + } - /** - updateNCharacterStream() - Should throw an exception when the column - name is invalid. - **/ - public void Var010() - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "INVALID", new StringReader ("Colorado Springs"), 16L); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + /** + * updateNCharacterStream() - Update a FLOAT, when the string is not a number. + **/ + public void Var031() { + if (checkJdbc40()) { + try { + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_FLOAT", new StringReader("Madison"), 7L); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } + } + /** + * updateNCharacterStream() - Update a DOUBLE. + **/ + public void Var032() { + if (checkJdbc40()) { + try { + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_DOUBLE", new StringReader("-9845"), 5L); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + double v = rs2.getDouble("C_DOUBLE"); + rs2.close(); + assertCondition(v == -9845); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + /** + * updateNCharacterStream() - Update a DOUBLE, when the number is too big. + * + * Note: Given the new data truncation rules for JDBC, this testcase is expected + * to work without throwing a DataTruncation exception. + **/ + public void Var033() { + if (checkJdbc40()) { + try { + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_DOUBLE", + new StringReader("453342035.44445532333"), 21L); + rs_.updateRow(); + + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + float v = rs2.getFloat("C_DOUBLE"); + rs2.close(); + // Does anyone have a good suggestion for what should be done here? + assertCondition(true, "" + v); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + /* + * failed ("Didn't throw SQLException"); } catch (Exception e) { DataTruncation + * dt = (DataTruncation)e; assertCondition ((dt.getIndex() == expectedColumn) && + * (dt.getParameter() == false) && (dt.getRead() == false) && (dt.getDataSize() + * == 19) && (dt.getTransferSize() == 17)); + * + * } } + */ + } - /** - updateNCharacterStream() - Should work when the column name is valid. - **/ - public void Var011() - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_VARCHAR_50", new StringReader ("Gillette"),8L); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - String v = rs2.getString ("C_VARCHAR_50"); - rs2.close (); - assertCondition (v.equals ("Gillette")); - } - catch(Exception e) - { - failed (e, "Unexpected Exception"); - } - } + /** + * updateNCharacterStream() - Update a DOUBLE, when the string is not a number. + **/ + public void Var034() { + if (checkJdbc40()) { + try { + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_DOUBLE", new StringReader("Chicago"), 7L); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } + } + /** + * updateNCharacterStream() - Update a DECIMAL. + **/ + public void Var035() { + if (checkJdbc40()) { + try { + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_DECIMAL_105", new StringReader("4533.43"), 7L); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + BigDecimal v = rs2.getBigDecimal("C_DECIMAL_105"); + rs2.close(); + assertCondition(v.floatValue() == 4533.43f); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + /** + * updateNCharacterStream() - Update a DECIMAL, when the value is too big. + **/ + public void Var036() { + if (checkJdbc40()) { + int expectedColumn = -1; + try { + JDRSTest.position(rs_, key_); + expectedColumn = rs_.findColumn("C_DECIMAL_40"); + JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_DECIMAL_40", new StringReader("5333644511"), + 10L); + rs_.updateRow(); + failed("Didn't throw SQLException"); + } catch (Exception e) { + if (e instanceof DataTruncation) { + DataTruncation dt = (DataTruncation) e; + assertCondition((dt.getIndex() == expectedColumn) && (dt.getParameter() == false) && (dt.getRead() == false) + && (dt.getDataSize() == 10) && (dt.getTransferSize() == 4)); + } else { + assertSqlException(e, -99999, "07006", "Data type mismatch", + "Mismatch instead of truncation in latest toolbox"); - /** - updateNCharacterStream() - Should update to SQL NULL when the column - value is null. - **/ - public void Var012() - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_VARCHAR_50", null, 0L); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - String v = rs2.getString ("C_VARCHAR_50"); - boolean wn = rs2.wasNull (); - rs2.close (); - assertCondition ((v == null) && (wn == true)); - } - catch(Exception e) - { - failed (e, "Unexpected Exception"); - } } + + } } + } + /** + * updateNCharacterStream() - Update a DECIMAL, when the string is not a number. + **/ + public void Var037() { + if (checkJdbc40()) { + try { + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_DECIMAL_105", new StringReader("Terre Haute"), + 11L); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } + } + } + /** + * updateNCharacterStream() - Update a NUMERIC. + **/ + public void Var038() { + if (checkJdbc40()) { + try { + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_NUMERIC_105", new StringReader("-9333.455"), + 9L); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + BigDecimal v = rs2.getBigDecimal("C_NUMERIC_105"); + rs2.close(); + assertCondition(v.doubleValue() == -9333.455); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } - /** - updateNCharacterStream() - Should throw an exception when the length is invalid. - **/ - public void Var013() - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_VARCHAR_50", new StringReader ("Reno"), -1L); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } + /** + * updateNCharacterStream() - Update a NUMERIC, when the value is too big. + **/ + public void Var039() { + if (checkJdbc40()) { + int expectedColumn = -1; + try { + JDRSTest.position(rs_, key_); + expectedColumn = rs_.findColumn("C_NUMERIC_40"); + JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_NUMERIC_40", new StringReader("-3315145"), 8L); + rs_.updateRow(); + failed("Didn't throw SQLException"); + } catch (Exception e) { + if (e instanceof DataTruncation) { + DataTruncation dt = (DataTruncation) e; + assertCondition((dt.getIndex() == expectedColumn) && (dt.getParameter() == false) && (dt.getRead() == false) + && (dt.getDataSize() == 7) && (dt.getTransferSize() == 4)); + } else { + assertSqlException(e, -99999, "07006", "Data type mismatch", + "Mismatch instead of truncation in latest toolbox"); } + + } } + } + /** + * updateNCharacterStream() - Update a NUMERIC, when the string is not a number. + **/ + public void Var040() { + if (checkJdbc40()) { + try { + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_NUMERIC_105", new StringReader("Detroit"), 7L); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } + } + } + /** + * updateNCharacterStream() - Update a CHAR. + **/ + public void Var041() { - /** - updateNCharacterStream() - Should be reflected by get, even if update has - not yet been issued (i.e. update is still pending). - **/ - public void Var014() - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_VARCHAR_50", new StringReader ("Santa Fe"),8L); - assertCondition (rs_.getString ("C_VARCHAR_50").equals ("Santa Fe")); - } - catch(Exception e) - { - failed (e, "Unexpected Exception"); - } - } - } - - - - - /** - updateNCharacterStream() - Should be reflected by get, after update has - been issued, but cursor has not been repositioned. - **/ - public void Var015() - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_VARCHAR_50", new StringReader ("Phoenix"),7L); - rs_.updateRow (); - assertCondition (rs_.getString ("C_VARCHAR_50").equals ("Phoenix")); - } - catch(Exception e) - { - failed (e, "Unexpected Exception"); - } - } - } - - - - - /** - updateNCharacterStream() - Should be reflected by get, after update has - been issued and cursor has been repositioned. - **/ - public void Var016() - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_VARCHAR_50", new StringReader ("Austin"),6L); - rs_.updateRow (); - rs_.beforeFirst (); - JDRSTest.position (rs_, key_); - String v = rs_.getString ("C_VARCHAR_50"); - assertCondition (v.equals ("Austin")); - } - catch(Exception e) - { - failed (e, "Unexpected Exception"); - } - } - } - - - - - /** - updateNCharacterStream() - Should work when the current row is the insert - row. - **/ - public void Var017() - { - if(checkJdbc40 ()) - { - try - { - rs_.moveToInsertRow (); - rs_.updateString ("C_KEY", "JDRSCharacterStream 1"); - JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_VARCHAR_50", new StringReader ("Tulsa"),5L); - rs_.insertRow (); - JDRSTest.position (rs_, "JDRSCharacterStream 1"); - assertCondition (rs_.getString ("C_VARCHAR_50").equals ("Tulsa")); - } - catch(Exception e) - { - failed (e, "Unexpected Exception"); - } - } - } - - - - /** - updateNCharacterStream() - Should be reflected by get on insert row, even if - insert has not yet been issued (i.e. insert is still pending). - **/ - public void Var018() - { - if(checkJdbc40 ()) - { - try - { - rs_.moveToInsertRow (); - JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_VARCHAR_50", new StringReader ("Lawrence"),8L); - assertCondition (rs_.getString ("C_VARCHAR_50").equals ("Lawrence")); - } - catch(Exception e) - { - failed (e, "Unexpected Exception"); - } - } - } - - - - /** - updateNCharacterStream() - Should throw an exception on a deleted row. - **/ - public void Var019() - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, "DUMMY_ROW"); - rs_.deleteRow (); - JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_VARCHAR_50", new StringReader ("Ames"),4L); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } - } - - - /** - updateNCharacterStream() - Update a SMALLINT. - **/ - public void Var020 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_SMALLINT", new StringReader ("31"),2L); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - short v = rs2.getShort ("C_SMALLINT"); - rs2.close (); - assertCondition (v == 31); - } - catch(Exception e) - { - failed (e, "Unexpected Exception"); - } - } - } - - - - /** - updateNCharacterStream() - Update a SMALLINT, when the integer is too big. - **/ - public void Var021 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_SMALLINT", new StringReader ("224323"),6L); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } - } - - - - /** - updateNCharacterStream() - Update a SMALLINT, when the string is not a number. - **/ - public void Var022 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_SMALLINT", new StringReader ("Van Buren"),9L); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } - } - - - - /** - updateNCharacterStream() - Update an INTEGER. - **/ - public void Var023 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_INTEGER", new StringReader ("-12374"),6L); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - int v = rs2.getInt ("C_INTEGER"); - rs2.close (); - assertCondition (v == -12374); - } - catch(Exception e) - { - failed (e, "Unexpected Exception"); - } - } - } - - - - /** - updateNCharacterStream() - Update an INTEGER, when the integer is too big. - **/ - public void Var024 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_INTEGER", new StringReader ("435353487623"),12L); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } - } - - - - /** - updateNCharacterStream() - Update an INTEGER, when the string is not a number. - **/ - public void Var025 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_INTEGER", new StringReader ("Baton Rouge"), 11L); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } - } - - - - /** - updateNCharacterStream() - Update a REAL. - **/ - public void Var026 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_REAL", new StringReader ("13.35"),5L); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - float v = rs2.getFloat ("C_REAL"); - rs2.close (); - assertCondition (v == 13.35f); - } - catch(Exception e) - { - failed (e, "Unexpected Exception"); - } - } - } - - - /** - updateNCharacterStream() - Update a REAL, when the number is too big. - - Note: Given the new data truncation rules for JDBC, this testcase - is expected to work without throwing a DataTruncation exception. - **/ - public void Var027 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_REAL", new StringReader ("453433335.4437623"),17L); - rs_.updateRow (); - - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - float v = rs2.getFloat ("C_REAL"); - rs2.close (); - // Does anyone have a good suggestion for what should be done here? - assertCondition (true, ""+v); - } - catch(Exception e) - { - failed (e, "Unexpected Exception"); - } - } - /* - failed ("Didn't throw SQLException"); - } - catch (Exception e) { - DataTruncation dt = (DataTruncation)e; - assertCondition ((dt.getIndex() == expectedColumn) - && (dt.getParameter() == false) - && (dt.getRead() == false) - && (dt.getDataSize() == 15) - && (dt.getTransferSize() == 10)); - - } - } - */ - } - - - - /** - updateNCharacterStream() - Update a REAL, when the string is not a number. - **/ - public void Var028 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_INTEGER", new StringReader ("Edina"),5L); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } - } - - - - - /** - updateNCharacterStream() - Update a FLOAT. - **/ - public void Var029 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_FLOAT", new StringReader ("9835.2"),6L); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - float v = rs2.getFloat ("C_FLOAT"); - rs2.close (); - assertCondition (v == 9835.2f); - } - catch(Exception e) - { - failed (e, "Unexpected Exception"); - } - } - } - - - - /** - updateNCharacterStream() - Update a FLOAT, when the number is too big. - - Note: Given the new data truncation rules for JDBC, this testcase - is expected to work without throwing a DataTruncation exception. - **/ - public void Var030 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_FLOAT", new StringReader ("453435.4434556337633"),20L); - rs_.updateRow (); - - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - float v = rs2.getFloat ("C_FLOAT"); - rs2.close (); - assertCondition ((v > 453435) && (v < 453436)); - } - catch(Exception e) - { - failed (e, "Unexpected Exception"); - } - } - /* - failed ("Didn't throw SQLException"); - } - catch (Exception e) { - DataTruncation dt = (DataTruncation)e; - assertCondition ((dt.getIndex() == expectedColumn) - && (dt.getParameter() == false) - && (dt.getRead() == false) - && (dt.getDataSize() == 19) - && (dt.getTransferSize() == 17)); - - } - } - */ - } - - - - /** - updateNCharacterStream() - Update a FLOAT, when the string is not a number. - **/ - public void Var031 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_FLOAT", new StringReader ("Madison"),7L); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } - } - - - /** - updateNCharacterStream() - Update a DOUBLE. - **/ - public void Var032 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_DOUBLE", new StringReader ("-9845"),5L); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - double v = rs2.getDouble ("C_DOUBLE"); - rs2.close (); - assertCondition (v == -9845); - } - catch(Exception e) - { - failed (e, "Unexpected Exception"); - } - } - } - - - - /** - updateNCharacterStream() - Update a DOUBLE, when the number is too big. - - Note: Given the new data truncation rules for JDBC, this testcase - is expected to work without throwing a DataTruncation exception. - **/ - public void Var033 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_DOUBLE", new StringReader ("453342035.44445532333"), 21L); - rs_.updateRow (); - - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - float v = rs2.getFloat ("C_DOUBLE"); - rs2.close (); - // Does anyone have a good suggestion for what should be done here? - assertCondition (true, ""+v); - } - catch(Exception e) - { - failed (e, "Unexpected Exception"); - } - } - /* - failed ("Didn't throw SQLException"); - } - catch (Exception e) { - DataTruncation dt = (DataTruncation)e; - assertCondition ((dt.getIndex() == expectedColumn) - && (dt.getParameter() == false) - && (dt.getRead() == false) - && (dt.getDataSize() == 19) - && (dt.getTransferSize() == 17)); - - } - } - */ - } - - - - /** - updateNCharacterStream() - Update a DOUBLE, when the string is not a number. - **/ - public void Var034 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_DOUBLE", new StringReader ("Chicago"),7L); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } - } - - - /** - updateNCharacterStream() - Update a DECIMAL. - **/ - public void Var035 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_DECIMAL_105", new StringReader ("4533.43"), 7L); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - BigDecimal v = rs2.getBigDecimal ("C_DECIMAL_105"); - rs2.close (); - assertCondition (v.floatValue() == 4533.43f); - } - catch(Exception e) - { - failed (e, "Unexpected Exception"); - } - } - } - - - - /** - updateNCharacterStream() - Update a DECIMAL, when the value is too big. - **/ - public void Var036 () - { - if(checkJdbc40 ()) - { - int expectedColumn = -1; - try - { - JDRSTest.position (rs_, key_); - expectedColumn = rs_.findColumn ("C_DECIMAL_40"); - JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_DECIMAL_40", new StringReader ("5333644511"), 10L); - rs_.updateRow (); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - if (e instanceof DataTruncation) { - DataTruncation dt = (DataTruncation)e; - assertCondition ((dt.getIndex() == expectedColumn) - && (dt.getParameter() == false) - && (dt.getRead() == false) - && (dt.getDataSize() == 10) - && (dt.getTransferSize() == 4)); - } else { - assertSqlException(e, -99999, "07006", "Data type mismatch", - "Mismatch instead of truncation in latest toolbox"); - - } - - } - } - } - - - /** - updateNCharacterStream() - Update a DECIMAL, when the string is not a number. - **/ - public void Var037 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_DECIMAL_105", new StringReader ("Terre Haute"), 11L); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } - } - - - - /** - updateNCharacterStream() - Update a NUMERIC. - **/ - public void Var038 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_NUMERIC_105", new StringReader ("-9333.455"),9L); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - BigDecimal v = rs2.getBigDecimal ("C_NUMERIC_105"); - rs2.close (); - assertCondition (v.doubleValue() == -9333.455); - } - catch(Exception e) - { - failed (e, "Unexpected Exception"); - } - } - } - - - - /** - updateNCharacterStream() - Update a NUMERIC, when the value is too big. - **/ - public void Var039 () - { - if(checkJdbc40 ()) - { - int expectedColumn = -1; - try - { - JDRSTest.position (rs_, key_); - expectedColumn = rs_.findColumn ("C_NUMERIC_40"); - JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_NUMERIC_40", new StringReader ("-3315145"),8L); - rs_.updateRow (); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - if (e instanceof DataTruncation) { - DataTruncation dt = (DataTruncation)e; - assertCondition ((dt.getIndex() == expectedColumn) - && (dt.getParameter() == false) - && (dt.getRead() == false) - && (dt.getDataSize() == 7) - && (dt.getTransferSize() == 4)); - } else { - assertSqlException(e, -99999, "07006", "Data type mismatch", - "Mismatch instead of truncation in latest toolbox"); - } - - - } - } - } - - - - /** - updateNCharacterStream() - Update a NUMERIC, when the string is not a number. - **/ - public void Var040 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_NUMERIC_105", new StringReader ("Detroit"), 7L); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } - } - - - - /** - updateNCharacterStream() - Update a CHAR. - **/ - public void Var041 () - { - - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_CHAR_50", new StringReader ("Upper Darby"), 11L); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - String v = rs2.getString ("C_CHAR_50"); - rs2.close (); - assertCondition (v.equals ("Upper Darby ")); - } - catch(Exception e) - { - failed (e, "Unexpected Exception"); - } - } - } - - - - /** - updateNCharacterStream() - Update a CHAR, when the value is too big. - **/ - public void Var042 () - { - if(checkJdbc40 ()) - { - int expectedColumn = -1; - try - { - JDRSTest.position (rs_, key_); - expectedColumn = rs_.findColumn ("C_CHAR_1"); - JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_CHAR_1", new StringReader ("Manhattan"),9L); - rs_.updateRow (); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - if (e instanceof DataTruncation) { - DataTruncation dt = (DataTruncation)e; - assertCondition ((dt.getIndex() == expectedColumn) - && (dt.getParameter() == false) - && (dt.getRead() == false) - && (dt.getDataSize() == 9) - && (dt.getTransferSize() == 1), - - "dt.getIndex()="+dt.getIndex()+" sb "+expectedColumn+"\n"+ - "dt.getParameter()="+dt.getParameter()+" sb false\n" + - "dt.getRead()="+dt.getRead()+" sb false\n"+ - "dt.getDataSize()="+dt.getDataSize()+" sb 9\n"+ - "dt.getTransferSize()="+dt.getTransferSize()+"sb 1"); - } else { - failed(e, "Unexpected Exception"); - } - - - } - } - } - - - - /** - updateNCharacterStream() - Update a VARCHAR, with the length equal to the - full stream. - **/ - public void Var043 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_VARCHAR_50", new StringReader ("Rehoboth Beach"), 14L); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - String v = rs2.getString ("C_VARCHAR_50"); - rs2.close (); - assertCondition (v.equals ("Rehoboth Beach")); - } - catch(Exception e) - { - failed (e, "Unexpected Exception"); - } - } - } - - - - /** - updateNCharacterStream() - Update a VARCHAR, with the length less than the - full stream. - - @D2 - Native driver doesn't throw an exception if stream contains extra characters then there needs to be there. - **/ - public void Var044 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_VARCHAR_50", new StringReader ("Toronto"),4L); - if( getDriver() == JDTestDriver.DRIVER_NATIVE && // @D2 - true ) // @D2 - succeeded(); // @D2 - else // @D2 - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - if( getDriver() == JDTestDriver.DRIVER_NATIVE && // @D2 - true ) // @D2 - succeeded(); // @D2 - else // @D2 - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } - } - - - - /** - updateNCharacterStream() - Update a VARCHAR, with the length greater than the - full stream. - **/ - public void Var045 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_VARCHAR_50", new StringReader ("Montreal"), 13L); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } - } - - - - /** - updateNCharacterStream() - Update a VARCHAR, with the length set to 1. - - @D2 - Native driver doesn't throw an exception if stream contains extra characters then there needs to be there. - **/ - public void Var046 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_VARCHAR_50", new StringReader ("Winnipeg"), 1L); - if( getDriver() == JDTestDriver.DRIVER_NATIVE && // @D2 - true ) // @D2 - succeeded(); // @D2 - else // @D2 - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - if( getDriver() == JDTestDriver.DRIVER_NATIVE && // @D2 - true ) // @D2 - succeeded(); // @D2 - else // @D2 - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } - } - - - - /** - updateNCharacterStream() - Update a VARCHAR, with the length set to 0. - - @D2 - Native driver doesn't throw an exception if stream contains extra characters then there needs to be there. - **/ - public void Var047 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_VARCHAR_50", new StringReader ("Vancouver"), 0L); - if( getDriver() == JDTestDriver.DRIVER_NATIVE && // @D2 - true ) // @D2 - succeeded(); // @D2 - else // @D2 - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - if( getDriver() == JDTestDriver.DRIVER_NATIVE && // @D2 - true ) // @D2 - succeeded(); // @D2 - else // @D2 - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } - } - - - - /** - updateNCharacterStream() - Update a VARCHAR, with an empty string. - **/ - public void Var048 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_VARCHAR_50", new StringReader (""), 0L); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - String v = rs2.getString ("C_VARCHAR_50"); - rs2.close (); - assertCondition (v.equals ("")); - } - catch(Exception e) - { - failed (e, "Unexpected Exception"); - } - } - } - - - - /** - updateNCharacterStream() - Update a VARCHAR, when the value is too big. - **/ - public void Var049 () - { - if(checkJdbc40 ()) - { - int expectedColumn = -1; - try - { - JDRSTest.position (rs_, key_); - expectedColumn = rs_.findColumn ("C_VARCHAR_50"); - JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_VARCHAR_50", new StringReader ("The greater Washington, D.C. Metropolitan Area and surrounding communities"), 74L); - rs_.updateRow (); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - if (e instanceof DataTruncation) { - DataTruncation dt = (DataTruncation)e; - assertCondition ((dt.getIndex() == expectedColumn) - && (dt.getParameter() == false) - && (dt.getRead() == false) - && (dt.getDataSize() == 74) - && (dt.getTransferSize() == 50), - "dt.getIndex()="+dt.getIndex()+" sb "+expectedColumn+"\n"+ - "dt.getParameter()="+dt.getParameter()+" sb false\n" + - "dt.getRead()="+dt.getRead()+" sb false\n"+ - "dt.getDataSize()="+dt.getDataSize()+" sb 74\n"+ - "dt.getTransferSize()="+dt.getTransferSize()+"sb 50"); - } else { - failed(e, "Unexpected Exception"); - } - - - } - } + if (checkJdbc40()) { + try { + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_CHAR_50", new StringReader("Upper Darby"), 11L); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + String v = rs2.getString("C_CHAR_50"); + rs2.close(); + assertCondition(v.equals("Upper Darby ")); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } } + } - - /** - updateNCharacterStream() - Update a VARCHAR parameter to a bad reader. - **/ - public void Var050() - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - - class BadReader extends StringReader - { - - public BadReader () - { - super ("Hi Mom!"); - } - public int read (char[] buffer) throws IOException { - throw new IOException (); - }; - } - - Reader r = new BadReader (); - JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_VARCHAR_50", r,2L); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } + /** + * updateNCharacterStream() - Update a CHAR, when the value is too big. + **/ + public void Var042() { + if (checkJdbc40()) { + int expectedColumn = -1; + try { + JDRSTest.position(rs_, key_); + expectedColumn = rs_.findColumn("C_CHAR_1"); + JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_CHAR_1", new StringReader("Manhattan"), 9L); + rs_.updateRow(); + failed("Didn't throw SQLException"); + } catch (Exception e) { + if (e instanceof DataTruncation) { + DataTruncation dt = (DataTruncation) e; + assertCondition( + (dt.getIndex() == expectedColumn) && (dt.getParameter() == false) && (dt.getRead() == false) + && (dt.getDataSize() == 9) && (dt.getTransferSize() == 1), + + "dt.getIndex()=" + dt.getIndex() + " sb " + expectedColumn + "\n" + "dt.getParameter()=" + + dt.getParameter() + " sb false\n" + "dt.getRead()=" + dt.getRead() + " sb false\n" + + "dt.getDataSize()=" + dt.getDataSize() + " sb 9\n" + "dt.getTransferSize()=" + dt.getTransferSize() + + "sb 1"); + } else { + failed(e, "Unexpected Exception"); } - } - - - - - /** - updateNCharacterStream() - Update a BINARY. - **/ - public void Var051 () - { - if(checkJdbc40 ()) - { - try - { - String expected; - - if(isToolboxDriver()) - expected = "F1F2"; - else - expected = "Ford"; - - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_BINARY_20", new StringReader (expected),4L); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - String v = rs2.getString ("C_BINARY_20"); - rs2.close (); - assertCondition (v.startsWith (expected)); - } - catch(Exception e) - { - failed (e, "Unexpected Exception"); - } - } + } } + } + /** + * updateNCharacterStream() - Update a VARCHAR, with the length equal to the + * full stream. + **/ + public void Var043() { + if (checkJdbc40()) { + try { + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_VARCHAR_50", new StringReader("Rehoboth Beach"), + 14L); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + String v = rs2.getString("C_VARCHAR_50"); + rs2.close(); + assertCondition(v.equals("Rehoboth Beach")); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + /** + * updateNCharacterStream() - Update a VARCHAR, with the length less than the + * full stream. + * + * @D2 - Native driver doesn't throw an exception if stream contains extra + * characters then there needs to be there. + **/ + public void Var044() { + if (checkJdbc40()) { + try { + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_VARCHAR_50", new StringReader("Toronto"), 4L); + if (getDriver() == JDTestDriver.DRIVER_NATIVE && // @D2 + true) // @D2 + succeeded(); // @D2 + else // @D2 + failed("Didn't throw SQLException"); + } catch (Exception e) { + if (getDriver() == JDTestDriver.DRIVER_NATIVE && // @D2 + true) // @D2 + succeeded(); // @D2 + else // @D2 + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } + } + } - /** - updateNCharacterStream() - Update a BINARY, when the value is too big. - **/ - public void Var052 () - { - if(checkJdbc40 ()) - { - int expectedColumn = -1; - try - { - JDRSTest.position (rs_, key_); - expectedColumn = rs_.findColumn ("C_BINARY_1"); - JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_BINARY_1", new StringReader ("F1F2F3"),6L); - rs_.updateRow (); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - if (e instanceof DataTruncation) { - DataTruncation dt = (DataTruncation)e; - assertCondition ((dt.getIndex() == expectedColumn) - && (dt.getParameter() == false) - && (dt.getRead() == false) - && (dt.getTransferSize() == 1), - "dt.getIndex()="+dt.getIndex()+" sb "+expectedColumn+"\n"+ - "dt.getParameter()="+dt.getParameter()+" sb false\n" + - "dt.getRead()="+dt.getRead()+" sb false\n"+ - - "dt.getTransferSize()="+dt.getTransferSize()+"sb 1"); - } else { - failed(e, "Unexpected Exception"); - } - + /** + * updateNCharacterStream() - Update a VARCHAR, with the length greater than the + * full stream. + **/ + public void Var045() { + if (checkJdbc40()) { + try { + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_VARCHAR_50", new StringReader("Montreal"), 13L); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } + } + } - } - } + /** + * updateNCharacterStream() - Update a VARCHAR, with the length set to 1. + * + * @D2 - Native driver doesn't throw an exception if stream contains extra + * characters then there needs to be there. + **/ + public void Var046() { + if (checkJdbc40()) { + try { + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_VARCHAR_50", new StringReader("Winnipeg"), 1L); + if (getDriver() == JDTestDriver.DRIVER_NATIVE && // @D2 + true) // @D2 + succeeded(); // @D2 + else // @D2 + failed("Didn't throw SQLException"); + } catch (Exception e) { + if (getDriver() == JDTestDriver.DRIVER_NATIVE && // @D2 + true) // @D2 + succeeded(); // @D2 + else // @D2 + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } + } + /** + * updateNCharacterStream() - Update a VARCHAR, with the length set to 0. + * + * @D2 - Native driver doesn't throw an exception if stream contains extra + * characters then there needs to be there. + **/ + public void Var047() { + if (checkJdbc40()) { + try { + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_VARCHAR_50", new StringReader("Vancouver"), 0L); + if (getDriver() == JDTestDriver.DRIVER_NATIVE && // @D2 + true) // @D2 + succeeded(); // @D2 + else // @D2 + failed("Didn't throw SQLException"); + } catch (Exception e) { + if (getDriver() == JDTestDriver.DRIVER_NATIVE && // @D2 + true) // @D2 + succeeded(); // @D2 + else // @D2 + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } + } + } + /** + * updateNCharacterStream() - Update a VARCHAR, with an empty string. + **/ + public void Var048() { + if (checkJdbc40()) { + try { + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_VARCHAR_50", new StringReader(""), 0L); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + String v = rs2.getString("C_VARCHAR_50"); + rs2.close(); + assertCondition(v.equals("")); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } - /** - updateNCharacterStream() - Update a VARBINARY. - **/ - public void Var053 () - { - if(checkJdbc40 ()) - { - try - { - String expected; - if(isToolboxDriver()) - expected = "F1F2"; - else - expected = "Ford"; - - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_VARBINARY_20", new StringReader (expected),4L); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - String v = rs2.getString ("C_VARBINARY_20"); - rs2.close (); - assertCondition (v.equals (expected)); - } - catch(Exception e) - { - failed (e, "Unexpected Exception"); - } + /** + * updateNCharacterStream() - Update a VARCHAR, when the value is too big. + **/ + public void Var049() { + if (checkJdbc40()) { + int expectedColumn = -1; + try { + JDRSTest.position(rs_, key_); + expectedColumn = rs_.findColumn("C_VARCHAR_50"); + JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_VARCHAR_50", + new StringReader("The greater Washington, D.C. Metropolitan Area and surrounding communities"), 74L); + rs_.updateRow(); + failed("Didn't throw SQLException"); + } catch (Exception e) { + if (e instanceof DataTruncation) { + DataTruncation dt = (DataTruncation) e; + assertCondition( + (dt.getIndex() == expectedColumn) && (dt.getParameter() == false) && (dt.getRead() == false) + && (dt.getDataSize() == 74) && (dt.getTransferSize() == 50), + "dt.getIndex()=" + dt.getIndex() + " sb " + expectedColumn + "\n" + "dt.getParameter()=" + + dt.getParameter() + " sb false\n" + "dt.getRead()=" + dt.getRead() + " sb false\n" + + "dt.getDataSize()=" + dt.getDataSize() + " sb 74\n" + "dt.getTransferSize()=" + dt.getTransferSize() + + "sb 50"); + } else { + failed(e, "Unexpected Exception"); } + + } } + } + /** + * updateNCharacterStream() - Update a VARCHAR parameter to a bad reader. + **/ + public void Var050() { + if (checkJdbc40()) { + try { + JDRSTest.position(rs_, key_); + class BadReader extends StringReader { - /** - updateNCharacterStream() - Update a VARBINARY, when the value is too big. - **/ - public void Var054 () - { - if(checkJdbc40 ()) - { - int expectedColumn = -1; - try - { - String expected; - if(isToolboxDriver()) - expected = "F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1"; - else - expected = "Thirty characters, thirty characters, thirty characters xxxx"; - - JDRSTest.position (rs_, key_); - expectedColumn = rs_.findColumn ("C_VARBINARY_20"); - JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_VARBINARY_20", new StringReader (expected), 60L); - rs_.updateRow (); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - if (e instanceof DataTruncation) { - DataTruncation dt = (DataTruncation)e; - assertCondition ((dt.getIndex() == expectedColumn) - && (dt.getParameter() == false) - && (dt.getRead() == false) - && (dt.getTransferSize() == 20), - "dt.getIndex()="+dt.getIndex()+" sb "+expectedColumn+"\n"+ - "dt.getParameter()="+dt.getParameter()+" sb false\n" + - "dt.getRead()="+dt.getRead()+" sb false\n"+ - - "dt.getTransferSize()="+dt.getTransferSize()+"sb 20"); - } else { - failed(e, "Unexpected Exception"); - } + public BadReader() { + super("Hi Mom!"); + } - } + public int read(char[] buffer) throws IOException { + throw new IOException(); + }; } - } - - - /** - updateNCharacterStream() - Update a CLOB. - - SQL400 - the native driver expects this update to work correctly. - **/ - public void Var055 () - { - if(checkJdbc40 ()) - { - if(checkLobSupport ()) - { - try - { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_CLOB", new StringReader ("Knoxville"),9L); - - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - String v = rs2.getString ("C_CLOB"); - rs2.close (); - assertCondition (v.equals ("Knoxville")); - } - catch(Exception e) - { - failed (e, "Unexpected Exception"); - } - } - } + Reader r = new BadReader(); + JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_VARCHAR_50", r, 2L); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } + } - - - /** - updateNCharacterStream() - Update a DBCLOB. - - SQL400 - the native driver expects this update to work correctly. - **/ - public void Var056 () - { - if(checkJdbc40 ()) - { - if(checkLobSupport ()) - { - try - { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_DBCLOB", new StringReader ("Memphis"), 7L); - - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - String v = rs2.getString ("C_DBCLOB"); - rs2.close (); - assertCondition (v.equals ("Memphis")); - } - catch(Exception e) - { - failed (e, "Unexpected Exception"); - } - } - } + /** + * updateNCharacterStream() - Update a BINARY. + **/ + public void Var051() { + if (checkJdbc40()) { + try { + String expected; + + if (isToolboxDriver()) + expected = "F1F2"; + else + expected = "Ford"; + + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_BINARY_20", new StringReader(expected), 4L); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + String v = rs2.getString("C_BINARY_20"); + rs2.close(); + assertCondition(v.startsWith(expected)); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } } + } + /** + * updateNCharacterStream() - Update a BINARY, when the value is too big. + **/ + public void Var052() { + if (checkJdbc40()) { + int expectedColumn = -1; + try { + JDRSTest.position(rs_, key_); + expectedColumn = rs_.findColumn("C_BINARY_1"); + JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_BINARY_1", new StringReader("F1F2F3"), 6L); + rs_.updateRow(); + failed("Didn't throw SQLException"); + } catch (Exception e) { + if (e instanceof DataTruncation) { + DataTruncation dt = (DataTruncation) e; + assertCondition( + (dt.getIndex() == expectedColumn) && (dt.getParameter() == false) && (dt.getRead() == false) + && (dt.getTransferSize() == 1), + "dt.getIndex()=" + dt.getIndex() + " sb " + expectedColumn + "\n" + "dt.getParameter()=" + + dt.getParameter() + " sb false\n" + "dt.getRead()=" + dt.getRead() + " sb false\n" + + + "dt.getTransferSize()=" + dt.getTransferSize() + "sb 1"); + } else { + failed(e, "Unexpected Exception"); + } + } + } + } - /** - updateNCharacterStream() - Update a BLOB. - **/ - public void Var057 () - { - if(checkJdbc40 ()) - { - if(checkLobSupport ()) - { - try - { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_BLOB", new StringReader ("Honolulu"),8L); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } - } + /** + * updateNCharacterStream() - Update a VARBINARY. + **/ + public void Var053() { + if (checkJdbc40()) { + try { + String expected; + if (isToolboxDriver()) + expected = "F1F2"; + else + expected = "Ford"; + + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_VARBINARY_20", new StringReader(expected), 4L); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + String v = rs2.getString("C_VARBINARY_20"); + rs2.close(); + assertCondition(v.equals(expected)); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } } + } + /** + * updateNCharacterStream() - Update a VARBINARY, when the value is too big. + **/ + public void Var054() { + if (checkJdbc40()) { + int expectedColumn = -1; + try { + String expected; + if (isToolboxDriver()) + expected = "F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1"; + else + expected = "Thirty characters, thirty characters, thirty characters xxxx"; + + JDRSTest.position(rs_, key_); + expectedColumn = rs_.findColumn("C_VARBINARY_20"); + JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_VARBINARY_20", new StringReader(expected), 60L); + rs_.updateRow(); + failed("Didn't throw SQLException"); + } catch (Exception e) { + if (e instanceof DataTruncation) { + DataTruncation dt = (DataTruncation) e; + assertCondition( + (dt.getIndex() == expectedColumn) && (dt.getParameter() == false) && (dt.getRead() == false) + && (dt.getTransferSize() == 20), + "dt.getIndex()=" + dt.getIndex() + " sb " + expectedColumn + "\n" + "dt.getParameter()=" + + dt.getParameter() + " sb false\n" + "dt.getRead()=" + dt.getRead() + " sb false\n" + + + "dt.getTransferSize()=" + dt.getTransferSize() + "sb 20"); + } else { + failed(e, "Unexpected Exception"); + } + } + } + } - /** - updateNCharacterStream() - Update a DATE. - **/ - public void Var058 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_DATE", new StringReader ("1970-02-10"), 10L); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - Date v = rs2.getDate ("C_DATE"); - rs2.close (); - assertCondition (v.toString ().equals ("1970-02-10")); - } - catch(Exception e) - { - failed (e, "Unexpected Exception"); - } + /** + * updateNCharacterStream() - Update a CLOB. + * + * SQL400 - the native driver expects this update to work correctly. + **/ + public void Var055() { + if (checkJdbc40()) { + if (checkLobSupport()) { + try { + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_CLOB", new StringReader("Knoxville"), 9L); + + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + String v = rs2.getString("C_CLOB"); + rs2.close(); + assertCondition(v.equals("Knoxville")); + } catch (Exception e) { + failed(e, "Unexpected Exception"); } + } } + } - - - /** - updateNCharacterStream() - Update a DATE, when the string is not a valid date. - **/ - public void Var059 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_DATE", new StringReader ("Augusta"), 7L); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } + /** + * updateNCharacterStream() - Update a DBCLOB. + * + * SQL400 - the native driver expects this update to work correctly. + **/ + public void Var056() { + if (checkJdbc40()) { + if (checkLobSupport()) { + try { + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_DBCLOB", new StringReader("Memphis"), 7L); + + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + String v = rs2.getString("C_DBCLOB"); + rs2.close(); + assertCondition(v.equals("Memphis")); + } catch (Exception e) { + failed(e, "Unexpected Exception"); } + } } + } - - - /** - updateNCharacterStream() - Update a TIME. - **/ - public void Var060 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_TIME", new StringReader ("13:45:32"),8L); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - Time v = rs2.getTime ("C_TIME"); - rs2.close (); - assertCondition (v.toString ().equals ("13:45:32")); - } - catch(Exception e) - { - failed (e, "Unexpected Exception"); - } + /** + * updateNCharacterStream() - Update a BLOB. + **/ + public void Var057() { + if (checkJdbc40()) { + if (checkLobSupport()) { + try { + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_BLOB", new StringReader("Honolulu"), 8L); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); } + } } + } + /** + * updateNCharacterStream() - Update a DATE. + **/ + public void Var058() { + if (checkJdbc40()) { + try { + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_DATE", new StringReader("1970-02-10"), 10L); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + Date v = rs2.getDate("C_DATE"); + rs2.close(); + assertCondition(v.toString().equals("1970-02-10")); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } - - /** - updateNCharacterStream() - Update a TIME, when the string is not a valid time. - **/ - public void Var061 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_TIME", new StringReader ("Birmingham"), 10L); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + /** + * updateNCharacterStream() - Update a DATE, when the string is not a valid + * date. + **/ + public void Var059() { + if (checkJdbc40()) { + try { + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_DATE", new StringReader("Augusta"), 7L); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } + } + /** + * updateNCharacterStream() - Update a TIME. + **/ + public void Var060() { + if (checkJdbc40()) { + try { + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_TIME", new StringReader("13:45:32"), 8L); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + Time v = rs2.getTime("C_TIME"); + rs2.close(); + assertCondition(v.toString().equals("13:45:32")); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + /** + * updateNCharacterStream() - Update a TIME, when the string is not a valid + * time. + **/ + public void Var061() { + if (checkJdbc40()) { + try { + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_TIME", new StringReader("Birmingham"), 10L); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } + } + } - /** - updateNCharacterStream() - Update a TIMESTAMP. - **/ - public void Var062 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_TIMESTAMP", new StringReader ("1969-11-18 15:22:23.4329"), 24L); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - Timestamp v = rs2.getTimestamp ("C_TIMESTAMP"); - rs2.close (); - assertCondition (v.toString ().equals ("1969-11-18 15:22:23.4329")); - } - catch(Exception e) - { - failed (e, "Unexpected Exception"); - } - } + /** + * updateNCharacterStream() - Update a TIMESTAMP. + **/ + public void Var062() { + if (checkJdbc40()) { + try { + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_TIMESTAMP", + new StringReader("1969-11-18 15:22:23.4329"), 24L); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + Timestamp v = rs2.getTimestamp("C_TIMESTAMP"); + rs2.close(); + assertCondition(v.toString().equals("1969-11-18 15:22:23.4329")); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } } + } + /** + * updateNCharacterStream() - Update a TIMESTAMP, when the string is not a valid + * timestamp. + **/ + public void Var063() { + if (checkJdbc40()) { + try { + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_TIMESTAMP", new StringReader("Boston"), 6L); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } + } + } + /** + * updateNCharacterStream() - Update a DATALINK. + **/ + public void Var064() { + if (checkJdbc40()) { + if (checkLobSupport()) { + // We do not test updating datalinks, since it is not + // possible to open a updatable cursor/result set with + // a datalink column. + notApplicable("DATALINK update not supported."); + /* + * try { JDRSTest.position (rs_, key_); JDReflectionUtil.callMethod_V(rs_, + * "updateNCharacterStream", "C_DATALINK", new StringReader ("Providence"),9L); + * failed ("Didn't throw SQLException"); } catch (Exception e) { + * assertExceptionIsInstanceOf (e, "java.sql.SQLException"); } + */ + } + } + } - /** - updateNCharacterStream() - Update a TIMESTAMP, when the string is not a valid timestamp. - **/ - public void Var063 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_TIMESTAMP", new StringReader ("Boston"),6L); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } + /** + * updateNCharacterStream() - Update a DISTINCT. + **/ + public void Var065() { + if (checkJdbc40()) { + if (checkLobSupport()) { + try { + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_DISTINCT", new StringReader("Concord"), 7L); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + String v = rs2.getString("C_DISTINCT"); + rs2.close(); + assertCondition(v.equals("Concord ")); + } catch (Exception e) { + failed(e, "Unexpected Exception"); } + } } + } - - - /** - updateNCharacterStream() - Update a DATALINK. - **/ - public void Var064 () - { - if(checkJdbc40 ()) - { - if(checkLobSupport ()) - { - // We do not test updating datalinks, since it is not - // possible to open a updatable cursor/result set with - // a datalink column. - notApplicable("DATALINK update not supported."); - /* - try { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_DATALINK", new StringReader ("Providence"),9L); - failed ("Didn't throw SQLException"); - } - catch (Exception e) { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - */ - } + /** + * updateNCharacterStream() - Update a BIGINT. + **/ + public void Var066() { + if (checkJdbc40()) { + if (checkBigintSupport()) { + try { + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_BIGINT", new StringReader("-1237324"), 8L); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + long v = rs2.getLong("C_BIGINT"); + rs2.close(); + assertCondition(v == -1237324); + } catch (Exception e) { + failed(e, "Unexpected Exception"); } + } } + } - - - /** - updateNCharacterStream() - Update a DISTINCT. - **/ - public void Var065 () - { - if(checkJdbc40 ()) - { - if(checkLobSupport ()) - { - try - { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_DISTINCT", new StringReader ("Concord"), 7L); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - String v = rs2.getString ("C_DISTINCT"); - rs2.close (); - assertCondition (v.equals ("Concord ")); - } - catch(Exception e) - { - failed (e, "Unexpected Exception"); - } - } + /** + * updateNCharacterStream() - Update a BIGINT, when the integer is too big. + **/ + public void Var067() { + if (checkJdbc40()) { + if (checkBigintSupport()) { + try { + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_BIGINT", + new StringReader("4353534432176864587623"), 22L); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); } + } } + } - - - /** - updateNCharacterStream() - Update a BIGINT. - **/ - public void Var066() - { - if(checkJdbc40 ()) - { - if(checkBigintSupport()) - { - try - { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_BIGINT", new StringReader ("-1237324"),8L); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - long v = rs2.getLong ("C_BIGINT"); - rs2.close (); - assertCondition (v == -1237324); - } - catch(Exception e) - { - failed (e, "Unexpected Exception"); - } - } + /** + * updateNCharacterStream() - Update a BIGINTEGER, when the string is not a + * number. + **/ + public void Var068() { + if (checkJdbc40()) { + if (checkBigintSupport()) { + try { + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_BIGINT", new StringReader("Baton Rouge"), + 11L); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); } + } } + } - - - /** - updateNCharacterStream() - Update a BIGINT, when the integer is too big. - **/ - public void Var067() - { - if(checkJdbc40 ()) - { - if(checkBigintSupport()) - { - try - { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_BIGINT", new StringReader ("4353534432176864587623"), 22L); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + /** + * updateNCharacterStream() - Update a BLOB. Native will fail because they do + * not support -- see Var057 + **/ + public void Var069() { + if (checkJdbc40()) { + if (checkLobSupport()) { + try { + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_BLOB", new StringReader("1023AAFFB10"), 11L); + if (isToolboxDriver()) { + succeeded(); + } else { + failed("Didn't throw SQLException"); + } + } catch (Exception e) { + if (isToolboxDriver()) { + failed(e, "Unexpected Exception"); + } else { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } + } } + } + /** + * updateCharacterStream() - Should work with weird reader + **/ + public void Var070() { - /** - updateNCharacterStream() - Update a BIGINTEGER, when the string is not a number. - **/ - public void Var068() - { - if(checkJdbc40 ()) - { - if(checkBigintSupport()) - { - try - { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_BIGINT", new StringReader ("Baton Rouge"), 11L); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } - } - } - + String added = "Added by native driver 10/11/2006 to test input stream that sometimes returns 0 bytes "; + if (checkJdbc40()) - /** - updateNCharacterStream() - Update a BLOB. - Native will fail because they do not support -- see Var057 - **/ - public void Var069 () { - if(checkJdbc40 ()) - { - if(checkLobSupport ()) - { - try - { - JDRSTest.position(rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_BLOB", new StringReader("1023AAFFB10"), 11L); - if(isToolboxDriver()) - { - succeeded(); - } - else - { - failed("Didn't throw SQLException"); - } - } - catch(Exception e) - { - if(isToolboxDriver()) - { - failed(e, "Unexpected Exception"); - } - else - { - assertExceptionIsInstanceOf(e, "java.sql.SQLException"); - } - } - } + try { + JDRSTest.position(rs_, key_); + Reader r = new JDWeirdReader("0102030"); + // toolbox expects correct size + try { + + JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", 14, r, (long) 6); + } catch (SQLException e) { + r.close(); + if (isToolboxDriver()) { + + assertCondition(("" + e.getMessage()).endsWith("buffer length not valid."), "Exception was " + e); + + return; + } else { + throw e; + } } + r.close(); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + String check = rs2.getString("C_VARCHAR_50"); + rs2.close(); + String expected = " !\"#$%"; + assertCondition(check.equals(expected), + "\nExpected :'" + expected + "'" + "\nGot :'" + check + "'" + added); + } catch (Exception e) { + failed(e, "Unexpected Exception " + added); + } } + } + /** + * updateNCharacterStream() - Should work with weird reader and not all read + **/ + public void Var071() { + String added = "Added by native driver 10/11/2006 to test input stream that sometimes returns 0 bytes "; + if (checkJdbc40()) - /** - updateCharacterStream() - Should work with weird reader - **/ - - public void Var070() { - - String added = "Added by native driver 10/11/2006 to test input stream that sometimes returns 0 bytes "; - if(checkJdbc40 ()) - - { - try - { - JDRSTest.position (rs_, key_); - Reader r = new JDWeirdReader("0102030"); - //toolbox expects correct size - try{ - - JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", 14, r, (long) 6); - }catch(SQLException e){ - if(isToolboxDriver()) - { - assertCondition((""+e.getMessage()).endsWith("buffer length not valid."), "Exception was "+e); - return; - }else{ - throw e; - } - } - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - String check = rs2.getString ("C_VARCHAR_50"); - rs2.close (); - String expected = " !\"#$%"; - assertCondition (check.equals (expected), "\nExpected :'"+expected+"'" + - "\nGot :'"+check+"'" + added ); - } - catch(Exception e) - { - failed (e, "Unexpected Exception "+added); - } + try { + JDRSTest.position(rs_, key_); + Reader r = new JDWeirdReader("0102030"); + // toolbox expects correct size + try { + JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", 14, r, (long) 6); + } catch (SQLException e) { + r.close(); + if (isToolboxDriver()) { + assertCondition(("" + e.getMessage()).endsWith("buffer length not valid."), "Exception was " + e); + return; + } else { + throw e; + } } + r.close(); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + String check = rs2.getString("C_VARCHAR_50"); + rs2.close(); + String expected = " !\"#$%"; + assertCondition(check.equals(expected), + "\nExpected :'" + expected + "'" + "\nGot :'" + check + "'" + added); + } catch (Exception e) { + failed(e, "Unexpected Exception " + added); + } } + } - /** - updateNCharacterStream() - Should work with weird reader and not all read - **/ - public void Var071() - { - String added = "Added by native driver 10/11/2006 to test input stream that sometimes returns 0 bytes "; - if(checkJdbc40 ()) - - { - try - { - JDRSTest.position (rs_, key_); - Reader r = new JDWeirdReader("0102030"); - //toolbox expects correct size - try{ - JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", 14, r, (long) 6); - }catch(SQLException e){ - if(isToolboxDriver()) - { - assertCondition((""+e.getMessage()).endsWith("buffer length not valid."), "Exception was "+e); - return; - }else{ - throw e; - } - } - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - String check = rs2.getString ("C_VARCHAR_50"); - rs2.close (); - String expected = " !\"#$%"; - assertCondition (check.equals (expected), "\nExpected :'"+expected+"'" + - "\nGot :'"+check+"'" + added ); - } - catch(Exception e) - { - failed (e, "Unexpected Exception "+added); + /** + * updateNCharacterStream() - Update DFP16: + **/ + public void Var072() { + if (checkJdbc40()) + if (checkDecFloatSupport()) { + try { + Statement s = connection_.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); + ResultSet rs = s.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_UPDDFP16 + " FOR UPDATE "); + rs.next(); + JDReflectionUtil.callMethod_V(rs, "updateNCharacterStream", 1, new StringReader("Hannover"), 8L); + rs.close(); + s.close(); + failed("Didn't throw SQLException "); + } catch (Exception e) { + if (getDriver() == JDTestDriver.DRIVER_NATIVE) { + String message = e.getMessage(); + boolean success = (message.indexOf("Data type mismatch") >= 0); + if (!success) { + e.printStackTrace(); } + assertCondition(success, "Expected Data type mismatch exception but got " + message); + } else { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } - } + } + } + + /** + * updateNCharacterStream() - Update DFP34: + **/ - - /** - updateNCharacterStream() - Update DFP16: - **/ - public void Var072 () - { - if(checkJdbc40 ()) - if (checkDecFloatSupport()) { - try { - Statement s = connection_.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, - ResultSet.CONCUR_UPDATABLE); - ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP16+" FOR UPDATE "); - rs.next(); - JDReflectionUtil.callMethod_V(rs, "updateNCharacterStream", 1, - new StringReader ("Hannover"), 8L ); - failed ("Didn't throw SQLException "); - } - catch (Exception e) { - if (getDriver() == JDTestDriver.DRIVER_NATIVE) { - String message = e.getMessage(); + public void Var073() { + if (checkJdbc40()) + if (checkDecFloatSupport()) { + try { + Statement s = connection_.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); + ResultSet rs = s.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_UPDDFP34 + " FOR UPDATE "); + rs.next(); + JDReflectionUtil.callMethod_V(rs, "updateNCharacterStream", 1, new StringReader("Hannover"), 8L); + rs.close(); + s.close(); + failed("Didn't throw SQLException "); + } catch (Exception e) { + if (getDriver() == JDTestDriver.DRIVER_NATIVE) { + String message = e.getMessage(); boolean success = (message.indexOf("Data type mismatch") >= 0); - if (!success) { + if (!success) { e.printStackTrace(); } - assertCondition(success, "Expected Data type mismatch exception but got "+message); - } else { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } - } - } - - /** - updateNCharacterStream() - Update DFP34: - **/ - - public void Var073 () - { - if(checkJdbc40 ()) - if (checkDecFloatSupport()) { - try { - Statement s = connection_.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, - ResultSet.CONCUR_UPDATABLE); - ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP34+" FOR UPDATE "); - rs.next(); - JDReflectionUtil.callMethod_V(rs, "updateNCharacterStream", 1, - new StringReader ("Hannover"), 8L ); - failed ("Didn't throw SQLException "); - } - catch (Exception e) { - if (getDriver() == JDTestDriver.DRIVER_NATIVE) { - String message = e.getMessage(); - boolean success = (message.indexOf("Data type mismatch") >= 0); - if (!success) { - e.printStackTrace(); - } - assertCondition(success, "Expected Data type mismatch exception but got "+message); - } else { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } - } - } - - - - /** - updateNCharacterStream() - Update a BOOLEAN - **/ - public void Var074() - { - if(checkJdbc40 ()) - { - if(checkBooleanSupport()) - { - try - { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_BOOLEAN", new StringReader ("1"), 1L); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + assertCondition(success, "Expected Data type mismatch exception but got " + message); + } else { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } - } - - + } + } + /** + * updateNCharacterStream() - Update a BOOLEAN + **/ + public void Var074() { + if (checkJdbc40()) { + if (checkBooleanSupport()) { + try { + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateNCharacterStream", "C_BOOLEAN", new StringReader("1"), 1L); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } + } + } + } } - - - diff --git a/src/test/JD/RS/JDRSUpdateNClob.java b/src/test/JD/RS/JDRSUpdateNClob.java index b062545b..cae90194 100644 --- a/src/test/JD/RS/JDRSUpdateNClob.java +++ b/src/test/JD/RS/JDRSUpdateNClob.java @@ -31,2458 +31,1967 @@ import test.JDReflectionUtil; import test.JDTestDriver; import test.JDTestcase; - - +import test.JD.JDSerializeFile; /** -Testcase JDRSUpdateNClob. This tests the following method -of the JDBC ResultSet class: - -
    -
  • updateNClob() -
-**/ -public class JDRSUpdateNClob -extends JDTestcase -{ + * Testcase JDRSUpdateNClob. This tests the following method of the JDBC + * ResultSet class: + * + *
    + *
  • updateNClob() + *
+ **/ +public class JDRSUpdateNClob extends JDTestcase { public static void main(String args[]) throws Exception { - String[] newArgs = new String[args.length+2]; - newArgs[0] = "-tc"; - newArgs[1] = "JDRSUpdateNClob"; - for (int i = 0; i < args.length; i++) { - newArgs[2+i]=args[i]; - } - test.JDRSTest.main(newArgs); - } - - - - // Private data. - private static final String key_ = "JDRSUpdateNClob"; - private static String select_ = "SELECT * FROM " - + JDRSTest.RSTEST_UPDATE; - - private Statement statement_; - private Statement statement2_; - private ResultSet rs_; - - - - /** - Constructor. - **/ - public JDRSUpdateNClob (AS400 systemObject, - Hashtable> namesAndVars, - int runMode, - FileOutputStream fileOutputStream, - - String password) - { - super (systemObject, "JDRSUpdateNClob", - namesAndVars, runMode, fileOutputStream, - password); - } - - - - /** - Performs setup needed before running variations. - - @exception Exception If an exception occurs. - **/ - protected void setup () - throws Exception - { - if (connection_ != null) connection_.close(); - select_ = "SELECT * FROM " + JDRSTest.RSTEST_UPDATE; - - if(isJdbc40 ()) - { - String url = baseURL_ - - - + ";date format=iso" - + ";data truncation=true"; - connection_ = testDriver_.getConnection (url,systemObject_.getUserId(), encryptedPassword_); - connection_.setAutoCommit(false); // @C1A - statement_ = connection_.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, - ResultSet.CONCUR_UPDATABLE); - statement2_ = connection_.createStatement (ResultSet.TYPE_SCROLL_INSENSITIVE, - ResultSet.CONCUR_READ_ONLY); - - statement_.executeUpdate ("INSERT INTO " + JDRSTest.RSTEST_UPDATE - + " (C_KEY) VALUES ('DUMMY_ROW')"); - statement_.executeUpdate ("INSERT INTO " + JDRSTest.RSTEST_UPDATE - + " (C_KEY) VALUES ('" + key_ + "')"); - - rs_ = statement_.executeQuery (select_ + " FOR UPDATE"); - } + String[] newArgs = new String[args.length + 2]; + newArgs[0] = "-tc"; + newArgs[1] = "JDRSUpdateNClob"; + for (int i = 0; i < args.length; i++) { + newArgs[2 + i] = args[i]; } + test.JDRSTest.main(newArgs); + } + // Private data. + private static final String key_ = "JDRSUpdateNClob"; + private static String select_ = "SELECT * FROM " + JDRSTest.RSTEST_UPDATE; + private Statement statement_; + private Statement statement2_; + private ResultSet rs_; + private JDSerializeFile serializeUpdateFile_; - /** - Performs cleanup needed after running variations. - - @exception Exception If an exception occurs. - **/ - protected void cleanup () - throws Exception - { - if(isJdbc40 ()) - { - rs_.close (); - statement_.close (); - connection_.commit(); // @C1A - connection_.close (); - } - } + /** + * Constructor. + **/ + public JDRSUpdateNClob(AS400 systemObject, Hashtable> namesAndVars, int runMode, + FileOutputStream fileOutputStream, + String password) { + super(systemObject, "JDRSUpdateNClob", namesAndVars, runMode, fileOutputStream, password); + } + /** + * Performs setup needed before running variations. + * + * @exception Exception If an exception occurs. + **/ + protected void setup() throws Exception { + if (connection_ != null) + connection_.close(); + select_ = "SELECT * FROM " + JDRSTest.RSTEST_UPDATE; - /** - updateNClob() - Should throw exception when the result set is - closed. - **/ - public void Var001() - { - if(checkJdbc40 ()) - { - try - { - Statement s = connection_.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, - ResultSet.CONCUR_UPDATABLE); - ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_UPDATE + " FOR UPDATE"); - rs.next (); - rs.close (); - - Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); - JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "Juneau"); - JDReflectionUtil.callMethod_V(rs, "updateNClob", "C_VARCHAR_50", nClob);// "Juneau")); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } - } + if (isJdbc40()) { + String url = baseURL_ + + ";date format=iso" + ";data truncation=true"; + connection_ = testDriver_.getConnection(url, systemObject_.getUserId(), encryptedPassword_); + connection_.setAutoCommit(false); // @C1A + serializeUpdateFile_ = new JDSerializeFile(connection_, JDRSTest.RSTEST_UPDATE); + connection_.commit(); + statement_ = connection_.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); + statement2_ = connection_.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); + statement_.executeUpdate("INSERT INTO " + JDRSTest.RSTEST_UPDATE + " (C_KEY) VALUES ('DUMMY_UPDNCLOB')"); + statement_.executeUpdate("INSERT INTO " + JDRSTest.RSTEST_UPDATE + " (C_KEY) VALUES ('" + key_ + "')"); - /** - updateNClob() - Should throw exception when the result set is - not updatable. - **/ - public void Var002() - { - if(checkJdbc40 ()) - { - try - { - Statement s = connection_.createStatement (ResultSet.TYPE_SCROLL_INSENSITIVE, - ResultSet.CONCUR_READ_ONLY); - ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_UPDATE); - rs.next (); - - Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); - JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "Tacoma"); - - JDReflectionUtil.callMethod_V(rs, "updateNClob", "C_VARCHAR_50", nClob);//"Tacoma")); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + rs_ = statement_.executeQuery(select_ + " FOR UPDATE"); } + } - - - /** - updateNClob() - Should throw exception when cursor is not pointing - to a row. - **/ - public void Var003() - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, null); - Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); - JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "Portland"); - JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_VARCHAR_50", nClob);//"Portland")); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + /** + * Performs cleanup needed after running variations. + * + * @exception Exception If an exception occurs. + **/ + protected void cleanup() throws Exception { + if (isJdbc40()) { + rs_.close(); + statement_.close(); + connection_.commit(); // @C1A + serializeUpdateFile_.close(); + connection_.commit(); + connection_.close(); } + } - - - /** - updateNClob() - Should throw an exception when the column - is an invalid index. - **/ - public void Var004() - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); - JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "San Francisco"); - JDReflectionUtil.callMethod_V(rs_, "updateNClob", 100, nClob);//"San Francisco")); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + /** + * updateNClob() - Should throw exception when the result set is closed. + **/ + public void Var001() { + if (checkJdbc40()) { + + try { + + Statement s = connection_.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); + ResultSet rs = s.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_UPDATE + " FOR UPDATE"); + rs.next(); + rs.close(); + + Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); + JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "Juneau"); + JDReflectionUtil.callMethod_V(rs, "updateNClob", "C_VARCHAR_50", nClob);// "Juneau")); + s.close(); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } + } - - - /** - updateNClob() - Should throw an exception when the column - is 0. - **/ - public void Var005() - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); - JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "Boise"); - JDReflectionUtil.callMethod_V(rs_, "updateNClob", 0, nClob);// "Boise")); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + /** + * updateNClob() - Should throw exception when the result set is not updatable. + **/ + public void Var002() { + if (checkJdbc40()) { + + try { + + Statement s = connection_.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); + ResultSet rs = s.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_UPDATE); + rs.next(); + + Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); + JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "Tacoma"); + + JDReflectionUtil.callMethod_V(rs, "updateNClob", "C_VARCHAR_50", nClob);// "Tacoma")); + rs.close(); + s.close(); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } + } - - - /** - updateNClob() - Should throw an exception when the column - is -1. - **/ - public void Var006() - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); - JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "Helena"); - JDReflectionUtil.callMethod_V(rs_, "updateNClob", -1, nClob);// "Helena")); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + /** + * updateNClob() - Should throw exception when cursor is not pointing to a row. + **/ + public void Var003() { + if (checkJdbc40()) { + + try { + + JDRSTest.position(rs_, null); + Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); + JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "Portland"); + JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_VARCHAR_50", nClob);// "Portland")); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } + } - - - /** - updateNClob() - Should work when the column index is valid. - **/ - public void Var007() - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); - JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "Fargo"); - JDReflectionUtil.callMethod_V(rs_, "updateNClob", 14, nClob);// "Fargo")); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - String v = rs2.getString ("C_VARCHAR_50"); - rs2.close (); - assertCondition (v.equals ("Fargo")); - } - catch(Exception e) - { - failed (e, "Unexpected Exception"); - } - } + /** + * updateNClob() - Should throw an exception when the column is an invalid + * index. + **/ + public void Var004() { + if (checkJdbc40()) { + + try { + + JDRSTest.position(rs_, key_); + Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); + JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "San Francisco"); + JDReflectionUtil.callMethod_V(rs_, "updateNClob", 100, nClob);// "San Francisco")); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } + } - - - /** - updateNClob() - Should throw an exception when the column - name is null. - **/ - public void Var008() - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); - JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "Sioux Falls"); - JDReflectionUtil.callMethod_V(rs_, "updateNClob", null, nClob);//"Sioux Falls")); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + /** + * updateNClob() - Should throw an exception when the column is 0. + **/ + public void Var005() { + if (checkJdbc40()) { + + try { + + JDRSTest.position(rs_, key_); + Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); + JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "Boise"); + JDReflectionUtil.callMethod_V(rs_, "updateNClob", 0, nClob);// "Boise")); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } + } - - - /** - updateNClob() - Should throw an exception when the column - name is an empty string. - **/ - public void Var009() - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); - JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "Lincoln"); - JDReflectionUtil.callMethod_V(rs_, "updateNClob", "", nClob);//"Lincoln")); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + /** + * updateNClob() - Should throw an exception when the column is -1. + **/ + public void Var006() { + if (checkJdbc40()) { + + try { + + JDRSTest.position(rs_, key_); + Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); + JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "Helena"); + JDReflectionUtil.callMethod_V(rs_, "updateNClob", -1, nClob);// "Helena")); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } + } - - - /** updateNClob() - Should throw an exception when the column - name is invalid. - **/ - public void Var010() - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); - JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "Colorado Springs"); - JDReflectionUtil.callMethod_V(rs_, "updateNClob", "INVALID", nClob);// "Colorado Springs")); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + /** + * updateNClob() - Should work when the column index is valid. + **/ + public void Var007() { + if (checkJdbc40()) { + + try { + + JDRSTest.position(rs_, key_); + Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); + JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "Fargo"); + JDReflectionUtil.callMethod_V(rs_, "updateNClob", 14, nClob);// "Fargo")); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + String v = rs2.getString("C_VARCHAR_50"); + rs2.close(); + assertCondition(v.equals("Fargo")); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } } + } - - - /** - updateNClob() - Should work when the column name is valid. - **/ - public void Var011() - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); - JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "Gillette"); - JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_VARCHAR_50", nClob);// "Gillette")); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - String v = rs2.getString ("C_VARCHAR_50"); - rs2.close (); - assertCondition (v.equals ("Gillette")); - } - catch(Exception e) - { - failed (e, "Unexpected Exception"); - } - } + /** + * updateNClob() - Should throw an exception when the column name is null. + **/ + public void Var008() { + if (checkJdbc40()) { + + try { + + JDRSTest.position(rs_, key_); + Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); + JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "Sioux Falls"); + JDReflectionUtil.callMethod_V(rs_, "updateNClob", null, nClob);// "Sioux Falls")); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } + } - - - /** - updateNClob() - Should update to SQL NULL when the column - value is null. - **/ - public void Var012() - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - Class[] argClasses = new Class[2]; - argClasses[0] = String.class; - try { - argClasses[1] = Class.forName("java.sql.NClob"); - } catch (Exception e) { - output_.println("Warning :"+e); - argClasses[1] = Class.forName("com.ibm.db2.jdbc.app.NClob"); - } - Object[] args = new Object[2]; - args[0] = "C_VARCHAR_50"; - args[1] = null; - JDReflectionUtil.callMethod_V(rs_, "updateNClob", argClasses, args); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - String v = rs2.getString ("C_VARCHAR_50"); - boolean wn = rs2.wasNull (); - rs2.close (); - assertCondition ((v == null) && (wn == true)); - } - catch(Exception e) - { - failed (e, "Unexpected Exception"); - } - } + /** + * updateNClob() - Should throw an exception when the column name is an empty + * string. + **/ + public void Var009() { + if (checkJdbc40()) { + + try { + + JDRSTest.position(rs_, key_); + Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); + JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "Lincoln"); + JDReflectionUtil.callMethod_V(rs_, "updateNClob", "", nClob);// "Lincoln")); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } + } - - - /** - updateNClob() - Should throw an exception when the length is invalid. - **/ - public void Var013() - { - notApplicable(); + /** + * updateNClob() - Should throw an exception when the column name is invalid. + **/ + public void Var010() { + if (checkJdbc40()) { + + try { + + JDRSTest.position(rs_, key_); + Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); + JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "Colorado Springs"); + JDReflectionUtil.callMethod_V(rs_, "updateNClob", "INVALID", nClob);// "Colorado Springs")); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } + } - - - /** - updateNClob() - Should be reflected by get, even if update has - not yet been issued (i.e. update is still pending). - **/ - public void Var014() - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); - JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "Santa Fe"); - JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_VARCHAR_50", nClob);//, "Santa Fe")); - assertCondition (rs_.getString ("C_VARCHAR_50").equals ("Santa Fe")); - } - catch(Exception e) - { - failed (e, "Unexpected Exception"); - } - } + /** + * updateNClob() - Should work when the column name is valid. + **/ + public void Var011() { + if (checkJdbc40()) { + + try { + + JDRSTest.position(rs_, key_); + Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); + JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "Gillette"); + JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_VARCHAR_50", nClob);// "Gillette")); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + String v = rs2.getString("C_VARCHAR_50"); + rs2.close(); + assertCondition(v.equals("Gillette")); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } } + } - - - - /** - updateNClob() - Should be reflected by get, after update has - been issued, but cursor has not been repositioned. - **/ - public void Var015() - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); - JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "Phoenix"); - JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_VARCHAR_50", nClob);//, "Phoenix")); - rs_.updateRow (); - assertCondition (rs_.getString ("C_VARCHAR_50").equals ("Phoenix")); - } - catch(Exception e) - { - failed (e, "Unexpected Exception"); - } - } + /** + * updateNClob() - Should update to SQL NULL when the column value is null. + **/ + public void Var012() { + if (checkJdbc40()) { + + try { + + JDRSTest.position(rs_, key_); + Class[] argClasses = new Class[2]; + argClasses[0] = String.class; + try { + argClasses[1] = Class.forName("java.sql.NClob"); + } catch (Exception e) { + output_.println("Warning :" + e); + argClasses[1] = Class.forName("com.ibm.db2.jdbc.app.NClob"); + } + Object[] args = new Object[2]; + args[0] = "C_VARCHAR_50"; + args[1] = null; + JDReflectionUtil.callMethod_V(rs_, "updateNClob", argClasses, args); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + String v = rs2.getString("C_VARCHAR_50"); + boolean wn = rs2.wasNull(); + rs2.close(); + assertCondition((v == null) && (wn == true)); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } } + } + /** + * updateNClob() - Should throw an exception when the length is invalid. + **/ + public void Var013() { + notApplicable(); + } - - - /** - updateNClob() - Should be reflected by get, after update has - been issued and cursor has been repositioned. - **/ - public void Var016() - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); - JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "Austin"); - JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_VARCHAR_50", nClob);//"Austin")); - rs_.updateRow (); - rs_.beforeFirst (); - JDRSTest.position (rs_, key_); - String v = rs_.getString ("C_VARCHAR_50"); - assertCondition (v.equals ("Austin")); - } - catch(Exception e) - { - failed (e, "Unexpected Exception"); - } - } + /** + * updateNClob() - Should be reflected by get, even if update has not yet been + * issued (i.e. update is still pending). + **/ + public void Var014() { + if (checkJdbc40()) { + + try { + + JDRSTest.position(rs_, key_); + Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); + JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "Santa Fe"); + JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_VARCHAR_50", nClob);// , "Santa Fe")); + assertCondition(rs_.getString("C_VARCHAR_50").equals("Santa Fe")); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } } + } - - - - /** - updateNClob() - Should work when the current row is the insert - row. - **/ - public void Var017() - { - if(checkJdbc40 ()) - { - try - { - rs_.moveToInsertRow (); - rs_.updateString ("C_KEY", "JDRSCharacterStream 1"); - Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); - JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "Tulsa"); - JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_VARCHAR_50", nClob);// "Tulsa")); - rs_.insertRow (); - JDRSTest.position (rs_, "JDRSCharacterStream 1"); - assertCondition (rs_.getString ("C_VARCHAR_50").equals ("Tulsa")); - } - catch(Exception e) - { - failed (e, "Unexpected Exception"); - } - } + /** + * updateNClob() - Should be reflected by get, after update has been issued, but + * cursor has not been repositioned. + **/ + public void Var015() { + if (checkJdbc40()) { + + try { + + JDRSTest.position(rs_, key_); + Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); + JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "Phoenix"); + JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_VARCHAR_50", nClob);// , "Phoenix")); + rs_.updateRow(); + assertCondition(rs_.getString("C_VARCHAR_50").equals("Phoenix")); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } } + } - - - /** - updateNClob() - Should be reflected by get on insert row, even if - insert has not yet been issued (i.e. insert is still pending). - **/ - public void Var018() - { - if(checkJdbc40 ()) - { - try - { - rs_.moveToInsertRow (); - Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); - JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "Lawrence"); - JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_VARCHAR_50", nClob);// "Lawrence")); - assertCondition (rs_.getString ("C_VARCHAR_50").equals ("Lawrence")); - } - catch(Exception e) - { - failed (e, "Unexpected Exception"); - } - } + /** + * updateNClob() - Should be reflected by get, after update has been issued and + * cursor has been repositioned. + **/ + public void Var016() { + if (checkJdbc40()) { + + try { + + JDRSTest.position(rs_, key_); + Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); + JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "Austin"); + JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_VARCHAR_50", nClob);// "Austin")); + rs_.updateRow(); + rs_.beforeFirst(); + JDRSTest.position(rs_, key_); + String v = rs_.getString("C_VARCHAR_50"); + assertCondition(v.equals("Austin")); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } } + } - - - /** - updateNClob() - Should throw an exception on a deleted row. - **/ - public void Var019() - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, "DUMMY_ROW"); - rs_.deleteRow (); - Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); - JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "Ames"); - JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_VARCHAR_50", nClob);//"Ames")); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + /** + * updateNClob() - Should work when the current row is the insert row. + **/ + public void Var017() { + if (checkJdbc40()) { + + try { + + rs_.moveToInsertRow(); + rs_.updateString("C_KEY", "JDRSCharacterStream 1"); + Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); + JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "Tulsa"); + JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_VARCHAR_50", nClob);// "Tulsa")); + rs_.insertRow(); + JDRSTest.position(rs_, "JDRSCharacterStream 1"); + assertCondition(rs_.getString("C_VARCHAR_50").equals("Tulsa")); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } } + } - - /** - updateNClob() - Update a SMALLINT. - **/ - public void Var020 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); - JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "31"); - try - { - JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_SMALLINT", nClob);// "31")); - }catch(SQLException e) - { - if(isToolboxDriver()) - { - assertCondition(e.getMessage().equals("Data type mismatch.")); - return; - } - else - throw e; - } - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - short v = rs2.getShort ("C_SMALLINT"); - rs2.close (); - assertCondition (v == 31); - } - catch(Exception e) - { - failed (e, "Unexpected Exception"); - } - } + /** + * updateNClob() - Should be reflected by get on insert row, even if insert has + * not yet been issued (i.e. insert is still pending). + **/ + public void Var018() { + if (checkJdbc40()) { + + try { + + rs_.moveToInsertRow(); + Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); + JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "Lawrence"); + JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_VARCHAR_50", nClob);// "Lawrence")); + assertCondition(rs_.getString("C_VARCHAR_50").equals("Lawrence")); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } } + } - - - /** - updateNClob() - Update a SMALLINT, when the integer is too big. - **/ - public void Var021 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); - JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "224323"); - JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_SMALLINT", nClob);// "224323")); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + /** + * updateNClob() - Should throw an exception on a deleted row. + **/ + public void Var019() { + if (checkJdbc40()) { + + try { + + JDRSTest.position(rs_, "DUMMY_UPDNCLOB"); + rs_.deleteRow(); + Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); + JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "Ames"); + JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_VARCHAR_50", nClob);// "Ames")); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } + } - - - /** - updateNClob() - Update a SMALLINT, when the string is not a number. - **/ - public void Var022 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); - JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "Van Buren"); - JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_SMALLINT", nClob);// "Van Buren")); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + /** + * updateNClob() - Update a SMALLINT. + **/ + public void Var020() { + if (checkJdbc40()) { + + try { + + JDRSTest.position(rs_, key_); + Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); + JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "31"); + try { + JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_SMALLINT", nClob);// "31")); + } catch (SQLException e) { + if (isToolboxDriver()) { + assertCondition(e.getMessage().equals("Data type mismatch.")); + return; + } else + throw e; + } + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + short v = rs2.getShort("C_SMALLINT"); + rs2.close(); + assertCondition(v == 31); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } } + } - - - /** - updateNClob() - Update an INTEGER. - **/ - public void Var023 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); - JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "-12374"); - try - { - JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_INTEGER", nClob);// "-12374")); - }catch(SQLException e) - { - if(isToolboxDriver()) - { - assertCondition(e.getMessage().equals("Data type mismatch.")); - return; - } - else - throw e; - } - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - int v = rs2.getInt ("C_INTEGER"); - rs2.close (); - assertCondition (v == -12374); - } - catch(Exception e) - { - failed (e, "Unexpected Exception"); - } - } + /** + * updateNClob() - Update a SMALLINT, when the integer is too big. + **/ + public void Var021() { + if (checkJdbc40()) { + + try { + + JDRSTest.position(rs_, key_); + Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); + JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "224323"); + JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_SMALLINT", nClob);// "224323")); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } + } - - - /** - updateNClob() - Update an INTEGER, when the integer is too big. - **/ - public void Var024 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); - JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "435353487623"); - JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_INTEGER", nClob);// "435353487623")); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + /** + * updateNClob() - Update a SMALLINT, when the string is not a number. + **/ + public void Var022() { + if (checkJdbc40()) { + + try { + + JDRSTest.position(rs_, key_); + Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); + JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "Van Buren"); + JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_SMALLINT", nClob);// "Van Buren")); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } + } - - - /** - updateNClob() - Update an INTEGER, when the string is not a number. - **/ - public void Var025 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); - JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "Baton Rouge"); - JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_INTEGER", nClob);// "Baton Rouge")); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + /** + * updateNClob() - Update an INTEGER. + **/ + public void Var023() { + if (checkJdbc40()) { + + try { + + JDRSTest.position(rs_, key_); + Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); + JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "-12374"); + try { + JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_INTEGER", nClob);// "-12374")); + } catch (SQLException e) { + if (isToolboxDriver()) { + assertCondition(e.getMessage().equals("Data type mismatch.")); + return; + } else + throw e; + } + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + int v = rs2.getInt("C_INTEGER"); + rs2.close(); + assertCondition(v == -12374); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } } + } - - - /** - updateNClob() - Update a REAL. - **/ - public void Var026 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); - JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "13.35"); - try - { - JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_REAL", nClob);// "13.35")); - }catch(SQLException e) - { - if(isToolboxDriver()) - { - assertCondition(e.getMessage().equals("Data type mismatch.")); - return; - } - else - throw e; - } - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - float v = rs2.getFloat ("C_REAL"); - rs2.close (); - assertCondition (v == 13.35f); - } - catch(Exception e) - { - failed (e, "Unexpected Exception"); - } - } + /** + * updateNClob() - Update an INTEGER, when the integer is too big. + **/ + public void Var024() { + if (checkJdbc40()) { + + try { + + JDRSTest.position(rs_, key_); + Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); + JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "435353487623"); + JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_INTEGER", nClob);// "435353487623")); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } + } - - /** - updateNClob() - Update a REAL, when the number is too big. - - Note: Given the new data truncation rules for JDBC, this testcase - is expected to work without throwing a DataTruncation exception. - **/ - public void Var027 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); - JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "453433335.4437623"); - try - { - JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_REAL", nClob);// "453433335.4437623")); - }catch(SQLException e) - { - if(isToolboxDriver()) - { - assertCondition(e.getMessage().equals("Data type mismatch.")); - return; - } - else - throw e; - } - rs_.updateRow (); - - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - float v = rs2.getFloat ("C_REAL"); - rs2.close (); - // Does anyone have a good suggestion for what should be done here? - assertCondition (v == 4.53433344E8, "v = "+v+"\n"+"" + - " sb 4.53433344E8"); - } - catch(Exception e) - { - failed (e, "Unexpected Exception"); - } - } - /* - failed ("Didn't throw SQLException"); - } - catch (Exception e) { - DataTruncation dt = (DataTruncation)e; - assertCondition ((dt.getIndex() == expectedColumn) - && (dt.getParameter() == false) - && (dt.getRead() == false) - && (dt.getDataSize() == 15) - && (dt.getTransferSize() == 10)); - - } - } - */ - } - - - - /** - updateNClob() - Update a REAL, when the string is not a number. - **/ public void Var028 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); - JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "Edina"); - JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_INTEGER", nClob); //"Edina")); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + /** + * updateNClob() - Update an INTEGER, when the string is not a number. + **/ + public void Var025() { + if (checkJdbc40()) { + + try { + + JDRSTest.position(rs_, key_); + Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); + JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "Baton Rouge"); + JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_INTEGER", nClob);// "Baton Rouge")); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } + } - - - - /** - updateNClob() - Update a FLOAT. - **/ - public void Var029 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); - JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "9835.2"); - try - { - JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_FLOAT", nClob);// "9835.2")); - }catch(SQLException e) - { - if(isToolboxDriver()) - { - assertCondition(e.getMessage().equals("Data type mismatch.")); - return; - } - else - throw e; - } - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - float v = rs2.getFloat ("C_FLOAT"); - rs2.close (); - assertCondition (v == 9835.2f); - } - catch(Exception e) - { - failed (e, "Unexpected Exception"); - } - } + /** + * updateNClob() - Update a REAL. + **/ + public void Var026() { + if (checkJdbc40()) { + + try { + + JDRSTest.position(rs_, key_); + Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); + JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "13.35"); + try { + JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_REAL", nClob);// "13.35")); + } catch (SQLException e) { + if (isToolboxDriver()) { + assertCondition(e.getMessage().equals("Data type mismatch.")); + return; + } else + throw e; + } + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + float v = rs2.getFloat("C_REAL"); + rs2.close(); + assertCondition(v == 13.35f); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } } + } + /** + * updateNClob() - Update a REAL, when the number is too big. + * + * Note: Given the new data truncation rules for JDBC, this testcase is expected + * to work without throwing a DataTruncation exception. + **/ + public void Var027() { + if (checkJdbc40()) { + + try { + + JDRSTest.position(rs_, key_); + Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); + JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "453433335.4437623"); + try { + JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_REAL", nClob);// "453433335.4437623")); + } catch (SQLException e) { + if (isToolboxDriver()) { + assertCondition(e.getMessage().equals("Data type mismatch.")); + return; + } else + throw e; + } + rs_.updateRow(); + + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + float v = rs2.getFloat("C_REAL"); + rs2.close(); + // Does anyone have a good suggestion for what should be done here? + assertCondition(v == 4.53433344E8, "v = " + v + "\n" + "" + " sb 4.53433344E8"); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + /* + * failed ("Didn't throw SQLException"); } catch (Exception e) { DataTruncation + * dt = (DataTruncation)e; assertCondition ((dt.getIndex() == expectedColumn) && + * (dt.getParameter() == false) && (dt.getRead() == false) && (dt.getDataSize() + * == 15) && (dt.getTransferSize() == 10)); + * + * } } + */ + } - - /** - updateNClob() - Update a FLOAT, when the number is too big. - - Note: Given the new data truncation rules for JDBC, this testcase - is expected to work without throwing a DataTruncation exception. - **/ - public void Var030 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); - JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "453435.4434556337633"); - try - { - JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_FLOAT", nClob);// "453435.4434556337633")); - }catch(SQLException e) - { - if(isToolboxDriver()) - { - assertCondition(e.getMessage().equals("Data type mismatch.")); - return; - } - else - throw e; - } - rs_.updateRow (); - - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - float v = rs2.getFloat ("C_FLOAT"); - rs2.close (); - assertCondition ((v > 453435) && (v < 453436)); - } - catch(Exception e) - { - failed (e, "Unexpected Exception"); - } - } - /* - failed ("Didn't throw SQLException"); - } - catch (Exception e) { - DataTruncation dt = (DataTruncation)e; - assertCondition ((dt.getIndex() == expectedColumn) - && (dt.getParameter() == false) - && (dt.getRead() == false) - && (dt.getDataSize() == 19) - && (dt.getTransferSize() == 17)); - - } - } - */ - } - - - - /** - updateNClob() - Update a FLOAT, when the string is not a number. - **/ - public void Var031 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); - JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "Madison"); - JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_FLOAT", nClob);//, "Madison")); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + /** + * updateNClob() - Update a REAL, when the string is not a number. + **/ + public void Var028() { + if (checkJdbc40()) { + + try { + + JDRSTest.position(rs_, key_); + Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); + JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "Edina"); + JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_INTEGER", nClob); // "Edina")); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } + } - - /** - updateNClob() - Update a DOUBLE. - **/ - public void Var032 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); - JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "-9845"); - try - { - JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_DOUBLE", nClob);// "-9845")); - }catch(SQLException e) - { - if(isToolboxDriver()) - { - assertCondition(e.getMessage().equals("Data type mismatch.")); - return; - } - else - throw e; - } - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - double v = rs2.getDouble ("C_DOUBLE"); - rs2.close (); - assertCondition (v == -9845); - } - catch(Exception e) - { - failed (e, "Unexpected Exception"); - } - } + /** + * updateNClob() - Update a FLOAT. + **/ + public void Var029() { + if (checkJdbc40()) { + + try { + + JDRSTest.position(rs_, key_); + Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); + JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "9835.2"); + try { + JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_FLOAT", nClob);// "9835.2")); + } catch (SQLException e) { + if (isToolboxDriver()) { + assertCondition(e.getMessage().equals("Data type mismatch.")); + return; + } else + throw e; + } + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + float v = rs2.getFloat("C_FLOAT"); + rs2.close(); + assertCondition(v == 9835.2f); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } } + } + /** + * updateNClob() - Update a FLOAT, when the number is too big. + * + * Note: Given the new data truncation rules for JDBC, this testcase is expected + * to work without throwing a DataTruncation exception. + **/ + public void Var030() { + if (checkJdbc40()) { + + try { + + JDRSTest.position(rs_, key_); + Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); + JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "453435.4434556337633"); + try { + JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_FLOAT", nClob);// "453435.4434556337633")); + } catch (SQLException e) { + if (isToolboxDriver()) { + assertCondition(e.getMessage().equals("Data type mismatch.")); + return; + } else + throw e; + } + rs_.updateRow(); + + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + float v = rs2.getFloat("C_FLOAT"); + rs2.close(); + assertCondition((v > 453435) && (v < 453436)); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + /* + * failed ("Didn't throw SQLException"); } catch (Exception e) { DataTruncation + * dt = (DataTruncation)e; assertCondition ((dt.getIndex() == expectedColumn) && + * (dt.getParameter() == false) && (dt.getRead() == false) && (dt.getDataSize() + * == 19) && (dt.getTransferSize() == 17)); + * + * } } + */ + } - - /** - updateNClob() - Update a DOUBLE, when the number is too big. - - Note: Given the new data truncation rules for JDBC, this testcase - is expected to work without throwing a DataTruncation exception. - **/ - public void Var033 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); - JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "453342035.44445532333"); - try - { - JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_DOUBLE", nClob);// "453342035.44445532333")); - }catch(SQLException e) - { - if(isToolboxDriver()) - { - assertCondition(e.getMessage().equals("Data type mismatch.")); - return; - } - else - throw e; - } - rs_.updateRow (); - - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - float v = rs2.getFloat ("C_DOUBLE"); - rs2.close (); - // Does anyone have a good suggestion for what should be done here? - assertCondition (true, "v="+v); - } - catch(Exception e) - { - failed (e, "Unexpected Exception"); - } - } - /* - failed ("Didn't throw SQLException"); - } - catch (Exception e) { - DataTruncation dt = (DataTruncation)e; - assertCondition ((dt.getIndex() == expectedColumn) - && (dt.getParameter() == false) - && (dt.getRead() == false) - && (dt.getDataSize() == 19) - && (dt.getTransferSize() == 17)); - - } - } - */ - } - - - - /** - updateNClob() - Update a DOUBLE, when the string is not a number. - **/ - public void Var034 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); - JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "Chicago"); - JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_DOUBLE", nClob);// "Chicago")); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + /** + * updateNClob() - Update a FLOAT, when the string is not a number. + **/ + public void Var031() { + if (checkJdbc40()) { + + try { + + JDRSTest.position(rs_, key_); + Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); + JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "Madison"); + JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_FLOAT", nClob);// , "Madison")); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } + } - - /** - updateNClob() - Update a DECIMAL. - **/ - public void Var035 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); - JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "4533.43"); - try - { - JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_DECIMAL_105", nClob);//"4533.43")); - }catch(SQLException e) - { - if(isToolboxDriver()) - { - assertCondition(e.getMessage().equals("Data type mismatch.")); - return; - } - else - throw e; - } - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - BigDecimal v = rs2.getBigDecimal ("C_DECIMAL_105"); - rs2.close (); - assertCondition (v.floatValue() == 4533.43f); - } - catch(Exception e) - { - failed (e, "Unexpected Exception"); - } - } + /** + * updateNClob() - Update a DOUBLE. + **/ + public void Var032() { + if (checkJdbc40()) { + + try { + + JDRSTest.position(rs_, key_); + Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); + JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "-9845"); + try { + JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_DOUBLE", nClob);// "-9845")); + } catch (SQLException e) { + if (isToolboxDriver()) { + assertCondition(e.getMessage().equals("Data type mismatch.")); + return; + } else + throw e; + } + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + double v = rs2.getDouble("C_DOUBLE"); + rs2.close(); + assertCondition(v == -9845); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } } + } + /** + * updateNClob() - Update a DOUBLE, when the number is too big. + * + * Note: Given the new data truncation rules for JDBC, this testcase is expected + * to work without throwing a DataTruncation exception. + **/ + public void Var033() { + if (checkJdbc40()) { + + try { + + JDRSTest.position(rs_, key_); + Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); + JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "453342035.44445532333"); + try { + JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_DOUBLE", nClob);// "453342035.44445532333")); + } catch (SQLException e) { + if (isToolboxDriver()) { + assertCondition(e.getMessage().equals("Data type mismatch.")); + return; + } else + throw e; + } + rs_.updateRow(); + + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + float v = rs2.getFloat("C_DOUBLE"); + rs2.close(); + // Does anyone have a good suggestion for what should be done here? + assertCondition(true, "v=" + v); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + /* + * failed ("Didn't throw SQLException"); } catch (Exception e) { DataTruncation + * dt = (DataTruncation)e; assertCondition ((dt.getIndex() == expectedColumn) && + * (dt.getParameter() == false) && (dt.getRead() == false) && (dt.getDataSize() + * == 19) && (dt.getTransferSize() == 17)); + * + * } } + */ + } - - /** - updateNClob() - Update a DECIMAL, when the value is too big. - **/ - public void Var036 () - { - if(checkJdbc40 ()) - { - int expectedColumn = -1; - try - { - JDRSTest.position (rs_, key_); - expectedColumn = rs_.findColumn ("C_DECIMAL_40"); - Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); - JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "5333644511"); - JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_DECIMAL_40", nClob);// "5333644511")); - rs_.updateRow (); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - if(isToolboxDriver()) - { - assertCondition(e.getMessage().equals("Data type mismatch.")); - return; - } - DataTruncation dt = (DataTruncation)e; - assertCondition ((dt.getIndex() == expectedColumn) - && (dt.getParameter() == false) - && (dt.getRead() == false) - && (dt.getDataSize() == 10) - && (dt.getTransferSize() == 4)); - - } - } + /** + * updateNClob() - Update a DOUBLE, when the string is not a number. + **/ + public void Var034() { + if (checkJdbc40()) { + + try { + + JDRSTest.position(rs_, key_); + Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); + JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "Chicago"); + JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_DOUBLE", nClob);// "Chicago")); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } + } - - /** - updateNClob() - Update a DECIMAL, when the string is not a number. - **/ - public void Var037 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); - JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "Terre Haute"); - JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_DECIMAL_105", nClob);// "Terre Haute")); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + /** + * updateNClob() - Update a DECIMAL. + **/ + public void Var035() { + if (checkJdbc40()) { + + try { + + JDRSTest.position(rs_, key_); + Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); + JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "4533.43"); + try { + JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_DECIMAL_105", nClob);// "4533.43")); + } catch (SQLException e) { + if (isToolboxDriver()) { + assertCondition(e.getMessage().equals("Data type mismatch.")); + return; + } else + throw e; + } + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + BigDecimal v = rs2.getBigDecimal("C_DECIMAL_105"); + rs2.close(); + assertCondition(v.floatValue() == 4533.43f); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } } + } - - - /** - updateNClob() - Update a NUMERIC. - **/ - public void Var038 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); - JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "-9333.455"); - try - { - JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_NUMERIC_105", nClob);// "-9333.455")); - }catch(SQLException e) - { - if(isToolboxDriver()) - { - assertCondition(e.getMessage().equals("Data type mismatch.")); - return; - } - else - throw e; - } - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - BigDecimal v = rs2.getBigDecimal ("C_NUMERIC_105"); - rs2.close (); - assertCondition (v.doubleValue() == -9333.455); - } - catch(Exception e) - { - failed (e, "Unexpected Exception"); - } - } + /** + * updateNClob() - Update a DECIMAL, when the value is too big. + **/ + public void Var036() { + if (checkJdbc40()) { + int expectedColumn = -1; + + try { + + JDRSTest.position(rs_, key_); + expectedColumn = rs_.findColumn("C_DECIMAL_40"); + Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); + JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "5333644511"); + JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_DECIMAL_40", nClob);// "5333644511")); + rs_.updateRow(); + failed("Didn't throw SQLException"); + } catch (Exception e) { + if (isToolboxDriver()) { + assertCondition(e.getMessage().equals("Data type mismatch.")); + return; + } + DataTruncation dt = (DataTruncation) e; + assertCondition((dt.getIndex() == expectedColumn) && (dt.getParameter() == false) && (dt.getRead() == false) + && (dt.getDataSize() == 10) && (dt.getTransferSize() == 4)); + + } } + } - - - /** - updateNClob() - Update a NUMERIC, when the value is too big. - **/ - public void Var039 () - { - if(checkJdbc40 ()) - { - int expectedColumn = -1; - try - { - JDRSTest.position (rs_, key_); - expectedColumn = rs_.findColumn ("C_NUMERIC_40"); - Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); - JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "-3315145"); - JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_NUMERIC_40", nClob);// "-3315145")); - rs_.updateRow (); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - if(isToolboxDriver()) - { - assertCondition(e.getMessage().equals("Data type mismatch.")); - return; - } - DataTruncation dt = (DataTruncation)e; - assertCondition ((dt.getIndex() == expectedColumn) - && (dt.getParameter() == false) - && (dt.getRead() == false) - && (dt.getDataSize() == 7) - && (dt.getTransferSize() == 4)); - - } - } + /** + * updateNClob() - Update a DECIMAL, when the string is not a number. + **/ + public void Var037() { + if (checkJdbc40()) { + + try { + + JDRSTest.position(rs_, key_); + Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); + JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "Terre Haute"); + JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_DECIMAL_105", nClob);// "Terre Haute")); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } + } - - - /** - updateNClob() - Update a NUMERIC, when the string is not a number. - **/ - public void Var040 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); - JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "Detroit"); - JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_NUMERIC_105", nClob);// "Detroit")); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + /** + * updateNClob() - Update a NUMERIC. + **/ + public void Var038() { + if (checkJdbc40()) { + + try { + + JDRSTest.position(rs_, key_); + Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); + JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "-9333.455"); + try { + JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_NUMERIC_105", nClob);// "-9333.455")); + } catch (SQLException e) { + if (isToolboxDriver()) { + assertCondition(e.getMessage().equals("Data type mismatch.")); + return; + } else + throw e; + } + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + BigDecimal v = rs2.getBigDecimal("C_NUMERIC_105"); + rs2.close(); + assertCondition(v.doubleValue() == -9333.455); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } } + } - - - /** - updateNClob() - Update a CHAR. - **/ - public void Var041 () - { - - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); - JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "Upper Darby"); - JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_CHAR_50", nClob);// "Upper Darby")); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - String v = rs2.getString ("C_CHAR_50"); - rs2.close (); - assertCondition (v.equals ("Upper Darby ")); - } - catch(Exception e) - { - failed (e, "Unexpected Exception"); - } - } + /** + * updateNClob() - Update a NUMERIC, when the value is too big. + **/ + public void Var039() { + if (checkJdbc40()) { + int expectedColumn = -1; + + try { + + JDRSTest.position(rs_, key_); + expectedColumn = rs_.findColumn("C_NUMERIC_40"); + Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); + JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "-3315145"); + JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_NUMERIC_40", nClob);// "-3315145")); + rs_.updateRow(); + failed("Didn't throw SQLException"); + } catch (Exception e) { + if (isToolboxDriver()) { + assertCondition(e.getMessage().equals("Data type mismatch.")); + return; + } + DataTruncation dt = (DataTruncation) e; + assertCondition((dt.getIndex() == expectedColumn) && (dt.getParameter() == false) && (dt.getRead() == false) + && (dt.getDataSize() == 7) && (dt.getTransferSize() == 4)); + + } } + } - - - /** - updateNClob() - Update a CHAR, when the value is too big. - **/ - public void Var042 () - { - if(checkJdbc40 ()) - { - int expectedColumn = -1; - try - { - JDRSTest.position (rs_, key_); - expectedColumn = rs_.findColumn ("C_CHAR_1"); - Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); - JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "Manhattan"); - JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_CHAR_1", nClob);// "Manhattan")); - rs_.updateRow (); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - DataTruncation dt = (DataTruncation)e; - assertCondition ((dt.getIndex() == expectedColumn) - && (dt.getParameter() == false) - && (dt.getRead() == false) - && (dt.getDataSize() == 9) - && (dt.getTransferSize() == 1)); - - } - } + /** + * updateNClob() - Update a NUMERIC, when the string is not a number. + **/ + public void Var040() { + if (checkJdbc40()) { + + try { + + JDRSTest.position(rs_, key_); + Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); + JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "Detroit"); + JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_NUMERIC_105", nClob);// "Detroit")); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } + } + /** + * updateNClob() - Update a CHAR. + **/ + public void Var041() { - - /** - updateNClob() - Update a VARCHAR, with the length equal to the - full stream. - **/ - public void Var043 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); - JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "Rehoboth Beach"); - JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_VARCHAR_50", nClob);//"Rehoboth Beach")); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - String v = rs2.getString ("C_VARCHAR_50"); - rs2.close (); - assertCondition (v.equals ("Rehoboth Beach")); - } - catch(Exception e) - { - failed (e, "Unexpected Exception"); - } - } + if (checkJdbc40()) { + + try { + + JDRSTest.position(rs_, key_); + Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); + JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "Upper Darby"); + JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_CHAR_50", nClob);// "Upper Darby")); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + String v = rs2.getString("C_CHAR_50"); + rs2.close(); + assertCondition(v.equals("Upper Darby ")); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } } + } - - - /** - updateNClob() - Update a VARCHAR, with the length less than the - full stream. - - @D2 - Native driver doesn't throw an exception if stream contains extra characters then there needs to be there. - **/ - public void Var044 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); - JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "Toronto"); - JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_VARCHAR_50", nClob);// "Toronto")); - if( (getDriver() == JDTestDriver.DRIVER_NATIVE && // @D2 - true) || isToolboxDriver() ) // @D2 - succeeded(); // @D2 - else // @D2 - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - if( getDriver() == JDTestDriver.DRIVER_NATIVE && // @D2 - true ) // @D2 - succeeded(); // @D2 - else // @D2 - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + /** + * updateNClob() - Update a CHAR, when the value is too big. + **/ + public void Var042() { + if (checkJdbc40()) { + int expectedColumn = -1; + + try { + + JDRSTest.position(rs_, key_); + expectedColumn = rs_.findColumn("C_CHAR_1"); + Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); + JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "Manhattan"); + JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_CHAR_1", nClob);// "Manhattan")); + rs_.updateRow(); + failed("Didn't throw SQLException"); + } catch (Exception e) { + DataTruncation dt = (DataTruncation) e; + assertCondition((dt.getIndex() == expectedColumn) && (dt.getParameter() == false) && (dt.getRead() == false) + && (dt.getDataSize() == 9) && (dt.getTransferSize() == 1)); + + } } + } - - - /** - updateNClob() - Update a VARCHAR, with the length greater than the - full stream. - **/ - public void Var045 () - { - notApplicable(); - } - - - - /** - updateNClob() - Update a VARCHAR, with the length set to 1. - - @D2 - Native driver doesn't throw an exception if stream contains extra characters then there needs to be there. - **/ - public void Var046 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); - JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "Winnipeg"); - JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_VARCHAR_50", nClob);// "Winnipeg")); - if( (getDriver() == JDTestDriver.DRIVER_NATIVE && // @D2 - true) || isToolboxDriver() ) // @D2 - succeeded(); // @D2 - else // @D2 - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - if( getDriver() == JDTestDriver.DRIVER_NATIVE && // @D2 - true ) // @D2 - succeeded(); // @D2 - else // @D2 - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + /** + * updateNClob() - Update a VARCHAR, with the length equal to the full stream. + **/ + public void Var043() { + if (checkJdbc40()) { + + try { + + JDRSTest.position(rs_, key_); + Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); + JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "Rehoboth Beach"); + JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_VARCHAR_50", nClob);// "Rehoboth Beach")); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + String v = rs2.getString("C_VARCHAR_50"); + rs2.close(); + assertCondition(v.equals("Rehoboth Beach")); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } } + } + /** + * updateNClob() - Update a VARCHAR, with the length less than the full stream. + * + * @D2 - Native driver doesn't throw an exception if stream contains extra + * characters then there needs to be there. + **/ + public void Var044() { + if (checkJdbc40()) { + + try { + + JDRSTest.position(rs_, key_); + Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); + JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "Toronto"); + JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_VARCHAR_50", nClob);// "Toronto")); + if ((getDriver() == JDTestDriver.DRIVER_NATIVE && // @D2 + true) || isToolboxDriver()) // @D2 + succeeded(); // @D2 + else // @D2 + failed("Didn't throw SQLException"); + } catch (Exception e) { + if (getDriver() == JDTestDriver.DRIVER_NATIVE && // @D2 + true) // @D2 + succeeded(); // @D2 + else // @D2 + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } + } + } + /** + * updateNClob() - Update a VARCHAR, with the length greater than the full + * stream. + **/ + public void Var045() { + notApplicable(); + } - /** - updateNClob() - Update a VARCHAR, with the length set to 0. - **/ - public void Var047 () - { - notApplicable(); - } - - - - /** - updateNClob() - Update a VARCHAR, with an empty string. - **/ - public void Var048 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); - JDReflectionUtil.callMethod_V(nClob, "setString", 1L, ""); - JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_VARCHAR_50", nClob);// "")); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - String v = rs2.getString ("C_VARCHAR_50"); - rs2.close (); - assertCondition (v.equals ("")); - } - catch(Exception e) - { - failed (e, "Unexpected Exception"); - } - } + /** + * updateNClob() - Update a VARCHAR, with the length set to 1. + * + * @D2 - Native driver doesn't throw an exception if stream contains extra + * characters then there needs to be there. + **/ + public void Var046() { + if (checkJdbc40()) { + + try { + + JDRSTest.position(rs_, key_); + Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); + JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "Winnipeg"); + JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_VARCHAR_50", nClob);// "Winnipeg")); + if ((getDriver() == JDTestDriver.DRIVER_NATIVE && // @D2 + true) || isToolboxDriver()) // @D2 + succeeded(); // @D2 + else // @D2 + failed("Didn't throw SQLException"); + } catch (Exception e) { + if (getDriver() == JDTestDriver.DRIVER_NATIVE && // @D2 + true) // @D2 + succeeded(); // @D2 + else // @D2 + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } + } + /** + * updateNClob() - Update a VARCHAR, with the length set to 0. + **/ + public void Var047() { + notApplicable(); + } - - /** - updateNClob() - Update a VARCHAR, when the value is too big. - **/ - public void Var049 () - { - if(checkJdbc40 ()) - { - int expectedColumn = -1; - try - { - JDRSTest.position (rs_, key_); - expectedColumn = rs_.findColumn ("C_VARCHAR_50"); - Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); - JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "The greater Washington, D.C. Metropolitan Area and surrounding communities"); - JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_VARCHAR_50", nClob);//, "The greater Washington, D.C. Metropolitan Area and surrounding communities")); - rs_.updateRow (); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - DataTruncation dt = (DataTruncation)e; - assertCondition ((dt.getIndex() == expectedColumn) - && (dt.getParameter() == false) - && (dt.getRead() == false) - && (dt.getDataSize() == 74) - && (dt.getTransferSize() == 50)); - - } - } + /** + * updateNClob() - Update a VARCHAR, with an empty string. + **/ + public void Var048() { + if (checkJdbc40()) { + + try { + + JDRSTest.position(rs_, key_); + Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); + JDReflectionUtil.callMethod_V(nClob, "setString", 1L, ""); + JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_VARCHAR_50", nClob);// "")); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + String v = rs2.getString("C_VARCHAR_50"); + rs2.close(); + assertCondition(v.equals("")); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } } + } - - /** - updateNClob() - Update a VARCHAR parameter to a bad reader. - **/ - public void Var050() - { - notApplicable(); + /** + * updateNClob() - Update a VARCHAR, when the value is too big. + **/ + public void Var049() { + if (checkJdbc40()) { + int expectedColumn = -1; + + try { + + JDRSTest.position(rs_, key_); + expectedColumn = rs_.findColumn("C_VARCHAR_50"); + Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); + JDReflectionUtil.callMethod_V(nClob, "setString", 1L, + "The greater Washington, D.C. Metropolitan Area and surrounding communities"); + JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_VARCHAR_50", nClob);// , "The greater Washington, D.C. + // Metropolitan Area and surrounding + // communities")); + rs_.updateRow(); + failed("Didn't throw SQLException"); + } catch (Exception e) { + DataTruncation dt = (DataTruncation) e; + assertCondition((dt.getIndex() == expectedColumn) && (dt.getParameter() == false) && (dt.getRead() == false) + && (dt.getDataSize() == 74) && (dt.getTransferSize() == 50)); + + } } + } + /** + * updateNClob() - Update a VARCHAR parameter to a bad reader. + **/ + public void Var050() { + notApplicable(); + } - - - - /** - updateNClob() - Update a BINARY. - **/ - public void Var051 () - { - if(checkJdbc40 ()) - { - try - { - String expected; - - if(isToolboxDriver()) - expected = "F1F2"; - else - expected = "Ford"; - - JDRSTest.position (rs_, key_); - Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); - JDReflectionUtil.callMethod_V(nClob, "setString", 1L, expected); - JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_BINARY_20", nClob);// expected)); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - String v = rs2.getString ("C_BINARY_20"); - rs2.close (); - assertCondition (v.startsWith (expected)); - } - catch(Exception e) - { - failed (e, "Unexpected Exception"); - } - } + /** + * updateNClob() - Update a BINARY. + **/ + public void Var051() { + if (checkJdbc40()) { + + try { + + String expected; + + if (isToolboxDriver()) + expected = "F1F2"; + else + expected = "Ford"; + + JDRSTest.position(rs_, key_); + Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); + JDReflectionUtil.callMethod_V(nClob, "setString", 1L, expected); + JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_BINARY_20", nClob);// expected)); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + String v = rs2.getString("C_BINARY_20"); + rs2.close(); + assertCondition(v.startsWith(expected)); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } } + } - - - /** - updateNClob() - Update a BINARY, when the value is too big. - **/ - public void Var052 () - { - if(checkJdbc40 ()) - { - int expectedColumn = -1; - try - { - JDRSTest.position (rs_, key_); - expectedColumn = rs_.findColumn ("C_BINARY_1"); - Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); - JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "F1F2F3"); - JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_BINARY_1", nClob);//"F1F2F3")); - rs_.updateRow (); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - DataTruncation dt = (DataTruncation)e; - assertCondition ((dt.getIndex() == expectedColumn) - && (dt.getParameter() == false) - && (dt.getRead() == false) - && (dt.getTransferSize() == 1)); - - } - } + /** + * updateNClob() - Update a BINARY, when the value is too big. + **/ + public void Var052() { + if (checkJdbc40()) { + int expectedColumn = -1; + + try { + + JDRSTest.position(rs_, key_); + expectedColumn = rs_.findColumn("C_BINARY_1"); + Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); + JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "F1F2F3"); + JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_BINARY_1", nClob);// "F1F2F3")); + rs_.updateRow(); + failed("Didn't throw SQLException"); + } catch (Exception e) { + DataTruncation dt = (DataTruncation) e; + assertCondition((dt.getIndex() == expectedColumn) && (dt.getParameter() == false) && (dt.getRead() == false) + && (dt.getTransferSize() == 1)); + + } } + } - - - /** - updateNClob() - Update a VARBINARY. - **/ - public void Var053 () - { - if(checkJdbc40 ()) - { - try - { - String expected; - if(isToolboxDriver()) - expected = "F1F2"; - else - expected = "Ford"; - - JDRSTest.position (rs_, key_); - Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); - JDReflectionUtil.callMethod_V(nClob, "setString", 1L, expected); - JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_VARBINARY_20", nClob);//, expected)); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - String v = rs2.getString ("C_VARBINARY_20"); - rs2.close (); - assertCondition (v.equals (expected)); - } - catch(Exception e) - { - failed (e, "Unexpected Exception"); - } - } + /** + * updateNClob() - Update a VARBINARY. + **/ + public void Var053() { + if (checkJdbc40()) { + + try { + + String expected; + if (isToolboxDriver()) + expected = "F1F2"; + else + expected = "Ford"; + + JDRSTest.position(rs_, key_); + Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); + JDReflectionUtil.callMethod_V(nClob, "setString", 1L, expected); + JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_VARBINARY_20", nClob);// , expected)); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + String v = rs2.getString("C_VARBINARY_20"); + rs2.close(); + assertCondition(v.equals(expected)); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } } + } - - - /** - updateNClob() - Update a VARBINARY, when the value is too big. - **/ - public void Var054 () - { - if(checkJdbc40 ()) - { - int expectedColumn = -1; - try - { - String expected; - if(isToolboxDriver()) - expected = "F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1"; - else - expected = "Thirty characters, thirty characters, thirty characters xxxx"; - - JDRSTest.position (rs_, key_); - expectedColumn = rs_.findColumn ("C_VARBINARY_20"); - Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); - JDReflectionUtil.callMethod_V(nClob, "setString", 1L, expected); - JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_VARBINARY_20", nClob);// expected)); - rs_.updateRow (); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - DataTruncation dt = (DataTruncation)e; - assertCondition ((dt.getIndex() == expectedColumn) - && (dt.getParameter() == false) - && (dt.getRead() == false) - && (dt.getTransferSize() == 20)); - - } - } + /** + * updateNClob() - Update a VARBINARY, when the value is too big. + **/ + public void Var054() { + if (checkJdbc40()) { + int expectedColumn = -1; + + try { + + String expected; + if (isToolboxDriver()) + expected = "F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1F1"; + else + expected = "Thirty characters, thirty characters, thirty characters xxxx"; + + JDRSTest.position(rs_, key_); + expectedColumn = rs_.findColumn("C_VARBINARY_20"); + Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); + JDReflectionUtil.callMethod_V(nClob, "setString", 1L, expected); + JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_VARBINARY_20", nClob);// expected)); + rs_.updateRow(); + failed("Didn't throw SQLException"); + } catch (Exception e) { + DataTruncation dt = (DataTruncation) e; + assertCondition((dt.getIndex() == expectedColumn) && (dt.getParameter() == false) && (dt.getRead() == false) + && (dt.getTransferSize() == 20)); + + } } + } - - - /** - updateNClob() - Update a CLOB. - - SQL400 - the native driver expects this update to work correctly. - **/ - public void Var055 () - { - if(checkJdbc40 ()) - { - if(checkLobSupport ()) - { - try - { - JDRSTest.position (rs_, key_); - Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); - JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "Knoxville"); - JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_CLOB", nClob);// "Knoxville")); - - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - String v = rs2.getString ("C_CLOB"); - rs2.close (); - assertCondition (v.equals ("Knoxville")); - } - catch(Exception e) - { - failed (e, "Unexpected Exception"); - } - } - } + /** + * updateNClob() - Update a CLOB. + * + * SQL400 - the native driver expects this update to work correctly. + **/ + public void Var055() { + if (checkJdbc40()) { + if (checkLobSupport()) { + + try { + + JDRSTest.position(rs_, key_); + Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); + JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "Knoxville"); + JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_CLOB", nClob);// "Knoxville")); + + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + String v = rs2.getString("C_CLOB"); + rs2.close(); + assertCondition(v.equals("Knoxville")); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } } + } - - - /** - updateNClob() - Update a DBCLOB. - - SQL400 - the native driver expects this update to work correctly. - **/ - public void Var056 () - { - if(checkJdbc40 ()) - { - if(checkLobSupport ()) - { - try - { - JDRSTest.position (rs_, key_); - Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); - JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "Memphis"); - JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_DBCLOB", nClob);//"Memphis")); - - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - String v = rs2.getString ("C_DBCLOB"); - rs2.close (); - assertCondition (v.equals ("Memphis")); - } - catch(Exception e) - { - failed (e, "Unexpected Exception"); - } - } - } + /** + * updateNClob() - Update a DBCLOB. + * + * SQL400 - the native driver expects this update to work correctly. + **/ + public void Var056() { + if (checkJdbc40()) { + if (checkLobSupport()) { + + try { + + JDRSTest.position(rs_, key_); + Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); + JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "Memphis"); + JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_DBCLOB", nClob);// "Memphis")); + + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + String v = rs2.getString("C_DBCLOB"); + rs2.close(); + assertCondition(v.equals("Memphis")); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } } + } - - - /** - updateNClob() - Update a BLOB. - **/ - public void Var057 () - { - if(checkJdbc40 ()) - { - if(checkLobSupport ()) - { - try - { - JDRSTest.position (rs_, key_); - Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); - JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "Honolulu"); - JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_BLOB", nClob);// "Honolulu")); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } - } + /** + * updateNClob() - Update a BLOB. + **/ + public void Var057() { + if (checkJdbc40()) { + if (checkLobSupport()) { + + try { + + JDRSTest.position(rs_, key_); + Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); + JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "Honolulu"); + JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_BLOB", nClob);// "Honolulu")); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } + } } + } - - - /** - updateNClob() - Update a DATE. - **/ - public void Var058 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); - JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "1970-02-10"); - JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_DATE", nClob);// "1970-02-10")); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - Date v = rs2.getDate ("C_DATE"); - rs2.close (); - assertCondition (v.toString ().equals ("1970-02-10"), "got "+v.toString()+" sb 1970-02-10"); - } - catch(Exception e) - { - if(isToolboxDriver()) - { - assertCondition(e.getMessage().indexOf("Data type mismatch.") >= 0, "got error "+e.getMessage()+" should have Data type mismatch"); - return; - } - failed (e, "Unexpected Exception"); - } - } + /** + * updateNClob() - Update a DATE. + **/ + public void Var058() { + if (checkJdbc40()) { + + try { + + JDRSTest.position(rs_, key_); + Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); + JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "1970-02-10"); + JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_DATE", nClob);// "1970-02-10")); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + Date v = rs2.getDate("C_DATE"); + rs2.close(); + assertCondition(v.toString().equals("1970-02-10"), "got " + v.toString() + " sb 1970-02-10"); + } catch (Exception e) { + if (isToolboxDriver()) { + assertCondition(e.getMessage().indexOf("Data type mismatch.") >= 0, + "got error " + e.getMessage() + " should have Data type mismatch"); + return; + } + failed(e, "Unexpected Exception"); + } } + } - - - /** - updateNClob() - Update a DATE, when the string is not a valid date. - **/ - public void Var059 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); - JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "Augusta"); - JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_DATE", nClob);// "Augusta")); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + /** + * updateNClob() - Update a DATE, when the string is not a valid date. + **/ + public void Var059() { + if (checkJdbc40()) { + + try { + + JDRSTest.position(rs_, key_); + Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); + JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "Augusta"); + JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_DATE", nClob);// "Augusta")); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } + } - - - /** - updateNClob() - Update a TIME. - **/ - public void Var060 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); - JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "13:45:32"); - JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_TIME", nClob);//"13:45:32")); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - Time v = rs2.getTime ("C_TIME"); - rs2.close (); - assertCondition (v.toString ().equals ("13:45:32")); - } - catch(Exception e) - { - if(isToolboxDriver()) - { - assertCondition(e.getMessage().equals("Data type mismatch.")); - return; - } - failed (e, "Unexpected Exception"); - } - } + /** + * updateNClob() - Update a TIME. + **/ + public void Var060() { + if (checkJdbc40()) { + + try { + + JDRSTest.position(rs_, key_); + Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); + JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "13:45:32"); + JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_TIME", nClob);// "13:45:32")); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + Time v = rs2.getTime("C_TIME"); + rs2.close(); + assertCondition(v.toString().equals("13:45:32")); + } catch (Exception e) { + if (isToolboxDriver()) { + assertCondition(e.getMessage().equals("Data type mismatch.")); + return; + } + failed(e, "Unexpected Exception"); + } } + } - - - /** - updateNClob() - Update a TIME, when the string is not a valid time. - **/ - public void Var061 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); - JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "Birmingham"); - JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_TIME", nClob);// "Birmingham")); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + /** + * updateNClob() - Update a TIME, when the string is not a valid time. + **/ + public void Var061() { + if (checkJdbc40()) { + + try { + + JDRSTest.position(rs_, key_); + Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); + JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "Birmingham"); + JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_TIME", nClob);// "Birmingham")); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } + } - - - /** - updateNClob() - Update a TIMESTAMP. - **/ - public void Var062 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); - JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "1969-11-18 15:22:23.4329"); - JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_TIMESTAMP", nClob);// "1969-11-18 15:22:23.4329")); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - Timestamp v = rs2.getTimestamp ("C_TIMESTAMP"); - rs2.close (); - assertCondition (v.toString ().equals ("1969-11-18 15:22:23.4329")); - } - catch(Exception e) - { - if(isToolboxDriver()) - { - assertCondition(e.getMessage().equals("Data type mismatch.")); - return; - } - failed (e, "Unexpected Exception"); - } - } + /** + * updateNClob() - Update a TIMESTAMP. + **/ + public void Var062() { + if (checkJdbc40()) { + + try { + + JDRSTest.position(rs_, key_); + Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); + JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "1969-11-18 15:22:23.4329"); + JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_TIMESTAMP", nClob);// "1969-11-18 15:22:23.4329")); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + Timestamp v = rs2.getTimestamp("C_TIMESTAMP"); + rs2.close(); + assertCondition(v.toString().equals("1969-11-18 15:22:23.4329")); + } catch (Exception e) { + if (isToolboxDriver()) { + assertCondition(e.getMessage().equals("Data type mismatch.")); + return; + } + failed(e, "Unexpected Exception"); + } } + } - - - /** - updateNClob() - Update a TIMESTAMP, when the string is not a valid timestamp. - **/ - public void Var063 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); - JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "Boston"); - JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_TIMESTAMP", nClob);// "Boston")); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + /** + * updateNClob() - Update a TIMESTAMP, when the string is not a valid timestamp. + **/ + public void Var063() { + if (checkJdbc40()) { + + try { + + JDRSTest.position(rs_, key_); + Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); + JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "Boston"); + JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_TIMESTAMP", nClob);// "Boston")); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } + } - - - /** - updateNClob() - Update a DATALINK. - **/ - public void Var064 () - { - if(checkJdbc40 ()) - { - if(checkLobSupport ()) - { - // We do not test updating datalinks, since it is not - // possible to open a updatable cursor/result set with - // a datalink column. - notApplicable("DATALINK update not supported."); - /* - try { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_DATALINK", JDRelectionUtil.callMethod_OS(connection_, "createNClob", "Providence")); - failed ("Didn't throw SQLException"); - } - catch (Exception e) { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - */ - } - } + /** + * updateNClob() - Update a DATALINK. + **/ + public void Var064() { + if (checkJdbc40()) { + if (checkLobSupport()) { + // We do not test updating datalinks, since it is not + // possible to open a updatable cursor/result set with + // a datalink column. + notApplicable("DATALINK update not supported."); + /* + * try { JDRSTest.position (rs_, key_); JDReflectionUtil.callMethod_V(rs_, + * "updateNClob", "C_DATALINK", JDRelectionUtil.callMethod_OS(connection_, + * "createNClob", "Providence")); failed ("Didn't throw SQLException"); } catch + * (Exception e) { assertExceptionIsInstanceOf (e, "java.sql.SQLException"); } + */ + } } + } - - - /** - updateNClob() - Update a DISTINCT. - **/ - public void Var065 () - { - if(checkJdbc40 ()) - { - if(checkLobSupport ()) - { - try - { - JDRSTest.position (rs_, key_); - Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); - JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "Concord"); - JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_DISTINCT", nClob);// "Concord")); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - String v = rs2.getString ("C_DISTINCT"); - rs2.close (); - assertCondition (v.equals ("Concord ")); - } - catch(Exception e) - { - failed (e, "Unexpected Exception"); - } - } - } + /** + * updateNClob() - Update a DISTINCT. + **/ + public void Var065() { + if (checkJdbc40()) { + if (checkLobSupport()) { + + try { + + JDRSTest.position(rs_, key_); + Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); + JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "Concord"); + JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_DISTINCT", nClob);// "Concord")); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + String v = rs2.getString("C_DISTINCT"); + rs2.close(); + assertCondition(v.equals("Concord ")); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } } + } - - - /** - updateNClob() - Update a BIGINT. - **/ - public void Var066() - { - if(checkJdbc40 ()) - { - if(checkBigintSupport()) - { - try - { - JDRSTest.position (rs_, key_); - Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); - JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "-1237324"); - JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_BIGINT", nClob);// "-1237324")); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - long v = rs2.getLong ("C_BIGINT"); - rs2.close (); - assertCondition (v == -1237324); - } - catch(Exception e) - { - if(isToolboxDriver()) - { - assertCondition(e.getMessage().equals("Data type mismatch.")); - return; - } - failed (e, "Unexpected Exception"); - } - } - } + /** + * updateNClob() - Update a BIGINT. + **/ + public void Var066() { + if (checkJdbc40()) { + if (checkBigintSupport()) { + + try { + + JDRSTest.position(rs_, key_); + Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); + JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "-1237324"); + JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_BIGINT", nClob);// "-1237324")); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + long v = rs2.getLong("C_BIGINT"); + rs2.close(); + assertCondition(v == -1237324); + } catch (Exception e) { + if (isToolboxDriver()) { + assertCondition(e.getMessage().equals("Data type mismatch.")); + return; + } + failed(e, "Unexpected Exception"); + } + } } + } - - - /** - updateNClob() - Update a BIGINT, when the integer is too big. - **/ - public void Var067() - { - if(checkJdbc40 ()) - { - if(checkBigintSupport()) - { - try - { - JDRSTest.position (rs_, key_); - Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); - JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "4353534432176864587623"); - JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_BIGINT", nClob);// "4353534432176864587623")); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } - } + /** + * updateNClob() - Update a BIGINT, when the integer is too big. + **/ + public void Var067() { + if (checkJdbc40()) { + if (checkBigintSupport()) { + + try { + + JDRSTest.position(rs_, key_); + Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); + JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "4353534432176864587623"); + JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_BIGINT", nClob);// "4353534432176864587623")); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } + } } + } - - - /** - updateNClob() - Update a BIGINTEGER, when the string is not a number. - **/ - public void Var068() - { - if(checkJdbc40 ()) - { - if(checkBigintSupport()) - { - try - { - JDRSTest.position (rs_, key_); - Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); - JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "Baton Rouge"); - JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_BIGINT", nClob);// "Baton Rouge")); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } - } + /** + * updateNClob() - Update a BIGINTEGER, when the string is not a number. + **/ + public void Var068() { + if (checkJdbc40()) { + if (checkBigintSupport()) { + + try { + + JDRSTest.position(rs_, key_); + Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); + JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "Baton Rouge"); + JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_BIGINT", nClob);// "Baton Rouge")); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } + } } + } + /** + * updateNClob() - Update a BLOB. Native will fail because they do not support + * -- see Var057 + **/ + public void Var069() { + if (checkJdbc40()) { + if (checkLobSupport()) { + + try { + + JDRSTest.position(rs_, key_); + Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); + JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "1023AAFFB10"); + JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_BLOB", nClob);// "1023AAFFB10")); - /** - updateNClob() - Update a BLOB. - Native will fail because they do not support -- see Var057 - **/ - public void Var069 () - { - if(checkJdbc40 ()) - { - if(checkLobSupport ()) - { - try - { - JDRSTest.position(rs_, key_); - Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); - JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "1023AAFFB10"); - JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_BLOB", nClob);// "1023AAFFB10")); - - failed("Didn't throw SQLException"); - - } - catch(Exception e) - { - assertExceptionIsInstanceOf(e, "java.sql.SQLException"); - - } - } - } - } - - - - - /** - updateNClob() - Update a DFP16. - **/ - public void Var070 () - { - if (checkJdbc40()) - if(checkDecFloatSupport()) - { - String value = "4533.43"; - try - { - Statement s = connection_.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, - ResultSet.CONCUR_UPDATABLE); - ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP16+" FOR UPDATE "); - rs.next(); - Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); - JDReflectionUtil.callMethod_V(nClob, "setString", 1L, value); - JDReflectionUtil.callMethod_V(rs, "updateNClob", 1, nClob); - rs.updateRow (); - - ResultSet rs2 = statement2_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP16); - rs2.next(); - String v = rs2.getString (1); - rs2.close (); - assertCondition (v.equals(value), "Got "+v+" sb "+value); - } - catch(Exception e) - { - //toolbox does not support updateNClob on this type - if(isToolboxDriver()) - { - assertCondition(e.getMessage().indexOf("Data type mismatch") != -1, "Expected Data type mismatch received " + e.getMessage()); - return; - } - failed (e, "Unexpected Exception"); - } - } - } - + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); - /** - updateNClob() - Update a DFP16, when the value is too big. - **/ - public void Var071 () - { - if (checkJdbc40()) - if(checkDecFloatSupport()) - { - String value = "123456E700"; - try - { - Statement s = connection_.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, - ResultSet.CONCUR_UPDATABLE); - ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP16+" FOR UPDATE "); - rs.next(); - Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); - JDReflectionUtil.callMethod_V(nClob, "setString", 1L, value); - JDReflectionUtil.callMethod_V(rs, "updateNClob", 1, nClob); - rs.updateRow (); - - ResultSet rs2 = statement2_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP16); - rs2.next(); - String v = rs2.getString (1); - rs2.close (); - failed("Expected exception but got "+v+" for "+value); - } - catch(Exception e) - { - // e.printStackTrace(); - assertExceptionIsInstanceOf(e, "java.sql.SQLException"); - } + } } } + } - - /** - updateNClob() - Update a DFP16, when the string is not a number. - **/ - public void Var072 () - { - if (checkJdbc40()) - if(checkDecFloatSupport()) - { - String value = "Terre Haute"; - try - { - Statement s = connection_.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, - ResultSet.CONCUR_UPDATABLE); - ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP16+" FOR UPDATE "); - rs.next(); - Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); - JDReflectionUtil.callMethod_V(nClob, "setString", 1L, value); - JDReflectionUtil.callMethod_V(rs, "updateNClob", 1, nClob); - rs.updateRow (); - - ResultSet rs2 = statement2_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP16); - rs2.next(); - String v = rs2.getString (1); - rs2.close (); - failed("Expected exception but got "+v+" for "+value); - } - catch(Exception e) - { - // e.printStackTrace(); - assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + /** + * updateNClob() - Update a DFP16. + **/ + public void Var070() { + if (checkJdbc40()) + if (checkDecFloatSupport()) { + String value = "4533.43"; + + try { + + Statement s = connection_.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); + ResultSet rs = s.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_UPDDFP16 + " FOR UPDATE "); + rs.next(); + Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); + JDReflectionUtil.callMethod_V(nClob, "setString", 1L, value); + JDReflectionUtil.callMethod_V(rs, "updateNClob", 1, nClob); + rs.updateRow(); /* serialized */ + + ResultSet rs2 = statement2_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_UPDDFP16); + rs2.next(); + String v = rs2.getString(1); + rs2.close(); + rs.close(); + s.close(); + assertCondition(v.equals(value), "Got " + v + " sb " + value); + } catch (Exception e) { + // toolbox does not support updateNClob on this type + if (isToolboxDriver()) { + assertCondition(e.getMessage().indexOf("Data type mismatch") != -1, + "Expected Data type mismatch received " + e.getMessage()); + return; } + failed(e, "Unexpected Exception"); + } } - } - - - /** - updateNClob() - Update a DFP34. - **/ - public void Var073 () - { - if (checkJdbc40()) - if(checkDecFloatSupport()) - { - String value = "4533.43"; - try - { - Statement s = connection_.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, - ResultSet.CONCUR_UPDATABLE); - ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP34+" FOR UPDATE "); - rs.next(); - Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); - JDReflectionUtil.callMethod_V(nClob, "setString", 1L, value); - JDReflectionUtil.callMethod_V(rs, "updateNClob", 1, nClob); - rs.updateRow (); - - ResultSet rs2 = statement2_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP34); - rs2.next(); - String v = rs2.getString (1); - rs2.close (); - assertCondition (v.equals(value), "Got "+v+" sb "+value); - } - catch(Exception e) - { - //toolbox does not support updateNClob on this type - if(isToolboxDriver()) - { - assertCondition(e.getMessage().indexOf("Data type mismatch") != -1); - return; - } - failed (e, "Unexpected Exception"); - } - } - } + } + /** + * updateNClob() - Update a DFP16, when the value is too big. + **/ + public void Var071() { + if (checkJdbc40()) + if (checkDecFloatSupport()) { + String value = "123456E700"; + + try { + + Statement s = connection_.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); + ResultSet rs = s.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_UPDDFP16 + " FOR UPDATE "); + rs.next(); + Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); + JDReflectionUtil.callMethod_V(nClob, "setString", 1L, value); + JDReflectionUtil.callMethod_V(rs, "updateNClob", 1, nClob); + rs.updateRow(); /* serialized */ + + ResultSet rs2 = statement2_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_UPDDFP16); + rs2.next(); + String v = rs2.getString(1); + rs2.close(); + rs.close(); + s.close(); + failed("Expected exception but got " + v + " for " + value); + } catch (Exception e) { + // e.printStackTrace(); + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } + } + } + /** + * updateNClob() - Update a DFP16, when the string is not a number. + **/ + public void Var072() { + if (checkJdbc40()) + if (checkDecFloatSupport()) { + String value = "Terre Haute"; + + try { + + Statement s = connection_.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); + ResultSet rs = s.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_UPDDFP16 + " FOR UPDATE "); + rs.next(); + Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); + JDReflectionUtil.callMethod_V(nClob, "setString", 1L, value); + JDReflectionUtil.callMethod_V(rs, "updateNClob", 1, nClob); + rs.updateRow(); /* serialized */ + + ResultSet rs2 = statement2_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_UPDDFP16); + rs2.next(); + String v = rs2.getString(1); + rs2.close(); + rs.close(); + s.close(); + failed("Expected exception but got " + v + " for " + value); + } catch (Exception e) { + // e.printStackTrace(); + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } + } + } - /** - updateNClob() - Update a DFP34, when the value is too big. - **/ - public void Var074 () - { - if (checkJdbc40()) - if(checkDecFloatSupport()) - { - String value = "12345E7000 " ; - - try - { - Statement s = connection_.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, - ResultSet.CONCUR_UPDATABLE); - ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP34+" FOR UPDATE "); - rs.next(); - Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); - JDReflectionUtil.callMethod_V(nClob, "setString", 1L, value); - JDReflectionUtil.callMethod_V(rs, "updateNClob", 1, nClob); - rs.updateRow (); - - ResultSet rs2 = statement2_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP34); - rs2.next(); - String v = rs2.getString (1); - rs2.close (); - failed("Expected exception but got "+v+" for "+value); - } - catch(Exception e) - { - // e.printStackTrace(); - assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + /** + * updateNClob() - Update a DFP34. + **/ + public void Var073() { + if (checkJdbc40()) + if (checkDecFloatSupport()) { + String value = "4533.43"; + + try { + + Statement s = connection_.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); + ResultSet rs = s.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_UPDDFP34 + " FOR UPDATE "); + rs.next(); + Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); + JDReflectionUtil.callMethod_V(nClob, "setString", 1L, value); + JDReflectionUtil.callMethod_V(rs, "updateNClob", 1, nClob); + rs.updateRow(); /* serialized */ + + ResultSet rs2 = statement2_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_UPDDFP34); + rs2.next(); + String v = rs2.getString(1); + rs2.close(); + rs.close(); + s.close(); + assertCondition(v.equals(value), "Got " + v + " sb " + value); + } catch (Exception e) { + // toolbox does not support updateNClob on this type + if (isToolboxDriver()) { + assertCondition(e.getMessage().indexOf("Data type mismatch") != -1); + return; } + failed(e, "Unexpected Exception"); + } } - } + } + /** + * updateNClob() - Update a DFP34, when the value is too big. + **/ + public void Var074() { + if (checkJdbc40()) + if (checkDecFloatSupport()) { + String value = "12345E7000 "; - /** - updateNClob() - Update a DFP34, when the string is not a number. - **/ - public void Var075 () - { - if (checkJdbc40()) - if(checkDecFloatSupport()) - { - String value = "Terre Haute"; - try - { - Statement s = connection_.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, - ResultSet.CONCUR_UPDATABLE); - ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP34+" FOR UPDATE "); - rs.next(); - Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); - JDReflectionUtil.callMethod_V(nClob, "setString", 1L, value); - JDReflectionUtil.callMethod_V(rs, "updateNClob", 1, nClob); - rs.updateRow (); - - ResultSet rs2 = statement2_.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP34); - rs2.next(); - String v = rs2.getString (1); - rs2.close (); - failed("Expected exception but got "+v+" for "+value); - } - catch(Exception e) - { - //e.printStackTrace(); - assertExceptionIsInstanceOf(e, "java.sql.SQLException"); - } + + try { + + Statement s = connection_.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); + ResultSet rs = s.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_UPDDFP34 + " FOR UPDATE "); + rs.next(); + Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); + JDReflectionUtil.callMethod_V(nClob, "setString", 1L, value); + JDReflectionUtil.callMethod_V(rs, "updateNClob", 1, nClob); + rs.updateRow(); /* serialized */ + + ResultSet rs2 = statement2_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_UPDDFP34); + rs2.next(); + String v = rs2.getString(1); + rs2.close(); + rs.close(); + s.close(); + failed("Expected exception but got " + v + " for " + value); + } catch (Exception e) { + // e.printStackTrace(); + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } - } + } + + /** + * updateNClob() - Update a DFP34, when the string is not a number. + **/ + public void Var075() { + if (checkJdbc40()) + if (checkDecFloatSupport()) { + String value = "Terre Haute"; + + try { + + Statement s = connection_.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); + ResultSet rs = s.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_UPDDFP34 + " FOR UPDATE "); + rs.next(); + Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); + JDReflectionUtil.callMethod_V(nClob, "setString", 1L, value); + JDReflectionUtil.callMethod_V(rs, "updateNClob", 1, nClob); + rs.updateRow(); /* serialized */ + + ResultSet rs2 = statement2_.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_UPDDFP34); + rs2.next(); + String v = rs2.getString(1); + rs2.close(); + rs.close(); + s.close(); + failed("Expected exception but got " + v + " for " + value); + } catch (Exception e) { + // e.printStackTrace(); + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } + } + } /** * updateNClob() - Update a BOOLEAN @@ -2490,23 +1999,19 @@ public void Var075 () public void Var076() { if (checkJdbc40()) { if (checkBooleanSupport()) { + try { + JDRSTest.position(rs_, key_); - Object nClob = JDReflectionUtil.callMethod_O(connection_, - "createNClob"); + Object nClob = JDReflectionUtil.callMethod_O(connection_, "createNClob"); JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "1"); JDReflectionUtil.callMethod_V(rs_, "updateNClob", "C_BOOLEAN", nClob); failed("Didn't throw SQLException"); } catch (Exception e) { assertExceptionIsInstanceOf(e, "java.sql.SQLException"); - } + } } } } - - } - - - diff --git a/src/test/JD/RS/JDRSUpdateNString.java b/src/test/JD/RS/JDRSUpdateNString.java index f0ed1ece..990385f5 100644 --- a/src/test/JD/RS/JDRSUpdateNString.java +++ b/src/test/JD/RS/JDRSUpdateNString.java @@ -6,6 +6,7 @@ import java.sql.Date; import java.sql.PreparedStatement; import java.sql.ResultSet; +import java.sql.SQLException; import java.sql.Statement; import java.sql.Time; import java.sql.Timestamp; @@ -19,2331 +20,2394 @@ import test.JDReflectionUtil; import test.JDTestDriver; import test.JDTestcase; - - +import test.JD.JDSerializeFile; /** -Testcase JDRSUpdateNString. This tests the following method -of the JDBC ResultSet class: - -
    -
  • updateNString() -
-**/ -public class JDRSUpdateNString -extends JDTestcase -{ + * Testcase JDRSUpdateNString. This tests the following method of the JDBC + * ResultSet class: + * + *
    + *
  • updateNString() + *
+ **/ +public class JDRSUpdateNString extends JDTestcase { public static void main(String args[]) throws Exception { - String[] newArgs = new String[args.length+2]; - newArgs[0] = "-tc"; - newArgs[1] = "JDRSUpdateNString"; - for (int i = 0; i < args.length; i++) { - newArgs[2+i]=args[i]; - } - test.JDRSTest.main(newArgs); - } - - - - // Private data. - private static final String key_ = "JDRSUpdateNString"; - private static final String key1_= "JDRSUpdateNString 1"; - private static String select_ = "SELECT * FROM " + JDRSTest.RSTEST_UPDATE; - - private Statement statement_; - private Statement statement2_; - private ResultSet rs_; - - - - /** - Constructor. - **/ - public JDRSUpdateNString (AS400 systemObject, - Hashtable> namesAndVars, - int runMode, - FileOutputStream fileOutputStream, - - String password) - { - super (systemObject, "JDRSUpdateNString", - namesAndVars, runMode, fileOutputStream, - password); - } - - - - /** - Performs setup needed before running variations. - - @exception Exception If an exception occurs. - **/ - protected void setup () - throws Exception - { - if (connection_ != null) connection_.close(); - select_ = "SELECT * FROM " + JDRSTest.RSTEST_UPDATE; - - if(isJdbc40 ()) - { - // SQL400 - driver neutral... - String url = baseURL_ - // String url = "jdbc:as400://" + systemObject_.getSystemName() - - - + ";data truncation=true"; - connection_ = testDriver_.getConnection (url,systemObject_.getUserId(), encryptedPassword_); - connection_.setAutoCommit(false); // @C1A - statement_ = connection_.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, - ResultSet.CONCUR_UPDATABLE); - statement2_ = connection_.createStatement (ResultSet.TYPE_SCROLL_INSENSITIVE, - ResultSet.CONCUR_READ_ONLY); - - statement_.executeUpdate ("INSERT INTO " + JDRSTest.RSTEST_UPDATE - + " (C_KEY) VALUES ('DUMMY_ROW')"); - statement_.executeUpdate ("INSERT INTO " + JDRSTest.RSTEST_UPDATE - + " (C_KEY) VALUES ('" + key_ + "')"); - - rs_ = statement_.executeQuery (select_ + " FOR UPDATE"); - } + String[] newArgs = new String[args.length + 2]; + newArgs[0] = "-tc"; + newArgs[1] = "JDRSUpdateNString"; + for (int i = 0; i < args.length; i++) { + newArgs[2 + i] = args[i]; } + test.JDRSTest.main(newArgs); + } + // Private data. + private static final String key_ = "JDRSUpdateNString"; + private static final String key1_ = "JDRSUpdateNString 1"; + private static String select_ = "SELECT * FROM " + JDRSTest.RSTEST_UPDATE; + private Statement statement_; + private Statement statement2_; + private ResultSet rs_; + private JDSerializeFile serializeUpdateFile_; - /** - Performs cleanup needed after running variations. - - @exception Exception If an exception occurs. - **/ - protected void cleanup () - throws Exception - { - if(isJdbc40 ()) - { - rs_.close (); - statement_.close (); - connection_.commit(); // @C1A - connection_.close (); - } + /** + * Constructor. + **/ + public JDRSUpdateNString(AS400 systemObject, Hashtable> namesAndVars, int runMode, + FileOutputStream fileOutputStream, + + String password) { + super(systemObject, "JDRSUpdateNString", namesAndVars, runMode, fileOutputStream, password); + } + + /** + * Performs setup needed before running variations. + * + * @exception Exception If an exception occurs. + **/ + protected void setup() throws Exception { + if (connection_ != null) + connection_.close(); + select_ = "SELECT * FROM " + JDRSTest.RSTEST_UPDATE; + + if (isJdbc40()) { + // SQL400 - driver neutral... + String url = baseURL_ + // String url = "jdbc:as400://" + systemObject_.getSystemName() + + + ";data truncation=true"; + connection_ = testDriver_.getConnection(url, systemObject_.getUserId(), encryptedPassword_); + connection_.setAutoCommit(false); // @C1A + serializeUpdateFile_ = new JDSerializeFile(connection_, JDRSTest.RSTEST_UPDATE); + connection_.commit(); + + statement_ = connection_.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); + statement2_ = connection_.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); + + statement_.executeUpdate("INSERT INTO " + JDRSTest.RSTEST_UPDATE + " (C_KEY) VALUES ('DUMMY_UPDNSTR')"); + statement_.executeUpdate("INSERT INTO " + JDRSTest.RSTEST_UPDATE + " (C_KEY) VALUES ('" + key_ + "')"); + + rs_ = statement_.executeQuery(select_ + " FOR UPDATE"); } + } + /** + * Performs cleanup needed after running variations. + * + * @exception Exception If an exception occurs. + **/ + protected void cleanup() throws Exception { + if (isJdbc40()) { + rs_.close(); + statement_.close(); + connection_.commit(); // @C1A + serializeUpdateFile_.close(); + connection_.commit(); + connection_.close(); + } + } + /** + * updateNString() - Should throw exception when the result set is closed. + **/ + public void Var001() { + if (checkJdbc40()) { + + try { + + Statement s = connection_.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); + ResultSet rs = s.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_UPDATE + " FOR UPDATE"); + rs.next(); + rs.close(); + JDReflectionUtil.callMethod_V(rs, "updateNString", "C_VARCHAR_50", "JDBC"); + s.close(); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } + } + } - /** - updateNString() - Should throw exception when the result set is - closed. - **/ - public void Var001() - { - if(checkJdbc40 ()) - { - try - { - Statement s = connection_.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, - ResultSet.CONCUR_UPDATABLE); - ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_UPDATE + " FOR UPDATE"); - rs.next (); - rs.close (); - JDReflectionUtil.callMethod_V(rs, "updateNString", "C_VARCHAR_50", "JDBC"); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + /** + * updateNString() - Should throw exception when the result set is not + * updatable. + **/ + public void Var002() { + if (checkJdbc40()) { + + try { + + Statement s = connection_.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); + ResultSet rs = s.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_UPDATE); + rs.next(); + JDReflectionUtil.callMethod_V(rs, "updateNString", "C_VARCHAR_50", "Database"); + rs.close(); + s.close(); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } + } + /** + * updateNString() - Should throw exception when cursor is not pointing to a + * row. + **/ + public void Var003() { + if (checkJdbc40()) { + + try { + + JDRSTest.position(rs_, null); + JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_VARCHAR_50", "Tables"); + rs_.updateRow(); /* exception */ + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } + } + } + /** + * updateNString() - Should throw an exception when the column is an invalid + * index. + **/ + public void Var004() { + if (checkJdbc40()) { + + try { + + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateNString", 100, "Schemas"); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } + } + } - /** - updateNString() - Should throw exception when the result set is - not updatable. - **/ - public void Var002() - { - if(checkJdbc40 ()) - { - try - { - Statement s = connection_.createStatement (ResultSet.TYPE_SCROLL_INSENSITIVE, - ResultSet.CONCUR_READ_ONLY); - ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_UPDATE); - rs.next (); - JDReflectionUtil.callMethod_V(rs, "updateNString", "C_VARCHAR_50", "Database"); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + /** + * updateNString() - Should throw an exception when the column is 0. + **/ + public void Var005() { + if (checkJdbc40()) { + + try { + + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateNString", 0, "Columns"); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } + } + } + + /** + * updateNString() - Should throw an exception when the column is -1. + **/ + public void Var006() { + if (checkJdbc40()) { + + try { + + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateNString", -1, "Rows"); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } + } + /** + * updateNString() - Should work when the column index is valid. + **/ + public void Var007() { + if (checkJdbc40()) { + + try { + + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateNString", 14, "Queries"); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + String v = rs2.getString("C_VARCHAR_50"); + rs2.close(); + assertCondition(v.equals("Queries")); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + /** + * updateNString() - Should throw an exception when the column name is null. + **/ + public void Var008() { + if (checkJdbc40()) { + if (getDriver() == JDTestDriver.DRIVER_JCC) { + notApplicable("JCC throws null pointer exception when column name is null "); + } else { - /** - updateNString() - Should throw exception when cursor is not pointing - to a row. - **/ - public void Var003() - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, null); - JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_VARCHAR_50", "Tables"); - rs_.updateRow(); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + + try { + + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateNString", null, "Updates"); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } + } } + } + /** + * updateNString() - Should throw an exception when the column name is an empty + * string. + **/ + public void Var009() { + if (checkJdbc40()) { + + try { + + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateNString", "", "Inserts"); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } + } + } + /** + * updateNString() - Should throw an exception when the column name is invalid. + **/ + public void Var010() { + if (checkJdbc40()) { + + try { + + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateNString", "INVALID", "Joins"); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } + } + } - /** - updateNString() - Should throw an exception when the column - is an invalid index. - **/ - public void Var004() - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNString", 100, "Schemas"); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + /** + * updateNString() - Should work when the column name is valid. + **/ + public void Var011() { + if (checkJdbc40()) { + + try { + + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_VARCHAR_50", "Inner joins"); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + String v = rs2.getString("C_VARCHAR_50"); + rs2.close(); + assertCondition(v.equals("Inner joins")); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } } + } + /** + * updateNString() - Should update to SQL NULL when the column value is null. + **/ + public void Var012() { + if (checkJdbc40()) { + + try { + + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_VARCHAR_50", null); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + String v = rs2.getString("C_VARCHAR_50"); + boolean wn = rs2.wasNull(); + rs2.close(); + assertCondition((v == null) && (wn == true)); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + /** + * updateNString() - Should be reflected by get, even if update has not yet been + * issued (i.e. update is still pending). + **/ + public void Var013() { + if (checkJdbc40()) { + + try { + + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_VARCHAR_50", "DB2/400"); + assertCondition(rs_.getString("C_VARCHAR_50").equals("DB2/400")); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } - /** - updateNString() - Should throw an exception when the column - is 0. - **/ - public void Var005() - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNString", 0, "Columns"); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + /** + * updateNString() - Should be reflected by get, after update has been issued, + * but cursor has not been repositioned. + **/ + public void Var014() { + if (checkJdbc40()) { + + try { + + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_VARCHAR_50", "SQL"); + rs_.updateRow(); + assertCondition(rs_.getString("C_VARCHAR_50").equals("SQL")); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } } + } + /** + * updateNString() - Should be reflected by get, after update has been issued + * and cursor has been repositioned. + **/ + public void Var015() { + if (checkJdbc40()) { + + try { + + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_VARCHAR_50", "Collections"); + rs_.updateRow(); + rs_.beforeFirst(); + JDRSTest.position(rs_, key_); + String v = rs_.getString("C_VARCHAR_50"); + assertCondition(v.equals("Collections")); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + /** + * updateNString() - Should work when the current row is the insert row. + **/ + public void Var016() { + if (checkJdbc40()) { + + try { + + rs_.moveToInsertRow(); + JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_KEY", key1_); + JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_VARCHAR_50", "Foreign keys"); + rs_.insertRow(); + JDRSTest.position(rs_, key1_); + assertCondition(rs_.getString("C_VARCHAR_50").equals("Foreign keys")); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } - /** - updateNString() - Should throw an exception when the column - is -1. - **/ - public void Var006() - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNString", -1, "Rows"); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + /** + * updateNString() - Should be reflected by get on insert row, even if insert + * has not yet been issued (i.e. insert is still pending). + **/ + public void Var017() { + if (checkJdbc40()) { + + try { + + rs_.moveToInsertRow(); + JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_VARCHAR_50", "Primary keys"); + assertCondition(rs_.getString("C_VARCHAR_50").equals("Primary keys")); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } } + } + /** + * updateNString() - Should throw an exception on a deleted row. + **/ + public void Var018() { + if (checkJdbc40()) { + + try { + + JDRSTest.position(rs_, "DUMMY_UPDNSTR"); + rs_.deleteRow(); + JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_VARCHAR_50", "STRSQL"); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } + } + } + /** + * updateNString() - Update a SMALLINT. + **/ + public void Var019() { + if (checkJdbc40()) { + + try { + + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_SMALLINT", "423"); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + short v = rs2.getShort("C_SMALLINT"); + rs2.close(); + assertCondition(v == 423); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } - /** - updateNString() - Should work when the column index is valid. - **/ - public void Var007() - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNString", 14, "Queries"); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - String v = rs2.getString ("C_VARCHAR_50"); - rs2.close (); - assertCondition (v.equals ("Queries")); - } - catch(Exception e) - { - failed (e, "Unexpected Exception"); - } - } + /** + * updateNString() - Update a SMALLINT, when the integer is too big. + **/ + public void Var020() { + if (checkJdbc40()) { + + try { + + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_SMALLINT", "487623"); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } + } + /** + * updateNString() - Update a SMALLINT, when the string is not a number. + **/ + public void Var021() { + if (checkJdbc40()) { + + try { + + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_SMALLINT", "Record level access"); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } + } + } + /** + * updateNString() - Update an INTEGER. + **/ + public void Var022() { + if (checkJdbc40()) { + + try { + + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_INTEGER", "-1228374"); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + int v = rs2.getInt("C_INTEGER"); + rs2.close(); + assertCondition(v == -1228374); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } - /** - updateNString() - Should throw an exception when the column - name is null. - **/ - public void Var008() - { - if(checkJdbc40 ()) - { - if (getDriver() == JDTestDriver.DRIVER_JCC) { - notApplicable("JCC throws null pointer exception when column name is null "); - } else { - - try - { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNString", null, "Updates"); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } - } + /** + * updateNString() - Update an INTEGER, when the integer is too big. + **/ + public void Var023() { + if (checkJdbc40()) { + + try { + + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_INTEGER", "45353487623"); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } + } + /** + * updateNString() - Update an INTEGER, when the string is not a number. + **/ + public void Var024() { + if (checkJdbc40()) { + + try { + + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_INTEGER", "Data queues"); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } + } + } - /** - updateNString() - Should throw an exception when the column - name is an empty string. - **/ - public void Var009() - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNString", "", "Inserts"); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + /** + * updateNString() - Update a REAL. + **/ + public void Var025() { + if (checkJdbc40()) { + + try { + + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_REAL", "-1.5"); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + float v = rs2.getFloat("C_REAL"); + rs2.close(); + assertCondition(v == -1.5); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } } + } + /** + * updateNString() - Update a REAL, when the number is too big. + * + * Note: Given the new data truncation rules for JDBC, this testcase is expected + * to work without throwing a DataTruncation exception. + **/ + public void Var026() { + if (checkJdbc40()) { + + try { + + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_REAL", "4534335.443487623"); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + float v = rs2.getFloat("C_REAL"); + rs2.close(); + assertCondition(v == 4534335.5); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } - /** - updateNString() - Should throw an exception when the column - name is invalid. - **/ - public void Var010() - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNString", "INVALID", "Joins"); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + /* + * failed ("Didn't throw SQLException"); } catch (Exception e) { DataTruncation + * dt = (DataTruncation)e; assertCondition ((dt.getIndex() == expectedColumn) && + * (dt.getParameter() == false) && (dt.getRead() == false) && (dt.getDataSize() + * == 16) && (dt.getTransferSize() == 8)); + * + * } } + */ + } + + /** + * updateNString() - Update a REAL, when the string is not a number. + **/ + public void Var027() { + if (checkJdbc40()) { + + try { + + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_INTEGER", "Data areas"); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } + } + /** + * updateNString() - Update a FLOAT. + **/ + public void Var028() { + if (checkJdbc40()) { + + try { + + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_FLOAT", "9845.0"); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + float v = rs2.getFloat("C_FLOAT"); + rs2.close(); + assertCondition(v == 9845.0); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + /** + * updateNString() - Update a FLOAT, when the number is too big. + * + * Note: Given the new data truncation rules for JDBC, this testcase is expected + * to work without throwing a DataTruncation exception. + **/ + public void Var029() { + if (checkJdbc40()) { + + try { + + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_FLOAT", "453435.4434556337633"); + rs_.updateRow(); + + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + float v = rs2.getFloat("C_FLOAT"); + rs2.close(); + assertCondition((v > 453435) && (v < 453436)); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + /* + * failed ("Didn't throw SQLException"); } catch (Exception e) { DataTruncation + * dt = (DataTruncation)e; assertCondition ((dt.getIndex() == expectedColumn) && + * (dt.getParameter() == false) && (dt.getRead() == false) && (dt.getDataSize() + * == 19) && (dt.getTransferSize() == 17)); + * + * } } + */ + } - /** - updateNString() - Should work when the column name is valid. - **/ - public void Var011() - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_VARCHAR_50", "Inner joins"); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - String v = rs2.getString ("C_VARCHAR_50"); - rs2.close (); - assertCondition (v.equals ("Inner joins")); - } - catch(Exception e) - { - failed (e, "Unexpected Exception"); - } - } + /** + * updateNString() - Update a FLOAT, when the string is not a number. + **/ + public void Var030() { + if (checkJdbc40()) { + + try { + + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_FLOAT", "User spaces"); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } + } + /** + * updateNString() - Update a DOUBLE. + **/ + public void Var031() { + if (checkJdbc40()) { + + try { + + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_DOUBLE", "-19845"); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + double v = rs2.getDouble("C_DOUBLE"); + rs2.close(); + assertCondition(v == -19845); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + /** + * updateNString() - Update a DOUBLE, when the number is too big. + * + * Note: Given the new data truncation rules for JDBC, this testcase is expected + * to work without throwing a DataTruncation exception. + **/ + public void Var032() { + if (checkJdbc40()) { + + try { + + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_DOUBLE", "4533435.4433445532333"); + rs_.updateRow(); + + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + float v = rs2.getFloat("C_DOUBLE"); + rs2.close(); + assertCondition(v == 4533435.5); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + /* + * failed ("Didn't throw SQLException"); } catch (Exception e) { DataTruncation + * dt = (DataTruncation)e; assertCondition ((dt.getIndex() == expectedColumn) && + * (dt.getParameter() == false) && (dt.getRead() == false) && (dt.getDataSize() + * == 20) && (dt.getTransferSize() == 16)); + * + * } } + */ + } - /** - updateNString() - Should update to SQL NULL when the column - value is null. - **/ - public void Var012() - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_VARCHAR_50", null); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - String v = rs2.getString ("C_VARCHAR_50"); - boolean wn = rs2.wasNull (); - rs2.close (); - assertCondition ((v == null) && (wn == true)); - } - catch(Exception e) - { - failed (e, "Unexpected Exception"); - } - } + /** + * updateNString() - Update a DOUBLE, when the string is not a number. + **/ + public void Var033() { + if (checkJdbc40()) { + + try { + + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_DOUBLE", "IFS"); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } + } + /** + * updateNString() - Update a DECIMAL. + **/ + public void Var034() { + if (checkJdbc40()) { + + try { + + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_DECIMAL_105", "-4533.4"); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + BigDecimal v = rs2.getBigDecimal("C_DECIMAL_105"); + rs2.close(); + assertCondition(v.floatValue() == -4533.4f); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + /** + * updateNString() - Update a DECIMAL, when the value is too big. + **/ + public void Var035() { + if (checkJdbc40()) { + int expectedColumn = -1; + + try { + + JDRSTest.position(rs_, key_); + expectedColumn = rs_.findColumn("C_DECIMAL_40"); + JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_DECIMAL_40", "543511"); + rs_.updateRow(); + failed("Didn't throw SQLException"); + } catch (Exception e) { + if (e instanceof DataTruncation) { + DataTruncation dt = (DataTruncation) e; + assertCondition((dt.getIndex() == expectedColumn) && (dt.getParameter() == false) && (dt.getRead() == false) + && (dt.getDataSize() == 6) && (dt.getTransferSize() == 4)); + } else { + assertSqlException(e, -99999, "07006", "Data type mismatch", + "Mismatch instead of truncation in latest toolbox"); - /** - updateNString() - Should be reflected by get, even if update has - not yet been issued (i.e. update is still pending). - **/ - public void Var013() - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_VARCHAR_50", "DB2/400"); - assertCondition (rs_.getString ("C_VARCHAR_50").equals ("DB2/400")); - } - catch(Exception e) - { - failed (e, "Unexpected Exception"); - } } + + } } + } + /** + * updateNString() - Update a DECIMAL, when the string is not a number. + **/ + public void Var036() { + if (checkJdbc40()) { + + try { + + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_DECIMAL1050", "GUI components"); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } + } + } + /** + * updateNString() - Update a NUMERIC. + **/ + public void Var037() { + if (checkJdbc40()) { + + try { + + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_NUMERIC_105", "-9933.455"); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + BigDecimal v = rs2.getBigDecimal("C_NUMERIC_105"); + rs2.close(); + assertCondition(v.doubleValue() == -9933.455); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + + } + } + } + /** + * updateNString() - Update a NUMERIC, when the value is too big. + **/ + public void Var038() { + if (checkJdbc40()) { + int expectedColumn = -1; + + try { + + JDRSTest.position(rs_, key_); + expectedColumn = rs_.findColumn("C_NUMERIC_40"); + JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_NUMERIC_40", "-331515"); + rs_.updateRow(); + failed("Didn't throw SQLException"); + } catch (Exception e) { + if (e instanceof DataTruncation) { + DataTruncation dt = (DataTruncation) e; + assertCondition((dt.getIndex() == expectedColumn) && (dt.getParameter() == false) && (dt.getRead() == false) + && (dt.getDataSize() == 6) && (dt.getTransferSize() == 4)); + } else { + assertSqlException(e, -99999, "07006", "Data type mismatch", + "Mismatch instead of truncation in latest toolbox"); - /** - updateNString() - Should be reflected by get, after update has - been issued, but cursor has not been repositioned. - **/ - public void Var014() - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_VARCHAR_50", "SQL"); - rs_.updateRow (); - assertCondition (rs_.getString ("C_VARCHAR_50").equals ("SQL")); - } - catch(Exception e) - { - failed (e, "Unexpected Exception"); - } } + + } } + } + /** + * updateNString() - Update a NUMERIC, when the string is not a number. + **/ + public void Var039() { + if (checkJdbc40()) { + + try { + + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_NUMERIC_105", "Jar maker"); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } + } + } + + /** + * updateNString() - Update a CHAR. + **/ + public void Var040() { + if (checkJdbc40()) { + + try { + + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_CHAR_50", "JDBC 2.0"); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + String v = rs2.getString("C_CHAR_50"); + rs2.close(); + assertCondition(v.equals("JDBC 2.0 ")); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + /** + * updateNString() - Update a CHAR, when the value is too big. + **/ + public void Var041() { + if (checkJdbc40()) { + int expectedColumn = -1; + + try { + + JDRSTest.position(rs_, key_); + expectedColumn = rs_.findColumn("C_CHAR_1"); + JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_CHAR_1", "Data conversion"); + rs_.updateRow(); + failed("Didn't throw SQLException"); + } catch (Exception e) { + DataTruncation dt = (DataTruncation) e; + assertCondition( + (dt.getIndex() == expectedColumn) && (dt.getParameter() == false) && (dt.getRead() == false) + && (dt.getDataSize() == 15) && (dt.getTransferSize() == 1), + "dt.getIndex()=" + dt.getIndex() + " sb " + expectedColumn + "\n" + "dt.getParameter()=" + dt.getParameter() + + " sb false\n" + "dt.getRead()=" + dt.getRead() + " sb false\n" + "dt.getDataSize()=" + + dt.getDataSize() + " sb 15\n" + "dt.getTransferSize()=" + dt.getTransferSize() + "sb 1"); + + } + } + } + /** + * updateNString() - Update a VARCHAR. + **/ + public void Var042() { + if (checkJdbc40()) { + + try { + + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_VARCHAR_50", "Message files"); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + String v = rs2.getString("C_VARCHAR_50"); + rs2.close(); + assertCondition(v.equals("Message files")); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } - /** - updateNString() - Should be reflected by get, after update has - been issued and cursor has been repositioned. - **/ - public void Var015() - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_VARCHAR_50", "Collections"); - rs_.updateRow (); - rs_.beforeFirst (); - JDRSTest.position (rs_, key_); - String v = rs_.getString ("C_VARCHAR_50"); - assertCondition (v.equals ("Collections")); - } - catch(Exception e) - { - failed (e, "Unexpected Exception"); - } - } + /** + * updateNString() - Update a VARCHAR, when the value is too big. + **/ + public void Var043() { + if (checkJdbc40()) { + int expectedColumn = -1; + + try { + + JDRSTest.position(rs_, key_); + expectedColumn = rs_.findColumn("C_VARCHAR_50"); + JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_VARCHAR_50", + "This string is really long and is testing data truncation."); + rs_.updateRow(); + failed("Didn't throw SQLException"); + } catch (Exception e) { + DataTruncation dt = (DataTruncation) e; + assertCondition( + (dt.getIndex() == expectedColumn) && (dt.getParameter() == false) && (dt.getRead() == false) + && (dt.getDataSize() == 58) && (dt.getTransferSize() == 50), + "dt.getIndex()=" + dt.getIndex() + " sb " + expectedColumn + "\n" + "dt.getParameter()=" + dt.getParameter() + + " sb false\n" + "dt.getRead()=" + dt.getRead() + " sb false\n" + "dt.getDataSize()=" + + dt.getDataSize() + " sb 58\n" + "dt.getTransferSize()=" + dt.getTransferSize() + "sb 50"); + + } } + } + /** + * updateNString() - Update a BINARY. + **/ + public void Var044() { + if (checkJdbc40()) { + + try { + + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_BINARY_20", "F1F2F3F4F5"); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + String v = rs2.getString("C_BINARY_20"); + rs2.close(); + assertCondition(v.startsWith("F1F2F3F4F5")); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + /** + * updateNString() - Update a BINARY, when the value is too big. + **/ + public void Var045() { + if (checkJdbc40()) { + int expectedColumn = -1; + + try { + + JDRSTest.position(rs_, key_); + expectedColumn = rs_.findColumn("C_BINARY_1"); + JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_BINARY_1", "F1F2F3F4"); + rs_.updateRow(); + failed("Didn't throw SQLException"); + } catch (Exception e) { + DataTruncation dt = (DataTruncation) e; + assertCondition((dt.getIndex() == expectedColumn) && (dt.getParameter() == false) && (dt.getRead() == false) + && (dt.getTransferSize() == 1)); + } + } + } - /** - updateNString() - Should work when the current row is the insert - row. - **/ - public void Var016() - { - if(checkJdbc40 ()) - { - try - { - rs_.moveToInsertRow (); - JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_KEY", key1_); - JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_VARCHAR_50", "Foreign keys"); - rs_.insertRow (); - JDRSTest.position (rs_, key1_); - assertCondition (rs_.getString ("C_VARCHAR_50").equals ("Foreign keys")); - } - catch(Exception e) - { - failed (e, "Unexpected Exception"); - } - } + /** + * updateNString() - Update a VARBINARY. + **/ + public void Var046() { + if (checkJdbc40()) { + + try { + + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_VARBINARY_20", "F1"); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + String v = rs2.getString("C_VARBINARY_20"); + rs2.close(); + assertCondition(v.equals("F1")); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } } + } + /** + * updateNString() - Update a VARBINARY, when the value is too big. + **/ + public void Var047() { + if (checkJdbc40()) { + int expectedColumn = -1; + + try { + + JDRSTest.position(rs_, key_); + expectedColumn = rs_.findColumn("C_VARBINARY_20"); + JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_VARBINARY_20", + "F1F2F3F4F5F1F2F3F4F5F1F2F3F4F5F1F2F3F4F5F1F2F3F4F5F1F2F3F4F5"); + rs_.updateRow(); + failed("Didn't throw SQLException"); + } catch (Exception e) { + DataTruncation dt = (DataTruncation) e; + assertCondition((dt.getIndex() == expectedColumn) && (dt.getParameter() == false) && (dt.getRead() == false) + && (dt.getTransferSize() == 20)); + } + } + } + /** + * updateNString() - Update a CLOB. + * + * SQL400 - the native driver expects this update to work correctly. + **/ + public void Var048() { + if (checkJdbc40()) { + if (checkLobSupport()) { + + try { + + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_CLOB", "Toolbox"); - /** - updateNString() - Should be reflected by get on insert row, even if - insert has not yet been issued (i.e. insert is still pending). - **/ - public void Var017() - { - if(checkJdbc40 ()) - { - try - { - rs_.moveToInsertRow (); - JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_VARCHAR_50", "Primary keys"); - assertCondition (rs_.getString ("C_VARCHAR_50").equals ("Primary keys")); - } - catch(Exception e) - { - failed (e, "Unexpected Exception"); - } - } + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + String v = rs2.getString("C_CLOB"); + rs2.close(); + assertCondition(v.equals("Toolbox")); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } } + } + /** + * updateNString() - Update a DBCLOB. + * + * SQL400 - the native driver expects this update to work correctly. + **/ + public void Var049() { + if (checkJdbc40()) { + if (checkLobSupport()) { + + try { + + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_DBCLOB", "For Java"); + + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + String v = rs2.getString("C_DBCLOB"); + rs2.close(); + assertCondition(v.equals("For Java")); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + } + /** + * updateNString() - Update a BLOB. + **/ + public void Var050() { + if (checkJdbc40()) { + if (checkLobSupport()) { + + try { + + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_BLOB", "JDK 1.2"); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } + } + } + } - /** - updateNString() - Should throw an exception on a deleted row. - **/ - public void Var018() - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, "DUMMY_ROW"); - rs_.deleteRow (); - JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_VARCHAR_50", "STRSQL"); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + /** + * updateNString() - Update a DATE. + **/ + public void Var051() { + if (checkJdbc40()) { + + try { + + JDRSTest.position(rs_, key_); + + // TODO: Start supporting these different date styles. + if (isToolboxDriver()) + JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_DATE", "02-10-70"); + else + JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_DATE", "1970-02-10"); + + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + Date v = rs2.getDate("C_DATE"); + rs2.close(); + assertCondition(v.toString().equals("1970-02-10")); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } } + } + /** + * updateNString() - Update a DATE, when the string is not a valid date. + **/ + public void Var052() { + if (checkJdbc40()) { + + try { + + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_DATE", "Emerging markets"); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } + } + } - /** - updateNString() - Update a SMALLINT. - **/ - public void Var019 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_SMALLINT", "423"); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - short v = rs2.getShort ("C_SMALLINT"); - rs2.close (); - assertCondition (v == 423); - } - catch(Exception e) - { - failed (e, "Unexpected Exception"); - } - } + /** + * updateNString() - Update a TIME. + **/ + public void Var053() { + if (checkJdbc40()) { + + try { + + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_TIME", "07:24:34"); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + Time v = rs2.getTime("C_TIME"); + rs2.close(); + assertCondition(v.toString().equals("07:24:34")); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } } + } + /** + * updateNString() - Update a TIME, when the string is not a valid time. + **/ + public void Var054() { + if (checkJdbc40()) { + + try { + + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_TIME", "V4R4"); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } + } + } + /** + * updateNString() - Update a TIMESTAMP. + **/ + public void Var055() { + if (checkJdbc40()) { + + try { + + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_TIMESTAMP", "1975-04-30 07:24:34.543"); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + Timestamp v = rs2.getTimestamp("C_TIMESTAMP"); + rs2.close(); + assertCondition(v.toString().equals("1975-04-30 07:24:34.543")); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } - /** - updateNString() - Update a SMALLINT, when the integer is too big. - **/ - public void Var020 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_SMALLINT", "487623"); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + /** + * updateNString() - Update a TIMESTAMP, when the string is not a vliad + * timestamp. + **/ + public void Var056() { + if (checkJdbc40()) { + + try { + + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_TIMESTAMP", "Beta web page"); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } + } + /** + * updateNString() - Update a DATALINK. + **/ + public void Var057() { + if (checkJdbc40()) { + if (checkLobSupport()) { + // We do not test updating datalinks, since it is not + // possible to open a updatable cursor/result set with + // a datalink column. + notApplicable("DATALINK update not supported."); + + } + } + } + /** + * updateNString() - Update a DISTINCT. + **/ + public void Var058() { + if (checkJdbc40()) { + if (checkLobSupport()) { + + try { + + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_DISTINCT", "AS/400"); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + String v = rs2.getString("C_DISTINCT"); + rs2.close(); + assertCondition(v.equals("AS/400 ")); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + } - /** - updateNString() - Update a SMALLINT, when the string is not a number. - **/ - public void Var021 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_SMALLINT", "Record level access"); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + /** + * updateNString() - Update a BIGINT. + **/ + public void Var059() { + if (checkJdbc40()) { + if (checkBigintSupport()) { + + try { + + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_BIGINT", "999228374"); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + long v = rs2.getLong("C_BIGINT"); + rs2.close(); + assertCondition(v == 999228374); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + } + + /** + * updateNString() - Update a BIGINT, when the integer is too big. + **/ + public void Var060() { + if (checkJdbc40()) { + if (checkBigintSupport()) { + + try { + + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_BIGINT", "-44332245453454325353487623"); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } + } } + } + + /** + * updateNString() - Update an BIGINT, when the string is not a number. + **/ + public void Var061() { + if (checkJdbc40()) { + if (checkBigintSupport()) { + + try { + + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_BIGINT", "System values"); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } + } + } + } + + /** + * updateNString() - column names with quotes. + **/ + public void Var062() { + if (checkJdbc40()) { + + try { + + Statement statement = connection_.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); + initTable(statement, JDRSTest.COLLECTION + ".\"MixedC\"", " ( " + "\"MixedCaseField\" VARCHAR (10), " + + "MIXEDCASEFIELD VARCHAR (10), " + "\"Mixed2\" VARCHAR(20) )"); + + ResultSet rs = statement.executeQuery("SELECT * FROM " + JDRSTest.COLLECTION + ".\"MixedC\" FOR UPDATE"); + rs.moveToInsertRow(); + + // Since the names do not include quotes the first two updates will + // both update the FIRST column. The first column name is + // MixedCaseField which matches MixedCaseField. + JDReflectionUtil.callMethod_V(rs, "updateNString", "MixedCaseField", "Data"); + JDReflectionUtil.callMethod_V(rs, "updateNString", "MIXEDCASEFIELD", "MoreData"); + JDReflectionUtil.callMethod_V(rs, "updateNString", "\"Mixed2\"", "mixed2 data"); + + rs.insertRow(); + + // Now the first updateNString is correct. I will update the + // first column. + JDReflectionUtil.callMethod_V(rs, "updateNString", "\"MixedCaseField\"", "Data"); + JDReflectionUtil.callMethod_V(rs, "updateNString", "\"MIXEDCASEFIELD\"", "MoreData"); + JDReflectionUtil.callMethod_V(rs, "updateNString", "\"Mixed2\"", "mixed2 data"); + + rs.insertRow(); + + rs.close(); + statement.close(); + + PreparedStatement insert = connection_.prepareStatement("INSERT INTO " + JDRSTest.COLLECTION + ".\"MixedC\" " + + " (\"MixedCaseField\", MIXEDCASEFIELD, \"Mixed2\") " + " VALUES (?, ?, ?)"); + insert.setString(1, "Data"); + insert.setString(2, "MoreData"); + insert.setString(3, "mixed2 data"); + insert.executeUpdate(); + insert.close(); + statement = connection_.createStatement(); + rs = statement.executeQuery("SELECT * FROM " + JDRSTest.COLLECTION + ".\"MixedC\" "); - /** - updateNString() - Update an INTEGER. - **/ - public void Var022 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_INTEGER", "-1228374"); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - int v = rs2.getInt ("C_INTEGER"); - rs2.close (); - assertCondition (v == -1228374); - } - catch(Exception e) - { - failed (e, "Unexpected Exception"); - } + boolean successful = true; + + rs.next(); + + String col1 = rs.getString(1); + String col2 = rs.getString(2); + String col3 = rs.getString(3); + + // toolbox has fixed this + if (isToolboxDriver()) { + if (!"Data".equals(col1) || !"MoreData".equals(col2) || !"mixed2 data".equals(col3)) { + failed("ROW 1: data does not match: '" + col1 + "'!='Data' '" + col2 + "'!='MoreData' '" + col3 + + "'!='mixed2 data'"); + successful = false; + } + } else { + if (!"MoreData".equals(col1) || col2 != null || !"mixed2 data".equals(col3)) { + failed("ROW 1: data does not match: '" + col1 + "'!='MoreData' '" + col2 + "'!=null '" + col3 + + "'!='mixed2 data'"); + successful = false; + } } - } + if (successful) { + rs.next(); + col1 = rs.getString(1); + col2 = rs.getString(2); + col3 = rs.getString(3); + if (!"Data".equals(col1) || !"MoreData".equals(col2) || !"mixed2 data".equals(col3)) { + failed("ROW 2: data does not match: '" + col1 + "'!='Data' '" + col2 + "'!='MoreData' '" + col3 + + "'!='mixed2 data'"); + successful = false; + } + } - /** - updateNString() - Update an INTEGER, when the integer is too big. - **/ - public void Var023 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_INTEGER", "45353487623"); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } + if (successful) { + rs.next(); + col1 = rs.getString(1); + col2 = rs.getString(2); + col3 = rs.getString(3); + + if (!"Data".equals(col1) || !"MoreData".equals(col2) || !"mixed2 data".equals(col3)) { + failed("ROW 3: data does not match: '" + col1 + "'!='Data' '" + col2 + "'!='MoreData' '" + col3 + + "'!='mixed2 data'"); + successful = false; + } } + + if (successful) + succeeded(); + + rs.close(); + statement.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + + } + + /** + * updateNString -- update a CCSID 5035 CHAR field when the job ccsid is 5035 + * then use updateRow + * + * NOTE: This testcase should be last since it changes the job ccsid + */ + public void Var063() { + if (checkJdbc40()) { + if (checkNative()) { + + try { + + // Determine our job name + String jobname = JDJobName.getJobName(); + // Change the CCSID + String command = "QSYS/chgjob " + jobname + " CCSID(5035)"; + String sql = "CALL QSYS.QCMDEXC('" + command + "', 00000000" + command.length() + ".00000)"; + // output_.println("executing "+sql); + Statement stmt = connection_.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE); + stmt.execute(sql); + + // + // Create a new statement that will use the new job CCSID... + // + stmt.close(); + stmt = connection_.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE); + + String tablename = JDRSTest.COLLECTION + ".JDCCSIDN5035"; + + initTable(stmt, tablename, "(id vargraphic(30) CCSID 13488, name char(20) CCSID 5035)"); + stmt.executeUpdate("insert into " + tablename + " values('A01', '')"); + + String DAT0 = "\uFF11\uFF12\uFF13"; + sql = "select NAME from " + tablename + " where id = 'A01' FOR UPDATE"; + ResultSet rs = stmt.executeQuery(sql); + rs.first(); + JDReflectionUtil.callMethod_V(rs, "updateNString", "NAME", DAT0); + rs.updateRow(); /* unique file */ + + rs.close(); + // add the commit here so we can debug this.. + connection_.commit(); + + sql = "select NAME from " + tablename + " where id = 'A01'"; + rs = stmt.executeQuery(sql); + rs.next(); + String updatedString = rs.getString(1); + rs.close(); + cleanupTable(stmt, tablename); + stmt.close(); + connection_.commit(); + String check = updatedString.substring(0, 3); + assertCondition(DAT0.equals(check), "Error " + hexString(DAT0) + "!=" + hexString(check) + "<-" + + hexString(updatedString) + " new native testcase 12/03/2003"); + + } catch (Exception e) { + failed(e, "Unexpected exception -- new native testcase added 12/2/2003"); + } + } + } + + } + + /** + * updateNString -- update a CCSID 5035 CHAR field when the job ccsid is 5035 + * then use insertRow + * + * NOTE: This testcase should be last since it changes the job ccsid + */ + public void Var064() { + if (checkJdbc40()) { + if (checkNative()) { + + try { + + // Determine our job name + String jobname = JDJobName.getJobName(); + // Change the CCSID + String command = "QSYS/chgjob " + jobname + " CCSID(5035)"; + String sql = "CALL QSYS.QCMDEXC('" + command + "', 00000000" + command.length() + ".00000)"; + // output_.println("executing "+sql); + Statement stmt = connection_.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE); + stmt.execute(sql); + + // + // Create a new statement that will use the new job CCSID... + // + stmt.close(); + stmt = connection_.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE); + + String tablename = JDRSTest.COLLECTION + ".JDCCSIDN50352"; + + initTable(stmt, tablename, "(id vargraphic(30) CCSID 13488, name char(20) CCSID 5035)"); + stmt.executeUpdate("insert into " + tablename + " values('A01', '')"); + + String DAT0 = "\uFF11\uFF12\uFF13"; + sql = "select ID, NAME from " + tablename + " where id = 'A01' FOR UPDATE"; + ResultSet rs = stmt.executeQuery(sql); + rs.moveToInsertRow(); + JDReflectionUtil.callMethod_V(rs, "updateNString", 2, DAT0); + JDReflectionUtil.callMethod_V(rs, "updateNString", 1, "A02"); + rs.insertRow(); + + rs.close(); + sql = "select NAME from " + tablename + " where id = 'A02'"; + rs = stmt.executeQuery(sql); + rs.next(); + String updatedString = rs.getString(1); + rs.close(); + cleanupTable(stmt, tablename); + stmt.close(); + connection_.commit(); + + String check = updatedString.trim(); + assertCondition(DAT0.equals(check), "Error " + hexString(DAT0) + "!=" + hexString(check) + "<-" + + hexString(updatedString) + " new native testcase 12/03/2003"); + + } catch (Exception e) { + failed(e, "Unexpected exception -- new native testcase added 12/2/2003"); + } + } } + } + + public void dfpTest(String table, String value, String expected) { + if (checkJdbc40()) { + if (checkDecFloatSupport()) { + + try { + Statement s = connection_.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); + ResultSet rs = s.executeQuery("SELECT * FROM " + table + " FOR UPDATE "); + rs.next(); + JDReflectionUtil.callMethod_V(rs, "updateNString", 1, value); + rs.updateRow(); /* serialized */ + + ResultSet rs2 = statement2_.executeQuery("SELECT * FROM " + table); + rs2.next(); + String v = rs2.getString(1); + rs2.close(); + rs.close(); + s.close(); + try { + connection_.commit(); + } catch (Exception e) { + } + if (v == null) // @A1A + assertCondition(expected == null); // @A1A + else // @A1A + assertCondition(v.equals(expected), "Got " + v + " from " + value + " sb " + expected); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + } + + public void dfpRoundTest(String roundingMode, String table, String value, String expected) { + if (checkDecFloatSupport()) { + notApplicable("Rounding test covered by setString"); + } + } + + /** + * updateNString -- set DFP16 to different values and retrieve + */ + public void Var065() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, "4533.43", "4533.43"); + } + + public void Var066() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, "NaN", "NaN"); + } + + public void Var067() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, "NAN", "NaN"); + } + + public void Var068() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+NaN", "NaN"); + } + + public void Var069() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, "-NaN", "-NaN"); + } + + public void Var070() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, "QNaN", "NaN"); + } + + public void Var071() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+QNaN", "NaN"); + } + + public void Var072() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, "-QNaN", "-NaN"); + } + + public void Var073() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, "SNaN", "SNaN"); + } + + public void Var074() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+SNaN", "SNaN"); + } + + public void Var075() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, "-SNaN", "-SNaN"); + } + + public void Var076() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, "INF", "Infinity"); + } + + public void Var077() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+INF", "Infinity"); + } + + public void Var078() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, "-INF", "-Infinity"); + } + + public void Var079() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, "Infinity", "Infinity"); + } + + public void Var080() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+Infinity", "Infinity"); + } + + public void Var081() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, "-Infinity", "-Infinity"); + } + + public void Var082() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, "1234567890123456", "1234567890123456"); + } + + public void Var083() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, "-1234567890123456", "-1234567890123456"); + } + + public void Var084() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+1234567890123456", "1234567890123456"); + } + + public void Var085() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+1234567890123456E28", "1.234567890123456E+43"); + } + public void Var086() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+1234567890123456E+28", "1.234567890123456E+43"); + } - /** - updateNString() - Update an INTEGER, when the string is not a number. - **/ - public void Var024 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_INTEGER", "Data queues"); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } - } + public void Var087() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+123456789012345.6E+29", "1.234567890123456E+43"); + } + public void Var088() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+12345678901234.56E+30", "1.234567890123456E+43"); + } + public void Var089() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+1234567890123.456E+31", "1.234567890123456E+43"); + } - /** - updateNString() - Update a REAL. - **/ - public void Var025 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_REAL", "-1.5"); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - float v = rs2.getFloat ("C_REAL"); - rs2.close (); - assertCondition (v == -1.5); - } - catch(Exception e) - { - failed (e, "Unexpected Exception"); - } - } - } + public void Var090() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+123456789012.3456E+32", "1.234567890123456E+43"); + } + public void Var091() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+12345678901.23456E+33", "1.234567890123456E+43"); + } - /** - updateNString() - Update a REAL, when the number is too big. - - Note: Given the new data truncation rules for JDBC, this testcase - is expected to work without throwing a DataTruncation exception. - **/ - public void Var026 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_REAL", "4534335.443487623"); - rs_.updateRow (); - - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - float v = rs2.getFloat ("C_REAL"); - rs2.close (); - assertCondition (v == 4534335.5); - } - catch(Exception e) - { - failed (e, "Unexpected Exception"); - } - } + public void Var092() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+1234567890.123456E+34", "1.234567890123456E+43"); + } - /* - failed ("Didn't throw SQLException"); - } - catch (Exception e) { - DataTruncation dt = (DataTruncation)e; - assertCondition ((dt.getIndex() == expectedColumn) - && (dt.getParameter() == false) - && (dt.getRead() == false) - && (dt.getDataSize() == 16) - && (dt.getTransferSize() == 8)); + public void Var093() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+123456789.0123456E+35", "1.234567890123456E+43"); + } - } - } - */ - } + public void Var094() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+12345678.90123456E+36", "1.234567890123456E+43"); + } + public void Var095() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+1234567.890123456E+37", "1.234567890123456E+43"); + } + public void Var096() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+123456.7890123456E+38", "1.234567890123456E+43"); + } - /** - updateNString() - Update a REAL, when the string is not a number. - **/ - public void Var027 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_INTEGER", "Data areas"); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } - } + public void Var097() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+12345.67890123456E+39", "1.234567890123456E+43"); + } + public void Var098() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+1234.567890123456E+40", "1.234567890123456E+43"); + } + public void Var099() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+123.4567890123456E+41", "1.234567890123456E+43"); + } + public void Var100() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+12.34567890123456E+42", "1.234567890123456E+43"); + } - /** - updateNString() - Update a FLOAT. - **/ - public void Var028 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_FLOAT", "9845.0"); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - float v = rs2.getFloat ("C_FLOAT"); - rs2.close (); - assertCondition (v == 9845.0); - } - catch(Exception e) - { - failed (e, "Unexpected Exception"); - } - } - } + public void Var101() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+1.234567890123456E+43", "1.234567890123456E+43"); + } + public void Var102() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+.1234567890123456E+44", "1.234567890123456E+43"); + } + public void Var103() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+0.1234567890123456E+44", "1.234567890123456E+43"); + } - /** - updateNString() - Update a FLOAT, when the number is too big. - - Note: Given the new data truncation rules for JDBC, this testcase - is expected to work without throwing a DataTruncation exception. - **/ - public void Var029 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_FLOAT", "453435.4434556337633"); - rs_.updateRow (); - - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - float v = rs2.getFloat ("C_FLOAT"); - rs2.close (); - assertCondition ((v > 453435) && (v < 453436)); - } - catch(Exception e) - { - failed (e, "Unexpected Exception"); - } - } - /* - failed ("Didn't throw SQLException"); - } - catch (Exception e) { - DataTruncation dt = (DataTruncation)e; - assertCondition ((dt.getIndex() == expectedColumn) - && (dt.getParameter() == false) - && (dt.getRead() == false) - && (dt.getDataSize() == 19) - && (dt.getTransferSize() == 17)); + public void Var104() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+0.01234567890123456E+45", "1.234567890123456E+43"); + } - } - } - */ - } - - - - /** - updateNString() - Update a FLOAT, when the string is not a number. - **/ - public void Var030 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_FLOAT", "User spaces"); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } - } + public void Var105() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, "-1234567890123456E28", "-1.234567890123456E+43"); + } + public void Var106() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, "1E0", "1"); + } - /** - updateNString() - Update a DOUBLE. - **/ - public void Var031 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_DOUBLE", "-19845"); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - double v = rs2.getDouble ("C_DOUBLE"); - rs2.close (); - assertCondition (v == -19845); - } - catch(Exception e) - { - failed (e, "Unexpected Exception"); - } - } - } + public void Var107() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, "1.1", "1.1"); + } + public void Var108() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, "1.1E0", "1.1"); + } + public void Var109() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, null, null); + } - /** - updateNString() - Update a DOUBLE, when the number is too big. - - Note: Given the new data truncation rules for JDBC, this testcase - is expected to work without throwing a DataTruncation exception. - **/ - public void Var032 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_DOUBLE", "4533435.4433445532333"); - rs_.updateRow (); - - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - float v = rs2.getFloat ("C_DOUBLE"); - rs2.close (); - assertCondition (v == 4533435.5); - } - catch(Exception e) - { - failed (e, "Unexpected Exception"); - } - } - /* - failed ("Didn't throw SQLException"); - } - catch (Exception e) { - DataTruncation dt = (DataTruncation)e; - assertCondition ((dt.getIndex() == expectedColumn) - && (dt.getParameter() == false) - && (dt.getRead() == false) - && (dt.getDataSize() == 20) - && (dt.getTransferSize() == 16)); + /* + * updateString -- using different rounding modes + */ + String RHE = "round half even"; - } - } - */ - } + public void Var110() { + dfpRoundTest(RHE, JDRSTest.RSTEST_UPDDFP16, "1.2345678901234545", "1.234567890123454"); + } + public void Var111() { + dfpRoundTest(RHE, JDRSTest.RSTEST_UPDDFP16, "1.2345678901234555", "1.234567890123456"); + } + public void Var112() { + dfpRoundTest(RHE, JDRSTest.RSTEST_UPDDFP16, "-1.2345678901234545", "-1.234567890123454"); + } - /** - updateNString() - Update a DOUBLE, when the string is not a number. - **/ - public void Var033 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_DOUBLE", "IFS"); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } - } + public void Var113() { + dfpRoundTest(RHE, JDRSTest.RSTEST_UPDDFP16, "-1.2345678901234555", "-1.234567890123456"); + } + /** + * updateFloat -- set a DFP16 with rounding mode "round half up" + */ + String RHU = "round half up"; - /** - updateNString() - Update a DECIMAL. - **/ - public void Var034 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_DECIMAL_105", "-4533.4"); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - BigDecimal v = rs2.getBigDecimal ("C_DECIMAL_105"); - rs2.close (); - assertCondition (v.floatValue() == -4533.4f); - } - catch(Exception e) - { - failed (e, "Unexpected Exception"); - } - } - } + public void Var114() { + dfpRoundTest(RHU, JDRSTest.RSTEST_UPDDFP16, "1.2345678901234555", "1.234567890123456"); + } + public void Var115() { + dfpRoundTest(RHU, JDRSTest.RSTEST_UPDDFP16, "1.2345678901234545", "1.234567890123455"); + } + public void Var116() { + dfpRoundTest(RHU, JDRSTest.RSTEST_UPDDFP16, "1.2345678901234565", "1.234567890123457"); + } - /** - updateNString() - Update a DECIMAL, when the value is too big. - **/ - public void Var035 () - { - if(checkJdbc40 ()) - { - int expectedColumn = -1; - try - { - JDRSTest.position (rs_, key_); - expectedColumn = rs_.findColumn ("C_DECIMAL_40"); - JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_DECIMAL_40", "543511"); - rs_.updateRow (); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - if (e instanceof DataTruncation) { - DataTruncation dt = (DataTruncation)e; - assertCondition ((dt.getIndex() == expectedColumn) - && (dt.getParameter() == false) - && (dt.getRead() == false) - && (dt.getDataSize() == 6) - && (dt.getTransferSize() == 4)); - } else { - assertSqlException(e, -99999, "07006", "Data type mismatch", - "Mismatch instead of truncation in latest toolbox"); - - } - - } - } - } + public void Var117() { + dfpRoundTest(RHU, JDRSTest.RSTEST_UPDDFP16, "-1.2345678901234555", "-1.234567890123455"); + } + public void Var118() { + dfpRoundTest(RHU, JDRSTest.RSTEST_UPDDFP16, "-1.2345678901234545", "-1.234567890123454"); + } - /** - updateNString() - Update a DECIMAL, when the string is not a number. - **/ - public void Var036 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_DECIMAL1050", "GUI components"); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } - } + public void Var119() { + dfpRoundTest(RHU, JDRSTest.RSTEST_UPDDFP16, "-1.2345678901234565", "-1.234567890123456"); + } + /** + * updateFloat -- set a DFP16 with rounding mode "round down" + */ + String RD = "round down"; + public void Var120() { + dfpRoundTest(RD, JDRSTest.RSTEST_UPDDFP16, "1.2345678901234555", "1.234567890123455"); + } - /** - updateNString() - Update a NUMERIC. - **/ - public void Var037 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_NUMERIC_105", "-9933.455"); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - BigDecimal v = rs2.getBigDecimal ("C_NUMERIC_105"); - rs2.close (); - assertCondition (v.doubleValue() == -9933.455); - } - catch(Exception e) - { - failed (e, "Unexpected Exception"); - } - } - } + public void Var121() { + dfpRoundTest(RD, JDRSTest.RSTEST_UPDDFP16, "1.2345678901234559999999", "1.234567890123455"); + } + public void Var122() { + dfpRoundTest(RD, JDRSTest.RSTEST_UPDDFP16, "=1.2345678901234555", "-1.234567890123456"); + } + public void Var123() { + dfpRoundTest(RD, JDRSTest.RSTEST_UPDDFP16, "-1.2345678901234559999999", "-1.234567890123456"); + } - /** - updateNString() - Update a NUMERIC, when the value is too big. - **/ - public void Var038 () - { - if(checkJdbc40 ()) - { - int expectedColumn = -1; - try - { - JDRSTest.position (rs_, key_); - expectedColumn = rs_.findColumn ("C_NUMERIC_40"); - JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_NUMERIC_40", "-331515"); - rs_.updateRow (); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - if (e instanceof DataTruncation) { - DataTruncation dt = (DataTruncation)e; - assertCondition ((dt.getIndex() == expectedColumn) - && (dt.getParameter() == false) - && (dt.getRead() == false) - && (dt.getDataSize() == 6) - && (dt.getTransferSize() == 4)); - } else { - assertSqlException(e, -99999, "07006", "Data type mismatch", - "Mismatch instead of truncation in latest toolbox"); - - } - - } - } - } + /** + * updateFloat -- set a DFP16 with rounding mode "round ceiling" + */ + String RC = "round ceiling"; + public void Var124() { + dfpRoundTest(RC, JDRSTest.RSTEST_UPDDFP16, "1.2345678901234555", "1.234567890123456"); + } + public void Var125() { + dfpRoundTest(RC, JDRSTest.RSTEST_UPDDFP16, "1.2345678901234559999999", "1.234567890123456"); + } - /** - updateNString() - Update a NUMERIC, when the string is not a number. - **/ - public void Var039 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_NUMERIC_105", "Jar maker"); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } - } + public void Var126() { + dfpRoundTest(RC, JDRSTest.RSTEST_UPDDFP16, "=1.2345678901234555", "-1.234567890123456"); + } + public void Var127() { + dfpRoundTest(RC, JDRSTest.RSTEST_UPDDFP16, "-1.2345678901234559999999", "-1.234567890123456"); + } + /** + * updateFloat -- set a DFP16 with rounding mode "round floor" + */ + String RF = "round floor"; - /** - updateNString() - Update a CHAR. - **/ - public void Var040 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_CHAR_50", "JDBC 2.0"); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - String v = rs2.getString ("C_CHAR_50"); - rs2.close (); - assertCondition (v.equals ("JDBC 2.0 ")); - } - catch(Exception e) - { - failed (e, "Unexpected Exception"); - } - } - } + public void Var128() { + dfpRoundTest(RF, JDRSTest.RSTEST_UPDDFP16, "1.2345678901234555", "1.234567890123455"); + } + public void Var129() { + dfpRoundTest(RF, JDRSTest.RSTEST_UPDDFP16, "1.2345678901234559999999", "1.234567890123455"); + } + public void Var130() { + dfpRoundTest(RF, JDRSTest.RSTEST_UPDDFP16, "=1.2345678901234555", "-1.234567890123455"); + } - /** - updateNString() - Update a CHAR, when the value is too big. - **/ - public void Var041 () - { - if(checkJdbc40 ()) - { - int expectedColumn = -1; - try - { - JDRSTest.position (rs_, key_); - expectedColumn = rs_.findColumn ("C_CHAR_1"); - JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_CHAR_1", "Data conversion"); - rs_.updateRow (); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - DataTruncation dt = (DataTruncation)e; - assertCondition ((dt.getIndex() == expectedColumn) - && (dt.getParameter() == false) - && (dt.getRead() == false) - && (dt.getDataSize() == 15) - && (dt.getTransferSize() == 1), - "dt.getIndex()="+dt.getIndex()+" sb "+expectedColumn+"\n"+ - "dt.getParameter()="+dt.getParameter()+" sb false\n" + - "dt.getRead()="+dt.getRead()+" sb false\n"+ - "dt.getDataSize()="+dt.getDataSize()+" sb 15\n"+ - "dt.getTransferSize()="+dt.getTransferSize()+"sb 1"); - - } - } - } + public void Var131() { + dfpRoundTest(RF, JDRSTest.RSTEST_UPDDFP16, "-1.2345678901234559999999", "-1.234567890123455"); + } + /** + * updateFloat -- set a DFP16 with rounding mode "round half down" + */ + String RHD = "round half down"; + public void Var132() { + dfpRoundTest(RHD, JDRSTest.RSTEST_UPDDFP16, "1.2345678901234555", "1.234567890123455"); + } - /** - updateNString() - Update a VARCHAR. - **/ - public void Var042 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_VARCHAR_50", "Message files"); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - String v = rs2.getString ("C_VARCHAR_50"); - rs2.close (); - assertCondition (v.equals ("Message files")); - } - catch(Exception e) - { - failed (e, "Unexpected Exception"); - } - } - } + public void Var133() { + dfpRoundTest(RHD, JDRSTest.RSTEST_UPDDFP16, "1.2345678901234545", "1.234567890123454"); + } + public void Var134() { + dfpRoundTest(RHD, JDRSTest.RSTEST_UPDDFP16, "1.2345678901234565", "1.234567890123456"); + } + public void Var135() { + dfpRoundTest(RHD, JDRSTest.RSTEST_UPDDFP16, "-1.2345678901234555", "-1.234567890123456"); + } - /** - updateNString() - Update a VARCHAR, when the value is too big. - **/ - public void Var043 () - { - if(checkJdbc40 ()) - { - int expectedColumn = -1; - try - { - JDRSTest.position (rs_, key_); - expectedColumn = rs_.findColumn ("C_VARCHAR_50"); - JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_VARCHAR_50", "This string is really long and is testing data truncation."); - rs_.updateRow (); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - DataTruncation dt = (DataTruncation)e; - assertCondition ((dt.getIndex() == expectedColumn) - && (dt.getParameter() == false) - && (dt.getRead() == false) - && (dt.getDataSize() == 58) - && (dt.getTransferSize() == 50), - "dt.getIndex()="+dt.getIndex()+" sb "+expectedColumn+"\n"+ - "dt.getParameter()="+dt.getParameter()+" sb false\n" + - "dt.getRead()="+dt.getRead()+" sb false\n"+ - "dt.getDataSize()="+dt.getDataSize()+" sb 58\n"+ - "dt.getTransferSize()="+dt.getTransferSize()+"sb 50"); - - } - } - } + public void Var136() { + dfpRoundTest(RHD, JDRSTest.RSTEST_UPDDFP16, "-1.2345678901234545", "-1.234567890123455"); + } + public void Var137() { + dfpRoundTest(RHD, JDRSTest.RSTEST_UPDDFP16, "-1.2345678901234565", "-1.234567890123457"); + } + /** + * updateFloat -- set a DFP16 with rounding mode "round down" + */ + String RU = "round up"; - /** - updateNString() - Update a BINARY. - **/ - public void Var044 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_BINARY_20", "F1F2F3F4F5"); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - String v = rs2.getString ("C_BINARY_20"); - rs2.close (); - assertCondition (v.startsWith ("F1F2F3F4F5")); - } - catch(Exception e) - { - failed (e, "Unexpected Exception"); - } - } - } + public void Var138() { + dfpRoundTest(RU, JDRSTest.RSTEST_UPDDFP16, "1.2345678901234555", "1.234567890123456"); + } + public void Var139() { + dfpRoundTest(RU, JDRSTest.RSTEST_UPDDFP16, "1.2345678901234559999999", "1.234567890123456"); + } + public void Var140() { + dfpRoundTest(RU, JDRSTest.RSTEST_UPDDFP16, "=1.2345678901234555", "-1.234567890123455"); + } - /** - updateNString() - Update a BINARY, when the value is too big. - **/ - public void Var045 () - { - if(checkJdbc40 ()) - { - int expectedColumn = -1; - try - { - JDRSTest.position (rs_, key_); - expectedColumn = rs_.findColumn ("C_BINARY_1"); - JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_BINARY_1", "F1F2F3F4"); - rs_.updateRow (); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - DataTruncation dt = (DataTruncation)e; - assertCondition ((dt.getIndex() == expectedColumn) - && (dt.getParameter() == false) - && (dt.getRead() == false) - && (dt.getTransferSize() == 1)); - } - } + public void Var141() { + dfpRoundTest(RU, JDRSTest.RSTEST_UPDDFP16, "-1.2345678901234559999999", "-1.234567890123455"); + } - } + /** + * updateString -- set DFP34 to different values and retrieve + */ + public void Var142() { + dfpTest(JDRSTest.RSTEST_UPDDFP34, "4533.43", "4533.43"); + } + public void Var143() { + dfpTest(JDRSTest.RSTEST_UPDDFP34, "NaN", "NaN"); + } + public void Var144() { + dfpTest(JDRSTest.RSTEST_UPDDFP34, "NAN", "NaN"); + } - /** - updateNString() - Update a VARBINARY. - **/ - public void Var046 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_VARBINARY_20", "F1"); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - String v = rs2.getString ("C_VARBINARY_20"); - rs2.close (); - assertCondition (v.equals ("F1")); - } - catch(Exception e) - { - failed (e, "Unexpected Exception"); - } - } - } + public void Var145() { + dfpTest(JDRSTest.RSTEST_UPDDFP34, "+NaN", "NaN"); + } + public void Var146() { + dfpTest(JDRSTest.RSTEST_UPDDFP34, "-NaN", "-NaN"); + } + public void Var147() { + dfpTest(JDRSTest.RSTEST_UPDDFP34, "QNaN", "NaN"); + } - /** - updateNString() - Update a VARBINARY, when the value is too big. - **/ - public void Var047 () - { - if(checkJdbc40 ()) - { - int expectedColumn = -1; - try - { - JDRSTest.position (rs_, key_); - expectedColumn = rs_.findColumn ("C_VARBINARY_20"); - JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_VARBINARY_20", "F1F2F3F4F5F1F2F3F4F5F1F2F3F4F5F1F2F3F4F5F1F2F3F4F5F1F2F3F4F5"); - rs_.updateRow (); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - DataTruncation dt = (DataTruncation)e; - assertCondition ((dt.getIndex() == expectedColumn) - && (dt.getParameter() == false) - && (dt.getRead() == false) - && (dt.getTransferSize() == 20)); - } - } - } + public void Var148() { + dfpTest(JDRSTest.RSTEST_UPDDFP34, "+QNaN", "NaN"); + } + public void Var149() { + dfpTest(JDRSTest.RSTEST_UPDDFP34, "-QNaN", "-NaN"); + } + public void Var150() { + dfpTest(JDRSTest.RSTEST_UPDDFP34, "SNaN", "SNaN"); + } - /** - updateNString() - Update a CLOB. - - SQL400 - the native driver expects this update to work correctly. - **/ - public void Var048 () - { - if(checkJdbc40 ()) - { - if(checkLobSupport ()) - { - try - { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_CLOB", "Toolbox"); - - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - String v = rs2.getString ("C_CLOB"); - rs2.close (); - assertCondition (v.equals ("Toolbox")); - } - catch(Exception e) - { - failed (e, "Unexpected Exception"); - } - } - } - } + public void Var151() { + dfpTest(JDRSTest.RSTEST_UPDDFP34, "+SNaN", "SNaN"); + } + public void Var152() { + dfpTest(JDRSTest.RSTEST_UPDDFP34, "-SNaN", "-SNaN"); + } + public void Var153() { + dfpTest(JDRSTest.RSTEST_UPDDFP34, "INF", "Infinity"); + } - /** - updateNString() - Update a DBCLOB. - - SQL400 - the native driver expects this update to work correctly. - **/ - public void Var049 () - { - if(checkJdbc40 ()) - { - if(checkLobSupport ()) - { - try - { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_DBCLOB", "For Java"); - - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - String v = rs2.getString ("C_DBCLOB"); - rs2.close (); - assertCondition (v.equals ("For Java")); - } - catch(Exception e) - { - failed (e, "Unexpected Exception"); - } - } - } - } + public void Var154() { + dfpTest(JDRSTest.RSTEST_UPDDFP34, "+INF", "Infinity"); + } + public void Var155() { + dfpTest(JDRSTest.RSTEST_UPDDFP34, "-INF", "-Infinity"); + } + public void Var156() { + dfpTest(JDRSTest.RSTEST_UPDDFP34, "Infinity", "Infinity"); + } - /** - updateNString() - Update a BLOB. - **/ - public void Var050 () - { - if(checkJdbc40 ()) - { - if(checkLobSupport ()) - { - try - { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_BLOB", "JDK 1.2"); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } - } - } + public void Var157() { + dfpTest(JDRSTest.RSTEST_UPDDFP34, "+Infinity", "Infinity"); + } + public void Var158() { + dfpTest(JDRSTest.RSTEST_UPDDFP34, "-Infinity", "-Infinity"); + } + public void Var159() { + dfpTest(JDRSTest.RSTEST_UPDDFP34, "1234567890123456", "1234567890123456"); + } - /** - updateNString() - Update a DATE. - **/ - public void Var051 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - - // TODO: Start supporting these different date styles. - if(isToolboxDriver()) - JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_DATE", "02-10-70"); - else - JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_DATE", "1970-02-10"); - - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - Date v = rs2.getDate ("C_DATE"); - rs2.close (); - assertCondition (v.toString ().equals ("1970-02-10")); - } - catch(Exception e) - { - failed (e, "Unexpected Exception"); - } - } - } + public void Var160() { + dfpTest(JDRSTest.RSTEST_UPDDFP34, "-1234567890123456", "-1234567890123456"); + } + public void Var161() { + dfpTest(JDRSTest.RSTEST_UPDDFP34, "+1234567890123456", "1234567890123456"); + } + public void Var162() { + dfpTest(JDRSTest.RSTEST_UPDDFP34, "+1234567890123456E28", "1.234567890123456E+43"); + } - /** - updateNString() - Update a DATE, when the string is not a valid date. - **/ - public void Var052 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_DATE", "Emerging markets"); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } - } + public void Var163() { + dfpTest(JDRSTest.RSTEST_UPDDFP34, "+1234567890123456E+28", "1.234567890123456E+43"); + } + public void Var164() { + dfpTest(JDRSTest.RSTEST_UPDDFP34, "+123456789012345.6E+29", "1.234567890123456E+43"); + } + public void Var165() { + dfpTest(JDRSTest.RSTEST_UPDDFP34, "+12345678901234.56E+30", "1.234567890123456E+43"); + } - /** - updateNString() - Update a TIME. - **/ - public void Var053 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_TIME", "07:24:34"); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - Time v = rs2.getTime ("C_TIME"); - rs2.close (); - assertCondition (v.toString ().equals ("07:24:34")); - } - catch(Exception e) - { - failed (e, "Unexpected Exception"); - } - } - } + public void Var166() { + dfpTest(JDRSTest.RSTEST_UPDDFP34, "+1234567890123.456E+31", "1.234567890123456E+43"); + } + public void Var167() { + dfpTest(JDRSTest.RSTEST_UPDDFP34, "+123456789012.3456E+32", "1.234567890123456E+43"); + } + public void Var168() { + dfpTest(JDRSTest.RSTEST_UPDDFP34, "+12345678901.23456E+33", "1.234567890123456E+43"); + } - /** - updateNString() - Update a TIME, when the string is not a valid time. - **/ - public void Var054 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_TIME", "V4R4"); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } - } + public void Var169() { + dfpTest(JDRSTest.RSTEST_UPDDFP34, "+1234567890.123456E+34", "1.234567890123456E+43"); + } + public void Var170() { + dfpTest(JDRSTest.RSTEST_UPDDFP34, "+123456789.0123456E+35", "1.234567890123456E+43"); + } + public void Var171() { + dfpTest(JDRSTest.RSTEST_UPDDFP34, "+12345678.90123456E+36", "1.234567890123456E+43"); + } - /** - updateNString() - Update a TIMESTAMP. - **/ - public void Var055 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_TIMESTAMP", "1975-04-30 07:24:34.543"); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - Timestamp v = rs2.getTimestamp ("C_TIMESTAMP"); - rs2.close (); - assertCondition (v.toString ().equals ("1975-04-30 07:24:34.543")); - } - catch(Exception e) - { - failed (e, "Unexpected Exception"); - } - } - } + public void Var172() { + dfpTest(JDRSTest.RSTEST_UPDDFP34, "+1234567.890123456E+37", "1.234567890123456E+43"); + } + public void Var173() { + dfpTest(JDRSTest.RSTEST_UPDDFP34, "+123456.7890123456E+38", "1.234567890123456E+43"); + } + public void Var174() { + dfpTest(JDRSTest.RSTEST_UPDDFP34, "+12345.67890123456E+39", "1.234567890123456E+43"); + } - /** - updateNString() - Update a TIMESTAMP, when the string is not a vliad timestamp. - **/ - public void Var056 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_TIMESTAMP", "Beta web page"); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } - } + public void Var175() { + dfpTest(JDRSTest.RSTEST_UPDDFP34, "+1234.567890123456E+40", "1.234567890123456E+43"); + } + public void Var176() { + dfpTest(JDRSTest.RSTEST_UPDDFP34, "+123.4567890123456E+41", "1.234567890123456E+43"); + } + public void Var177() { + dfpTest(JDRSTest.RSTEST_UPDDFP34, "+12.34567890123456E+42", "1.234567890123456E+43"); + } - /** - updateNString() - Update a DATALINK. - **/ - public void Var057 () - { - if(checkJdbc40 ()) - { - if(checkLobSupport ()) - { - // We do not test updating datalinks, since it is not - // possible to open a updatable cursor/result set with - // a datalink column. - notApplicable("DATALINK update not supported."); - /* - try { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_DATALINK", "Secure sockets"); - failed ("Didn't throw SQLException"); - } - catch (Exception e) { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - */ - } - } - } + public void Var178() { + dfpTest(JDRSTest.RSTEST_UPDDFP34, "+1.234567890123456E+43", "1.234567890123456E+43"); + } + public void Var179() { + dfpTest(JDRSTest.RSTEST_UPDDFP34, "+.1234567890123456E+44", "1.234567890123456E+43"); + } + public void Var180() { + dfpTest(JDRSTest.RSTEST_UPDDFP34, "+0.1234567890123456E+44", "1.234567890123456E+43"); + } - /** - updateNString() - Update a DISTINCT. - **/ - public void Var058 () - { - if(checkJdbc40 ()) - { - if(checkLobSupport ()) - { - try - { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_DISTINCT", "AS/400"); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - String v = rs2.getString ("C_DISTINCT"); - rs2.close (); - assertCondition (v.equals ("AS/400 ")); - } - catch(Exception e) - { - failed (e, "Unexpected Exception"); - } - } - } - } + public void Var181() { + dfpTest(JDRSTest.RSTEST_UPDDFP34, "+0.01234567890123456E+45", "1.234567890123456E+43"); + } + public void Var182() { + dfpTest(JDRSTest.RSTEST_UPDDFP34, "-1234567890123456E28", "-1.234567890123456E+43"); + } + public void Var183() { + dfpTest(JDRSTest.RSTEST_UPDDFP34, "1E0", "1"); + } - /** - updateNString() - Update a BIGINT. - **/ - public void Var059() - { - if(checkJdbc40 ()) - { - if(checkBigintSupport()) - { - try - { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_BIGINT", "999228374"); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - long v = rs2.getLong ("C_BIGINT"); - rs2.close (); - assertCondition (v == 999228374); - } - catch(Exception e) - { - failed (e, "Unexpected Exception"); - } - } - } - } + public void Var184() { + dfpTest(JDRSTest.RSTEST_UPDDFP34, "1.1", "1.1"); + } + public void Var185() { + dfpTest(JDRSTest.RSTEST_UPDDFP34, "1.1E0", "1.1"); + } + public void Var186() { + dfpTest(JDRSTest.RSTEST_UPDDFP34, null, null); + } - /** - updateNString() - Update a BIGINT, when the integer is too big. - **/ - public void Var060() - { - if(checkJdbc40 ()) - { - if(checkBigintSupport()) - { - try - { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_BIGINT", "-44332245453454325353487623"); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } - } - } + /* + * updateString -- using different rounding modes + */ + public void Var187() { + dfpRoundTest(RHE, JDRSTest.RSTEST_UPDDFP34, "1.1818181818181818182345678901234545", + "1.181818181818181818234567890123454"); + } + public void Var188() { + dfpRoundTest(RHE, JDRSTest.RSTEST_UPDDFP34, "1.1818181818181818182345678901234555", + "1.181818181818181818234567890123456"); + } + public void Var189() { + dfpRoundTest(RHE, JDRSTest.RSTEST_UPDDFP34, "-1.1818181818181818182345678901234545", + "-1.181818181818181818234567890123454"); + } - /** - updateNString() - Update an BIGINT, when the string is not a number. - **/ - public void Var061() - { - if(checkJdbc40 ()) - { - if(checkBigintSupport()) - { - try - { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_BIGINT", "System values"); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } - } - } + public void Var190() { + dfpRoundTest(RHE, JDRSTest.RSTEST_UPDDFP34, "-1.1818181818181818182345678901234555", + "-1.181818181818181818234567890123456"); + } + /** + * updateFloat -- set a DFP34 with rounding mode "round half up" + */ + public void Var191() { + dfpRoundTest(RHU, JDRSTest.RSTEST_UPDDFP34, "1.1818181818181818182345678901234555", + "1.181818181818181818234567890123456"); + } - /** - updateNString() - column names with quotes. - **/ - public void Var062() - { - if(checkJdbc40 ()) - { - try - { - Statement statement = connection_.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, - ResultSet.CONCUR_UPDATABLE); - initTable(statement, JDRSTest.COLLECTION + ".\"MixedC\""," ( " + - "\"MixedCaseField\" VARCHAR (10), " + - "MIXEDCASEFIELD VARCHAR (10), " + - "\"Mixed2\" VARCHAR(20) )" ); - - ResultSet rs = statement.executeQuery("SELECT * FROM " + JDRSTest.COLLECTION + ".\"MixedC\" FOR UPDATE"); - rs.moveToInsertRow(); - - // Since the names do not include quotes the first two updates will - // both update the FIRST column. The first column name is - // MixedCaseField which matches MixedCaseField. - JDReflectionUtil.callMethod_V(rs, "updateNString", "MixedCaseField", "Data"); - JDReflectionUtil.callMethod_V(rs, "updateNString", "MIXEDCASEFIELD", "MoreData"); - JDReflectionUtil.callMethod_V(rs, "updateNString", "\"Mixed2\"", "mixed2 data"); - - rs.insertRow(); - - // Now the first updateNString is correct. I will update the - // first column. - JDReflectionUtil.callMethod_V(rs, "updateNString", "\"MixedCaseField\"", "Data"); - JDReflectionUtil.callMethod_V(rs, "updateNString", "\"MIXEDCASEFIELD\"", "MoreData"); - JDReflectionUtil.callMethod_V(rs, "updateNString", "\"Mixed2\"", "mixed2 data"); - - rs.insertRow(); - - rs.close(); - statement.close(); - - PreparedStatement insert = connection_.prepareStatement ("INSERT INTO " + JDRSTest.COLLECTION + ".\"MixedC\" " - + " (\"MixedCaseField\", MIXEDCASEFIELD, \"Mixed2\") " - + " VALUES (?, ?, ?)"); - insert.setString(1, "Data"); - insert.setString(2, "MoreData"); - insert.setString(3, "mixed2 data"); - insert.executeUpdate(); - insert.close(); - - statement = connection_.createStatement(); - - rs = statement.executeQuery("SELECT * FROM " + JDRSTest.COLLECTION + ".\"MixedC\" "); - - boolean successful = true; - - rs.next(); - - String col1 = rs.getString(1); - String col2 = rs.getString(2); - String col3 = rs.getString(3); - - //toolbox has fixed this - if( isToolboxDriver() ) - { - if(!"Data".equals(col1) || - !"MoreData".equals(col2) || - !"mixed2 data".equals(col3)) - { - failed("ROW 1: data does not match: '"+col1+"'!='Data' '"+col2+"'!='MoreData' '"+col3+"'!='mixed2 data'"); - successful = false; - } - }else - { - if(!"MoreData".equals(col1) || - col2 != null || - !"mixed2 data".equals(col3)) - { - failed("ROW 1: data does not match: '"+col1+"'!='MoreData' '"+col2+"'!=null '"+col3+"'!='mixed2 data'"); - successful = false; - } - } - - if(successful) - { - rs.next(); - col1 = rs.getString(1); - col2 = rs.getString(2); - col3 = rs.getString(3); - - if(!"Data".equals(col1) || - !"MoreData".equals(col2) || - !"mixed2 data".equals(col3)) - { - failed("ROW 2: data does not match: '"+col1+"'!='Data' '"+col2+"'!='MoreData' '"+col3+"'!='mixed2 data'"); - successful = false; - } - } - - if(successful) - { - rs.next(); - col1 = rs.getString(1); - col2 = rs.getString(2); - col3 = rs.getString(3); - - if(!"Data".equals(col1) || - !"MoreData".equals(col2) || - !"mixed2 data".equals(col3)) - { - failed("ROW 3: data does not match: '"+col1+"'!='Data' '"+col2+"'!='MoreData' '"+col3+"'!='mixed2 data'"); - successful = false; - } - } - - if(successful) - succeeded(); - - rs.close(); - statement.close(); - } - catch(Exception e) - { - failed (e, "Unexpected Exception"); - } - } + public void Var192() { + dfpRoundTest(RHU, JDRSTest.RSTEST_UPDDFP34, "1.1818181818181818182345678901234545", + "1.181818181818181818234567890123455"); + } - } + public void Var193() { + dfpRoundTest(RHU, JDRSTest.RSTEST_UPDDFP34, "1.1818181818181818182345678901234565", + "1.181818181818181818234567890123457"); + } - /** - * updateNString -- update a CCSID 5035 CHAR field when the job ccsid is 5035 - * then use updateRow - * - * NOTE: This testcase should be last since it changes the job ccsid - */ - public void Var063() - { - if(checkJdbc40 ()) { - if (checkNative()) { - try { - // Determine our job name - String jobname = JDJobName.getJobName(); - // Change the CCSID - String command = "QSYS/chgjob "+jobname+" CCSID(5035)"; - String sql = "CALL QSYS.QCMDEXC('"+command+"', 00000000"+command.length()+".00000)"; - // output_.println("executing "+sql); - Statement stmt = connection_.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, - ResultSet.CONCUR_UPDATABLE); - stmt.execute(sql); - - - // - // Create a new statement that will use the new job CCSID... - // - stmt = connection_.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, - ResultSet.CONCUR_UPDATABLE); - - - String tablename =JDRSTest.COLLECTION+".JDCCSID5035"; - - initTable(stmt, tablename,"(id vargraphic(30) CCSID 13488, name char(20) CCSID 5035)"); - stmt.executeUpdate("insert into "+tablename+" values('A01', '')"); - - String DAT0 = "\uFF11\uFF12\uFF13"; - sql = "select NAME from "+tablename+" where id = 'A01' FOR UPDATE"; - ResultSet rs = stmt.executeQuery(sql); - rs.first(); - JDReflectionUtil.callMethod_V(rs, "updateNString", "NAME",DAT0); - rs.updateRow(); - - rs.close(); - // add the commit here so we can debug this.. - connection_.commit(); - - sql = "select NAME from "+tablename+" where id = 'A01'"; - rs = stmt.executeQuery(sql); - rs.next(); - String updatedString = rs.getString(1); - rs.close(); - cleanupTable(stmt, tablename); - stmt.close(); - connection_.commit(); - String check = updatedString.substring(0,3); - assertCondition(DAT0.equals(check), "Error "+hexString(DAT0)+"!="+hexString(check)+"<-"+hexString(updatedString)+" new native testcase 12/03/2003"); - - } catch (Exception e) { - failed(e, "Unexpected exception -- new native testcase added 12/2/2003"); - } - } - } - - } - - /** - * updateNString -- update a CCSID 5035 CHAR field when the job ccsid is 5035 - * then use insertRow - * - * NOTE: This testcase should be last since it changes the job ccsid - */ - public void Var064() - { - if(checkJdbc40 ()) { - if (checkNative()) { - try { - // Determine our job name - String jobname = JDJobName.getJobName(); - // Change the CCSID - String command = "QSYS/chgjob "+jobname+" CCSID(5035)"; - String sql = "CALL QSYS.QCMDEXC('"+command+"', 00000000"+command.length()+".00000)"; - // output_.println("executing "+sql); - Statement stmt = connection_.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, - ResultSet.CONCUR_UPDATABLE); - stmt.execute(sql); - - // - // Create a new statement that will use the new job CCSID... - // - stmt = connection_.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, - ResultSet.CONCUR_UPDATABLE); - - - String tablename =JDRSTest.COLLECTION+".JDCCSID50352"; - - initTable(stmt, tablename,"(id vargraphic(30) CCSID 13488, name char(20) CCSID 5035)"); - stmt.executeUpdate("insert into "+tablename+" values('A01', '')"); - - String DAT0 = "\uFF11\uFF12\uFF13"; - sql = "select ID, NAME from "+tablename+" where id = 'A01' FOR UPDATE"; - ResultSet rs = stmt.executeQuery(sql); - rs.moveToInsertRow(); - JDReflectionUtil.callMethod_V(rs, "updateNString", 2, DAT0); - JDReflectionUtil.callMethod_V(rs, "updateNString", 1, "A02"); - rs.insertRow(); - - rs.close(); - sql = "select NAME from "+tablename+" where id = 'A02'"; - rs = stmt.executeQuery(sql); - rs.next(); - String updatedString = rs.getString(1); - rs.close(); - cleanupTable(stmt, tablename); - stmt.close(); - connection_.commit(); - - String check = updatedString.trim(); - assertCondition(DAT0.equals(check), "Error "+hexString(DAT0)+"!="+hexString(check)+"<-"+hexString(updatedString)+" new native testcase 12/03/2003"); - - - } catch (Exception e) { - failed(e, "Unexpected exception -- new native testcase added 12/2/2003"); - } - } - } - - } - - - - public void dfpTest(String table, String value, String expected) { - if (checkJdbc40()) { - if (checkDecFloatSupport()) { - try { - Statement s = connection_.createStatement( - ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); - ResultSet rs = s - .executeQuery("SELECT * FROM " + table + " FOR UPDATE "); - rs.next(); - JDReflectionUtil.callMethod_V(rs, "updateNString", 1, value); - rs.updateRow(); - - ResultSet rs2 = statement2_.executeQuery("SELECT * FROM " + table); - rs2.next(); - String v = rs2.getString(1); - rs2.close(); - s.close(); - try { - connection_.commit(); - } catch (Exception e) {} - if(v == null) //@A1A - assertCondition(expected == null); //@A1A - else //@A1A - assertCondition(v.equals(expected), "Got " + v + " from "+ value +" sb " + expected); - } catch (Exception e) { - failed(e, "Unexpected Exception"); - } - } - } - } - - - public void dfpRoundTest(String roundingMode, String table, String value, String expected) { - if (checkDecFloatSupport()) { - notApplicable("Rounding test covered by setString"); - } - } - + public void Var194() { + dfpRoundTest(RHU, JDRSTest.RSTEST_UPDDFP34, "-1.1818181818181818182345678901234555", + "-1.181818181818181818234567890123455"); + } + public void Var195() { + dfpRoundTest(RHU, JDRSTest.RSTEST_UPDDFP34, "-1.1818181818181818182345678901234545", + "-1.181818181818181818234567890123454"); + } - /** - * updateNString -- set DFP16 to different values and retrieve - */ - public void Var065 () { dfpTest(JDRSTest.RSTEST_DFP16, "4533.43", "4533.43"); } - public void Var066 () { dfpTest(JDRSTest.RSTEST_DFP16, "NaN", "NaN");} - public void Var067 () { dfpTest(JDRSTest.RSTEST_DFP16, "NAN", "NaN");} - public void Var068 () { dfpTest(JDRSTest.RSTEST_DFP16, "+NaN", "NaN");} - public void Var069 () { dfpTest(JDRSTest.RSTEST_DFP16, "-NaN", "-NaN");} - public void Var070 () { dfpTest(JDRSTest.RSTEST_DFP16, "QNaN", "NaN");} - public void Var071 () { dfpTest(JDRSTest.RSTEST_DFP16, "+QNaN", "NaN");} - public void Var072 () { dfpTest(JDRSTest.RSTEST_DFP16, "-QNaN", "-NaN");} - public void Var073 () { dfpTest(JDRSTest.RSTEST_DFP16, "SNaN", "SNaN");} - public void Var074 () { dfpTest(JDRSTest.RSTEST_DFP16, "+SNaN", "SNaN");} - public void Var075 () { dfpTest(JDRSTest.RSTEST_DFP16, "-SNaN", "-SNaN");} - public void Var076 () { dfpTest(JDRSTest.RSTEST_DFP16, "INF", "Infinity");} - public void Var077 () { dfpTest(JDRSTest.RSTEST_DFP16, "+INF", "Infinity");} - public void Var078 () { dfpTest(JDRSTest.RSTEST_DFP16, "-INF", "-Infinity");} - public void Var079 () { dfpTest(JDRSTest.RSTEST_DFP16, "Infinity", "Infinity");} - public void Var080 () { dfpTest(JDRSTest.RSTEST_DFP16, "+Infinity", "Infinity");} - public void Var081 () { dfpTest(JDRSTest.RSTEST_DFP16, "-Infinity", "-Infinity");} - public void Var082 () { dfpTest(JDRSTest.RSTEST_DFP16, "1234567890123456", "1234567890123456");} - public void Var083 () { dfpTest(JDRSTest.RSTEST_DFP16, "-1234567890123456", "-1234567890123456");} - public void Var084 () { dfpTest(JDRSTest.RSTEST_DFP16, "+1234567890123456","1234567890123456");} - public void Var085 () { dfpTest(JDRSTest.RSTEST_DFP16, "+1234567890123456E28","1.234567890123456E+43");} - public void Var086 () { dfpTest(JDRSTest.RSTEST_DFP16, "+1234567890123456E+28","1.234567890123456E+43");} - public void Var087 () { dfpTest(JDRSTest.RSTEST_DFP16, "+123456789012345.6E+29","1.234567890123456E+43");} - public void Var088 () { dfpTest(JDRSTest.RSTEST_DFP16, "+12345678901234.56E+30","1.234567890123456E+43");} - public void Var089 () { dfpTest(JDRSTest.RSTEST_DFP16, "+1234567890123.456E+31","1.234567890123456E+43");} - public void Var090 () { dfpTest(JDRSTest.RSTEST_DFP16, "+123456789012.3456E+32","1.234567890123456E+43");} - public void Var091 () { dfpTest(JDRSTest.RSTEST_DFP16, "+12345678901.23456E+33","1.234567890123456E+43");} - public void Var092 () { dfpTest(JDRSTest.RSTEST_DFP16, "+1234567890.123456E+34","1.234567890123456E+43");} - public void Var093 () { dfpTest(JDRSTest.RSTEST_DFP16, "+123456789.0123456E+35","1.234567890123456E+43");} - public void Var094 () { dfpTest(JDRSTest.RSTEST_DFP16, "+12345678.90123456E+36","1.234567890123456E+43");} - public void Var095 () { dfpTest(JDRSTest.RSTEST_DFP16, "+1234567.890123456E+37","1.234567890123456E+43");} - public void Var096 () { dfpTest(JDRSTest.RSTEST_DFP16, "+123456.7890123456E+38","1.234567890123456E+43");} - public void Var097 () { dfpTest(JDRSTest.RSTEST_DFP16, "+12345.67890123456E+39","1.234567890123456E+43");} - public void Var098 () { dfpTest(JDRSTest.RSTEST_DFP16, "+1234.567890123456E+40","1.234567890123456E+43");} - public void Var099 () { dfpTest(JDRSTest.RSTEST_DFP16, "+123.4567890123456E+41","1.234567890123456E+43");} - public void Var100 () { dfpTest(JDRSTest.RSTEST_DFP16, "+12.34567890123456E+42","1.234567890123456E+43");} - public void Var101 () { dfpTest(JDRSTest.RSTEST_DFP16, "+1.234567890123456E+43","1.234567890123456E+43");} - public void Var102 () { dfpTest(JDRSTest.RSTEST_DFP16, "+.1234567890123456E+44","1.234567890123456E+43");} - public void Var103 () { dfpTest(JDRSTest.RSTEST_DFP16, "+0.1234567890123456E+44","1.234567890123456E+43");} - public void Var104 () { dfpTest(JDRSTest.RSTEST_DFP16, "+0.01234567890123456E+45","1.234567890123456E+43");} - public void Var105 () { dfpTest(JDRSTest.RSTEST_DFP16, "-1234567890123456E28","-1.234567890123456E+43");} - public void Var106 () { dfpTest(JDRSTest.RSTEST_DFP16, "1E0", "1");} - public void Var107 () { dfpTest(JDRSTest.RSTEST_DFP16, "1.1", "1.1");} - public void Var108 () { dfpTest(JDRSTest.RSTEST_DFP16, "1.1E0", "1.1");} - public void Var109 () { dfpTest(JDRSTest.RSTEST_DFP16, null, null);} - - - /* - * updateString -- using different rounding modes - */ - String RHE="round half even"; - public void Var110 () { dfpRoundTest(RHE, JDRSTest.RSTEST_DFP16, "1.2345678901234545", "1.234567890123454"); } - public void Var111 () { dfpRoundTest(RHE, JDRSTest.RSTEST_DFP16, "1.2345678901234555", "1.234567890123456"); } - public void Var112 () { dfpRoundTest(RHE, JDRSTest.RSTEST_DFP16, "-1.2345678901234545", "-1.234567890123454"); } - public void Var113 () { dfpRoundTest(RHE, JDRSTest.RSTEST_DFP16, "-1.2345678901234555", "-1.234567890123456"); } - - /** - * updateFloat -- set a DFP16 with rounding mode "round half up" - */ - String RHU = "round half up"; - public void Var114 () { dfpRoundTest(RHU, JDRSTest.RSTEST_DFP16, "1.2345678901234555", "1.234567890123456"); } - public void Var115 () { dfpRoundTest(RHU, JDRSTest.RSTEST_DFP16, "1.2345678901234545", "1.234567890123455"); } - public void Var116 () { dfpRoundTest(RHU, JDRSTest.RSTEST_DFP16, "1.2345678901234565", "1.234567890123457"); } - public void Var117 () { dfpRoundTest(RHU, JDRSTest.RSTEST_DFP16, "-1.2345678901234555", "-1.234567890123455"); } - public void Var118 () { dfpRoundTest(RHU, JDRSTest.RSTEST_DFP16, "-1.2345678901234545", "-1.234567890123454"); } - public void Var119 () { dfpRoundTest(RHU, JDRSTest.RSTEST_DFP16, "-1.2345678901234565", "-1.234567890123456"); } - - /** - * updateFloat -- set a DFP16 with rounding mode "round down" - */ - String RD = "round down"; - public void Var120 () { dfpRoundTest(RD, JDRSTest.RSTEST_DFP16, "1.2345678901234555", "1.234567890123455"); } - public void Var121 () { dfpRoundTest(RD, JDRSTest.RSTEST_DFP16, "1.2345678901234559999999", "1.234567890123455"); } - public void Var122 () { dfpRoundTest(RD, JDRSTest.RSTEST_DFP16, "=1.2345678901234555", "-1.234567890123456"); } - public void Var123 () { dfpRoundTest(RD, JDRSTest.RSTEST_DFP16, "-1.2345678901234559999999", "-1.234567890123456"); } + public void Var196() { + dfpRoundTest(RHU, JDRSTest.RSTEST_UPDDFP34, "-1.1818181818181818182345678901234565", + "-1.181818181818181818234567890123456"); + } + /** + * updateFloat -- set a DFP34 with rounding mode "round down" + */ + public void Var197() { + dfpRoundTest(RD, JDRSTest.RSTEST_UPDDFP34, "1.1818181818181818182345678901234555", + "1.181818181818181818234567890123455"); + } - - /** - * updateFloat -- set a DFP16 with rounding mode "round ceiling" - */ - String RC = "round ceiling"; - public void Var124 () { dfpRoundTest(RC, JDRSTest.RSTEST_DFP16, "1.2345678901234555", "1.234567890123456"); } - public void Var125 () { dfpRoundTest(RC, JDRSTest.RSTEST_DFP16, "1.2345678901234559999999", "1.234567890123456"); } - public void Var126 () { dfpRoundTest(RC, JDRSTest.RSTEST_DFP16, "=1.2345678901234555", "-1.234567890123456"); } - public void Var127 () { dfpRoundTest(RC, JDRSTest.RSTEST_DFP16, "-1.2345678901234559999999", "-1.234567890123456"); } + public void Var198() { + dfpRoundTest(RD, JDRSTest.RSTEST_UPDDFP34, "1.1818181818181818182345678901234559999999", + "1.181818181818181818234567890123455"); + } + public void Var199() { + dfpRoundTest(RD, JDRSTest.RSTEST_UPDDFP34, "=1.1818181818181818182345678901234555", + "-1.181818181818181818234567890123456"); + } - /** - * updateFloat -- set a DFP16 with rounding mode "round floor" - */ - String RF = "round floor"; - public void Var128 () { dfpRoundTest(RF, JDRSTest.RSTEST_DFP16, "1.2345678901234555", "1.234567890123455"); } - public void Var129 () { dfpRoundTest(RF, JDRSTest.RSTEST_DFP16, "1.2345678901234559999999", "1.234567890123455"); } - public void Var130 () { dfpRoundTest(RF, JDRSTest.RSTEST_DFP16, "=1.2345678901234555", "-1.234567890123455"); } - public void Var131 () { dfpRoundTest(RF, JDRSTest.RSTEST_DFP16, "-1.2345678901234559999999", "-1.234567890123455"); } + public void Var200() { + dfpRoundTest(RD, JDRSTest.RSTEST_UPDDFP34, "-1.1818181818181818182345678901234559999999", + "-1.181818181818181818234567890123456"); + } + /** + * updateFloat -- set a DFP34 with rounding mode "round ceiling" + */ + public void Var201() { + dfpRoundTest(RC, JDRSTest.RSTEST_UPDDFP34, "1.1818181818181818182345678901234555", + "1.181818181818181818234567890123456"); + } - /** - * updateFloat -- set a DFP16 with rounding mode "round half down" - */ - String RHD = "round half down"; - public void Var132 () { dfpRoundTest(RHD, JDRSTest.RSTEST_DFP16, "1.2345678901234555", "1.234567890123455"); } - public void Var133 () { dfpRoundTest(RHD, JDRSTest.RSTEST_DFP16, "1.2345678901234545", "1.234567890123454"); } - public void Var134 () { dfpRoundTest(RHD, JDRSTest.RSTEST_DFP16, "1.2345678901234565", "1.234567890123456"); } - public void Var135 () { dfpRoundTest(RHD, JDRSTest.RSTEST_DFP16, "-1.2345678901234555", "-1.234567890123456"); } - public void Var136 () { dfpRoundTest(RHD, JDRSTest.RSTEST_DFP16, "-1.2345678901234545", "-1.234567890123455"); } - public void Var137 () { dfpRoundTest(RHD, JDRSTest.RSTEST_DFP16, "-1.2345678901234565", "-1.234567890123457"); } - - - - /** - * updateFloat -- set a DFP16 with rounding mode "round down" - */ - String RU = "round up"; - public void Var138 () { dfpRoundTest(RU, JDRSTest.RSTEST_DFP16, "1.2345678901234555", "1.234567890123456"); } - public void Var139 () { dfpRoundTest(RU, JDRSTest.RSTEST_DFP16, "1.2345678901234559999999", "1.234567890123456"); } - public void Var140 () { dfpRoundTest(RU, JDRSTest.RSTEST_DFP16, "=1.2345678901234555", "-1.234567890123455"); } - public void Var141 () { dfpRoundTest(RU, JDRSTest.RSTEST_DFP16, "-1.2345678901234559999999", "-1.234567890123455"); } + public void Var202() { + dfpRoundTest(RC, JDRSTest.RSTEST_UPDDFP34, "1.1818181818181818182345678901234559999999", + "1.181818181818181818234567890123456"); + } + public void Var203() { + dfpRoundTest(RC, JDRSTest.RSTEST_UPDDFP34, "=1.1818181818181818182345678901234555", + "-1.181818181818181818234567890123456"); + } + public void Var204() { + dfpRoundTest(RC, JDRSTest.RSTEST_UPDDFP34, "-1.1818181818181818182345678901234559999999", + "-1.181818181818181818234567890123456"); + } - /** - * updateString -- set DFP34 to different values and retrieve - */ - public void Var142 () { dfpTest(JDRSTest.RSTEST_DFP34, "4533.43", "4533.43"); } - public void Var143 () { dfpTest(JDRSTest.RSTEST_DFP34, "NaN", "NaN");} - public void Var144 () { dfpTest(JDRSTest.RSTEST_DFP34, "NAN", "NaN");} - public void Var145 () { dfpTest(JDRSTest.RSTEST_DFP34, "+NaN", "NaN");} - public void Var146 () { dfpTest(JDRSTest.RSTEST_DFP34, "-NaN", "-NaN");} - public void Var147 () { dfpTest(JDRSTest.RSTEST_DFP34, "QNaN", "NaN");} - public void Var148 () { dfpTest(JDRSTest.RSTEST_DFP34, "+QNaN", "NaN");} - public void Var149 () { dfpTest(JDRSTest.RSTEST_DFP34, "-QNaN", "-NaN");} - public void Var150 () { dfpTest(JDRSTest.RSTEST_DFP34, "SNaN", "SNaN");} - public void Var151 () { dfpTest(JDRSTest.RSTEST_DFP34, "+SNaN", "SNaN");} - public void Var152 () { dfpTest(JDRSTest.RSTEST_DFP34, "-SNaN", "-SNaN");} - public void Var153 () { dfpTest(JDRSTest.RSTEST_DFP34, "INF", "Infinity");} - public void Var154 () { dfpTest(JDRSTest.RSTEST_DFP34, "+INF", "Infinity");} - public void Var155 () { dfpTest(JDRSTest.RSTEST_DFP34, "-INF", "-Infinity");} - public void Var156 () { dfpTest(JDRSTest.RSTEST_DFP34, "Infinity", "Infinity");} - public void Var157 () { dfpTest(JDRSTest.RSTEST_DFP34, "+Infinity", "Infinity");} - public void Var158 () { dfpTest(JDRSTest.RSTEST_DFP34, "-Infinity", "-Infinity");} - public void Var159 () { dfpTest(JDRSTest.RSTEST_DFP34, "1234567890123456", "1234567890123456");} - public void Var160 () { dfpTest(JDRSTest.RSTEST_DFP34, "-1234567890123456", "-1234567890123456");} - public void Var161 () { dfpTest(JDRSTest.RSTEST_DFP34, "+1234567890123456","1234567890123456");} - public void Var162 () { dfpTest(JDRSTest.RSTEST_DFP34, "+1234567890123456E28","1.234567890123456E+43");} - public void Var163 () { dfpTest(JDRSTest.RSTEST_DFP34, "+1234567890123456E+28","1.234567890123456E+43");} - public void Var164 () { dfpTest(JDRSTest.RSTEST_DFP34, "+123456789012345.6E+29","1.234567890123456E+43");} - public void Var165 () { dfpTest(JDRSTest.RSTEST_DFP34, "+12345678901234.56E+30","1.234567890123456E+43");} - public void Var166 () { dfpTest(JDRSTest.RSTEST_DFP34, "+1234567890123.456E+31","1.234567890123456E+43");} - public void Var167 () { dfpTest(JDRSTest.RSTEST_DFP34, "+123456789012.3456E+32","1.234567890123456E+43");} - public void Var168 () { dfpTest(JDRSTest.RSTEST_DFP34, "+12345678901.23456E+33","1.234567890123456E+43");} - public void Var169 () { dfpTest(JDRSTest.RSTEST_DFP34, "+1234567890.123456E+34","1.234567890123456E+43");} - public void Var170 () { dfpTest(JDRSTest.RSTEST_DFP34, "+123456789.0123456E+35","1.234567890123456E+43");} - public void Var171 () { dfpTest(JDRSTest.RSTEST_DFP34, "+12345678.90123456E+36","1.234567890123456E+43");} - public void Var172 () { dfpTest(JDRSTest.RSTEST_DFP34, "+1234567.890123456E+37","1.234567890123456E+43");} - public void Var173 () { dfpTest(JDRSTest.RSTEST_DFP34, "+123456.7890123456E+38","1.234567890123456E+43");} - public void Var174 () { dfpTest(JDRSTest.RSTEST_DFP34, "+12345.67890123456E+39","1.234567890123456E+43");} - public void Var175 () { dfpTest(JDRSTest.RSTEST_DFP34, "+1234.567890123456E+40","1.234567890123456E+43");} - public void Var176 () { dfpTest(JDRSTest.RSTEST_DFP34, "+123.4567890123456E+41","1.234567890123456E+43");} - public void Var177 () { dfpTest(JDRSTest.RSTEST_DFP34, "+12.34567890123456E+42","1.234567890123456E+43");} - public void Var178 () { dfpTest(JDRSTest.RSTEST_DFP34, "+1.234567890123456E+43","1.234567890123456E+43");} - public void Var179 () { dfpTest(JDRSTest.RSTEST_DFP34, "+.1234567890123456E+44","1.234567890123456E+43");} - public void Var180 () { dfpTest(JDRSTest.RSTEST_DFP34, "+0.1234567890123456E+44","1.234567890123456E+43");} - public void Var181 () { dfpTest(JDRSTest.RSTEST_DFP34, "+0.01234567890123456E+45","1.234567890123456E+43");} - public void Var182 () { dfpTest(JDRSTest.RSTEST_DFP34, "-1234567890123456E28","-1.234567890123456E+43");} - public void Var183 () { dfpTest(JDRSTest.RSTEST_DFP34, "1E0", "1");} - public void Var184 () { dfpTest(JDRSTest.RSTEST_DFP34, "1.1", "1.1");} - public void Var185 () { dfpTest(JDRSTest.RSTEST_DFP34, "1.1E0", "1.1");} - public void Var186 () { dfpTest(JDRSTest.RSTEST_DFP34, null, null);} + /** + * updateFloat -- set a DFP34 with rounding mode "round floor" + */ + public void Var205() { + dfpRoundTest(RF, JDRSTest.RSTEST_UPDDFP34, "1.1818181818181818182345678901234555", + "1.181818181818181818234567890123455"); + } + public void Var206() { + dfpRoundTest(RF, JDRSTest.RSTEST_UPDDFP34, "1.1818181818181818182345678901234559999999", + "1.181818181818181818234567890123455"); + } - /* - * updateString -- using different rounding modes - */ - public void Var187 () { dfpRoundTest(RHE, JDRSTest.RSTEST_DFP34, "1.1818181818181818182345678901234545", "1.181818181818181818234567890123454"); } - public void Var188 () { dfpRoundTest(RHE, JDRSTest.RSTEST_DFP34, "1.1818181818181818182345678901234555", "1.181818181818181818234567890123456"); } - public void Var189 () { dfpRoundTest(RHE, JDRSTest.RSTEST_DFP34, "-1.1818181818181818182345678901234545", "-1.181818181818181818234567890123454"); } - public void Var190 () { dfpRoundTest(RHE, JDRSTest.RSTEST_DFP34, "-1.1818181818181818182345678901234555", "-1.181818181818181818234567890123456"); } - - /** - * updateFloat -- set a DFP34 with rounding mode "round half up" - */ - public void Var191 () { dfpRoundTest(RHU, JDRSTest.RSTEST_DFP34, "1.1818181818181818182345678901234555", "1.181818181818181818234567890123456"); } - public void Var192 () { dfpRoundTest(RHU, JDRSTest.RSTEST_DFP34, "1.1818181818181818182345678901234545", "1.181818181818181818234567890123455"); } - public void Var193 () { dfpRoundTest(RHU, JDRSTest.RSTEST_DFP34, "1.1818181818181818182345678901234565", "1.181818181818181818234567890123457"); } - public void Var194 () { dfpRoundTest(RHU, JDRSTest.RSTEST_DFP34, "-1.1818181818181818182345678901234555", "-1.181818181818181818234567890123455"); } - public void Var195 () { dfpRoundTest(RHU, JDRSTest.RSTEST_DFP34, "-1.1818181818181818182345678901234545", "-1.181818181818181818234567890123454"); } - public void Var196 () { dfpRoundTest(RHU, JDRSTest.RSTEST_DFP34, "-1.1818181818181818182345678901234565", "-1.181818181818181818234567890123456"); } - - /** - * updateFloat -- set a DFP34 with rounding mode "round down" - */ - public void Var197 () { dfpRoundTest(RD, JDRSTest.RSTEST_DFP34, "1.1818181818181818182345678901234555", "1.181818181818181818234567890123455"); } - public void Var198 () { dfpRoundTest(RD, JDRSTest.RSTEST_DFP34, "1.1818181818181818182345678901234559999999", "1.181818181818181818234567890123455"); } - public void Var199 () { dfpRoundTest(RD, JDRSTest.RSTEST_DFP34, "=1.1818181818181818182345678901234555", "-1.181818181818181818234567890123456"); } - public void Var200 () { dfpRoundTest(RD, JDRSTest.RSTEST_DFP34, "-1.1818181818181818182345678901234559999999", "-1.181818181818181818234567890123456"); } + public void Var207() { + dfpRoundTest(RF, JDRSTest.RSTEST_UPDDFP34, "=1.1818181818181818182345678901234555", + "-1.181818181818181818234567890123455"); + } + public void Var208() { + dfpRoundTest(RF, JDRSTest.RSTEST_UPDDFP34, "-1.1818181818181818182345678901234559999999", + "-1.181818181818181818234567890123455"); + } - - /** - * updateFloat -- set a DFP34 with rounding mode "round ceiling" - */ - public void Var201 () { dfpRoundTest(RC, JDRSTest.RSTEST_DFP34, "1.1818181818181818182345678901234555", "1.181818181818181818234567890123456"); } - public void Var202 () { dfpRoundTest(RC, JDRSTest.RSTEST_DFP34, "1.1818181818181818182345678901234559999999", "1.181818181818181818234567890123456"); } - public void Var203 () { dfpRoundTest(RC, JDRSTest.RSTEST_DFP34, "=1.1818181818181818182345678901234555", "-1.181818181818181818234567890123456"); } - public void Var204 () { dfpRoundTest(RC, JDRSTest.RSTEST_DFP34, "-1.1818181818181818182345678901234559999999", "-1.181818181818181818234567890123456"); } + /** + * updateFloat -- set a DFP34 with rounding mode "round half down" + */ + public void Var209() { + dfpRoundTest(RHD, JDRSTest.RSTEST_UPDDFP34, "1.1818181818181818182345678901234555", + "1.181818181818181818234567890123455"); + } + public void Var210() { + dfpRoundTest(RHD, JDRSTest.RSTEST_UPDDFP34, "1.1818181818181818182345678901234545", + "1.181818181818181818234567890123454"); + } - /** - * updateFloat -- set a DFP34 with rounding mode "round floor" - */ - public void Var205 () { dfpRoundTest(RF, JDRSTest.RSTEST_DFP34, "1.1818181818181818182345678901234555", "1.181818181818181818234567890123455"); } - public void Var206 () { dfpRoundTest(RF, JDRSTest.RSTEST_DFP34, "1.1818181818181818182345678901234559999999", "1.181818181818181818234567890123455"); } - public void Var207 () { dfpRoundTest(RF, JDRSTest.RSTEST_DFP34, "=1.1818181818181818182345678901234555", "-1.181818181818181818234567890123455"); } - public void Var208 () { dfpRoundTest(RF, JDRSTest.RSTEST_DFP34, "-1.1818181818181818182345678901234559999999", "-1.181818181818181818234567890123455"); } + public void Var211() { + dfpRoundTest(RHD, JDRSTest.RSTEST_UPDDFP34, "1.1818181818181818182345678901234565", + "1.181818181818181818234567890123456"); + } + public void Var212() { + dfpRoundTest(RHD, JDRSTest.RSTEST_UPDDFP34, "-1.1818181818181818182345678901234555", + "-1.181818181818181818234567890123456"); + } - /** - * updateFloat -- set a DFP34 with rounding mode "round half down" - */ - public void Var209 () { dfpRoundTest(RHD, JDRSTest.RSTEST_DFP34, "1.1818181818181818182345678901234555", "1.181818181818181818234567890123455"); } - public void Var210 () { dfpRoundTest(RHD, JDRSTest.RSTEST_DFP34, "1.1818181818181818182345678901234545", "1.181818181818181818234567890123454"); } - public void Var211 () { dfpRoundTest(RHD, JDRSTest.RSTEST_DFP34, "1.1818181818181818182345678901234565", "1.181818181818181818234567890123456"); } - public void Var212 () { dfpRoundTest(RHD, JDRSTest.RSTEST_DFP34, "-1.1818181818181818182345678901234555", "-1.181818181818181818234567890123456"); } - public void Var213 () { dfpRoundTest(RHD, JDRSTest.RSTEST_DFP34, "-1.1818181818181818182345678901234545", "-1.181818181818181818234567890123455"); } - public void Var214 () { dfpRoundTest(RHD, JDRSTest.RSTEST_DFP34, "-1.1818181818181818182345678901234565", "-1.181818181818181818234567890123457"); } + public void Var213() { + dfpRoundTest(RHD, JDRSTest.RSTEST_UPDDFP34, "-1.1818181818181818182345678901234545", + "-1.181818181818181818234567890123455"); + } + public void Var214() { + dfpRoundTest(RHD, JDRSTest.RSTEST_UPDDFP34, "-1.1818181818181818182345678901234565", + "-1.181818181818181818234567890123457"); + } + /** + * updateFloat -- set a DFP34 with rounding mode "round down" + */ + public void Var215() { + dfpRoundTest(RU, JDRSTest.RSTEST_UPDDFP34, "1.1818181818181818182345678901234555", + "1.181818181818181818234567890123456"); + } - /** - * updateFloat -- set a DFP34 with rounding mode "round down" - */ - public void Var215 () { dfpRoundTest(RU, JDRSTest.RSTEST_DFP34, "1.1818181818181818182345678901234555", "1.181818181818181818234567890123456"); } - public void Var216 () { dfpRoundTest(RU, JDRSTest.RSTEST_DFP34, "1.1818181818181818182345678901234559999999", "1.181818181818181818234567890123456"); } - public void Var217 () { dfpRoundTest(RU, JDRSTest.RSTEST_DFP34, "=1.1818181818181818182345678901234555", "-1.181818181818181818234567890123455"); } - public void Var218 () { dfpRoundTest(RU, JDRSTest.RSTEST_DFP34, "-1.1818181818181818182345678901234559999999", "-1.181818181818181818234567890123455"); } + public void Var216() { + dfpRoundTest(RU, JDRSTest.RSTEST_UPDDFP34, "1.1818181818181818182345678901234559999999", + "1.181818181818181818234567890123456"); + } + public void Var217() { + dfpRoundTest(RU, JDRSTest.RSTEST_UPDDFP34, "=1.1818181818181818182345678901234555", + "-1.181818181818181818234567890123455"); + } + public void Var218() { + dfpRoundTest(RU, JDRSTest.RSTEST_UPDDFP34, "-1.1818181818181818182345678901234559999999", + "-1.181818181818181818234567890123455"); + } public void testBoolean(String inString, String outString) { if (checkJdbc40()) { if (checkBooleanSupport()) { + try { + JDRSTest.position(rs_, key1_); JDRSTest.position(rs_, key_); - JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_BOOLEAN", - inString); - rs_.updateRow(); + JDReflectionUtil.callMethod_V(rs_, "updateNString", "C_BOOLEAN", inString); + rs_.updateRow(); /* serialized */ ResultSet rs2 = statement2_.executeQuery(select_); JDRSTest.position(rs2, key_); String v = rs2.getString("C_BOOLEAN"); @@ -2351,29 +2415,36 @@ public void testBoolean(String inString, String outString) { assertCondition(outString.equals(v), "Got " + v + " sb " + outString); } catch (Exception e) { failed(e, "Unexpected Exception"); - } + } } } } - - /** - updateNString() - Update a BOOLEAN. - **/ - public void Var219() { testBoolean("1","1"); } - public void Var220() { testBoolean("0","0"); } - public void Var221() { testBoolean("true","1"); } - public void Var222() { testBoolean("false","0"); } + /** + * updateNString() - Update a BOOLEAN. + **/ + public void Var219() { + testBoolean("1", "1"); + } - private String hexString(String s) { - String out=""; - for (int i = 0; i < s.length(); i++) { - out += " "+Integer.toHexString(s.charAt(i)); - } - return out; - } + public void Var220() { + testBoolean("0", "0"); + } -} + public void Var221() { + testBoolean("true", "1"); + } + public void Var222() { + testBoolean("false", "0"); + } + private String hexString(String s) { + String out = ""; + for (int i = 0; i < s.length(); i++) { + out += " " + Integer.toHexString(s.charAt(i)); + } + return out; + } +} diff --git a/src/test/JD/RS/JDRSUpdateNull.java b/src/test/JD/RS/JDRSUpdateNull.java index fb08716f..1113e144 100644 --- a/src/test/JD/RS/JDRSUpdateNull.java +++ b/src/test/JD/RS/JDRSUpdateNull.java @@ -7,6 +7,7 @@ import java.sql.Clob; import java.sql.Date; import java.sql.ResultSet; +import java.sql.SQLException; import java.sql.Statement; import java.sql.Time; import java.sql.Timestamp; @@ -18,6 +19,7 @@ import test.JDRSTest; import test.JDTestDriver; import test.JDTestcase; +import test.JD.JDSerializeFile; @@ -52,6 +54,7 @@ public static void main(String args[]) throws Exception { private Statement statement_; private Statement statement2_; private ResultSet rs_; + private JDSerializeFile serializeUpdateFile_; @@ -92,13 +95,15 @@ protected void setup () + ";data truncation=true"; connection_ = testDriver_.getConnection (url,systemObject_.getUserId(), encryptedPassword_); connection_.setAutoCommit(false); // @C1A - statement_ = connection_.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, + serializeUpdateFile_ = new JDSerializeFile(connection_, JDRSTest.RSTEST_UPDATE); + connection_.commit(); + statement_ = connection_.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); statement2_ = connection_.createStatement (ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); statement_.executeUpdate ("INSERT INTO " + JDRSTest.RSTEST_UPDATE - + " (C_KEY) VALUES ('DUMMY_ROW')"); + + " (C_KEY) VALUES ('DUMMY_UPDNULL')"); statement_.executeUpdate ("INSERT INTO " + JDRSTest.RSTEST_UPDATE + " (C_KEY) VALUES ('SECOND_ROW')"); statement_.executeUpdate ("INSERT INTO " + JDRSTest.RSTEST_UPDATE @@ -122,7 +127,9 @@ protected void cleanup () rs_.close (); statement_.close (); connection_.commit(); // @C1A - connection_.close (); + serializeUpdateFile_.close(); + connection_.commit(); + connection_.close (); } } @@ -143,6 +150,7 @@ public void Var001() rs.next (); rs.close (); rs.updateNull ("C_VARCHAR_50"); + s.close(); failed ("Didn't throw SQLException"); } catch (Exception e) { @@ -167,6 +175,8 @@ public void Var002() + JDRSTest.RSTEST_UPDATE); rs.next (); rs.updateNull ("C_VARCHAR_50"); + rs.close(); + s.close(); failed ("Didn't throw SQLException"); } catch (Exception e) { @@ -187,7 +197,7 @@ public void Var003() try { JDRSTest.position (rs_, null); rs_.updateNull ("C_VARCHAR_50"); - rs_.updateRow(); + rs_.updateRow(); /* exception */ failed ("Didn't throw SQLException"); } catch (Exception e) { @@ -498,7 +508,7 @@ public void Var017() { if (checkJdbc20 ()) { try { - JDRSTest.position (rs_, "DUMMY_ROW"); + JDRSTest.position (rs_, "DUMMY_UPDNULL"); rs_.deleteRow (); rs_.updateNull ("C_VARCHAR_50"); failed ("Didn't throw SQLException"); @@ -1028,19 +1038,22 @@ public void Var037() public void dfpTest(String table) { if (checkDecFloatSupport()) { + try { + Statement s = connection_.createStatement( ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); ResultSet rs = s .executeQuery("SELECT * FROM " + table + " FOR UPDATE "); rs.next(); rs.updateNull(1); - rs.updateRow(); + rs.updateRow(); /* serialized */ ResultSet rs2 = statement2_.executeQuery("SELECT * FROM " + table); rs2.next(); String v = rs2.getString(1); rs2.close(); + rs.close(); s.close(); try { connection_.commit(); @@ -1048,7 +1061,7 @@ public void dfpTest(String table) { assertCondition(v == null, "Got " + v + " sb null "); } catch (Exception e) { failed(e, "Unexpected Exception"); - } + } } } @@ -1056,12 +1069,12 @@ public void dfpTest(String table) { /** * updateInt -- set a DFP16 value */ - public void Var038 () { dfpTest(JDRSTest.RSTEST_DFP16); } + public void Var038 () { dfpTest(JDRSTest.RSTEST_UPDDFP16); } /** * updateInt -- set a DFP16 value */ - public void Var039 () { dfpTest(JDRSTest.RSTEST_DFP34); } + public void Var039 () { dfpTest(JDRSTest.RSTEST_UPDDFP34); } /** updateNull() - Update a BOOLEAN. diff --git a/src/test/JD/RS/JDRSUpdateObject.java b/src/test/JD/RS/JDRSUpdateObject.java index a43c5309..25f37b67 100644 --- a/src/test/JD/RS/JDRSUpdateObject.java +++ b/src/test/JD/RS/JDRSUpdateObject.java @@ -24,220 +24,184 @@ import test.JDLobTest; import test.JDRSTest; import test.JDTestcase; - - +import test.JD.JDSerializeFile; /** -Testcase JDRSUpdateObject. This tests the following method -of the JDBC ResultSet class: - -
    -
  • updateObject() -
-**/ -public class JDRSUpdateObject -extends JDTestcase { + * Testcase JDRSUpdateObject. This tests the following method of the JDBC + * ResultSet class: + * + *
    + *
  • updateObject() + *
+ **/ +public class JDRSUpdateObject extends JDTestcase { public static void main(String args[]) throws Exception { - String[] newArgs = new String[args.length+2]; - newArgs[0] = "-tc"; - newArgs[1] = "JDRSUpdateObject"; - for (int i = 0; i < args.length; i++) { - newArgs[2+i]=args[i]; - } - test.JDRSTest.main(newArgs); - } - - - - // Private data. - private static final String key_ = "JDRSUpdateObject"; - private static String select_ = "SELECT * FROM " - + JDRSTest.RSTEST_UPDATE; - - private Statement statement_; - private Statement statement2_; - private Statement statement2f_; - private ResultSet rs_ = null; - - - private Connection connectionCommaSeparator_; - private Statement statementCommaSeparator_; - private Statement statementCommaSeparator2_; - private Statement statementCommaSeparator2f_; - private ResultSet rsCommaSeparator_ = null ; - - private Connection connection3_; - private Statement statement3_; - private Statement statement4_; - private ResultSet rs3_; - - private boolean tableUpdated = false; - - -/** -Constructor. -**/ - public JDRSUpdateObject (AS400 systemObject, - Hashtable> namesAndVars, - int runMode, - FileOutputStream fileOutputStream, - - String password) - { - super (systemObject, "JDRSUpdateObject", - namesAndVars, runMode, fileOutputStream, - password); + String[] newArgs = new String[args.length + 2]; + newArgs[0] = "-tc"; + newArgs[1] = "JDRSUpdateObject"; + for (int i = 0; i < args.length; i++) { + newArgs[2 + i] = args[i]; } + test.JDRSTest.main(newArgs); + } + // Private data. + private static final String key_ = "JDRSUpdateObject"; + private static String select_ = "SELECT * FROM " + JDRSTest.RSTEST_UPDATE; + + private Statement statement_; + private Statement statement2_; + private Statement statement2f_; + private ResultSet rs_ = null; + + private Connection connectionCommaSeparator_; + private Statement statementCommaSeparator_; + private Statement statementCommaSeparator2_; + private Statement statementCommaSeparator2f_; + private ResultSet rsCommaSeparator_ = null; + + private Connection connection3_; + private Statement statement3_; + private Statement statement4_; + private ResultSet rs3_; + + private boolean tableUpdated = false; + private JDSerializeFile serializeUpdateFile_; + + /** + * Constructor. + **/ + public JDRSUpdateObject(AS400 systemObject, Hashtable> namesAndVars, int runMode, + FileOutputStream fileOutputStream, + + String password) { + super(systemObject, "JDRSUpdateObject", namesAndVars, runMode, fileOutputStream, password); + } + /** + * Performs setup needed before running variations. + * + * @exception Exception If an exception occurs. + **/ + protected void setup() throws Exception { + if (connection_ != null) + connection_.close(); -/** -Performs setup needed before running variations. - -@exception Exception If an exception occurs. -**/ - protected void setup () - throws Exception - { - if (connection_ != null) connection_.close(); - - select_ = "SELECT * FROM " + JDRSTest.RSTEST_UPDATE; - - if (isJdbc20 ()) { - String url = baseURL_ - // String url = "jdbc:as400://" + systemObject_.getSystemName() - - - + ";data truncation=true"; - connection_ = testDriver_.getConnection (url + ";lob threshold=30000",systemObject_.getUserId(), encryptedPassword_); - connection_.setAutoCommit(false); // @C1A - - - - // Force LOB locators. - connection3_ = testDriver_.getConnection (url + ";lob threshold=0",systemObject_.getUserId(), encryptedPassword_); - connection3_.setAutoCommit(false); // @C1A - statement3_ = connection_.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, - ResultSet.CONCUR_UPDATABLE); - statement4_ = connection_.createStatement (ResultSet.TYPE_SCROLL_INSENSITIVE, - ResultSet.CONCUR_READ_ONLY); - - rs3_ = statement3_.executeQuery (select_ + " FOR UPDATE"); + select_ = "SELECT * FROM " + JDRSTest.RSTEST_UPDATE; + if (isJdbc20()) { + String url = baseURL_ + // String url = "jdbc:as400://" + systemObject_.getSystemName() + + ";data truncation=true"; + connection_ = testDriver_.getConnection(url + ";lob threshold=30000", systemObject_.getUserId(), + encryptedPassword_); + connection_.setAutoCommit(false); // @C1A + serializeUpdateFile_ = new JDSerializeFile(connection_, JDRSTest.RSTEST_UPDATE); + connection_.commit(); + // Force LOB locators. + connection3_ = testDriver_.getConnection(url + ";lob threshold=0", systemObject_.getUserId(), encryptedPassword_); + connection3_.setAutoCommit(false); // @C1A + statement3_ = connection_.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); + statement4_ = connection_.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); - connectionCommaSeparator_ = testDriver_.getConnection (url + ";lob threshold=30000;decimal separator=,"); - connectionCommaSeparator_.setAutoCommit(false); // @C1A + rs3_ = statement3_.executeQuery(select_ + " FOR UPDATE"); + connectionCommaSeparator_ = testDriver_.getConnection(url + ";lob threshold=30000;decimal separator=,"); + connectionCommaSeparator_.setAutoCommit(false); // @C1A - } } + } + protected void setupRs() { + if (rsCommaSeparator_ != null) { + try { + rsCommaSeparator_.close(); + statementCommaSeparator_.close(); + statementCommaSeparator2_.close(); + statementCommaSeparator2f_.close(); + connectionCommaSeparator_.commit(); + rsCommaSeparator_ = null; + statementCommaSeparator_ = null; + statementCommaSeparator2_ = null; + statementCommaSeparator2f_ = null; + } catch (SQLException e) { + e.printStackTrace(); + } + } + if (rs_ == null) { + try { + statement_ = connection_.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); + statement2_ = connection_.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); + statement2f_ = connection_.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY); + if (!tableUpdated) { - protected void setupRs() { - if (rsCommaSeparator_ != null) { - try { - rsCommaSeparator_.close (); - statementCommaSeparator_.close (); - statementCommaSeparator2_.close (); - statementCommaSeparator2f_.close (); - connectionCommaSeparator_.commit(); - rsCommaSeparator_ = null; - statementCommaSeparator_= null; - statementCommaSeparator2_= null; - statementCommaSeparator2f_= null; - } catch (SQLException e) { - e.printStackTrace(); - } - } - if (rs_ == null) { - try { - - - - statement_ = connection_.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, - ResultSet.CONCUR_UPDATABLE); - statement2_ = connection_.createStatement (ResultSet.TYPE_SCROLL_INSENSITIVE, - ResultSet.CONCUR_READ_ONLY); - statement2f_ = connection_.createStatement (ResultSet.TYPE_FORWARD_ONLY, - ResultSet.CONCUR_READ_ONLY); - - if (!tableUpdated) { - - statement_.executeUpdate ("INSERT INTO " + JDRSTest.RSTEST_UPDATE - + " (C_KEY) VALUES ('DUMMY_ROW')"); - statement_.executeUpdate ("INSERT INTO " + JDRSTest.RSTEST_UPDATE - + " (C_KEY) VALUES ('DUMMY_ROW2')"); - statement_.executeUpdate ("INSERT INTO " + JDRSTest.RSTEST_UPDATE - + " (C_KEY) VALUES ('" + key_ + "')"); - tableUpdated=true; - } - rs_ = statement_.executeQuery (select_ + " FOR UPDATE"); - - - - } catch (SQLException e) { - e.printStackTrace(); - } + statement_.executeUpdate("INSERT INTO " + JDRSTest.RSTEST_UPDATE + " (C_KEY) VALUES ('DUMMY_UPDOBJ')"); + statement_.executeUpdate("INSERT INTO " + JDRSTest.RSTEST_UPDATE + " (C_KEY) VALUES ('DUMMY_UPDOBJ2')"); + statement_.executeUpdate("INSERT INTO " + JDRSTest.RSTEST_UPDATE + " (C_KEY) VALUES ('" + key_ + "')"); + tableUpdated = true; + } + rs_ = statement_.executeQuery(select_ + " FOR UPDATE"); - } - } - - - protected void setupRsCommaSeparator() { - if (rs_ != null) { - try { - rs_.close (); - statement_.close (); - statement2_.close (); - statement2f_.close (); - connection_.commit(); - rs_ = null; - statement_= null; - statement2_= null; - statement2f_= null; - } catch (SQLException e) { - e.printStackTrace(); - } - - } - if (rsCommaSeparator_ == null) { - try { - statementCommaSeparator_ = connectionCommaSeparator_.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, - ResultSet.CONCUR_UPDATABLE); - statementCommaSeparator2_ = connectionCommaSeparator_.createStatement (ResultSet.TYPE_SCROLL_INSENSITIVE, - ResultSet.CONCUR_READ_ONLY); - statementCommaSeparator2f_ = connectionCommaSeparator_.createStatement (ResultSet.TYPE_FORWARD_ONLY, - ResultSet.CONCUR_READ_ONLY); - - if (!tableUpdated) { - tableUpdated = true; - statementCommaSeparator_.executeUpdate ("INSERT INTO " + JDRSTest.RSTEST_UPDATE - + " (C_KEY) VALUES ('DUMMY_ROW')"); - statementCommaSeparator_.executeUpdate ("INSERT INTO " + JDRSTest.RSTEST_UPDATE - + " (C_KEY) VALUES ('DUMMY_ROW1')"); - statementCommaSeparator_.executeUpdate ("INSERT INTO " + JDRSTest.RSTEST_UPDATE - + " (C_KEY) VALUES ('" + key_ + "')"); - } - rsCommaSeparator_ = statementCommaSeparator_.executeQuery (select_ + " FOR UPDATE"); - } catch (SQLException e) { - e.printStackTrace(); - } + } catch (SQLException e) { + e.printStackTrace(); + } - } - } + } + } + protected void setupRsCommaSeparator() { + if (rs_ != null) { + try { + rs_.close(); + statement_.close(); + statement2_.close(); + statement2f_.close(); + connection_.commit(); + rs_ = null; + statement_ = null; + statement2_ = null; + statement2f_ = null; + } catch (SQLException e) { + e.printStackTrace(); + } + } + if (rsCommaSeparator_ == null) { + try { + statementCommaSeparator_ = connectionCommaSeparator_.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, + ResultSet.CONCUR_UPDATABLE); + statementCommaSeparator2_ = connectionCommaSeparator_.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, + ResultSet.CONCUR_READ_ONLY); + statementCommaSeparator2f_ = connectionCommaSeparator_.createStatement(ResultSet.TYPE_FORWARD_ONLY, + ResultSet.CONCUR_READ_ONLY); + + if (!tableUpdated) { + tableUpdated = true; + statementCommaSeparator_ + .executeUpdate("INSERT INTO " + JDRSTest.RSTEST_UPDATE + " (C_KEY) VALUES ('DUMMY_UPDOBJ')"); + statementCommaSeparator_ + .executeUpdate("INSERT INTO " + JDRSTest.RSTEST_UPDATE + " (C_KEY) VALUES ('DUMMY_UPDOBJ1')"); + statementCommaSeparator_ + .executeUpdate("INSERT INTO " + JDRSTest.RSTEST_UPDATE + " (C_KEY) VALUES ('" + key_ + "')"); + } + rsCommaSeparator_ = statementCommaSeparator_.executeQuery(select_ + " FOR UPDATE"); + } catch (SQLException e) { + e.printStackTrace(); + } -/** -Performs cleanup needed after running variations. + } + } -@exception Exception If an exception occurs. -**/ - protected void cleanup() throws Exception { + /** + * Performs cleanup needed after running variations. + * + * @exception Exception If an exception occurs. + **/ + protected void cleanup() throws Exception { if (isJdbc20()) { rs3_.close(); statement4_.close(); @@ -252,6 +216,8 @@ protected void cleanup() throws Exception { statement_.close(); } connection_.commit(); // @C1A + serializeUpdateFile_.close(); + connection_.commit(); connection_.close(); if (rsCommaSeparator_ != null) { rsCommaSeparator_.close(); @@ -264,7 +230,7 @@ protected void cleanup() throws Exception { } } - protected void cleanupConnections() throws Exception { + protected void cleanupConnections() throws Exception { if (isJdbc20()) { connection3_.commit(); // @C1A connection3_.close(); @@ -277,2599 +243,2608 @@ protected void cleanupConnections() throws Exception { } } - - -/** -updateObject() - Should throw exception when the result set is -closed. -**/ - public void Var001() - { - setupRs(); - if (checkJdbc20 ()) { - try { - Statement s = connection_.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, - ResultSet.CONCUR_UPDATABLE); - ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_UPDATE + " FOR UPDATE"); - rs.next (); - rs.close (); - rs.updateObject ("C_VARCHAR_50", "Maine"); - failed ("Didn't throw SQLException"); - } - catch (Exception e) { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + /** + * updateObject() - Should throw exception when the result set is closed. + **/ + public void Var001() { + setupRs(); + if (checkJdbc20()) { + + try { + + Statement s = connection_.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); + ResultSet rs = s.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_UPDATE + " FOR UPDATE"); + rs.next(); + rs.close(); + rs.updateObject("C_VARCHAR_50", "Maine"); + s.close(); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } + } - - -/** -updateObject() - Should throw exception when the result set is -not updatable. -**/ - public void Var002() - { - setupRs(); - if (checkJdbc20 ()) { - try { - Statement s = connection_.createStatement (ResultSet.TYPE_SCROLL_INSENSITIVE, - ResultSet.CONCUR_READ_ONLY); - ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_UPDATE); - rs.next (); - rs.updateObject ("C_VARCHAR_50", "New Hampshire"); - failed ("Didn't throw SQLException"); - } - catch (Exception e) { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + /** + * updateObject() - Should throw exception when the result set is not updatable. + **/ + public void Var002() { + setupRs(); + if (checkJdbc20()) { + + try { + + Statement s = connection_.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); + ResultSet rs = s.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_UPDATE); + rs.next(); + rs.updateObject("C_VARCHAR_50", "New Hampshire"); + rs.close(); + s.close(); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } + } - - -/** -updateObject() - Should throw exception when cursor is not pointing -to a row. -**/ - public void Var003() - { - setupRs(); - if (checkJdbc20 ()) { - try { - JDRSTest.position (rs_, null); - rs_.updateObject ("C_VARCHAR_50", "Vermont"); - failed ("Didn't throw SQLException"); - } - catch (Exception e) { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + /** + * updateObject() - Should throw exception when cursor is not pointing to a row. + **/ + public void Var003() { + setupRs(); + if (checkJdbc20()) { + + try { + + JDRSTest.position(rs_, null); + rs_.updateObject("C_VARCHAR_50", "Vermont"); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } + } - - -/** -updateObject() - Should throw an exception when the column -is an invalid index. -**/ - public void Var004() - { - setupRs(); - if (checkJdbc20 ()) { - try { - JDRSTest.position (rs_, key_); - rs_.updateObject (100, "New York"); - failed ("Didn't throw SQLException"); - } - catch (Exception e) { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + /** + * updateObject() - Should throw an exception when the column is an invalid + * index. + **/ + public void Var004() { + setupRs(); + if (checkJdbc20()) { + + try { + + JDRSTest.position(rs_, key_); + rs_.updateObject(100, "New York"); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } + } - - -/** -updateObject() - Should throw an exception when the column -is 0. -**/ - public void Var005() - { - setupRs(); - if (checkJdbc20 ()) { - try { - JDRSTest.position (rs_, key_); - rs_.updateObject (0, "Connecticut"); - failed ("Didn't throw SQLException"); - } - catch (Exception e) { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + /** + * updateObject() - Should throw an exception when the column is 0. + **/ + public void Var005() { + setupRs(); + if (checkJdbc20()) { + + try { + + JDRSTest.position(rs_, key_); + rs_.updateObject(0, "Connecticut"); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } + } - - -/** -updateObject() - Should throw an exception when the column -is -1. -**/ - public void Var006() - { - setupRs(); - if (checkJdbc20 ()) { - try { - JDRSTest.position (rs_, key_); - rs_.updateObject (-1, "Massachusetts"); - failed ("Didn't throw SQLException"); - } - catch (Exception e) { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + /** + * updateObject() - Should throw an exception when the column is -1. + **/ + public void Var006() { + setupRs(); + if (checkJdbc20()) { + + try { + + JDRSTest.position(rs_, key_); + rs_.updateObject(-1, "Massachusetts"); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } + } - - -/** -updateObject() - Should work when the column index is valid. -**/ - public void Var007() - { - setupRs(); - if (checkJdbc20 ()) { - try { - JDRSTest.position (rs_, key_); - rs_.updateObject (14, "Rhode Island"); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - String v = rs2.getString ("C_VARCHAR_50"); - rs2.close (); - assertCondition (v.equals ("Rhode Island")); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } + /** + * updateObject() - Should work when the column index is valid. + **/ + public void Var007() { + setupRs(); + if (checkJdbc20()) { + + try { + + JDRSTest.position(rs_, key_); + rs_.updateObject(14, "Rhode Island"); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + String v = rs2.getString("C_VARCHAR_50"); + rs2.close(); + assertCondition(v.equals("Rhode Island")); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } } + } - - -/** -updateObject() - Should throw an exception when the column -name is null. -**/ - public void Var008() - { - setupRs(); - if (checkJdbc20 ()) { - try { - JDRSTest.position (rs_, key_); - rs_.updateObject (null, "Pennsylvania"); - failed ("Didn't throw SQLException"); - } - catch (Exception e) { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + /** + * updateObject() - Should throw an exception when the column name is null. + **/ + public void Var008() { + setupRs(); + if (checkJdbc20()) { + + try { + + JDRSTest.position(rs_, key_); + rs_.updateObject(null, "Pennsylvania"); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } + } - - -/** -updateObject() - Should throw an exception when the column -name is an empty string. -**/ - public void Var009() - { - setupRs(); - if (checkJdbc20 ()) { - try { - JDRSTest.position (rs_, key_); - rs_.updateObject ("", "Maryland"); - failed ("Didn't throw SQLException"); - } - catch (Exception e) { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + /** + * updateObject() - Should throw an exception when the column name is an empty + * string. + **/ + public void Var009() { + setupRs(); + if (checkJdbc20()) { + + try { + + JDRSTest.position(rs_, key_); + rs_.updateObject("", "Maryland"); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } + } - - -/** -updateObject() - Should throw an exception when the column -name is invalid. -**/ - public void Var010() - { - setupRs(); - if (checkJdbc20 ()) { - try { - JDRSTest.position (rs_, key_); - rs_.updateObject ("INVALID", "Delaware"); - failed ("Didn't throw SQLException"); - } - catch (Exception e) { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + /** + * updateObject() - Should throw an exception when the column name is invalid. + **/ + public void Var010() { + setupRs(); + if (checkJdbc20()) { + + try { + + JDRSTest.position(rs_, key_); + rs_.updateObject("INVALID", "Delaware"); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } + } - - -/** -updateObject() - Should work when the column name is valid. -**/ - public void Var011() - { - setupRs(); - if (checkJdbc20 ()) { - try { - JDRSTest.position (rs_, key_); - rs_.updateObject ("C_VARCHAR_50", "District of Columbia"); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - String v = rs2.getString ("C_VARCHAR_50"); - rs2.close (); - assertCondition (v.equals ("District of Columbia")); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } + /** + * updateObject() - Should work when the column name is valid. + **/ + public void Var011() { + setupRs(); + if (checkJdbc20()) { + + try { + + JDRSTest.position(rs_, key_); + rs_.updateObject("C_VARCHAR_50", "District of Columbia"); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + String v = rs2.getString("C_VARCHAR_50"); + rs2.close(); + assertCondition(v.equals("District of Columbia")); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } } + } - - -/** -updateObject() - Should update to SQL NULL when the column -value is null. -**/ - public void Var012() - { - setupRs(); - if (checkJdbc20 ()) { - try { - JDRSTest.position (rs_, key_); - rs_.updateObject ("C_VARCHAR_50", null); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - String v = rs2.getString ("C_VARCHAR_50"); - boolean wn = rs2.wasNull (); - rs2.close (); - assertCondition ((v == null) && (wn == true)); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } + /** + * updateObject() - Should update to SQL NULL when the column value is null. + **/ + public void Var012() { + setupRs(); + if (checkJdbc20()) { + + try { + + JDRSTest.position(rs_, key_); + rs_.updateObject("C_VARCHAR_50", null); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + String v = rs2.getString("C_VARCHAR_50"); + boolean wn = rs2.wasNull(); + rs2.close(); + assertCondition((v == null) && (wn == true)); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } } + } - - -/** -updateObject() - Should throw an exception when the scale is invalid. -**/ - public void Var013() - { - setupRs(); - if (checkJdbc20 ()) { - try { - JDRSTest.position (rs_, key_); - rs_.updateObject ("C_VARCHAR_50", "Virginia", -1); - failed ("Didn't throw SQLException"); - } - catch (Exception e) { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + /** + * updateObject() - Should throw an exception when the scale is invalid. + **/ + public void Var013() { + setupRs(); + if (checkJdbc20()) { + + try { + + JDRSTest.position(rs_, key_); + rs_.updateObject("C_VARCHAR_50", "Virginia", -1); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } + } - - -/** -updateObject() - Should be reflected by get, even if update has -not yet been issued (i.e. update is still pending). -**/ - public void Var014() - { - setupRs(); - if (checkJdbc20 ()) { - try { - JDRSTest.position (rs_, key_); - rs_.updateObject ("C_VARCHAR_50", "North Carolina"); - assertCondition (rs_.getString ("C_VARCHAR_50").equals ("North Carolina")); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } + /** + * updateObject() - Should be reflected by get, even if update has not yet been + * issued (i.e. update is still pending). + **/ + public void Var014() { + setupRs(); + if (checkJdbc20()) { + + try { + + JDRSTest.position(rs_, key_); + rs_.updateObject("C_VARCHAR_50", "North Carolina"); + assertCondition(rs_.getString("C_VARCHAR_50").equals("North Carolina")); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } } + } - - - -/** -updateObject() - Should be reflected by get, after update has -been issued, but cursor has not been repositioned. -**/ - public void Var015() - { - setupRs(); - if (checkJdbc20 ()) { - try { - JDRSTest.position (rs_, key_); - rs_.updateObject ("C_VARCHAR_50", "South Carolina"); - rs_.updateRow (); - assertCondition (rs_.getString ("C_VARCHAR_50").equals ("South Carolina")); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } + /** + * updateObject() - Should be reflected by get, after update has been issued, + * but cursor has not been repositioned. + **/ + public void Var015() { + setupRs(); + if (checkJdbc20()) { + + try { + + JDRSTest.position(rs_, key_); + rs_.updateObject("C_VARCHAR_50", "South Carolina"); + rs_.updateRow(); + assertCondition(rs_.getString("C_VARCHAR_50").equals("South Carolina")); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } } + } + /** + * updateObject() - Should be reflected by get, after update has been issued and + * cursor has been repositioned. + **/ + public void Var016() { + setupRs(); + if (checkJdbc20()) { + + try { + + JDRSTest.position(rs_, key_); + rs_.updateObject("C_VARCHAR_50", "Georgia"); + rs_.updateRow(); + rs_.beforeFirst(); + JDRSTest.position(rs_, key_); + String v = rs_.getString("C_VARCHAR_50"); + assertCondition(v.equals("Georgia")); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + /** + * updateObject() - Should work when the current row is the insert row. + **/ + public void Var017() { + setupRs(); + if (checkJdbc20()) { + + try { + + rs_.moveToInsertRow(); + rs_.updateString("C_KEY", "JDRSUpdateObject 1"); + rs_.updateObject("C_VARCHAR_50", "Florida"); + rs_.insertRow(); + JDRSTest.position(rs_, "JDRSUpdateObject 1"); + assertCondition(rs_.getString("C_VARCHAR_50").equals("Florida")); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + /** + * updateObject() - Should be reflected by get on insert row, even if insert has + * not yet been issued (i.e. insert is still pending). + **/ + public void Var018() { + setupRs(); + if (checkJdbc20()) { + + try { + + rs_.moveToInsertRow(); + rs_.updateObject("C_VARCHAR_50", "Ohio"); + assertCondition(rs_.getString("C_VARCHAR_50").equals("Ohio")); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } -/** -updateObject() - Should be reflected by get, after update has -been issued and cursor has been repositioned. -**/ - public void Var016() - { - setupRs(); - if (checkJdbc20 ()) { - try { - JDRSTest.position (rs_, key_); - rs_.updateObject ("C_VARCHAR_50", "Georgia"); - rs_.updateRow (); - rs_.beforeFirst (); - JDRSTest.position (rs_, key_); - String v = rs_.getString ("C_VARCHAR_50"); - assertCondition (v.equals ("Georgia")); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } + /** + * updateObject() - Should throw an exception on a deleted row. + **/ + public void Var019() { + setupRs(); + if (checkJdbc20()) { + + try { + + JDRSTest.position(rs_, "DUMMY_UPDOBJ"); + rs_.deleteRow(); + rs_.updateObject("C_VARCHAR_50", "Kentucky"); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } + } + /** + * updateObject() - Update a SMALLINT. + **/ + public void Var020() { + setupRs(); + if (checkJdbc20()) { + + try { + + JDRSTest.position(rs_, key_); + rs_.updateObject("C_SMALLINT", Short.valueOf((short) 243)); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + short v = rs2.getShort("C_SMALLINT"); + rs2.close(); + assertCondition(v == 243); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + /** + * updateObject() - Update a SMALLINT, when the integer is too big. + **/ + public void Var021() { + setupRs(); + if (checkJdbc20()) { + int expectedColumn = -1; + + try { + + JDRSTest.position(rs_, key_); + expectedColumn = rs_.findColumn("C_SMALLINT"); + rs_.updateObject("C_SMALLINT", Integer.valueOf(4873423)); + rs_.updateRow(); + failed("Didn't throw SQLException"); + } catch (Exception e) { + if (e instanceof DataTruncation) { + DataTruncation dt = (DataTruncation) e; + assertCondition((dt.getIndex() == expectedColumn) && (dt.getParameter() == false) && (dt.getRead() == false) + && (dt.getDataSize() == 8) && (dt.getTransferSize() == 2)); + } else { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } + } + } + } -/** -updateObject() - Should work when the current row is the insert -row. -**/ - public void Var017() - { - setupRs(); - if (checkJdbc20 ()) { - try { - rs_.moveToInsertRow (); - rs_.updateString ("C_KEY", "JDRSUpdateObject 1"); - rs_.updateObject ("C_VARCHAR_50", "Florida"); - rs_.insertRow (); - JDRSTest.position (rs_, "JDRSUpdateObject 1"); - assertCondition (rs_.getString ("C_VARCHAR_50").equals ("Florida")); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } + /** + * updateObject() - Update a SMALLINT with an object that has a fraction. This + * should work. + **/ + public void Var022() { + setupRs(); + if (checkJdbc20()) { + + try { + + JDRSTest.position(rs_, key_); + rs_.updateObject("C_SMALLINT", Float.valueOf(243.6f)); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + short v = rs2.getShort("C_SMALLINT"); + rs2.close(); + assertCondition(v == 243); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } } + } + /** + * updateObject() - Update a SMALLINT, when the object is not a number. + **/ + public void Var023() { + setupRs(); + if (checkJdbc20()) { + + try { + + JDRSTest.position(rs_, key_); + rs_.updateObject("C_SMALLINT", "West Virginia"); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } + } + } + /** + * updateObject() - Update an INTEGER. + **/ + public void Var024() { + setupRs(); + if (checkJdbc20()) { + + try { + + JDRSTest.position(rs_, key_); + rs_.updateObject("C_INTEGER", Integer.valueOf(-122833)); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + int v = rs2.getInt("C_INTEGER"); + rs2.close(); + assertCondition(v == -122833); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } -/** -updateObject() - Should be reflected by get on insert row, even if -insert has not yet been issued (i.e. insert is still pending). -**/ - public void Var018() - { - setupRs(); - if (checkJdbc20 ()) { - try { - rs_.moveToInsertRow (); - rs_.updateObject ("C_VARCHAR_50", "Ohio"); - assertCondition (rs_.getString ("C_VARCHAR_50").equals ("Ohio")); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } + /** + * updateObject() - Update an INTEGER, when the integer is too big. + **/ + public void Var025() { + setupRs(); + if (checkJdbc20()) { + int expectedColumn = -1; + + try { + + JDRSTest.position(rs_, key_); + expectedColumn = rs_.findColumn("C_INTEGER"); + rs_.updateObject("C_INTEGER", Long.valueOf(245545147483647L)); + rs_.updateRow(); + failed("Didn't throw SQLException"); + } catch (Exception e) { + if (e instanceof DataTruncation) { + DataTruncation dt = (DataTruncation) e; + assertCondition((dt.getIndex() == expectedColumn) && (dt.getParameter() == false) && (dt.getRead() == false) + && (dt.getDataSize() == 8) && (dt.getTransferSize() == 4)); + } else { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); } - } + } + } + } -/** -updateObject() - Should throw an exception on a deleted row. -**/ - public void Var019() - { - setupRs(); - if (checkJdbc20 ()) { - try { - JDRSTest.position (rs_, "DUMMY_ROW"); - rs_.deleteRow (); - rs_.updateObject ("C_VARCHAR_50", "Kentucky"); - failed ("Didn't throw SQLException"); - } - catch (Exception e) { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + /** + * updateObject() - Update an INTEGER with an object that has a fraction. This + * should work. + **/ + public void Var026() { + setupRs(); + if (checkJdbc20()) { + + try { + + JDRSTest.position(rs_, key_); + rs_.updateObject("C_INTEGER", Float.valueOf(-122833.6f)); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + int v = rs2.getInt("C_INTEGER"); + rs2.close(); + assertCondition(v == -122833); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } } + } - -/** -updateObject() - Update a SMALLINT. -**/ - public void Var020 () - { - setupRs(); - if (checkJdbc20 ()) { - try { - JDRSTest.position (rs_, key_); - rs_.updateObject ("C_SMALLINT", Short.valueOf((short) 243)); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - short v = rs2.getShort ("C_SMALLINT"); - rs2.close (); - assertCondition (v == 243); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } + /** + * updateObject() - Update an INTEGER, when the object is not a number. + **/ + public void Var027() { + setupRs(); + if (checkJdbc20()) { + + try { + + JDRSTest.position(rs_, key_); + rs_.updateObject("C_INTEGER", "Tennessee"); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } + } + /** + * updateObject() - Update a REAL. + **/ + public void Var028() { + setupRs(); + if (checkJdbc20()) { + + try { + + JDRSTest.position(rs_, key_); + rs_.updateObject("C_REAL", Float.valueOf(31.53f)); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + float v = rs2.getFloat("C_REAL"); + rs2.close(); + assertCondition(v == 31.53f); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + /** + * updateObject() - Update a REAL, when the object is not a number. + **/ + public void Var029() { + setupRs(); + if (checkJdbc20()) { + + try { + + JDRSTest.position(rs_, key_); + rs_.updateObject("C_INTEGER", "Alabama"); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } + } + } -/** -updateObject() - Update a SMALLINT, when the integer is too big. -**/ - public void Var021 () - { - setupRs(); - if (checkJdbc20 ()) { - int expectedColumn = -1; - try { - JDRSTest.position (rs_, key_); - expectedColumn = rs_.findColumn ("C_SMALLINT"); - rs_.updateObject ("C_SMALLINT", Integer.valueOf(4873423)); - rs_.updateRow (); - failed ("Didn't throw SQLException"); - } - catch (Exception e) { - if (e instanceof DataTruncation) { - DataTruncation dt = (DataTruncation)e; - assertCondition ((dt.getIndex() == expectedColumn) - && (dt.getParameter() == false) - && (dt.getRead() == false) - && (dt.getDataSize() == 8) - && (dt.getTransferSize() == 2)); - } else { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } + /** + * updateObject() - Update a FLOAT. + **/ + public void Var030() { + setupRs(); + if (checkJdbc20()) { + + try { + + JDRSTest.position(rs_, key_); + rs_.updateObject("C_FLOAT", Float.valueOf(-9845.32f)); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + float v = rs2.getFloat("C_FLOAT"); + rs2.close(); + assertCondition(v == -9845.32f); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } - } - } + /** + * updateObject() - Update a FLOAT, when the object is not a number. + **/ + public void Var031() { + setupRs(); + if (checkJdbc20()) { + + try { + + JDRSTest.position(rs_, key_); + rs_.updateObject("C_FLOAT", "Mississippi"); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } + } + /** + * updateObject() - Update a DOUBLE. + **/ + public void Var032() { + setupRs(); + if (checkJdbc20()) { + + try { + + JDRSTest.position(rs_, key_); + rs_.updateObject("C_DOUBLE", Double.valueOf(19845.987987)); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + double v = rs2.getDouble("C_DOUBLE"); + rs2.close(); + assertCondition(v == 19845.987987); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + /** + * updateObject() - Update a DOUBLE, when the object is not a number. + **/ + public void Var033() { + setupRs(); + if (checkJdbc20()) { + + try { + + JDRSTest.position(rs_, key_); + rs_.updateObject("C_DOUBLE", "Louisiana"); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } + } + } -/** -updateObject() - Update a SMALLINT with an object that has a fraction. -This should work. -**/ - public void Var022 () - { - setupRs(); - if (checkJdbc20 ()) { - try { - JDRSTest.position (rs_, key_); - rs_.updateObject ("C_SMALLINT", Float.valueOf(243.6f)); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - short v = rs2.getShort ("C_SMALLINT"); - rs2.close (); - assertCondition (v == 243); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } + /** + * updateObject() - Update a DECIMAL, with no scale specified. + **/ + public void Var034() { + setupRs(); + if (checkJdbc20()) { + + try { + + JDRSTest.position(rs_, key_); + rs_.updateObject("C_DECIMAL_105", new BigDecimal(-4539.9)); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + BigDecimal v = rs2.getBigDecimal("C_DECIMAL_105"); + rs2.close(); + assertCondition(v.floatValue() == -4539.9f); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } } + } + /** + * updateObject() - Update a DECIMAL, when the fraction will truncate. This is + * ok. + **/ + public void Var035() { + setupRs(); + if (checkJdbc20()) { + + try { + + JDRSTest.position(rs_, key_); + rs_.updateObject("C_DECIMAL_105", new BigDecimal(-4539.987666666)); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + BigDecimal v = rs2.getBigDecimal("C_DECIMAL_105"); + rs2.close(); + assertCondition(v.equals(new BigDecimal("-4539.98766"))); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + /** + * updateObject() - Update a DECIMAL, with scale -1 specified. + **/ + public void Var036() { + setupRs(); + if (checkJdbc20()) { + + try { + + JDRSTest.position(rs_, key_); + rs_.updateObject("C_DECIMAL_105", new BigDecimal(-4532.9), -1); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } + } + } -/** -updateObject() - Update a SMALLINT, when the object is not a number. -**/ - public void Var023 () - { - setupRs(); - if (checkJdbc20 ()) { - try { - JDRSTest.position (rs_, key_); - rs_.updateObject ("C_SMALLINT", "West Virginia"); - failed ("Didn't throw SQLException"); - } - catch (Exception e) { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + /** + * updateObject() - Update a DECIMAL, with scale 0 specified. + **/ + public void Var037() { + setupRs(); + if (checkJdbc20()) { + + try { + + JDRSTest.position(rs_, key_); + rs_.updateObject("C_DECIMAL_105", new BigDecimal(39455.58734), 0); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + BigDecimal v = rs2.getBigDecimal("C_DECIMAL_105"); + rs2.close(); + assertCondition(v.floatValue() == 39455); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } } + } + /** + * updateObject() - Update a DECIMAL, with scale less than the value's scale. + **/ + public void Var038() { + setupRs(); + if (checkJdbc20()) { + + try { + + JDRSTest.position(rs_, key_); + rs_.updateObject("C_DECIMAL_105", new BigDecimal(34255.53434), 3); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + BigDecimal v = rs2.getBigDecimal("C_DECIMAL_105"); + rs2.close(); + assertCondition(v.floatValue() == 34255.534f); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + /** + * updateObject() - Update a DECIMAL, with scale equal to the value's scale. + **/ + public void Var039() { + setupRs(); + if (checkJdbc20()) { + + try { + + JDRSTest.position(rs_, key_); + rs_.updateObject("C_DECIMAL_105", new BigDecimal(54321.12345), 5); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + BigDecimal v = rs2.getBigDecimal("C_DECIMAL_105"); + rs2.close(); + assertCondition(v.floatValue() == 54321.12345f); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } -/** -updateObject() - Update an INTEGER. -**/ - public void Var024 () - { - setupRs(); - if (checkJdbc20 ()) { - try { - JDRSTest.position (rs_, key_); - rs_.updateObject ("C_INTEGER", Integer.valueOf(-122833)); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - int v = rs2.getInt ("C_INTEGER"); - rs2.close (); - assertCondition (v == -122833); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } + /** + * updateObject() - Update a DECIMAL, with scale greater the value's scale. + **/ + public void Var040() { + setupRs(); + if (checkJdbc20()) { + + try { + + JDRSTest.position(rs_, key_); + rs_.updateObject("C_DECIMAL_105", new BigDecimal(54321.12345), 8); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + BigDecimal v = rs2.getBigDecimal("C_DECIMAL_105"); + rs2.close(); + assertCondition(v.floatValue() == 54321.12345f); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } } + } + /** + * updateObject() - Update a DECIMAL, when the value is too big. + **/ + public void Var041() { + setupRs(); + if (checkJdbc20()) { + int expectedColumn = -1; + + try { + + JDRSTest.position(rs_, key_); + expectedColumn = rs_.findColumn("C_DECIMAL_105"); + rs_.updateObject("C_DECIMAL_105", new BigDecimal("394585.432389445")); + rs_.updateRow(); + failed("Didn't throw SQLException"); + } catch (Exception e) { + if (e instanceof DataTruncation) { + DataTruncation dt = (DataTruncation) e; + assertCondition((dt.getIndex() == expectedColumn) && (dt.getParameter() == false) && (dt.getRead() == false) + && (dt.getDataSize() == 15) && (dt.getTransferSize() == 10)); + } else { + assertSqlException(e, -99999, "07006", "Data type mismatch", + "Mismatch instead of truncation in latest toolbox"); + } + } + } + } -/** -updateObject() - Update an INTEGER, when the integer is too big. -**/ - public void Var025 () - { - setupRs(); - if (checkJdbc20 ()) { - int expectedColumn = -1; - try { - JDRSTest.position (rs_, key_); - expectedColumn = rs_.findColumn ("C_INTEGER"); - rs_.updateObject ("C_INTEGER", Long.valueOf(245545147483647L)); - rs_.updateRow (); - failed ("Didn't throw SQLException"); - } - catch (Exception e) { - if (e instanceof DataTruncation) { - DataTruncation dt = (DataTruncation)e; - assertCondition ((dt.getIndex() == expectedColumn) - && (dt.getParameter() == false) - && (dt.getRead() == false) - && (dt.getDataSize() == 8) - && (dt.getTransferSize() == 4)); - } else { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - - } - } + /** + * updateObject() - Update a DECIMAL, when the object is not a number. + **/ + public void Var042() { + setupRs(); + if (checkJdbc20()) { + try { + + JDRSTest.position(rs_, key_); + rs_.updateObject("C_DECIMAL_105", "Arkansas"); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } + } + /** + * updateObject() - Update a NUMERIC, with no scale specified. + **/ + public void Var043() { + setupRs(); + if (checkJdbc20()) { + + try { + + JDRSTest.position(rs_, key_); + rs_.updateObject("C_NUMERIC_105", new BigDecimal(-6639.95)); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + BigDecimal v = rs2.getBigDecimal("C_NUMERIC_105"); + rs2.close(); + assertCondition(v.floatValue() == -6639.95f); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + /** + * updateObject() - Update a NUMERIC, when the fraction will truncate. + **/ + public void Var044() { + setupRs(); + if (checkJdbc20()) { + + try { + + JDRSTest.position(rs_, key_); + rs_.updateObject("C_NUMERIC_40", new BigDecimal(-4539.98)); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + BigDecimal v = rs2.getBigDecimal("C_NUMERIC_40"); + rs2.close(); + assertCondition(v.equals(new BigDecimal(-4539.0))); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } -/** -updateObject() - Update an INTEGER with an object that has a fraction. This -should work. -**/ - public void Var026 () - { - setupRs(); - if (checkJdbc20 ()) { - try { - JDRSTest.position (rs_, key_); - rs_.updateObject ("C_INTEGER", Float.valueOf(-122833.6f)); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - int v = rs2.getInt ("C_INTEGER"); - rs2.close (); - assertCondition (v == -122833); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } + /** + * updateObject() - Update a NUMERIC, with scale -1 specified. + **/ + public void Var045() { + setupRs(); + if (checkJdbc20()) { + + try { + + JDRSTest.position(rs_, key_); + rs_.updateObject("C_NUMERIC_105", new BigDecimal(-4432.9), -1); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } + } + /** + * updateObject() - Update a NUMERIC, with scale 0 specified. + **/ + public void Var046() { + setupRs(); + if (checkJdbc20()) { + + try { + + JDRSTest.position(rs_, key_); + rs_.updateObject("C_NUMERIC_105", new BigDecimal(39458.88734), 0); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + BigDecimal v = rs2.getBigDecimal("C_NUMERIC_105"); + rs2.close(); + assertCondition(v.floatValue() == 39458); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + /** + * updateObject() - Update a NUMERIC, with scale less than the value's scale. + **/ + public void Var047() { + setupRs(); + if (checkJdbc20()) { + + try { + + JDRSTest.position(rs_, key_); + rs_.updateObject("C_NUMERIC_105", new BigDecimal(34255.53434), 3); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + BigDecimal v = rs2.getBigDecimal("C_NUMERIC_105"); + rs2.close(); + assertCondition(v.floatValue() == 34255.534f); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } -/** -updateObject() - Update an INTEGER, when the object is not a number. -**/ - public void Var027 () - { - setupRs(); - if (checkJdbc20 ()) { - try { - JDRSTest.position (rs_, key_); - rs_.updateObject ("C_INTEGER", "Tennessee"); - failed ("Didn't throw SQLException"); - } - catch (Exception e) { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + /** + * updateObject() - Update a NUMERIC, with scale equal to the value's scale. + **/ + public void Var048() { + setupRs(); + if (checkJdbc20()) { + + try { + + JDRSTest.position(rs_, key_); + rs_.updateObject("C_NUMERIC_105", new BigDecimal(54321.12345), 5); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + BigDecimal v = rs2.getBigDecimal("C_NUMERIC_105"); + rs2.close(); + assertCondition(v.floatValue() == 54321.12345f); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } } + } + /** + * updateObject() - Update a NUMERIC, with scale greater the value's scale. + **/ + public void Var049() { + setupRs(); + if (checkJdbc20()) { + + try { + + JDRSTest.position(rs_, key_); + rs_.updateObject("C_NUMERIC_105", new BigDecimal(54321.12345), 8); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + BigDecimal v = rs2.getBigDecimal("C_NUMERIC_105"); + rs2.close(); + assertCondition(v.floatValue() == 54321.12345f); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + /** + * updateObject() - Update a NUMERIC, when the value is too big. + **/ + public void Var050() { -/** -updateObject() - Update a REAL. -**/ - public void Var028 () - { - setupRs(); - if (checkJdbc20 ()) { - try { - JDRSTest.position (rs_, key_); - rs_.updateObject ("C_REAL", Float.valueOf(31.53f)); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - float v = rs2.getFloat ("C_REAL"); - rs2.close (); - assertCondition (v == 31.53f); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } + setupRs(); + if (checkJdbc20()) { + int expectedColumn = -1; + + try { + + JDRSTest.position(rs_, key_); + expectedColumn = rs_.findColumn("C_NUMERIC_40"); + rs_.updateObject("C_NUMERIC_40", new BigDecimal(394585.0)); + rs_.updateRow(); + failed("Didn't throw SQLException"); + } catch (Exception e) { + if (e instanceof DataTruncation) { + DataTruncation dt = (DataTruncation) e; + assertCondition((dt.getIndex() == expectedColumn) && (dt.getParameter() == false) && (dt.getRead() == false) + && (dt.getDataSize() == 6) && (dt.getTransferSize() == 4)); + } else { + assertSqlException(e, -99999, "07006", "Data type mismatch", + "Mismatch instead of truncation in latest toolbox"); } - } + } + } + } -/** -updateObject() - Update a REAL, when the object is not a number. -**/ - public void Var029 () - { - setupRs(); - if (checkJdbc20 ()) { - try { - JDRSTest.position (rs_, key_); - rs_.updateObject ("C_INTEGER", "Alabama"); - failed ("Didn't throw SQLException"); - } - catch (Exception e) { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + /** + * updateObject() - Update a NUMERIC, when the object is not a number. + **/ + public void Var051() { + setupRs(); + if (checkJdbc20()) { + + try { + + JDRSTest.position(rs_, key_); + rs_.updateObject("C_NUMERIC_40", "Missouri"); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } + } + /** + * updateObject() - Update a CHAR. + **/ + public void Var052() { + setupRs(); + if (checkJdbc20()) { + + try { + + JDRSTest.position(rs_, key_); + rs_.updateObject("C_CHAR_50", "Iowa"); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + String v = rs2.getString("C_CHAR_50"); + rs2.close(); + assertCondition(v.equals("Iowa ")); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + /** + * updateObject() - Update a CHAR, when the value is too big. + **/ + public void Var053() { + setupRs(); + if (checkJdbc20()) { + int expectedColumn = -1; + + try { + + JDRSTest.position(rs_, key_); + expectedColumn = rs_.findColumn("C_CHAR_1"); + rs_.updateObject("C_CHAR_1", "Minnesota"); + rs_.updateRow(); + failed("Didn't throw SQLException"); + } catch (Exception e) { + DataTruncation dt = (DataTruncation) e; + assertCondition((dt.getIndex() == expectedColumn) && (dt.getParameter() == false) && (dt.getRead() == false) + && (dt.getDataSize() == 9) && (dt.getTransferSize() == 1)); + } + } + } -/** -updateObject() - Update a FLOAT. -**/ - public void Var030 () - { - setupRs(); - if (checkJdbc20 ()) { - try { - JDRSTest.position (rs_, key_); - rs_.updateObject ("C_FLOAT", Float.valueOf(-9845.32f)); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - float v = rs2.getFloat ("C_FLOAT"); - rs2.close (); - assertCondition (v == -9845.32f); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } + /** + * updateObject() - Update a VARCHAR. + **/ + public void Var054() { + setupRs(); + if (checkJdbc20()) { + + try { + + JDRSTest.position(rs_, key_); + rs_.updateObject("C_VARCHAR_50", "Wisconsin"); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + String v = rs2.getString("C_VARCHAR_50"); + rs2.close(); + assertCondition(v.equals("Wisconsin")); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } } + } + /** + * updateObject() - Update a VARCHAR, when the value is too big. + **/ + public void Var055() { + setupRs(); + if (checkJdbc20()) { + int expectedColumn = -1; + + try { + + JDRSTest.position(rs_, key_); + expectedColumn = rs_.findColumn("C_VARCHAR_50"); + rs_.updateObject("C_VARCHAR_50", + "Michigan, Illinois, Indiana, and whatever states around there that I have missed."); + rs_.updateRow(); + failed("Didn't throw SQLException"); + } catch (Exception e) { + DataTruncation dt = (DataTruncation) e; + assertCondition((dt.getIndex() == expectedColumn) && (dt.getParameter() == false) && (dt.getRead() == false) + && (dt.getDataSize() == 81) && (dt.getTransferSize() == 50)); - -/** -updateObject() - Update a FLOAT, when the object is not a number. -**/ - public void Var031 () - { - setupRs(); - if (checkJdbc20 ()) { - try { - JDRSTest.position (rs_, key_); - rs_.updateObject ("C_FLOAT", "Mississippi"); - failed ("Didn't throw SQLException"); - } - catch (Exception e) { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + } } + } + /** + * updateObject() - Update a BINARY. + **/ + public void Var056() { + setupRs(); + if (checkJdbc20()) { + try { + String expected; + if (isToolboxDriver()) + expected = "F1F2"; + else + expected = "Ford"; -/** -updateObject() - Update a DOUBLE. -**/ - public void Var032 () - { - setupRs(); - if (checkJdbc20 ()) { - try { - JDRSTest.position (rs_, key_); - rs_.updateObject ("C_DOUBLE", Double.valueOf(19845.987987)); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - double v = rs2.getDouble ("C_DOUBLE"); - rs2.close (); - assertCondition (v == 19845.987987); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } + JDRSTest.position(rs_, key_); + rs_.updateObject("C_BINARY_20", expected); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + String v = rs2.getString("C_BINARY_20"); + rs2.close(); + assertCondition(v.startsWith(expected)); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } } + } + /** + * updateObject() - Update a BINARY, when the value is too big. + **/ + public void Var057() { + setupRs(); + if (checkJdbc20()) { + int expectedColumn = -1; + + try { + + JDRSTest.position(rs_, key_); + expectedColumn = rs_.findColumn("C_BINARY_1"); + rs_.updateObject("C_BINARY_1", "F1F2F3F4"); + rs_.updateRow(); + failed("Didn't throw SQLException"); + } catch (Exception e) { + DataTruncation dt = (DataTruncation) e; + assertCondition((dt.getIndex() == expectedColumn) && (dt.getParameter() == false) && (dt.getRead() == false) + && (dt.getTransferSize() == 1)); - -/** -updateObject() - Update a DOUBLE, when the object is not a number. -**/ - public void Var033 () - { - setupRs(); - if (checkJdbc20 ()) { - try { - JDRSTest.position (rs_, key_); - rs_.updateObject ("C_DOUBLE", "Louisiana"); - failed ("Didn't throw SQLException"); - } - catch (Exception e) { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + } } + } + /** + * updateObject() - Update a VARBINARY. + **/ + public void Var058() { + setupRs(); + if (checkJdbc20()) { + try { + String expected; + if (isToolboxDriver()) + expected = "F1F2"; + else + expected = "Ford"; -/** -updateObject() - Update a DECIMAL, with no scale specified. -**/ - public void Var034 () - { - setupRs(); - if (checkJdbc20 ()) { - try { - JDRSTest.position (rs_, key_); - rs_.updateObject ("C_DECIMAL_105", new BigDecimal (-4539.9)); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - BigDecimal v = rs2.getBigDecimal ("C_DECIMAL_105"); - rs2.close (); - assertCondition (v.floatValue() == -4539.9f); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } + JDRSTest.position(rs_, key_); + rs_.updateObject("C_VARBINARY_20", expected); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + String v = rs2.getString("C_VARBINARY_20"); + rs2.close(); + assertCondition(v.equals(expected)); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } } + } + /** + * updateObject() - Update a VARBINARY, when the value is too big. + **/ + public void Var059() { + setupRs(); + if (checkJdbc20()) { + int expectedColumn = -1; + + try { + + JDRSTest.position(rs_, key_); + expectedColumn = rs_.findColumn("C_VARBINARY_20"); + rs_.updateObject("C_VARBINARY_20", + "E1E2E3E4E5F1F2F3F4F5C1C2C3C4C5D1D2D3D3D5E1E2E3E4E5F1F2F3F4F5C1C2C3C4C5D1D2D3D3D5"); + rs_.updateRow(); + failed("Didn't throw SQLException"); + } catch (Exception e) { + DataTruncation dt = (DataTruncation) e; + assertCondition((dt.getIndex() == expectedColumn) && (dt.getParameter() == false) && (dt.getRead() == false) + && (dt.getTransferSize() == 20)); - -/** -updateObject() - Update a DECIMAL, when the fraction will truncate. This is ok. -**/ - public void Var035 () - { - setupRs(); - if (checkJdbc20 ()) { - try { - JDRSTest.position (rs_, key_); - rs_.updateObject ("C_DECIMAL_105", new BigDecimal (-4539.987666666)); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - BigDecimal v = rs2.getBigDecimal ("C_DECIMAL_105"); - rs2.close (); - assertCondition (v.equals(new BigDecimal("-4539.98766"))); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } + } } + } - - -/** -updateObject() - Update a DECIMAL, with scale -1 specified. -**/ - public void Var036 () - { - setupRs(); - if (checkJdbc20 ()) { - try { - JDRSTest.position (rs_, key_); - rs_.updateObject ("C_DECIMAL_105", new BigDecimal (-4532.9), -1); - failed ("Didn't throw SQLException"); - } - catch (Exception e) { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + /** + * updateObject() - Update a CLOB, when the data is stored in the result set. + **/ + public void Var060() { + setupRs(); + if (checkJdbc20()) { + if (checkLobSupport()) { + + try { + + JDRSTest.position(rs_, key_); + String s = "New Mexico"; + Clob c = new JDLobTest.JDTestClob(s); + rs_.updateObject("C_CLOB", c); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + String v = rs2.getString("C_CLOB"); + rs2.close(); + assertCondition(v.equals(s)); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } + } } + } - -/** -updateObject() - Update a DECIMAL, with scale 0 specified. -**/ - public void Var037 () - { - setupRs(); - if (checkJdbc20 ()) { - try { - JDRSTest.position (rs_, key_); - rs_.updateObject ("C_DECIMAL_105", new BigDecimal (39455.58734), 0); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - BigDecimal v = rs2.getBigDecimal ("C_DECIMAL_105"); - rs2.close (); - assertCondition (v.floatValue() == 39455); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } + /** + * updateObject() - Update a CLOB, when the locator is stored in the result set. + **/ + public void Var061() { + setupRs(); + if (checkJdbc20()) { + if (checkLobSupport()) { + + try { + + JDRSTest.position(rs3_, key_); + String s = "New Mexico"; + Clob c = new JDLobTest.JDTestClob(s); + rs3_.updateObject("C_CLOB", c); + rs3_.updateRow(); + ResultSet rs2 = statement4_.executeQuery(select_); + JDRSTest.position(rs2, key_); + String v = rs2.getString("C_CLOB"); + rs2.close(); + assertCondition(v.equals(s)); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } + } } + } - -/** -updateObject() - Update a DECIMAL, with scale less than the value's scale. -**/ - public void Var038 () - { - setupRs(); - if (checkJdbc20 ()) { - try { - JDRSTest.position (rs_, key_); - rs_.updateObject ("C_DECIMAL_105", new BigDecimal (34255.53434), 3); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - BigDecimal v = rs2.getBigDecimal ("C_DECIMAL_105"); - rs2.close (); - assertCondition (v.floatValue() == 34255.534f); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } + /** + * updateObject() - Update a DBCLOB, when the data is stored in the result set. + **/ + public void Var062() { + setupRs(); + if (checkJdbc20()) { + if (checkLobSupport()) { + + try { + + JDRSTest.position(rs_, key_); + String s = "Arizona"; + Clob c = new JDLobTest.JDTestClob(s); + rs_.updateObject("C_DBCLOB", c); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + String v = rs2.getString("C_DBCLOB"); + rs2.close(); + assertCondition(v.equals(s)); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } + } } + } - -/** -updateObject() - Update a DECIMAL, with scale equal to the value's scale. -**/ - public void Var039 () - { - setupRs(); - if (checkJdbc20 ()) { - try { - JDRSTest.position (rs_, key_); - rs_.updateObject ("C_DECIMAL_105", new BigDecimal (54321.12345), 5); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - BigDecimal v = rs2.getBigDecimal ("C_DECIMAL_105"); - rs2.close (); - assertCondition (v.floatValue() == 54321.12345f); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } + /** + * updateObject() - Update a DBCLOB, when the locator is stored in the result + * set. + **/ + public void Var063() { + setupRs(); + if (checkJdbc20()) { + if (checkLobSupport()) { + + try { + + JDRSTest.position(rs3_, key_); + String s = "Arizona"; + Clob c = new JDLobTest.JDTestClob(s); + rs3_.updateObject("C_DBCLOB", c); + rs3_.updateRow(); + ResultSet rs2 = statement4_.executeQuery(select_); + JDRSTest.position(rs2, key_); + String v = rs2.getString("C_DBCLOB"); + rs2.close(); + assertCondition(v.equals(s)); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } + } } + } - -/** -updateObject() - Update a DECIMAL, with scale greater the value's scale. -**/ - public void Var040 () - { - setupRs(); - if (checkJdbc20 ()) { - try { - JDRSTest.position (rs_, key_); - rs_.updateObject ("C_DECIMAL_105", new BigDecimal (54321.12345), 8); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - BigDecimal v = rs2.getBigDecimal ("C_DECIMAL_105"); - rs2.close (); - assertCondition (v.floatValue() ==54321.12345f); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } + /** + * updateObject() - Update a BLOB, when the data is stored in the result set. + **/ + public void Var064() { + setupRs(); + if (checkJdbc20()) { + if (checkLobSupport()) { + + try { + + JDRSTest.position(rs_, key_); + byte[] ba = { 54, 65, -34, 65, 0, -2, -1, 0 }; + Blob b = new JDLobTest.JDTestBlob(ba); + rs_.updateObject("C_BLOB", b); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + byte[] v = rs2.getBytes("C_BLOB"); + rs2.close(); + assertCondition(areEqual(v, ba)); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } + } } + } - -/** -updateObject() - Update a DECIMAL, when the value is too big. -**/ - public void Var041 () - { - setupRs(); - if (checkJdbc20 ()) { - int expectedColumn = -1; + /** + * updateObject() - Update a BLOB, when the locator is stored in the result set. + **/ + public void Var065() { + setupRs(); + if (checkJdbc20()) { + if (checkLobSupport()) { + try { - JDRSTest.position (rs_, key_); - expectedColumn = rs_.findColumn ("C_DECIMAL_105"); - rs_.updateObject ("C_DECIMAL_105", new BigDecimal ("394585.432389445")); - rs_.updateRow (); - failed ("Didn't throw SQLException"); - } - catch (Exception e) { - if (e instanceof DataTruncation) { - DataTruncation dt = (DataTruncation)e; - assertCondition ((dt.getIndex() == expectedColumn) - && (dt.getParameter() == false) - && (dt.getRead() == false) - && (dt.getDataSize() == 15) - && (dt.getTransferSize() == 10)); - } else { - assertSqlException(e, -99999, "07006", "Data type mismatch", - "Mismatch instead of truncation in latest toolbox"); - } - - } - } + + JDRSTest.position(rs3_, key_); + byte[] ba = { 54, 65, -34, 65, 0, -2, -1, 0 }; + Blob b = new JDLobTest.JDTestBlob(ba); + rs3_.updateObject("C_BLOB", b); + rs3_.updateRow(); + ResultSet rs2 = statement4_.executeQuery(select_); + JDRSTest.position(rs2, key_); + byte[] v = rs2.getBytes("C_BLOB"); + rs2.close(); + assertCondition(areEqual(v, ba)); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } + } } + } + /** + * updateObject() - Update a DATE. + **/ + public void Var066() { + setupRs(); + if (checkJdbc20()) { + try { + JDRSTest.position(rs_, key_); + Date d = new Date(1922400000); + rs_.updateObject("C_DATE", d); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + Date v = rs2.getDate("C_DATE"); + rs2.close(); -/** -updateObject() - Update a DECIMAL, when the object is not a number. -**/ - public void Var042 () - { - setupRs(); - if (checkJdbc20 ()) { - try { - JDRSTest.position (rs_, key_); - rs_.updateObject ("C_DECIMAL_105", "Arkansas"); - failed ("Didn't throw SQLException"); - } - catch (Exception e) { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + assertCondition(v.toString().equals(d.toString())); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } } + } - - -/** -updateObject() - Update a NUMERIC, with no scale specified. -**/ - public void Var043 () - { - setupRs(); - if (checkJdbc20 ()) { - try { - JDRSTest.position (rs_, key_); - rs_.updateObject ("C_NUMERIC_105", new BigDecimal (-6639.95)); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - BigDecimal v = rs2.getBigDecimal ("C_NUMERIC_105"); - rs2.close (); - assertCondition (v.floatValue() == -6639.95f); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } + /** + * updateObject() - Update a DATE, when the string is not a valid date. + **/ + public void Var067() { + setupRs(); + if (checkJdbc20()) { + + try { + + JDRSTest.position(rs_, key_); + rs_.updateObject("C_DATE", "Nevada"); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } + } - - -/** -updateObject() - Update a NUMERIC, when the fraction will truncate. -**/ - public void Var044 () - { - setupRs(); - if (checkJdbc20 ()) { - try { - JDRSTest.position (rs_, key_); - rs_.updateObject ("C_NUMERIC_40", new BigDecimal (-4539.98)); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - BigDecimal v = rs2.getBigDecimal ("C_NUMERIC_40"); - rs2.close (); - assertCondition (v.equals(new BigDecimal(-4539.0))); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } + /** + * updateObject() - Update a TIME. + **/ + public void Var068() { + setupRs(); + if (checkJdbc20()) { + + try { + + JDRSTest.position(rs_, key_); + Time t = Time.valueOf("07:36:00"); + rs_.updateObject("C_TIME", t); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + Time v = rs2.getTime("C_TIME"); + rs2.close(); + assertCondition(v.toString().equals(t.toString())); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } } + } - - -/** -updateObject() - Update a NUMERIC, with scale -1 specified. -**/ - public void Var045 () - { - setupRs(); - if (checkJdbc20 ()) { - try { - JDRSTest.position (rs_, key_); - rs_.updateObject ("C_NUMERIC_105", new BigDecimal (-4432.9), -1); - failed ("Didn't throw SQLException"); - } - catch (Exception e) { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + /** + * updateObject() - Update a TIME, when the string is not a valid time. + **/ + public void Var069() { + setupRs(); + if (checkJdbc20()) { + + try { + + JDRSTest.position(rs_, key_); + rs_.updateObject("C_TIME", "Wyoming"); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } + } - -/** -updateObject() - Update a NUMERIC, with scale 0 specified. -**/ - public void Var046 () - { - setupRs(); - if (checkJdbc20 ()) { - try { - JDRSTest.position (rs_, key_); - rs_.updateObject ("C_NUMERIC_105", new BigDecimal (39458.88734), 0); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - BigDecimal v = rs2.getBigDecimal ("C_NUMERIC_105"); - rs2.close (); - assertCondition (v.floatValue() == 39458); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } + /** + * updateObject() - Update a TIMESTAMP. + **/ + public void Var070() { + setupRs(); + if (checkJdbc20()) { + + try { + + JDRSTest.position(rs_, key_); + Timestamp ts = new Timestamp(425252435); + rs_.updateObject("C_TIMESTAMP", ts); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + Timestamp v = rs2.getTimestamp("C_TIMESTAMP"); + rs2.close(); + assertCondition(v.equals(ts)); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } } + } - -/** -updateObject() - Update a NUMERIC, with scale less than the value's scale. -**/ - public void Var047 () - { - setupRs(); - if (checkJdbc20 ()) { - try { - JDRSTest.position (rs_, key_); - rs_.updateObject ("C_NUMERIC_105", new BigDecimal (34255.53434), 3); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - BigDecimal v = rs2.getBigDecimal ("C_NUMERIC_105"); - rs2.close (); - assertCondition (v.floatValue() == 34255.534f); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } + /** + * updateObject() - Update a TIMESTAMP, when the string is not a vliad + * timestamp. + **/ + public void Var071() { + setupRs(); + if (checkJdbc20()) { + + try { + + JDRSTest.position(rs_, key_); + rs_.updateObject("C_TIMESTAMP", "Montana"); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } + } - -/** -updateObject() - Update a NUMERIC, with scale equal to the value's scale. -**/ - public void Var048 () - { - setupRs(); - if (checkJdbc20 ()) { - try { - JDRSTest.position (rs_, key_); - rs_.updateObject ("C_NUMERIC_105", new BigDecimal (54321.12345), 5); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - BigDecimal v = rs2.getBigDecimal ("C_NUMERIC_105"); - rs2.close (); - assertCondition (v.floatValue() == 54321.12345f); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } + /** + * updateObject() - Update a DATALINK. + **/ + public void Var072() { + setupRs(); + if (checkJdbc20()) { + if (checkLobSupport()) { + // We do not test updating datalinks, since it is not + // possible to open a updatable cursor/result set with + // a datalink column. + notApplicable("DATALINK update not supported."); + /* + * try { JDRSTest.position (rs_, key_); rs_.updateObject ("C_DATALINK", + * "Idaho"); failed ("Didn't throw SQLException"); } catch (Exception e) { + * assertExceptionIsInstanceOf (e, "java.sql.SQLException"); } + */ + } } + } - -/** -updateObject() - Update a NUMERIC, with scale greater the value's scale. -**/ - public void Var049 () - { - setupRs(); - if (checkJdbc20 ()) { - try { - JDRSTest.position (rs_, key_); - rs_.updateObject ("C_NUMERIC_105", new BigDecimal (54321.12345), 8); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - BigDecimal v = rs2.getBigDecimal ("C_NUMERIC_105"); - rs2.close (); - assertCondition (v.floatValue() == 54321.12345f); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } + /** + * updateObject() - Update a DISTINCT. + **/ + public void Var073() { + setupRs(); + if (checkJdbc20()) { + if (checkLobSupport()) { + + try { + + JDRSTest.position(rs_, key_); + rs_.updateObject("C_DISTINCT", "Washing"); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + String v = rs2.getString("C_DISTINCT"); + rs2.close(); + assertCondition(v.equals("Washing ")); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } } + } - -/** -updateObject() - Update a NUMERIC, when the value is too big. -**/ - public void Var050 () - { - - setupRs(); - if (checkJdbc20 ()) { - int expectedColumn = -1; + /** + * updateObject() - Update a BIGINT. + **/ + public void Var074() { + setupRs(); + if (checkJdbc20()) { + if (checkBigintSupport()) { + try { - JDRSTest.position (rs_, key_); - expectedColumn = rs_.findColumn ("C_NUMERIC_40"); - rs_.updateObject ("C_NUMERIC_40", new BigDecimal (394585.0)); - rs_.updateRow (); - failed ("Didn't throw SQLException"); - } - catch (Exception e) { - if (e instanceof DataTruncation) { - DataTruncation dt = (DataTruncation)e; - assertCondition ((dt.getIndex() == expectedColumn) - && (dt.getParameter() == false) - && (dt.getRead() == false) - && (dt.getDataSize() == 6) - && (dt.getTransferSize() == 4)); - } else { - assertSqlException(e, -99999, "07006", "Data type mismatch", - "Mismatch instead of truncation in latest toolbox"); - } + + JDRSTest.position(rs_, key_); + rs_.updateObject("C_BIGINT", Integer.valueOf(223833)); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + long v = rs2.getLong("C_BIGINT"); + rs2.close(); + assertCondition(v == 223833); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + } - } - } + /** + * updateObject() - Update an BIGINT, when the object is not a number. + **/ + public void Var075() { + setupRs(); + if (checkJdbc20()) { + if (checkBigintSupport()) { + + try { + + JDRSTest.position(rs_, key_); + rs_.updateObject("C_BIGINT", "Tennessee"); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } + } } + } + /** + * B1A updateObject() - Update an BIGINT, when the integer is too big. + **/ + public void Var076() { + if (checkNative()) { + setupRs(); + if (checkJdbc20()) { + if (checkBigintSupport()) { + + try { + + JDRSTest.position(rs_, key_); + rs_.updateObject("C_BIGINT", new BigDecimal("-994535874335432445653")); + failed("Didn't throw SQLException"); + } catch (Exception e) { -/** -updateObject() - Update a NUMERIC, when the object is not a number. -**/ - public void Var051 () - { - setupRs(); - if (checkJdbc20 ()) { - try { - JDRSTest.position (rs_, key_); - rs_.updateObject ("C_NUMERIC_40", "Missouri"); - failed ("Didn't throw SQLException"); - } - catch (Exception e) { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); + boolean success = e.getMessage().indexOf("Data type mismatch") != -1; + if (success) { + assertCondition(true); + } else { + failed(e, "Expected data type mismatch -- updated 7/1/2014 to match other data types"); } + + } } + } } + } + /** + * setObject() - Set a CHAR parameter using Types.BOOLEAN. This is by customer + * request. Property "translate boolean", true is default + * + * This is to test property to force toolbox to match native driver's behavior. + * It was decided that the native driver's behavior was correct, but we cannot + * break existing customers' apps, so added this property for customer. + **/ + public void Var077() { + Connection conn = null; + Statement stmt = null; + // AS400JDBCDataSource ds = null; + + if (isToolboxDriver()) { + + try { + + for (int x = 0; x < 2; x++) { + + // "boolean string" property setting "true" is default, and driver just used old + // boolean values in setOjbect + String trueString = null; + String falseString = null; + String url = null; + + if (x == 0) { + // first time in iteration, use "true" and "false" in setObject + trueString = "true"; // toolbox default + falseString = "false"; // toolbox default + // don't set the "boolean string" property, true should be default + url = baseURL_; // ;translate boolean=true by default + conn = testDriver_.getConnection(url, systemObject_.getUserId(), encryptedPassword_); + } else if (x == 1) { + // second time in iteration, use "0" and "1" in setObject + trueString = "1"; // toolbox matches Native here + falseString = "0"; // toolbox matches Native here + // this time, explicity set property "boolean string" false + url = baseURL_ + ";translate boolean=false"; + conn = testDriver_.getConnection(url, systemObject_.getUserId(), encryptedPassword_); + } - -/** -updateObject() - Update a CHAR. -**/ - public void Var052 () - { - setupRs(); - if (checkJdbc20 ()) { - try { - JDRSTest.position (rs_, key_); - rs_.updateObject ("C_CHAR_50", "Iowa"); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - String v = rs2.getString ("C_CHAR_50"); - rs2.close (); - assertCondition (v.equals ("Iowa ")); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); + if (conn == null) { + throw new Exception("Connection is null"); + } + stmt = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); + + PreparedStatement ps = conn.prepareStatement( + "INSERT INTO " + JDRSTest.RSTEST_GET + " (C_KEY, C_CHAR_50, C_VARCHAR_50 ) " + " VALUES (?, ?, ?)"); + ps.setString(1, "PROP_CHAR_BOOL1"); + ps.setObject(2, Boolean.valueOf(true), Types.BOOLEAN); + ps.setObject(3, Boolean.valueOf(true), Types.BOOLEAN); + ps.executeUpdate(); + ps.setString(1, "PROP_CHAR_BOOL2"); + ps.setObject(2, Boolean.valueOf(false), Types.BOOLEAN); + ps.setObject(3, Boolean.valueOf(false), Types.BOOLEAN); + ps.executeUpdate(); + + ps.close(); + conn.setAutoCommit(false); + ResultSet rs = stmt.executeQuery( + "SELECT C_CHAR_50, C_VARCHAR_50 FROM " + JDRSTest.RSTEST_GET + " WHERE C_KEY like 'PROP_CHAR_BOOL%' "); + + while (rs.next()) { + + rs.updateObject("C_CHAR_50", Boolean.valueOf(true)); + rs.updateObject("C_VARCHAR_50", Boolean.valueOf(true)); + rs.updateRow(); /* serialized */ + conn.commit(); + String retVal = rs.getString("C_CHAR_50").trim(); + String retVal2 = rs.getString("C_VARCHAR_50"); + + if (((retVal.equals(falseString) == false) && (retVal.equals(trueString) == false)) + || ((retVal2.equals(falseString) == false) && (retVal2.equals(trueString) == false))) { + failed("SetObject(bool) should be stored as \"" + falseString + "\" or \"" + trueString + + "\" char. Values from select " + retVal + ", " + retVal2); + + rs.close(); + stmt.close(); + conn.close(); + return; } - } - } + } + rs = stmt.executeQuery( + "SELECT C_CHAR_50, C_VARCHAR_50 FROM " + JDRSTest.RSTEST_GET + " WHERE C_KEY like 'PROP_CHAR_BOOL%' "); + while (rs.next()) { + String retVal = rs.getString("C_CHAR_50").trim(); + String retVal2 = rs.getString("C_VARCHAR_50"); + if ((retVal.equals(trueString) == false) || (retVal2.equals(trueString) == false)) { + failed("SetObject(bool) should be stored as \"" + trueString + "\" char. Values from select " + retVal + + ", " + retVal2); -/** -updateObject() - Update a CHAR, when the value is too big. -**/ - public void Var053 () - { - setupRs(); - if (checkJdbc20 ()) { - int expectedColumn = -1; - try { - JDRSTest.position (rs_, key_); - expectedColumn = rs_.findColumn ("C_CHAR_1"); - rs_.updateObject ("C_CHAR_1", "Minnesota"); - rs_.updateRow (); - failed ("Didn't throw SQLException"); - } - catch (Exception e) { - DataTruncation dt = (DataTruncation)e; - assertCondition ((dt.getIndex() == expectedColumn) - && (dt.getParameter() == false) - && (dt.getRead() == false) - && (dt.getDataSize() == 9) - && (dt.getTransferSize() == 1)); + rs.close(); + stmt.close(); + conn.close(); + return; + } + } + conn.setAutoCommit(true); + rs.close(); + stmt.executeUpdate("DELETE FROM " + JDRSTest.RSTEST_GET + " WHERE C_KEY like 'PROP_CHAR_BOOL%' "); } - } - } + + stmt.close(); + assertCondition(true); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } else + notApplicable("Toolbox property"); + } -/** -updateObject() - Update a VARCHAR. -**/ - public void Var054 () - { - setupRs(); - if (checkJdbc20 ()) { - try { - JDRSTest.position (rs_, key_); - rs_.updateObject ("C_VARCHAR_50", "Wisconsin"); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - String v = rs2.getString ("C_VARCHAR_50"); - rs2.close (); - assertCondition (v.equals ("Wisconsin")); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } + public void dfpTest(String table, Object value, String expected) { + dfpTest(table, value, expected, expected); + } + public void dfpTest(String table, Object value, String expected, String expected2) { + dfpTest(table, value, expected, expected2, expected2); + } -/** -updateObject() - Update a VARCHAR, when the value is too big. -**/ - public void Var055 () - { - setupRs(); - if (checkJdbc20 ()) { - int expectedColumn = -1; + public void dfpTest(String table, Object value, String expected, String expected2, String expected3) { + if (checkDecFloatSupport()) { + + try { + + Statement s = connection_.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); + ResultSet rs = s.executeQuery("SELECT * FROM " + table + " FOR UPDATE "); + rs.next(); + rs.updateObject(1, value); + rs.updateRow(); /* serialized */ + + ResultSet rs2 = statement2f_.executeQuery("SELECT * FROM " + table); + rs2.next(); + String v = rs2.getString(1); + rs2.close(); + rs.close(); + s.close(); try { - JDRSTest.position (rs_, key_); - expectedColumn = rs_.findColumn ("C_VARCHAR_50"); - rs_.updateObject ("C_VARCHAR_50", "Michigan, Illinois, Indiana, and whatever states around there that I have missed."); - rs_.updateRow (); - failed ("Didn't throw SQLException"); - } - catch (Exception e) { - DataTruncation dt = (DataTruncation)e; - assertCondition ((dt.getIndex() == expectedColumn) - && (dt.getParameter() == false) - && (dt.getRead() == false) - && (dt.getDataSize() == 81) - && (dt.getTransferSize() == 50)); - - } + connection_.commit(); + } catch (Exception e) { } + assertCondition( + (v == null && expected == null) || (v != null && v.equals(expected)) || (v != null && v.equals(expected2)) + || (v != null && v.equals(expected3)), + "Got " + v + " from " + value + " sb " + expected + " or " + expected2 + " or " + expected3); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } } + } + /** + * updateObject -- set DFP16 to different values and retrieve + */ + public void Var078() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, "4533.43", "4533.43"); + } + public void Var079() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, "NaN", "NaN"); + } -/** -updateObject() - Update a BINARY. -**/ - public void Var056 () - { - setupRs(); - if (checkJdbc20 ()) - { - try - { - String expected; - if (isToolboxDriver()) - expected = "F1F2"; - else - expected = "Ford"; - - JDRSTest.position (rs_, key_); - rs_.updateObject ("C_BINARY_20", expected); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - String v = rs2.getString ("C_BINARY_20"); - rs2.close (); - assertCondition (v.startsWith (expected)); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } + public void Var080() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, "NAN", "NaN"); + } + public void Var081() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+NaN", "NaN"); + } + public void Var082() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, "-NaN", "-NaN"); + } -/** -updateObject() - Update a BINARY, when the value is too big. -**/ - public void Var057 () - { - setupRs(); - if (checkJdbc20 ()) { - int expectedColumn = -1; - try { - JDRSTest.position (rs_, key_); - expectedColumn = rs_.findColumn ("C_BINARY_1"); - rs_.updateObject ("C_BINARY_1", "F1F2F3F4"); - rs_.updateRow (); - failed ("Didn't throw SQLException"); - } - catch (Exception e) { - DataTruncation dt = (DataTruncation)e; - assertCondition ((dt.getIndex() == expectedColumn) - && (dt.getParameter() == false) - && (dt.getRead() == false) - && (dt.getTransferSize() == 1)); + public void Var083() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, "QNaN", "NaN"); + } - } - } - } + public void Var084() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+QNaN", "NaN"); + } + + public void Var085() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, "-QNaN", "-NaN"); + } + public void Var086() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, "SNaN", "SNaN"); + } + public void Var087() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+SNaN", "SNaN"); + } -/** -updateObject() - Update a VARBINARY. -**/ - public void Var058 () - { - setupRs(); - if (checkJdbc20 ()) { - try - { - String expected; - if (isToolboxDriver()) - expected = "F1F2"; - else - expected = "Ford"; - - JDRSTest.position (rs_, key_); - rs_.updateObject ("C_VARBINARY_20", expected); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - String v = rs2.getString ("C_VARBINARY_20"); - rs2.close (); - assertCondition (v.equals (expected)); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } + public void Var088() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, "-SNaN", "-SNaN"); + } + public void Var089() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, "INF", "Infinity"); + } + public void Var090() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+INF", "Infinity"); + } -/** -updateObject() - Update a VARBINARY, when the value is too big. -**/ - public void Var059 () - { - setupRs(); - if (checkJdbc20 ()) { - int expectedColumn = -1; - try { - JDRSTest.position (rs_, key_); - expectedColumn = rs_.findColumn ("C_VARBINARY_20"); - rs_.updateObject ("C_VARBINARY_20", "E1E2E3E4E5F1F2F3F4F5C1C2C3C4C5D1D2D3D3D5E1E2E3E4E5F1F2F3F4F5C1C2C3C4C5D1D2D3D3D5"); - rs_.updateRow (); - failed ("Didn't throw SQLException"); - } - catch (Exception e) { - DataTruncation dt = (DataTruncation)e; - assertCondition ((dt.getIndex() == expectedColumn) - && (dt.getParameter() == false) - && (dt.getRead() == false) - && (dt.getTransferSize() == 20)); + public void Var091() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, "-INF", "-Infinity"); + } - } - } - } + public void Var092() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, "Infinity", "Infinity"); + } + public void Var093() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+Infinity", "Infinity"); + } + public void Var094() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, "-Infinity", "-Infinity"); + } -/** -updateObject() - Update a CLOB, when the data is stored in the result -set. -**/ - public void Var060 () - { - setupRs(); - if (checkJdbc20 ()) { - if (checkLobSupport ()) { - try { - JDRSTest.position (rs_, key_); - String s = "New Mexico"; - Clob c = new JDLobTest.JDTestClob (s); - rs_.updateObject ("C_CLOB", c); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - String v = rs2.getString ("C_CLOB"); - rs2.close (); - assertCondition (v.equals (s)); - } - catch (Exception e) { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } - } - } + public void Var095() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, "1234567890123456", "1234567890123456"); + } + public void Var096() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, "-1234567890123456", "-1234567890123456"); + } + public void Var097() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+1234567890123456", "1234567890123456"); + } -/** -updateObject() - Update a CLOB, when the locator is stored in the result -set. -**/ - public void Var061 () - { - setupRs(); - if (checkJdbc20 ()) { - if (checkLobSupport ()) { - try { - JDRSTest.position (rs3_, key_); - String s = "New Mexico"; - Clob c = new JDLobTest.JDTestClob (s); - rs3_.updateObject ("C_CLOB", c); - rs3_.updateRow (); - ResultSet rs2 = statement4_.executeQuery (select_); - JDRSTest.position (rs2, key_); - String v = rs2.getString ("C_CLOB"); - rs2.close (); - assertCondition (v.equals (s)); - } - catch (Exception e) { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } - } - } + public void Var098() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+1234567890123456E28", "1.234567890123456E+43"); + } + public void Var099() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+1234567890123456E+28", "1.234567890123456E+43"); + } + public void Var100() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+123456789012345.6E+29", "1.234567890123456E+43"); + } -/** -updateObject() - Update a DBCLOB, when the data is stored in the result -set. -**/ - public void Var062 () - { - setupRs(); - if (checkJdbc20 ()) { - if (checkLobSupport ()) { - try { - JDRSTest.position (rs_, key_); - String s = "Arizona"; - Clob c = new JDLobTest.JDTestClob (s); - rs_.updateObject ("C_DBCLOB", c); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - String v = rs2.getString ("C_DBCLOB"); - rs2.close (); - assertCondition (v.equals (s)); - } - catch (Exception e) { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } - } - } + public void Var101() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+0.01234567890123456E+45", "1.234567890123456E+43"); + } + public void Var102() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, "-1234567890123456E28", "-1.234567890123456E+43"); + } + public void Var103() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, "1E0", "1"); + } -/** -updateObject() - Update a DBCLOB, when the locator is stored in the result -set. -**/ - public void Var063 () - { - setupRs(); - if (checkJdbc20 ()) { - if (checkLobSupport ()) { - try { - JDRSTest.position (rs3_, key_); - String s = "Arizona"; - Clob c = new JDLobTest.JDTestClob (s); - rs3_.updateObject ("C_DBCLOB", c); - rs3_.updateRow (); - ResultSet rs2 = statement4_.executeQuery (select_); - JDRSTest.position (rs2, key_); - String v = rs2.getString ("C_DBCLOB"); - rs2.close (); - assertCondition (v.equals (s)); - } - catch (Exception e) { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } - } - } + public void Var104() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, "1.1", "1.1"); + } + public void Var105() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, "1.1E0", "1.1"); + } + public void Var106() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, null, null); + } -/** -updateObject() - Update a BLOB, when the data is stored in the result -set. -**/ - public void Var064 () - { - setupRs(); - if (checkJdbc20 ()) { - if (checkLobSupport ()) { - try { - JDRSTest.position (rs_, key_); - byte[] ba = { 54, 65, -34, 65, 0, -2, -1, 0}; - Blob b = new JDLobTest.JDTestBlob (ba); - rs_.updateObject ("C_BLOB", b); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - byte[] v = rs2.getBytes ("C_BLOB"); - rs2.close (); - assertCondition (areEqual (v, ba)); - } - catch (Exception e) { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } - } - } + public void Var107() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, new BigDecimal("4533.43"), "4533.43"); + } + public void Var108() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, new BigDecimal("1234567890123456"), "1234567890123456"); + } + public void Var109() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, new BigDecimal("-1234567890123456"), "-1234567890123456"); + } -/** -updateObject() - Update a BLOB, when the locator is stored in the result -set. -**/ - public void Var065 () - { - setupRs(); - if (checkJdbc20 ()) { - if (checkLobSupport ()) { - try { - JDRSTest.position (rs3_, key_); - byte[] ba = { 54, 65, -34, 65, 0, -2, -1, 0}; - Blob b = new JDLobTest.JDTestBlob (ba); - rs3_.updateObject ("C_BLOB", b); - rs3_.updateRow (); - ResultSet rs2 = statement4_.executeQuery (select_); - JDRSTest.position (rs2, key_); - byte[] v = rs2.getBytes ("C_BLOB"); - rs2.close (); - assertCondition (areEqual (v, ba)); - } - catch (Exception e) { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } - } - } + public void Var110() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, new BigDecimal("+1234567890123456"), "1234567890123456"); + } + public void Var111() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, new BigDecimal("+1234567890123456E28"), "1.234567890123456E+43"); + } + public void Var112() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, new BigDecimal("+1234567890123456E+28"), "1.234567890123456E+43"); + } -/** -updateObject() - Update a DATE. -**/ - public void Var066 () - { - setupRs(); - if (checkJdbc20 ()) { - try - { - JDRSTest.position (rs_, key_); - Date d = new Date (1922400000); - rs_.updateObject ("C_DATE", d); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - Date v = rs2.getDate ("C_DATE"); - rs2.close (); - - assertCondition (v.toString().equals(d.toString())); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } + public void Var113() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, new BigDecimal("+123456789012345.6E+29"), "1.234567890123456E+43"); + } + public void Var114() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, new BigDecimal("+0.01234567890123456E+45"), "1.234567890123456E+43"); + } + public void Var115() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, new BigDecimal("-1234567890123456E28"), "-1.234567890123456E+43"); + } -/** -updateObject() - Update a DATE, when the string is not a valid date. -**/ - public void Var067 () - { - setupRs(); - if (checkJdbc20 ()) { - try { - JDRSTest.position (rs_, key_); - rs_.updateObject ("C_DATE", "Nevada"); - failed ("Didn't throw SQLException"); - } - catch (Exception e) { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } - } + public void Var116() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, new BigDecimal("1E0"), "1"); + } + public void Var117() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, new BigDecimal("1.1"), "1.1"); + } + public void Var118() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, new BigDecimal("1.1E0"), "1.1"); + } -/** -updateObject() - Update a TIME. -**/ - public void Var068 () - { - setupRs(); - if (checkJdbc20 ()) { - try { - JDRSTest.position (rs_, key_); - Time t = Time.valueOf ("07:36:00"); - rs_.updateObject ("C_TIME", t); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - Time v = rs2.getTime ("C_TIME"); - rs2.close (); - assertCondition (v.toString ().equals (t.toString ())); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } + public void Var119() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, Float.valueOf(4533.43f), "4533.43"); + } + public void Var120() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, Float.valueOf(Float.NaN), "NaN"); + } + public void Var121() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, Float.valueOf(Float.POSITIVE_INFINITY), "Infinity"); + } -/** -updateObject() - Update a TIME, when the string is not a valid time. -**/ - public void Var069 () - { - setupRs(); - if (checkJdbc20 ()) { - try { - JDRSTest.position (rs_, key_); - rs_.updateObject ("C_TIME", "Wyoming"); - failed ("Didn't throw SQLException"); - } - catch (Exception e) { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } - } + public void Var122() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, Float.valueOf(Float.NEGATIVE_INFINITY), "-Infinity"); + } + public void Var123() { + /* with the new native PASE support, this comes back with the zeros */ + /* + * Java 21, specifically starting from Java 19, changed the behavior of + * Double.toString() and Float.toString() to produce the smallest number of + * digits that still uniquely distinguish the float or double from its adjacent + * float or double. + */ + dfpTest(JDRSTest.RSTEST_UPDDFP16, Float.valueOf(-1234567890123456.0f), "-1.23456795E+15", "-1234567950000000", + "-1.234568E15"); -/** -updateObject() - Update a TIMESTAMP. -**/ - public void Var070 () - { - setupRs(); - if (checkJdbc20 ()) { - try { - JDRSTest.position (rs_, key_); - Timestamp ts = new Timestamp (425252435); - rs_.updateObject ("C_TIMESTAMP", ts); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - Timestamp v = rs2.getTimestamp ("C_TIMESTAMP"); - rs2.close (); - assertCondition (v.equals (ts)); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } + } + public void Var124() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, Double.valueOf(4533.43f), "4533.43017578125"); + } + public void Var125() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, Double.valueOf(Double.NaN), "NaN"); + } -/** -updateObject() - Update a TIMESTAMP, when the string is not a vliad timestamp. -**/ - public void Var071 () - { - setupRs(); - if (checkJdbc20 ()) { - try { - JDRSTest.position (rs_, key_); - rs_.updateObject ("C_TIMESTAMP", "Montana"); - failed ("Didn't throw SQLException"); - } - catch (Exception e) { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } - } + public void Var126() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, Double.valueOf(Double.POSITIVE_INFINITY), "Infinity"); + } + public void Var127() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, Double.valueOf(Double.NEGATIVE_INFINITY), "-Infinity"); + } + public void Var128() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, Double.valueOf(-1234567890123456.0), "-1234567890123456"); + } -/** -updateObject() - Update a DATALINK. -**/ - public void Var072 () - { - setupRs(); - if (checkJdbc20 ()) { - if (checkLobSupport ()) { - // We do not test updating datalinks, since it is not - // possible to open a updatable cursor/result set with - // a datalink column. - notApplicable("DATALINK update not supported."); - /* - try { - JDRSTest.position (rs_, key_); - rs_.updateObject ("C_DATALINK", "Idaho"); - failed ("Didn't throw SQLException"); - } - catch (Exception e) { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - */ - } - } - } + /** + * New comma decimal separator tests + **/ + /** + * updateObject() - Update a DECIMAL, with no scale specified. + **/ + public void Var129() { + String added = " -- added 12/17/2009 to test native driver for CPS 7YSU2X"; + setupRsCommaSeparator(); + if (checkJdbc20()) { + + try { + + JDRSTest.position(rsCommaSeparator_, key_); + rsCommaSeparator_.updateObject("C_DECIMAL_105", new BigDecimal(-4539.9)); + rsCommaSeparator_.updateRow(); + ResultSet rs2 = statementCommaSeparator2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + BigDecimal v = rs2.getBigDecimal("C_DECIMAL_105"); + rs2.close(); + assertCondition(v.floatValue() == -4539.9f, added); + } catch (Exception e) { + failed(e, "Unexpected Exception" + added); + } + } + } -/** -updateObject() - Update a DISTINCT. -**/ - public void Var073 () - { - setupRs(); - if (checkJdbc20 ()) { - if (checkLobSupport ()) { - try { - JDRSTest.position (rs_, key_); - rs_.updateObject ("C_DISTINCT", "Washing"); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - String v = rs2.getString ("C_DISTINCT"); - rs2.close (); - assertCondition (v.equals ("Washing ")); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } + /** + * updateObject() - Update a DECIMAL, when the fraction will truncate. This is + * ok. + **/ + public void Var130() { + String added = " -- added 12/17/2009 to test native driver for CPS 7YSU2X"; + setupRsCommaSeparator(); + if (checkJdbc20()) { + + try { + + JDRSTest.position(rsCommaSeparator_, key_); + rsCommaSeparator_.updateObject("C_DECIMAL_105", new BigDecimal(-4539.987666666)); + rsCommaSeparator_.updateRow(); + ResultSet rs2 = statementCommaSeparator2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + BigDecimal v = rs2.getBigDecimal("C_DECIMAL_105"); + rs2.close(); + assertCondition(v.equals(new BigDecimal("-4539.98766")), added); + } catch (Exception e) { + failed(e, "Unexpected Exception" + added); + } } + } + /** + * updateObject() - Update a DECIMAL, with scale 0 specified. + **/ + public void Var131() { + String added = " -- added 12/17/2009 to test native driver for CPS 7YSU2X"; + setupRsCommaSeparator(); + if (checkJdbc20()) { + + try { + + JDRSTest.position(rsCommaSeparator_, key_); + rsCommaSeparator_.updateObject("C_DECIMAL_105", new BigDecimal(39455.58734), 0); + rsCommaSeparator_.updateRow(); + ResultSet rs2 = statementCommaSeparator2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + BigDecimal v = rs2.getBigDecimal("C_DECIMAL_105"); + rs2.close(); + assertCondition(v.floatValue() == 39455, added); + } catch (Exception e) { + failed(e, "Unexpected Exception" + added); + } + } + } + /** + * updateObject() - Update a DECIMAL, with scale less than the value's scale. + **/ + public void Var132() { + String added = " -- added 12/17/2009 to test native driver for CPS 7YSU2X"; + setupRsCommaSeparator(); + if (checkJdbc20()) { + + try { + + JDRSTest.position(rsCommaSeparator_, key_); + rsCommaSeparator_.updateObject("C_DECIMAL_105", new BigDecimal(34255.53434), 3); + rsCommaSeparator_.updateRow(); + ResultSet rs2 = statementCommaSeparator2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + BigDecimal v = rs2.getBigDecimal("C_DECIMAL_105"); + rs2.close(); + assertCondition(v.floatValue() == 34255.534f, added); + } catch (Exception e) { + failed(e, "Unexpected Exception" + added); + } + } + } -/** -updateObject() - Update a BIGINT. -**/ - public void Var074() - { - setupRs(); - if (checkJdbc20 ()) { - if (checkBigintSupport()) { - try { - JDRSTest.position (rs_, key_); - rs_.updateObject ("C_BIGINT", Integer.valueOf(223833)); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - long v = rs2.getLong("C_BIGINT"); - rs2.close (); - assertCondition (v == 223833); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } + /** + * updateObject() - Update a DECIMAL, with scale equal to the value's scale. + **/ + public void Var133() { + String added = " -- added 12/17/2009 to test native driver for CPS 7YSU2X"; + setupRsCommaSeparator(); + if (checkJdbc20()) { + + try { + + JDRSTest.position(rsCommaSeparator_, key_); + rsCommaSeparator_.updateObject("C_DECIMAL_105", new BigDecimal(54321.12345), 5); + rsCommaSeparator_.updateRow(); + ResultSet rs2 = statementCommaSeparator2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + BigDecimal v = rs2.getBigDecimal("C_DECIMAL_105"); + rs2.close(); + assertCondition(v.floatValue() == 54321.12345f, added); + } catch (Exception e) { + failed(e, "Unexpected Exception" + added); + } } + } - - -/** -updateObject() - Update an BIGINT, when the object is not a number. -**/ - public void Var075() - { - setupRs(); - if (checkJdbc20 ()) { - if (checkBigintSupport()) { - try { - JDRSTest.position (rs_, key_); - rs_.updateObject ("C_BIGINT", "Tennessee"); - failed ("Didn't throw SQLException"); - } - catch (Exception e) { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } - } + /** + * updateObject() - Update a DECIMAL, with scale greater the value's scale. + **/ + public void Var134() { + String added = " -- added 12/17/2009 to test native driver for CPS 7YSU2X"; + setupRsCommaSeparator(); + if (checkJdbc20()) { + + try { + + JDRSTest.position(rsCommaSeparator_, key_); + rsCommaSeparator_.updateObject("C_DECIMAL_105", new BigDecimal(54321.12345), 8); + rsCommaSeparator_.updateRow(); + ResultSet rs2 = statementCommaSeparator2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + BigDecimal v = rs2.getBigDecimal("C_DECIMAL_105"); + rs2.close(); + assertCondition(v.floatValue() == 54321.12345f, added); + } catch (Exception e) { + failed(e, "Unexpected Exception" + added); + } } + } -/** B1A -updateObject() - Update an BIGINT, when the integer is too big. -**/ - public void Var076() - { - if (checkNative()) { - setupRs(); - if (checkJdbc20 ()) { - if (checkBigintSupport()) { - try { - JDRSTest.position (rs_, key_); - rs_.updateObject ("C_BIGINT", new BigDecimal ("-994535874335432445653")); - failed ("Didn't throw SQLException"); - } catch (Exception e) { - - - boolean success = e.getMessage().indexOf("Data type mismatch") != -1; - if (success) { - assertCondition(true); - } else { - failed(e, "Expected data type mismatch -- updated 7/1/2014 to match other data types"); - } - - } - } - } + /** + * updateObject() - Update a DECIMAL, when the value is too big. + **/ + public void Var135() { + String added = " -- added 12/17/2009 to test native driver for CPS 7YSU2X"; + setupRsCommaSeparator(); + if (checkJdbc20()) { + int expectedColumn = -1; + + try { + + JDRSTest.position(rsCommaSeparator_, key_); + expectedColumn = rsCommaSeparator_.findColumn("C_DECIMAL_105"); + rsCommaSeparator_.updateObject("C_DECIMAL_105", new BigDecimal("394585.432389445")); + rsCommaSeparator_.updateRow(); + failed("Didn't throw SQLException"); + } catch (Exception e) { + if (e instanceof DataTruncation) { + DataTruncation dt = (DataTruncation) e; + assertCondition((dt.getIndex() == expectedColumn) && (dt.getParameter() == false) && (dt.getRead() == false) + && (dt.getDataSize() == 15) && (dt.getTransferSize() == 10), added); + } else { + assertSqlException(e, -99999, "07006", "Data type mismatch", + "Mismatch instead of truncation in latest toolbox"); } - } - - /** - setObject() - Set a CHAR parameter using Types.BOOLEAN. - This is by customer request. Property "translate boolean", true is default - - This is to test property to force toolbox to match native driver's behavior. - It was decided that the native driver's behavior was correct, but we cannot - break existing customers' apps, so added this property for customer. - **/ - public void Var077() { - Connection conn = null; - Statement stmt = null; - // AS400JDBCDataSource ds = null; - - if (isToolboxDriver()) { - try { - for (int x = 0; x < 2; x++) { - - //"boolean string" property setting "true" is default, and driver just used old boolean values in setOjbect - String trueString = null; - String falseString = null; - String url = null; - - if (x == 0) { - //first time in iteration, use "true" and "false" in setObject - trueString = "true"; //toolbox default - falseString = "false"; //toolbox default - //don't set the "boolean string" property, true should be default - url = baseURL_ ; //;translate boolean=true by default - conn = testDriver_.getConnection (url,systemObject_.getUserId(), encryptedPassword_); - } else if (x == 1) { - //second time in iteration, use "0" and "1" in setObject - trueString = "1"; //toolbox matches Native here - falseString = "0"; //toolbox matches Native here - //this time, explicity set property "boolean string" false - url = baseURL_ + ";translate boolean=false"; - conn = testDriver_.getConnection (url,systemObject_.getUserId(), encryptedPassword_); - } - - if (conn == null) { - throw new Exception("Connection is null"); - } - stmt = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, - ResultSet.CONCUR_UPDATABLE); - - - - PreparedStatement ps = conn.prepareStatement("INSERT INTO " + JDRSTest.RSTEST_GET - + " (C_KEY, C_CHAR_50, C_VARCHAR_50 ) " + - " VALUES (?, ?, ?)"); - ps.setString(1, "PROP_CHAR_BOOL1"); - ps.setObject(2, Boolean.valueOf(true), Types.BOOLEAN); - ps.setObject(3, Boolean.valueOf(true), Types.BOOLEAN); - ps.executeUpdate(); - ps.setString(1, "PROP_CHAR_BOOL2"); - ps.setObject(2, Boolean.valueOf(false), Types.BOOLEAN); - ps.setObject(3, Boolean.valueOf(false), Types.BOOLEAN); - ps.executeUpdate(); - - ps.close(); - conn.setAutoCommit(false); - ResultSet rs = stmt.executeQuery("SELECT C_CHAR_50, C_VARCHAR_50 FROM " - + JDRSTest.RSTEST_GET - + " WHERE C_KEY like 'PROP_CHAR_BOOL%' "); - - while (rs.next()) { - - rs.updateObject("C_CHAR_50", Boolean.valueOf(true)); - rs.updateObject("C_VARCHAR_50", Boolean.valueOf(true)); - rs.updateRow(); - conn.commit(); - String retVal = rs.getString("C_CHAR_50").trim(); - String retVal2 = rs.getString("C_VARCHAR_50"); - - if ( ((retVal.equals( falseString ) == false) && (retVal.equals( trueString ) == false)) - || ((retVal2.equals( falseString ) == false) && (retVal2.equals( trueString ) == false)) ) { - failed("SetObject(bool) should be stored as \"" + falseString + "\" or \"" + trueString - + "\" char. Values from select " + retVal + ", " + retVal2 ); - - stmt.close(); - conn.close(); - return; - } - } - - - rs = stmt.executeQuery("SELECT C_CHAR_50, C_VARCHAR_50 FROM " - + JDRSTest.RSTEST_GET - + " WHERE C_KEY like 'PROP_CHAR_BOOL%' "); - - while (rs.next()) { - String retVal = rs.getString("C_CHAR_50").trim(); - String retVal2 = rs.getString("C_VARCHAR_50"); - if ( (retVal.equals( trueString ) == false) - || (retVal2.equals( trueString ) == false) ) { - failed("SetObject(bool) should be stored as \"" + trueString - + "\" char. Values from select " + retVal + ", " + retVal2 ); - - stmt.close(); - conn.close(); - return; - } - } - conn.setAutoCommit(true); - stmt.executeUpdate("DELETE FROM " + JDRSTest.RSTEST_GET + " WHERE C_KEY like 'PROP_CHAR_BOOL%' "); - - } - - assertCondition(true); - - } catch (Exception e) { - failed(e, "Unexpected Exception"); - } - - } else - notApplicable("Toolbox property"); + } } - - public void dfpTest(String table, Object value, String expected) { - dfpTest(table, value, expected, expected); } - public void dfpTest(String table, Object value, String expected, String expected2) { - dfpTest(table, value, expected, expected2, expected2); + + /** + * updateObject() - Update a NUMERIC, with no scale specified. + **/ + public void Var136() { + String added = " -- added 12/17/2009 to test native driver for CPS 7YSU2X"; + setupRsCommaSeparator(); + if (checkJdbc20()) { - } - public void dfpTest(String table, Object value, String expected, String expected2, String expected3) { - if (checkDecFloatSupport()) { - try { - Statement s = connection_.createStatement( - ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); - ResultSet rs = s.executeQuery("SELECT * FROM " + table + " FOR UPDATE "); - rs.next(); - rs.updateObject(1, value); - rs.updateRow(); - - ResultSet rs2 = statement2f_.executeQuery("SELECT * FROM " + table); - rs2.next(); - String v = rs2.getString(1); - rs2.close(); - s.close(); - try { - connection_.commit(); - } catch (Exception e) {} - assertCondition((v==null && expected==null) || - (v!=null && v.equals(expected)) || - (v!=null && v.equals(expected2)) || - (v!=null && v.equals(expected3)) , "Got " + v + " from "+ value +" sb " + expected + " or "+expected2+" or "+expected3); - } catch (Exception e) { - failed(e, "Unexpected Exception"); - } - } + try { + + JDRSTest.position(rsCommaSeparator_, key_); + rsCommaSeparator_.updateObject("C_NUMERIC_105", new BigDecimal(-6639.95)); + rsCommaSeparator_.updateRow(); + ResultSet rs2 = statementCommaSeparator2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + BigDecimal v = rs2.getBigDecimal("C_NUMERIC_105"); + rs2.close(); + assertCondition(v.floatValue() == -6639.95f, added); + } catch (Exception e) { + failed(e, "Unexpected Exception" + added); + } } + } - - /** - * updateObject -- set DFP16 to different values and retrieve - */ - public void Var078 () { dfpTest(JDRSTest.RSTEST_DFP16, "4533.43", "4533.43"); } - public void Var079 () { dfpTest(JDRSTest.RSTEST_DFP16, "NaN", "NaN");} - public void Var080 () { dfpTest(JDRSTest.RSTEST_DFP16, "NAN", "NaN");} - public void Var081 () { dfpTest(JDRSTest.RSTEST_DFP16, "+NaN", "NaN");} - public void Var082 () { dfpTest(JDRSTest.RSTEST_DFP16, "-NaN", "-NaN");} - public void Var083 () { dfpTest(JDRSTest.RSTEST_DFP16, "QNaN", "NaN");} - public void Var084 () { dfpTest(JDRSTest.RSTEST_DFP16, "+QNaN", "NaN");} - public void Var085 () { dfpTest(JDRSTest.RSTEST_DFP16, "-QNaN", "-NaN");} - public void Var086 () { dfpTest(JDRSTest.RSTEST_DFP16, "SNaN", "SNaN");} - public void Var087 () { dfpTest(JDRSTest.RSTEST_DFP16, "+SNaN", "SNaN");} - public void Var088 () { dfpTest(JDRSTest.RSTEST_DFP16, "-SNaN", "-SNaN");} - public void Var089 () { dfpTest(JDRSTest.RSTEST_DFP16, "INF", "Infinity");} - public void Var090 () { dfpTest(JDRSTest.RSTEST_DFP16, "+INF", "Infinity");} - public void Var091 () { dfpTest(JDRSTest.RSTEST_DFP16, "-INF", "-Infinity");} - public void Var092 () { dfpTest(JDRSTest.RSTEST_DFP16, "Infinity", "Infinity");} - public void Var093 () { dfpTest(JDRSTest.RSTEST_DFP16, "+Infinity", "Infinity");} - public void Var094 () { dfpTest(JDRSTest.RSTEST_DFP16, "-Infinity", "-Infinity");} - public void Var095 () { dfpTest(JDRSTest.RSTEST_DFP16, "1234567890123456", "1234567890123456");} - public void Var096 () { dfpTest(JDRSTest.RSTEST_DFP16, "-1234567890123456", "-1234567890123456");} - public void Var097 () { dfpTest(JDRSTest.RSTEST_DFP16, "+1234567890123456","1234567890123456");} - public void Var098 () { - dfpTest(JDRSTest.RSTEST_DFP16, "+1234567890123456E28","1.234567890123456E+43"); - } - public void Var099 () { - dfpTest(JDRSTest.RSTEST_DFP16, "+1234567890123456E+28","1.234567890123456E+43"); - } - public void Var100 () { - dfpTest(JDRSTest.RSTEST_DFP16, "+123456789012345.6E+29","1.234567890123456E+43"); - } - public void Var101 () { - dfpTest(JDRSTest.RSTEST_DFP16, "+0.01234567890123456E+45","1.234567890123456E+43"); - } - public void Var102 () { - dfpTest(JDRSTest.RSTEST_DFP16, "-1234567890123456E28","-1.234567890123456E+43"); + /** + * updateObject() - Update a NUMERIC, when the fraction will truncate. + **/ + public void Var137() { + String added = " -- added 12/17/2009 to test native driver for CPS 7YSU2X"; + setupRsCommaSeparator(); + if (checkJdbc20()) { + + try { + + JDRSTest.position(rsCommaSeparator_, key_); + rsCommaSeparator_.updateObject("C_NUMERIC_40", new BigDecimal(-4539.98)); + rsCommaSeparator_.updateRow(); + ResultSet rs2 = statementCommaSeparator2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + BigDecimal v = rs2.getBigDecimal("C_NUMERIC_40"); + rs2.close(); + assertCondition(v.equals(new BigDecimal(-4539.0)), added); + } catch (Exception e) { + failed(e, "Unexpected Exception" + added); + } } - - public void Var103 () { dfpTest(JDRSTest.RSTEST_DFP16, "1E0", "1");} - public void Var104 () { dfpTest(JDRSTest.RSTEST_DFP16, "1.1", "1.1");} - public void Var105 () { dfpTest(JDRSTest.RSTEST_DFP16, "1.1E0", "1.1");} - public void Var106 () { dfpTest(JDRSTest.RSTEST_DFP16, null, null);} + } - public void Var107 () { dfpTest(JDRSTest.RSTEST_DFP16, new BigDecimal("4533.43"), "4533.43"); } - public void Var108 () { dfpTest(JDRSTest.RSTEST_DFP16, new BigDecimal("1234567890123456"), "1234567890123456");} - public void Var109 () { dfpTest(JDRSTest.RSTEST_DFP16, new BigDecimal("-1234567890123456"), "-1234567890123456");} - public void Var110 () { dfpTest(JDRSTest.RSTEST_DFP16, new BigDecimal("+1234567890123456"),"1234567890123456");} - public void Var111 () { - dfpTest(JDRSTest.RSTEST_DFP16, new BigDecimal("+1234567890123456E28"),"1.234567890123456E+43"); - } - public void Var112 () { - dfpTest(JDRSTest.RSTEST_DFP16, new BigDecimal("+1234567890123456E+28"),"1.234567890123456E+43"); - } - public void Var113 () { - dfpTest(JDRSTest.RSTEST_DFP16, new BigDecimal("+123456789012345.6E+29"),"1.234567890123456E+43"); - } - public void Var114 () { - dfpTest(JDRSTest.RSTEST_DFP16, new BigDecimal("+0.01234567890123456E+45"),"1.234567890123456E+43"); - } - public void Var115 () { - dfpTest(JDRSTest.RSTEST_DFP16, new BigDecimal("-1234567890123456E28"),"-1.234567890123456E+43"); + /** + * updateObject() - Update a NUMERIC, with scale 0 specified. + **/ + public void Var138() { + String added = " -- added 12/17/2009 to test native driver for CPS 7YSU2X"; + setupRsCommaSeparator(); + if (checkJdbc20()) { + + try { + + JDRSTest.position(rsCommaSeparator_, key_); + rsCommaSeparator_.updateObject("C_NUMERIC_105", new BigDecimal(39458.88734), 0); + rsCommaSeparator_.updateRow(); + ResultSet rs2 = statementCommaSeparator2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + BigDecimal v = rs2.getBigDecimal("C_NUMERIC_105"); + rs2.close(); + assertCondition(v.floatValue() == 39458, added); + } catch (Exception e) { + failed(e, "Unexpected Exception" + added); + } } - - public void Var116 () { dfpTest(JDRSTest.RSTEST_DFP16, new BigDecimal("1E0"), "1");} - public void Var117 () { dfpTest(JDRSTest.RSTEST_DFP16, new BigDecimal("1.1"), "1.1");} - public void Var118 () { dfpTest(JDRSTest.RSTEST_DFP16, new BigDecimal("1.1E0"), "1.1");} - + } - public void Var119 () { dfpTest(JDRSTest.RSTEST_DFP16, Float.valueOf(4533.43f), "4533.43"); } - public void Var120 () { dfpTest(JDRSTest.RSTEST_DFP16, Float.valueOf(Float.NaN), "NaN");} - public void Var121 () { dfpTest(JDRSTest.RSTEST_DFP16, Float.valueOf(Float.POSITIVE_INFINITY), "Infinity");} - public void Var122 () { dfpTest(JDRSTest.RSTEST_DFP16, Float.valueOf(Float.NEGATIVE_INFINITY), "-Infinity");} - public void Var123 () { + /** + * updateObject() - Update a NUMERIC, with scale less than the value's scale. + **/ + public void Var139() { + String added = " -- added 12/17/2009 to test native driver for CPS 7YSU2X"; + setupRsCommaSeparator(); + if (checkJdbc20()) { - /* with the new native PASE support, this comes back with the zeros*/ - /* Java 21, specifically starting from Java 19, changed the behavior of Double.toString() and Float.toString() - * to produce the smallest number of digits that still uniquely distinguish the float or - * double from its adjacent float or double. */ - dfpTest(JDRSTest.RSTEST_DFP16, Float.valueOf(-1234567890123456.0f), "-1.23456795E+15", "-1234567950000000","-1.234568E15"); - + try { + + JDRSTest.position(rsCommaSeparator_, key_); + rsCommaSeparator_.updateObject("C_NUMERIC_105", new BigDecimal(34255.53434), 3); + rsCommaSeparator_.updateRow(); + ResultSet rs2 = statementCommaSeparator2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + BigDecimal v = rs2.getBigDecimal("C_NUMERIC_105"); + rs2.close(); + assertCondition(v.floatValue() == 34255.534f, added); + } catch (Exception e) { + failed(e, "Unexpected Exception" + added); + } } - public void Var124 () { dfpTest(JDRSTest.RSTEST_DFP16, Double.valueOf(4533.43f), "4533.43017578125"); } - public void Var125 () { dfpTest(JDRSTest.RSTEST_DFP16, Double.valueOf(Double.NaN), "NaN");} - public void Var126 () { dfpTest(JDRSTest.RSTEST_DFP16, Double.valueOf(Double.POSITIVE_INFINITY), "Infinity");} - public void Var127 () { dfpTest(JDRSTest.RSTEST_DFP16, Double.valueOf(Double.NEGATIVE_INFINITY), "-Infinity");} - public void Var128 () { dfpTest(JDRSTest.RSTEST_DFP16, Double.valueOf(-1234567890123456.0), "-1234567890123456");} + } + /** + * updateObject() - Update a NUMERIC, with scale equal to the value's scale. + **/ + public void Var140() { + String added = " -- added 12/17/2009 to test native driver for CPS 7YSU2X"; + setupRsCommaSeparator(); + if (checkJdbc20()) { + + try { + + JDRSTest.position(rsCommaSeparator_, key_); + rsCommaSeparator_.updateObject("C_NUMERIC_105", new BigDecimal(54321.12345), 5); + rsCommaSeparator_.updateRow(); + ResultSet rs2 = statementCommaSeparator2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + BigDecimal v = rs2.getBigDecimal("C_NUMERIC_105"); + rs2.close(); + assertCondition(v.floatValue() == 54321.12345f, added); + } catch (Exception e) { + failed(e, "Unexpected Exception" + added); + } + } + } + /** + * updateObject() - Update a NUMERIC, with scale greater the value's scale. + **/ + public void Var141() { + String added = " -- added 12/17/2009 to test native driver for CPS 7YSU2X"; + setupRsCommaSeparator(); + if (checkJdbc20()) { + + try { + + JDRSTest.position(rsCommaSeparator_, key_); + rsCommaSeparator_.updateObject("C_NUMERIC_105", new BigDecimal(54321.12345), 8); + rsCommaSeparator_.updateRow(); + ResultSet rs2 = statementCommaSeparator2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + BigDecimal v = rs2.getBigDecimal("C_NUMERIC_105"); + rs2.close(); + assertCondition(v.floatValue() == 54321.12345f, added); + } catch (Exception e) { + failed(e, "Unexpected Exception" + added); + } + } + } -/** - New comma decimal separator tests -**/ + public void dfpTestCommaSeparator(String table, Object value, String expected) { + dfpTestCommaSeparator(table, value, expected, expected); + } -/** -updateObject() - Update a DECIMAL, with no scale specified. -**/ - public void Var129 () - { - - String added = " -- added 12/17/2009 to test native driver for CPS 7YSU2X"; - setupRsCommaSeparator(); - if (checkJdbc20 ()) { - try { - JDRSTest.position (rsCommaSeparator_, key_); - rsCommaSeparator_.updateObject ("C_DECIMAL_105", new BigDecimal (-4539.9)); - rsCommaSeparator_.updateRow (); - ResultSet rs2 = statementCommaSeparator2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - BigDecimal v = rs2.getBigDecimal ("C_DECIMAL_105"); - rs2.close (); - assertCondition (v.floatValue() == -4539.9f, added); - } - catch (Exception e) { - failed (e, "Unexpected Exception"+added); - } - } - } + public void dfpTestCommaSeparator(String table, Object value, String expected, String expected2) { + dfpTestCommaSeparator(table, value, expected, expected2, expected2); + } + public void dfpTestCommaSeparator(String table, Object value, String expected, String expected2, String expected3) { + String added = " -- added 12/17/2009 to test native driver for CPS 7YSU2X"; + if (checkDecFloatSupport()) { + + try { + -/** -updateObject() - Update a DECIMAL, when the fraction will truncate. This is ok. -**/ - public void Var130 () - { - String added = " -- added 12/17/2009 to test native driver for CPS 7YSU2X"; - setupRsCommaSeparator(); - if (checkJdbc20 ()) { - try { - JDRSTest.position (rsCommaSeparator_, key_); - rsCommaSeparator_.updateObject ("C_DECIMAL_105", new BigDecimal (-4539.987666666)); - rsCommaSeparator_.updateRow (); - ResultSet rs2 = statementCommaSeparator2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - BigDecimal v = rs2.getBigDecimal ("C_DECIMAL_105"); - rs2.close (); - assertCondition (v.equals(new BigDecimal("-4539.98766")), added); - } - catch (Exception e) { - failed (e, "Unexpected Exception"+added); - } + setupRsCommaSeparator(); + Statement s = connectionCommaSeparator_.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, + ResultSet.CONCUR_UPDATABLE); + ResultSet rs = s.executeQuery("SELECT * FROM " + table + " FOR UPDATE "); + rs.next(); + rs.updateObject(1, value); + rs.updateRow(); /* serialized */ + + ResultSet rs2 = statementCommaSeparator2f_.executeQuery("SELECT * FROM " + table); + rs2.next(); + String v = rs2.getString(1); + rs2.close(); + rs.close(); + s.close(); + try { + connection_.commit(); + } catch (Exception e) { } + assertCondition( + (v == null && expected == null) || (v != null && v.equals(expected)) || (v != null && v.equals(expected2)) + || (v != null && v.equals(expected3)), + "Got " + v + " from " + value + " sb " + expected + " or " + expected2 + " or " + expected3 + added); + } catch (Exception e) { + failed(e, "Unexpected Exception" + added); + } } + } + /** + * updateObject -- set DFP16 to different values and retrieve + */ + public void Var142() { + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP16, "4533,43", "4533,43"); + } + public void Var143() { + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP16, "1234567890123456", "1234567890123456"); + } -/** -updateObject() - Update a DECIMAL, with scale 0 specified. -**/ - public void Var131 () - { - String added = " -- added 12/17/2009 to test native driver for CPS 7YSU2X"; - setupRsCommaSeparator(); - if (checkJdbc20 ()) { - try { - JDRSTest.position (rsCommaSeparator_, key_); - rsCommaSeparator_.updateObject ("C_DECIMAL_105", new BigDecimal (39455.58734), 0); - rsCommaSeparator_.updateRow (); - ResultSet rs2 = statementCommaSeparator2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - BigDecimal v = rs2.getBigDecimal ("C_DECIMAL_105"); - rs2.close (); - assertCondition (v.floatValue() == 39455, added); - } - catch (Exception e) { - failed (e, "Unexpected Exception"+added); - } - } - } + public void Var144() { + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP16, "-1234567890123456", "-1234567890123456"); + } + public void Var145() { + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP16, "+1234567890123456", "1234567890123456"); + } -/** -updateObject() - Update a DECIMAL, with scale less than the value's scale. -**/ - public void Var132 () - { - String added = " -- added 12/17/2009 to test native driver for CPS 7YSU2X"; - setupRsCommaSeparator(); - if (checkJdbc20 ()) { - try { - JDRSTest.position (rsCommaSeparator_, key_); - rsCommaSeparator_.updateObject ("C_DECIMAL_105", new BigDecimal (34255.53434), 3); - rsCommaSeparator_.updateRow (); - ResultSet rs2 = statementCommaSeparator2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - BigDecimal v = rs2.getBigDecimal ("C_DECIMAL_105"); - rs2.close (); - assertCondition (v.floatValue() == 34255.534f, added); - } - catch (Exception e) { - failed (e, "Unexpected Exception"+added); - } - } - } + public void Var146() { + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP16, "+1234567890123456E28", "1,234567890123456E+43"); + } + public void Var147() { + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP16, "+1234567890123456E+28", "1,234567890123456E+43"); + } -/** -updateObject() - Update a DECIMAL, with scale equal to the value's scale. -**/ - public void Var133 () - { - String added = " -- added 12/17/2009 to test native driver for CPS 7YSU2X"; - setupRsCommaSeparator(); - if (checkJdbc20 ()) { - try { - JDRSTest.position (rsCommaSeparator_, key_); - rsCommaSeparator_.updateObject ("C_DECIMAL_105", new BigDecimal (54321.12345), 5); - rsCommaSeparator_.updateRow (); - ResultSet rs2 = statementCommaSeparator2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - BigDecimal v = rs2.getBigDecimal ("C_DECIMAL_105"); - rs2.close (); - assertCondition (v.floatValue() == 54321.12345f, added); - } - catch (Exception e) { - failed (e, "Unexpected Exception"+added); - } - } - } + public void Var148() { + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP16, "+123456789012345.6E+29", "1,234567890123456E+43"); + } + public void Var149() { + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP16, "+0.01234567890123456E+45", "1,234567890123456E+43"); + } -/** -updateObject() - Update a DECIMAL, with scale greater the value's scale. -**/ - public void Var134 () - { - String added = " -- added 12/17/2009 to test native driver for CPS 7YSU2X"; - setupRsCommaSeparator(); - if (checkJdbc20 ()) { - try { - JDRSTest.position (rsCommaSeparator_, key_); - rsCommaSeparator_.updateObject ("C_DECIMAL_105", new BigDecimal (54321.12345), 8); - rsCommaSeparator_.updateRow (); - ResultSet rs2 = statementCommaSeparator2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - BigDecimal v = rs2.getBigDecimal ("C_DECIMAL_105"); - rs2.close (); - assertCondition (v.floatValue() ==54321.12345f, added); - } - catch (Exception e) { - failed (e, "Unexpected Exception"+added); - } - } - } + public void Var150() { + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP16, "-1234567890123456E28", "-1,234567890123456E+43"); + } + public void Var151() { + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP16, "1E0", "1"); + } -/** -updateObject() - Update a DECIMAL, when the value is too big. -**/ - public void Var135 () - { - String added = " -- added 12/17/2009 to test native driver for CPS 7YSU2X"; - setupRsCommaSeparator(); - if (checkJdbc20 ()) { - int expectedColumn = -1; - try { - JDRSTest.position (rsCommaSeparator_, key_); - expectedColumn = rsCommaSeparator_.findColumn ("C_DECIMAL_105"); - rsCommaSeparator_.updateObject ("C_DECIMAL_105", new BigDecimal ("394585.432389445")); - rsCommaSeparator_.updateRow (); - failed ("Didn't throw SQLException"); - } - catch (Exception e) { - if (e instanceof DataTruncation) { - DataTruncation dt = (DataTruncation)e; - assertCondition ((dt.getIndex() == expectedColumn) - && (dt.getParameter() == false) - && (dt.getRead() == false) - && (dt.getDataSize() == 15) - && (dt.getTransferSize() == 10), added); - } else { - assertSqlException(e, -99999, "07006", "Data type mismatch", - "Mismatch instead of truncation in latest toolbox"); - } + public void Var152() { + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP16, "1,1", "1,1"); + } - } - } - } + public void Var153() { + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP16, "1.1E0", "1,1"); + } + public void Var154() { + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP16, null, null); + } + public void Var155() { + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP16, new BigDecimal("4533.43"), "4533,43"); + } + public void Var156() { + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP16, new BigDecimal("1234567890123456"), "1234567890123456"); + } -/** -updateObject() - Update a NUMERIC, with no scale specified. -**/ - public void Var136 () - { - String added = " -- added 12/17/2009 to test native driver for CPS 7YSU2X"; - setupRsCommaSeparator(); - if (checkJdbc20 ()) { - try { - JDRSTest.position (rsCommaSeparator_, key_); - rsCommaSeparator_.updateObject ("C_NUMERIC_105", new BigDecimal (-6639.95)); - rsCommaSeparator_.updateRow (); - ResultSet rs2 = statementCommaSeparator2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - BigDecimal v = rs2.getBigDecimal ("C_NUMERIC_105"); - rs2.close (); - assertCondition (v.floatValue() == -6639.95f, added); - } - catch (Exception e) { - failed (e, "Unexpected Exception"+added); - } - } - } + public void Var157() { + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP16, new BigDecimal("-1234567890123456"), "-1234567890123456"); + } + public void Var158() { + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP16, new BigDecimal("+1234567890123456"), "1234567890123456"); + } + public void Var159() { + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP16, new BigDecimal("+1234567890123456E28"), "1,234567890123456E+43"); + } -/** -updateObject() - Update a NUMERIC, when the fraction will truncate. -**/ - public void Var137 () - { - String added = " -- added 12/17/2009 to test native driver for CPS 7YSU2X"; - setupRsCommaSeparator(); - if (checkJdbc20 ()) { - try { - JDRSTest.position (rsCommaSeparator_, key_); - rsCommaSeparator_.updateObject ("C_NUMERIC_40", new BigDecimal (-4539.98)); - rsCommaSeparator_.updateRow (); - ResultSet rs2 = statementCommaSeparator2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - BigDecimal v = rs2.getBigDecimal ("C_NUMERIC_40"); - rs2.close (); - assertCondition (v.equals(new BigDecimal(-4539.0)), added); - } - catch (Exception e) { - failed (e, "Unexpected Exception"+added); - } - } - } + public void Var160() { + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP16, new BigDecimal("+1234567890123456E+28"), "1,234567890123456E+43"); + } + public void Var161() { + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP16, new BigDecimal("+123456789012345.6E+29"), "1,234567890123456E+43"); + } -/** -updateObject() - Update a NUMERIC, with scale 0 specified. -**/ - public void Var138 () - { - String added = " -- added 12/17/2009 to test native driver for CPS 7YSU2X"; - setupRsCommaSeparator(); - if (checkJdbc20 ()) { - try { - JDRSTest.position (rsCommaSeparator_, key_); - rsCommaSeparator_.updateObject ("C_NUMERIC_105", new BigDecimal (39458.88734), 0); - rsCommaSeparator_.updateRow (); - ResultSet rs2 = statementCommaSeparator2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - BigDecimal v = rs2.getBigDecimal ("C_NUMERIC_105"); - rs2.close (); - assertCondition (v.floatValue() == 39458, added); - } - catch (Exception e) { - failed (e, "Unexpected Exception"+added); - } - } - } + public void Var162() { + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP16, new BigDecimal("+0.01234567890123456E+45"), + "1,234567890123456E+43"); + } + public void Var163() { + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP16, new BigDecimal("-1234567890123456E28"), "-1,234567890123456E+43"); + } -/** -updateObject() - Update a NUMERIC, with scale less than the value's scale. -**/ - public void Var139 () - { - String added = " -- added 12/17/2009 to test native driver for CPS 7YSU2X"; - setupRsCommaSeparator(); - if (checkJdbc20 ()) { - try { - JDRSTest.position (rsCommaSeparator_, key_); - rsCommaSeparator_.updateObject ("C_NUMERIC_105", new BigDecimal (34255.53434), 3); - rsCommaSeparator_.updateRow (); - ResultSet rs2 = statementCommaSeparator2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - BigDecimal v = rs2.getBigDecimal ("C_NUMERIC_105"); - rs2.close (); - assertCondition (v.floatValue() == 34255.534f, added); - } - catch (Exception e) { - failed (e, "Unexpected Exception"+added); - } - } - } + public void Var164() { + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP16, new BigDecimal("1E0"), "1"); + } + public void Var165() { + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP16, new BigDecimal("1.1"), "1,1"); + } -/** -updateObject() - Update a NUMERIC, with scale equal to the value's scale. -**/ - public void Var140 () - { - String added = " -- added 12/17/2009 to test native driver for CPS 7YSU2X"; - setupRsCommaSeparator(); - if (checkJdbc20 ()) { - try { - JDRSTest.position (rsCommaSeparator_, key_); - rsCommaSeparator_.updateObject ("C_NUMERIC_105", new BigDecimal (54321.12345), 5); - rsCommaSeparator_.updateRow (); - ResultSet rs2 = statementCommaSeparator2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - BigDecimal v = rs2.getBigDecimal ("C_NUMERIC_105"); - rs2.close (); - assertCondition (v.floatValue() == 54321.12345f, added); - } - catch (Exception e) { - failed (e, "Unexpected Exception"+added); - } - } - } + public void Var166() { + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP16, new BigDecimal("1.1E0"), "1,1"); + } + public void Var167() { + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP16, Float.valueOf(4533.43f), "4533,43"); + } -/** -updateObject() - Update a NUMERIC, with scale greater the value's scale. -**/ - public void Var141 () - { - String added = " -- added 12/17/2009 to test native driver for CPS 7YSU2X"; - setupRsCommaSeparator(); - if (checkJdbc20 ()) { - try { - JDRSTest.position (rsCommaSeparator_, key_); - rsCommaSeparator_.updateObject ("C_NUMERIC_105", new BigDecimal (54321.12345), 8); - rsCommaSeparator_.updateRow (); - ResultSet rs2 = statementCommaSeparator2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - BigDecimal v = rs2.getBigDecimal ("C_NUMERIC_105"); - rs2.close (); - assertCondition (v.floatValue() == 54321.12345f, added); - } - catch (Exception e) { - failed (e, "Unexpected Exception"+added); - } - } - } + public void Var168() { + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP16, Float.valueOf(Float.NaN), "NaN"); + } + public void Var169() { + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP16, Float.valueOf(Float.POSITIVE_INFINITY), "Infinity"); + } - public void dfpTestCommaSeparator(String table, Object value, String expected) { - dfpTestCommaSeparator(table, value, expected, expected); + public void Var170() { + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP16, Float.valueOf(Float.NEGATIVE_INFINITY), "-Infinity"); } - public void dfpTestCommaSeparator(String table, Object value, String expected, String expected2) { - dfpTestCommaSeparator(table, value, expected, expected2, expected2); - } - public void dfpTestCommaSeparator(String table, Object value, String expected, String expected2, String expected3) { - String added = " -- added 12/17/2009 to test native driver for CPS 7YSU2X"; - if (checkDecFloatSupport()) { - try { - setupRsCommaSeparator(); - Statement s = connectionCommaSeparator_.createStatement( - ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); - ResultSet rs = s.executeQuery("SELECT * FROM " + table + " FOR UPDATE "); - rs.next(); - rs.updateObject(1, value); - rs.updateRow(); - - ResultSet rs2 = statementCommaSeparator2f_.executeQuery("SELECT * FROM " + table); - rs2.next(); - String v = rs2.getString(1); - rs2.close(); - s.close(); - try { - connection_.commit(); - } catch (Exception e) {} - assertCondition((v==null && expected==null) || - (v!=null && v.equals(expected)) || - (v!=null && v.equals(expected2)) || - (v!=null && v.equals(expected3)), "Got " + v + " from "+ value +" sb " + expected +" or "+expected2+" or "+expected3+added); - } catch (Exception e) { - failed(e, "Unexpected Exception"+added); - } - } - } + public void Var171() { + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP16, Float.valueOf(-1234567890123456.0f), "-1,23456795E+15", + "-1234567950000000", "-1,234568E+15"); + } + public void Var172() { + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP16, Double.valueOf(4533.43f), "4533,43017578125"); + } - /** - * updateObject -- set DFP16 to different values and retrieve - */ - public void Var142 () { dfpTestCommaSeparator(JDRSTest.RSTEST_DFP16, "4533,43", "4533,43"); } - public void Var143 () { dfpTestCommaSeparator(JDRSTest.RSTEST_DFP16, "1234567890123456", "1234567890123456");} - public void Var144 () { dfpTestCommaSeparator(JDRSTest.RSTEST_DFP16, "-1234567890123456", "-1234567890123456");} - public void Var145 () { dfpTestCommaSeparator(JDRSTest.RSTEST_DFP16, "+1234567890123456","1234567890123456");} - public void Var146 () { - dfpTestCommaSeparator(JDRSTest.RSTEST_DFP16, "+1234567890123456E28","1,234567890123456E+43"); - } - public void Var147 () { - dfpTestCommaSeparator(JDRSTest.RSTEST_DFP16, "+1234567890123456E+28","1,234567890123456E+43"); - } - public void Var148 () { - dfpTestCommaSeparator(JDRSTest.RSTEST_DFP16, "+123456789012345.6E+29","1,234567890123456E+43"); - } - public void Var149 () { - dfpTestCommaSeparator(JDRSTest.RSTEST_DFP16, "+0.01234567890123456E+45","1,234567890123456E+43"); - } - public void Var150 () { - dfpTestCommaSeparator(JDRSTest.RSTEST_DFP16, "-1234567890123456E28","-1,234567890123456E+43"); - } - - public void Var151 () { dfpTestCommaSeparator(JDRSTest.RSTEST_DFP16, "1E0", "1");} - public void Var152 () { dfpTestCommaSeparator(JDRSTest.RSTEST_DFP16, "1,1", "1,1");} - public void Var153 () { dfpTestCommaSeparator(JDRSTest.RSTEST_DFP16, "1.1E0", "1,1");} - public void Var154 () { dfpTestCommaSeparator(JDRSTest.RSTEST_DFP16, null, null);} + public void Var173() { + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP16, Double.valueOf(Double.NaN), "NaN"); + } - public void Var155 () { dfpTestCommaSeparator(JDRSTest.RSTEST_DFP16, new BigDecimal("4533.43"), "4533,43"); } - public void Var156 () { dfpTestCommaSeparator(JDRSTest.RSTEST_DFP16, new BigDecimal("1234567890123456"), "1234567890123456");} - public void Var157 () { dfpTestCommaSeparator(JDRSTest.RSTEST_DFP16, new BigDecimal("-1234567890123456"), "-1234567890123456");} - public void Var158 () { dfpTestCommaSeparator(JDRSTest.RSTEST_DFP16, new BigDecimal("+1234567890123456"),"1234567890123456");} - public void Var159 () { - dfpTestCommaSeparator(JDRSTest.RSTEST_DFP16, new BigDecimal("+1234567890123456E28"),"1,234567890123456E+43"); - } - public void Var160 () { - dfpTestCommaSeparator(JDRSTest.RSTEST_DFP16, new BigDecimal("+1234567890123456E+28"),"1,234567890123456E+43"); - } - public void Var161 () { - dfpTestCommaSeparator(JDRSTest.RSTEST_DFP16, new BigDecimal("+123456789012345.6E+29"),"1,234567890123456E+43"); - } - public void Var162 () { - dfpTestCommaSeparator(JDRSTest.RSTEST_DFP16, new BigDecimal("+0.01234567890123456E+45"),"1,234567890123456E+43"); - } - public void Var163 () { - dfpTestCommaSeparator(JDRSTest.RSTEST_DFP16, new BigDecimal("-1234567890123456E28"),"-1,234567890123456E+43"); - } - - public void Var164 () { dfpTestCommaSeparator(JDRSTest.RSTEST_DFP16, new BigDecimal("1E0"), "1");} - public void Var165 () { dfpTestCommaSeparator(JDRSTest.RSTEST_DFP16, new BigDecimal("1.1"), "1,1");} - public void Var166 () { dfpTestCommaSeparator(JDRSTest.RSTEST_DFP16, new BigDecimal("1.1E0"), "1,1");} + public void Var174() { + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP16, Double.valueOf(Double.POSITIVE_INFINITY), "Infinity"); + } + public void Var175() { + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP16, Double.valueOf(Double.NEGATIVE_INFINITY), "-Infinity"); + } - public void Var167 () { dfpTestCommaSeparator(JDRSTest.RSTEST_DFP16, Float.valueOf(4533.43f), "4533,43"); } - public void Var168 () { dfpTestCommaSeparator(JDRSTest.RSTEST_DFP16, Float.valueOf(Float.NaN), "NaN");} - public void Var169 () { dfpTestCommaSeparator(JDRSTest.RSTEST_DFP16, Float.valueOf(Float.POSITIVE_INFINITY), "Infinity");} - public void Var170 () { dfpTestCommaSeparator(JDRSTest.RSTEST_DFP16, Float.valueOf(Float.NEGATIVE_INFINITY), "-Infinity");} - public void Var171 () { - dfpTestCommaSeparator(JDRSTest.RSTEST_DFP16, Float.valueOf(-1234567890123456.0f), "-1,23456795E+15", "-1234567950000000","-1,234568E+15"); - } - public void Var172 () { dfpTestCommaSeparator(JDRSTest.RSTEST_DFP16, Double.valueOf(4533.43f), "4533,43017578125"); } - public void Var173 () { dfpTestCommaSeparator(JDRSTest.RSTEST_DFP16, Double.valueOf(Double.NaN), "NaN");} - public void Var174 () { dfpTestCommaSeparator(JDRSTest.RSTEST_DFP16, Double.valueOf(Double.POSITIVE_INFINITY), "Infinity");} - public void Var175 () { dfpTestCommaSeparator(JDRSTest.RSTEST_DFP16, Double.valueOf(Double.NEGATIVE_INFINITY), "-Infinity");} - public void Var176 () { dfpTestCommaSeparator(JDRSTest.RSTEST_DFP16, Double.valueOf(-1234567890123456.0), "-1234567890123456");} + public void Var176() { + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP16, Double.valueOf(-1234567890123456.0), "-1234567890123456"); + } -/** -updateBooleanObject() - Update a BOOLEAN. -**/ + /** + * updateBooleanObject() - Update a BOOLEAN. + **/ public void updateBooleanObject(Object inObject, String outString) { setupRs(); if (checkBooleanSupport()) { + try { + JDRSTest.position(rs_, key_); rs_.updateObject("C_BOOLEAN", inObject); - rs_.updateRow(); + rs_.updateRow(); /* serialized */ ResultSet rs2 = statement2_.executeQuery(select_); JDRSTest.position(rs2, key_); String v = rs2.getString("C_BOOLEAN"); @@ -2877,16 +2852,30 @@ public void updateBooleanObject(Object inObject, String outString) { assertCondition(outString.equals(v), "got " + v + " sb " + outString); } catch (Exception e) { failed(e, "Unexpected Exception"); - } + } } } - public void Var177() { updateBooleanObject(Boolean.valueOf(true),"1"); } - public void Var178() { updateBooleanObject(Boolean.valueOf(false),"0"); } - public void Var179() {updateBooleanObject("1", "1"); } - public void Var180() {updateBooleanObject("0", "0"); } - public void Var181() { updateBooleanObject("1000", "1");} - + public void Var177() { + updateBooleanObject(Boolean.valueOf(true), "1"); + } + + public void Var178() { + updateBooleanObject(Boolean.valueOf(false), "0"); + } + + public void Var179() { + updateBooleanObject("1", "1"); + } + + public void Var180() { + updateBooleanObject("0", "0"); + } + + public void Var181() { + updateBooleanObject("1000", "1"); + } + public void Var182() { updateBooleanObject("-100", "1"); } @@ -2914,23 +2903,45 @@ public void Var187() { public void Var188() { updateBooleanObject("no", "0"); } - public void Var189() { updateBooleanObject(Integer.valueOf(1),"1"); } - public void Var190() { updateBooleanObject(Integer.valueOf(0),"0"); } - public void Var191() { updateBooleanObject(Long.valueOf(1),"1"); } - public void Var192() { updateBooleanObject(Long.valueOf(0),"0"); } - public void Var193() { updateBooleanObject(Float.valueOf(3.0f),"1"); } - public void Var194() { updateBooleanObject(Float.valueOf(0.0f),"0"); } - public void Var195() { updateBooleanObject(Double.valueOf(2.0),"1"); } - public void Var196() { updateBooleanObject(Double.valueOf(0.0),"0"); } - public void Var197() { updateBooleanObject(new BigDecimal(3.14),"1"); } - public void Var198() { updateBooleanObject(new BigDecimal(0.0),"0"); } + public void Var189() { + updateBooleanObject(Integer.valueOf(1), "1"); + } + public void Var190() { + updateBooleanObject(Integer.valueOf(0), "0"); + } + public void Var191() { + updateBooleanObject(Long.valueOf(1), "1"); + } + public void Var192() { + updateBooleanObject(Long.valueOf(0), "0"); + } + public void Var193() { + updateBooleanObject(Float.valueOf(3.0f), "1"); + } -} + public void Var194() { + updateBooleanObject(Float.valueOf(0.0f), "0"); + } + + public void Var195() { + updateBooleanObject(Double.valueOf(2.0), "1"); + } + + public void Var196() { + updateBooleanObject(Double.valueOf(0.0), "0"); + } + public void Var197() { + updateBooleanObject(new BigDecimal(3.14), "1"); + } + public void Var198() { + updateBooleanObject(new BigDecimal(0.0), "0"); + } +} diff --git a/src/test/JD/RS/JDRSUpdateObjectSQLType.java b/src/test/JD/RS/JDRSUpdateObjectSQLType.java index 3f2e6bf3..cb6e1d3c 100644 --- a/src/test/JD/RS/JDRSUpdateObjectSQLType.java +++ b/src/test/JD/RS/JDRSUpdateObjectSQLType.java @@ -11,7 +11,6 @@ // /////////////////////////////////////////////////////////////////////////////// - package test.JD.RS; import java.io.FileOutputStream; @@ -38,219 +37,183 @@ import test.JDRSTest; import test.JDReflectionUtil; import test.JDTestcase; - - - -/** -Testcase JDRSUpdateObjectSQLType. This tests the following method -of the JDBC ResultSet class: - -
    -
  • updateObject(SQLType) -
- -Note: The current implementation ignores SQLType. -**/ -public class JDRSUpdateObjectSQLType -extends JDTestcase { +import test.JD.JDSerializeFile; + +/** + * Testcase JDRSUpdateObjectSQLType. This tests the following method of the JDBC + * ResultSet class: + * + *
    + *
  • updateObject(SQLType) + *
+ * + * Note: The current implementation ignores SQLType. + **/ +public class JDRSUpdateObjectSQLType extends JDTestcase { public static void main(String args[]) throws Exception { - String[] newArgs = new String[args.length+2]; - newArgs[0] = "-tc"; - newArgs[1] = "JDRSUpdateObjectSQLType"; - for (int i = 0; i < args.length; i++) { - newArgs[2+i]=args[i]; - } - test.JDRSTest.main(newArgs); - } - - - // Private data. - private static final String key_ = "JDRSUpdateObjectSQLType"; - private static String select_ = "SELECT * FROM " - + JDRSTest.RSTEST_UPDATE; - - private Statement statement_; - private Statement statement2_; - private Statement statement2f_; - private ResultSet rs_ = null; - - - private Connection connectionCommaSeparator_; - private Statement statementCommaSeparator_; - private Statement statementCommaSeparator2_; - private Statement statementCommaSeparator2f_; - private ResultSet rsCommaSeparator_ = null ; - - private Connection connection3_; - private Statement statement3_; - private Statement statement4_; - private ResultSet rs3_; - - private boolean tableUpdated = false; - - -/** -Constructor. -**/ - public JDRSUpdateObjectSQLType (AS400 systemObject, - Hashtable> namesAndVars, - int runMode, - FileOutputStream fileOutputStream, - - String password) - { - super (systemObject, "JDRSUpdateObjectSQLType", - namesAndVars, runMode, fileOutputStream, - password); + String[] newArgs = new String[args.length + 2]; + newArgs[0] = "-tc"; + newArgs[1] = "JDRSUpdateObjectSQLType"; + for (int i = 0; i < args.length; i++) { + newArgs[2 + i] = args[i]; } + test.JDRSTest.main(newArgs); + } + // Private data. + private static final String key_ = "JDRSUpdateObjectSQLType"; + private static String select_ = "SELECT * FROM " + JDRSTest.RSTEST_UPDATE; + + private Statement statement_; + private Statement statement2_; + private Statement statement2f_; + private ResultSet rs_ = null; + + private Connection connectionCommaSeparator_; + private Statement statementCommaSeparator_; + private Statement statementCommaSeparator2_; + private Statement statementCommaSeparator2f_; + private ResultSet rsCommaSeparator_ = null; + + private Connection connection3_; + private Statement statement3_; + private Statement statement4_; + private ResultSet rs3_; + + private boolean tableUpdated = false; + private JDSerializeFile serializeUpdateFile_; + + /** + * Constructor. + **/ + public JDRSUpdateObjectSQLType(AS400 systemObject, Hashtable> namesAndVars, int runMode, + FileOutputStream fileOutputStream, + + String password) { + super(systemObject, "JDRSUpdateObjectSQLType", namesAndVars, runMode, fileOutputStream, password); + } + /** + * Performs setup needed before running variations. + * + * @exception Exception If an exception occurs. + **/ + protected void setup() throws Exception { + select_ = "SELECT * FROM " + JDRSTest.RSTEST_UPDATE; -/** -Performs setup needed before running variations. - -@exception Exception If an exception occurs. -**/ - protected void setup () - throws Exception - { - select_ = "SELECT * FROM " + JDRSTest.RSTEST_UPDATE; - - if (isJdbc20 ()) { - String url = baseURL_ - // String url = "jdbc:as400://" + systemObject_.getSystemName() - - - + ";data truncation=true"; - connection_ = testDriver_.getConnection (url + ";lob threshold=30000",systemObject_.getUserId(), encryptedPassword_); - connection_.setAutoCommit(false); // @C1A - - - - // Force LOB locators. - connection3_ = testDriver_.getConnection (url + ";lob threshold=0",systemObject_.getUserId(), encryptedPassword_); - connection3_.setAutoCommit(false); // @C1A - statement3_ = connection_.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, - ResultSet.CONCUR_UPDATABLE); - statement4_ = connection_.createStatement (ResultSet.TYPE_SCROLL_INSENSITIVE, - ResultSet.CONCUR_READ_ONLY); - - rs3_ = statement3_.executeQuery (select_ + " FOR UPDATE"); - + if (isJdbc20()) { + String url = baseURL_ + // String url = "jdbc:as400://" + systemObject_.getSystemName() + + ";data truncation=true"; + connection_ = testDriver_.getConnection(url + ";lob threshold=30000", systemObject_.getUserId(), + encryptedPassword_); + connection_.setAutoCommit(false); // @C1A + serializeUpdateFile_ = new JDSerializeFile(connection_, JDRSTest.RSTEST_UPDATE); + connection_.commit(); + // Force LOB locators. + connection3_ = testDriver_.getConnection(url + ";lob threshold=0", systemObject_.getUserId(), encryptedPassword_); + connection3_.setAutoCommit(false); // @C1A + statement3_ = connection_.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); + statement4_ = connection_.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); - connectionCommaSeparator_ = testDriver_.getConnection (url + ";lob threshold=30000;decimal separator=,"); - connectionCommaSeparator_.setAutoCommit(false); // @C1A + rs3_ = statement3_.executeQuery(select_ + " FOR UPDATE"); + connectionCommaSeparator_ = testDriver_.getConnection(url + ";lob threshold=30000;decimal separator=,"); + connectionCommaSeparator_.setAutoCommit(false); // @C1A - } } + } + protected void setupRs() { + if (rsCommaSeparator_ != null) { + try { + rsCommaSeparator_.close(); + statementCommaSeparator_.close(); + statementCommaSeparator2_.close(); + statementCommaSeparator2f_.close(); + connectionCommaSeparator_.commit(); + rsCommaSeparator_ = null; + statementCommaSeparator_ = null; + statementCommaSeparator2_ = null; + statementCommaSeparator2f_ = null; + } catch (SQLException e) { + e.printStackTrace(); + } + } + if (rs_ == null) { + try { + statement_ = connection_.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); + statement2_ = connection_.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); + statement2f_ = connection_.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY); + if (!tableUpdated) { - protected void setupRs() { - if (rsCommaSeparator_ != null) { - try { - rsCommaSeparator_.close (); - statementCommaSeparator_.close (); - statementCommaSeparator2_.close (); - statementCommaSeparator2f_.close (); - connectionCommaSeparator_.commit(); - rsCommaSeparator_ = null; - statementCommaSeparator_= null; - statementCommaSeparator2_= null; - statementCommaSeparator2f_= null; - } catch (SQLException e) { - e.printStackTrace(); - } - } - if (rs_ == null) { - try { - - - - statement_ = connection_.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, - ResultSet.CONCUR_UPDATABLE); - statement2_ = connection_.createStatement (ResultSet.TYPE_SCROLL_INSENSITIVE, - ResultSet.CONCUR_READ_ONLY); - statement2f_ = connection_.createStatement (ResultSet.TYPE_FORWARD_ONLY, - ResultSet.CONCUR_READ_ONLY); - - if (!tableUpdated) { - - statement_.executeUpdate ("INSERT INTO " + JDRSTest.RSTEST_UPDATE - + " (C_KEY) VALUES ('DUMMY_ROW')"); - statement_.executeUpdate ("INSERT INTO " + JDRSTest.RSTEST_UPDATE - + " (C_KEY) VALUES ('DUMMY_ROW2')"); - statement_.executeUpdate ("INSERT INTO " + JDRSTest.RSTEST_UPDATE - + " (C_KEY) VALUES ('" + key_ + "')"); - tableUpdated=true; - } - rs_ = statement_.executeQuery (select_ + " FOR UPDATE"); - - - - } catch (SQLException e) { - e.printStackTrace(); - } + statement_.executeUpdate("INSERT INTO " + JDRSTest.RSTEST_UPDATE + " (C_KEY) VALUES ('DUMMY_UPDOBJST')"); + statement_.executeUpdate("INSERT INTO " + JDRSTest.RSTEST_UPDATE + " (C_KEY) VALUES ('DUMMY_UPDOBJST2')"); + statement_.executeUpdate("INSERT INTO " + JDRSTest.RSTEST_UPDATE + " (C_KEY) VALUES ('" + key_ + "')"); + tableUpdated = true; + } + rs_ = statement_.executeQuery(select_ + " FOR UPDATE"); - } - } - - - protected void setupRsCommaSeparator() { - if (rs_ != null) { - try { - rs_.close (); - statement_.close (); - statement2_.close (); - statement2f_.close (); - connection_.commit(); - rs_ = null; - statement_= null; - statement2_= null; - statement2f_= null; - } catch (SQLException e) { - e.printStackTrace(); - } - - } - if (rsCommaSeparator_ == null) { - try { - statementCommaSeparator_ = connectionCommaSeparator_.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, - ResultSet.CONCUR_UPDATABLE); - statementCommaSeparator2_ = connectionCommaSeparator_.createStatement (ResultSet.TYPE_SCROLL_INSENSITIVE, - ResultSet.CONCUR_READ_ONLY); - statementCommaSeparator2f_ = connectionCommaSeparator_.createStatement (ResultSet.TYPE_FORWARD_ONLY, - ResultSet.CONCUR_READ_ONLY); - - if (!tableUpdated) { - tableUpdated = true; - statementCommaSeparator_.executeUpdate ("INSERT INTO " + JDRSTest.RSTEST_UPDATE - + " (C_KEY) VALUES ('DUMMY_ROW')"); - statementCommaSeparator_.executeUpdate ("INSERT INTO " + JDRSTest.RSTEST_UPDATE - + " (C_KEY) VALUES ('DUMMY_ROW1')"); - statementCommaSeparator_.executeUpdate ("INSERT INTO " + JDRSTest.RSTEST_UPDATE - + " (C_KEY) VALUES ('" + key_ + "')"); - } - rsCommaSeparator_ = statementCommaSeparator_.executeQuery (select_ + " FOR UPDATE"); - } catch (SQLException e) { - e.printStackTrace(); - } + } catch (SQLException e) { + e.printStackTrace(); + } - } - } + } + } + protected void setupRsCommaSeparator() { + if (rs_ != null) { + try { + rs_.close(); + statement_.close(); + statement2_.close(); + statement2f_.close(); + connection_.commit(); + rs_ = null; + statement_ = null; + statement2_ = null; + statement2f_ = null; + } catch (SQLException e) { + e.printStackTrace(); + } + } + if (rsCommaSeparator_ == null) { + try { + statementCommaSeparator_ = connectionCommaSeparator_.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, + ResultSet.CONCUR_UPDATABLE); + statementCommaSeparator2_ = connectionCommaSeparator_.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, + ResultSet.CONCUR_READ_ONLY); + statementCommaSeparator2f_ = connectionCommaSeparator_.createStatement(ResultSet.TYPE_FORWARD_ONLY, + ResultSet.CONCUR_READ_ONLY); + + if (!tableUpdated) { + tableUpdated = true; + statementCommaSeparator_ + .executeUpdate("INSERT INTO " + JDRSTest.RSTEST_UPDATE + " (C_KEY) VALUES ('DUMMY_UPDOBJST')"); + statementCommaSeparator_ + .executeUpdate("INSERT INTO " + JDRSTest.RSTEST_UPDATE + " (C_KEY) VALUES ('DUMMY_UPDOBJST1')"); + statementCommaSeparator_ + .executeUpdate("INSERT INTO " + JDRSTest.RSTEST_UPDATE + " (C_KEY) VALUES ('" + key_ + "')"); + } + rsCommaSeparator_ = statementCommaSeparator_.executeQuery(select_ + " FOR UPDATE"); + } catch (SQLException e) { + e.printStackTrace(); + } -/** -Performs cleanup needed after running variations. + } + } -@exception Exception If an exception occurs. -**/ - protected void cleanup() throws Exception { + /** + * Performs cleanup needed after running variations. + * + * @exception Exception If an exception occurs. + **/ + protected void cleanup() throws Exception { if (isJdbc20()) { rs3_.close(); statement4_.close(); @@ -265,6 +228,8 @@ protected void cleanup() throws Exception { statement_.close(); } connection_.commit(); // @C1A + serializeUpdateFile_.close(); + connection_.commit(); connection_.close(); if (rsCommaSeparator_ != null) { rsCommaSeparator_.close(); @@ -277,8 +242,7 @@ protected void cleanup() throws Exception { } } - - protected void cleanupConnections() throws Exception { + protected void cleanupConnections() throws Exception { if (isJdbc20()) { connection3_.commit(); // @C1A connection3_.close(); @@ -290,2653 +254,2705 @@ protected void cleanupConnections() throws Exception { } } - - /* * Create the SQLType corresponding to Type. */ private Object getSQLType(int typesNumber) throws Exception { - return JDReflectionUtil.callStaticMethod_O("java.sql.JDBCType", "valueOf", - typesNumber); + return JDReflectionUtil.callStaticMethod_O("java.sql.JDBCType", "valueOf", typesNumber); } -/** -updateObject() - Should throw exception when the result set is -closed. -**/ - public void Var001() - { - setupRs(); - if (checkJdbc42 ()) { - try { - Statement s = connection_.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, - ResultSet.CONCUR_UPDATABLE); - ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_UPDATE + " FOR UPDATE"); - rs.next (); - rs.close (); - JDReflectionUtil.callMethod_V(rs,"updateObject","C_VARCHAR_50", "Maine", getSQLType(Types.VARCHAR)); - failed ("Didn't throw SQLException"); - } - catch (Exception e) { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + /** + * updateObject() - Should throw exception when the result set is closed. + **/ + public void Var001() { + setupRs(); + if (checkJdbc42()) { + + try { + + Statement s = connection_.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); + ResultSet rs = s.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_UPDATE + " FOR UPDATE"); + rs.next(); + rs.close(); + + JDReflectionUtil.callMethod_V(rs, "updateObject", "C_VARCHAR_50", "Maine", getSQLType(Types.VARCHAR)); + s.close(); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } + } - - -/** -updateObject() - Should throw exception when the result set is -not updatable. -**/ - public void Var002() - { - setupRs(); - if (checkJdbc42 ()) { - try { - Statement s = connection_.createStatement (ResultSet.TYPE_SCROLL_INSENSITIVE, - ResultSet.CONCUR_READ_ONLY); - ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_UPDATE); - rs.next (); - JDReflectionUtil.callMethod_V(rs,"updateObject","C_VARCHAR_50", "New Hampshire", getSQLType(Types.VARCHAR)); - failed ("Didn't throw SQLException"); - } - catch (Exception e) { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + /** + * updateObject() - Should throw exception when the result set is not updatable. + **/ + public void Var002() { + setupRs(); + if (checkJdbc42()) { + + try { + + Statement s = connection_.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); + ResultSet rs = s.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_UPDATE); + rs.next(); + JDReflectionUtil.callMethod_V(rs, "updateObject", "C_VARCHAR_50", "New Hampshire", getSQLType(Types.VARCHAR)); + rs.close(); + s.close(); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } + } - - -/** -updateObject() - Should throw exception when cursor is not pointing -to a row. -**/ - public void Var003() - { - setupRs(); - if (checkJdbc42 ()) { - try { - JDRSTest.position (rs_, null); - JDReflectionUtil.callMethod_V(rs_,"updateObject","C_VARCHAR_50", "Vermont", getSQLType(Types.VARCHAR)); - failed ("Didn't throw SQLException"); - } - catch (Exception e) { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + /** + * updateObject() - Should throw exception when cursor is not pointing to a row. + **/ + public void Var003() { + setupRs(); + if (checkJdbc42()) { + + try { + + JDRSTest.position(rs_, null); + JDReflectionUtil.callMethod_V(rs_, "updateObject", "C_VARCHAR_50", "Vermont", getSQLType(Types.VARCHAR)); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } + } - - -/** -updateObject() - Should throw an exception when the column -is an invalid index. -**/ - public void Var004() - { - setupRs(); - if (checkJdbc42 ()) { - try { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_,"updateObject",100, "New York", getSQLType(Types.VARCHAR)); - failed ("Didn't throw SQLException"); - } - catch (Exception e) { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + /** + * updateObject() - Should throw an exception when the column is an invalid + * index. + **/ + public void Var004() { + setupRs(); + if (checkJdbc42()) { + + try { + + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateObject", 100, "New York", getSQLType(Types.VARCHAR)); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } + } - - -/** -updateObject() - Should throw an exception when the column -is 0. -**/ - public void Var005() - { - setupRs(); - if (checkJdbc42 ()) { - try { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_,"updateObject",0, "Connecticut", getSQLType(Types.VARCHAR)); - failed ("Didn't throw SQLException"); - } - catch (Exception e) { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + /** + * updateObject() - Should throw an exception when the column is 0. + **/ + public void Var005() { + setupRs(); + if (checkJdbc42()) { + + try { + + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateObject", 0, "Connecticut", getSQLType(Types.VARCHAR)); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } + } - - -/** -updateObject() - Should throw an exception when the column -is -1. -**/ - public void Var006() - { - setupRs(); - if (checkJdbc42 ()) { - try { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_,"updateObject",-1, "Massachusetts", getSQLType(Types.VARCHAR)); - failed ("Didn't throw SQLException"); - } - catch (Exception e) { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + /** + * updateObject() - Should throw an exception when the column is -1. + **/ + public void Var006() { + setupRs(); + if (checkJdbc42()) { + + try { + + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateObject", -1, "Massachusetts", getSQLType(Types.VARCHAR)); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } + } - - -/** -updateObject() - Should work when the column index is valid. -**/ - public void Var007() - { - setupRs(); - if (checkJdbc42 ()) { - try { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_,"updateObject",14, "Rhode Island", getSQLType(Types.VARCHAR)); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - String v = rs2.getString ("C_VARCHAR_50"); - rs2.close (); - assertCondition (v.equals ("Rhode Island")); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } + /** + * updateObject() - Should work when the column index is valid. + **/ + public void Var007() { + setupRs(); + if (checkJdbc42()) { + + try { + + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateObject", 14, "Rhode Island", getSQLType(Types.VARCHAR)); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + String v = rs2.getString("C_VARCHAR_50"); + rs2.close(); + assertCondition(v.equals("Rhode Island")); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } } + } - - -/** -updateObject() - Should throw an exception when the column -name is null. -**/ - public void Var008() - { - setupRs(); - if (checkJdbc42 ()) { - try { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_,"updateObject",null, "Pennsylvania", getSQLType(Types.VARCHAR)); - failed ("Didn't throw SQLException"); - } - catch (Exception e) { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + /** + * updateObject() - Should throw an exception when the column name is null. + **/ + public void Var008() { + setupRs(); + if (checkJdbc42()) { + + try { + + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateObject", null, "Pennsylvania", getSQLType(Types.VARCHAR)); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } + } - - -/** -updateObject() - Should throw an exception when the column -name is an empty string. -**/ - public void Var009() - { - setupRs(); - if (checkJdbc42 ()) { - try { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_,"updateObject","", "Maryland", getSQLType(Types.VARCHAR)); - failed ("Didn't throw SQLException"); - } - catch (Exception e) { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + /** + * updateObject() - Should throw an exception when the column name is an empty + * string. + **/ + public void Var009() { + setupRs(); + if (checkJdbc42()) { + + try { + + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateObject", "", "Maryland", getSQLType(Types.VARCHAR)); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } + } - - -/** -updateObject() - Should throw an exception when the column -name is invalid. -**/ - public void Var010() - { - setupRs(); - if (checkJdbc42 ()) { - try { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_,"updateObject","INVALID", "Delaware", getSQLType(Types.VARCHAR)); - failed ("Didn't throw SQLException"); - } - catch (Exception e) { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + /** + * updateObject() - Should throw an exception when the column name is invalid. + **/ + public void Var010() { + setupRs(); + if (checkJdbc42()) { + + try { + + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateObject", "INVALID", "Delaware", getSQLType(Types.VARCHAR)); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } + } - - -/** -updateObject() - Should work when the column name is valid. -**/ - public void Var011() - { - setupRs(); - if (checkJdbc42 ()) { - try { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_,"updateObject","C_VARCHAR_50", "District of Columbia", getSQLType(Types.VARCHAR)); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - String v = rs2.getString ("C_VARCHAR_50"); - rs2.close (); - assertCondition (v.equals ("District of Columbia")); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } + /** + * updateObject() - Should work when the column name is valid. + **/ + public void Var011() { + setupRs(); + if (checkJdbc42()) { + + try { + + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateObject", "C_VARCHAR_50", "District of Columbia", + getSQLType(Types.VARCHAR)); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + String v = rs2.getString("C_VARCHAR_50"); + rs2.close(); + assertCondition(v.equals("District of Columbia")); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } } + } + /** + * updateObject() - Should update to SQL NULL when the column value is null. + **/ + public void Var012() { + setupRs(); + if (checkJdbc42()) { + + try { + + JDRSTest.position(rs_, key_); + // JDReflectionUtil.callMethod_V(rs_,"updateObject","C_VARCHAR_50", null, + // getSQLType(Types.VARCHAR)); + + Class[] argClasses = new Class[3]; + argClasses[0] = Class.forName("java.lang.String"); + argClasses[1] = Class.forName("java.lang.Object"); + argClasses[2] = Class.forName("java.sql.SQLType"); + Object[] args = new Object[3]; + args[0] = "C_VARCHAR_50"; + args[1] = null; + args[2] = getSQLType(Types.VARCHAR); + JDReflectionUtil.callMethod_V(rs_, "updateObject", argClasses, args); - -/** -updateObject() - Should update to SQL NULL when the column -value is null. -**/ - public void Var012() - { - setupRs(); - if (checkJdbc42 ()) { - try { - JDRSTest.position (rs_, key_); - // JDReflectionUtil.callMethod_V(rs_,"updateObject","C_VARCHAR_50", null, getSQLType(Types.VARCHAR)); - - Class[] argClasses = new Class[3]; - argClasses[0] = Class.forName("java.lang.String"); - argClasses[1] = Class.forName("java.lang.Object"); - argClasses[2] = Class.forName("java.sql.SQLType"); - Object[] args = new Object[3]; - args[0] = "C_VARCHAR_50"; - args[1] = null; - args[2] = getSQLType(Types.VARCHAR); - JDReflectionUtil.callMethod_V(rs_,"updateObject",argClasses, args ); - - - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - String v = rs2.getString ("C_VARCHAR_50"); - boolean wn = rs2.wasNull (); - rs2.close (); - assertCondition ((v == null) && (wn == true)); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + String v = rs2.getString("C_VARCHAR_50"); + boolean wn = rs2.wasNull(); + rs2.close(); + assertCondition((v == null) && (wn == true)); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } } + } - - -/** -updateObject() - Should throw an exception when the scale is invalid. -**/ - public void Var013() - { - setupRs(); - if (checkJdbc42 ()) { - try { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_,"updateObject","C_VARCHAR_50", "Virginia", getSQLType(Types.VARCHAR), -1); - failed ("Didn't throw SQLException"); - } - catch (Exception e) { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + /** + * updateObject() - Should throw an exception when the scale is invalid. + **/ + public void Var013() { + setupRs(); + if (checkJdbc42()) { + + try { + + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateObject", "C_VARCHAR_50", "Virginia", getSQLType(Types.VARCHAR), -1); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } + } - - -/** -updateObject() - Should be reflected by get, even if update has -not yet been issued (i.e. update is still pending). -**/ - public void Var014() - { - setupRs(); - if (checkJdbc42 ()) { - try { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_,"updateObject","C_VARCHAR_50", "North Carolina", getSQLType(Types.VARCHAR)); - assertCondition (rs_.getString ("C_VARCHAR_50").equals ("North Carolina")); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } + /** + * updateObject() - Should be reflected by get, even if update has not yet been + * issued (i.e. update is still pending). + **/ + public void Var014() { + setupRs(); + if (checkJdbc42()) { + + try { + + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateObject", "C_VARCHAR_50", "North Carolina", getSQLType(Types.VARCHAR)); + assertCondition(rs_.getString("C_VARCHAR_50").equals("North Carolina")); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } } + } + /** + * updateObject() - Should be reflected by get, after update has been issued, + * but cursor has not been repositioned. + **/ + public void Var015() { + setupRs(); + if (checkJdbc42()) { + + try { + + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateObject", "C_VARCHAR_50", "South Carolina", getSQLType(Types.VARCHAR)); + rs_.updateRow(); + assertCondition(rs_.getString("C_VARCHAR_50").equals("South Carolina")); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } - - -/** -updateObject() - Should be reflected by get, after update has -been issued, but cursor has not been repositioned. -**/ - public void Var015() - { - setupRs(); - if (checkJdbc42 ()) { - try { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_,"updateObject","C_VARCHAR_50", "South Carolina", getSQLType(Types.VARCHAR)); - rs_.updateRow (); - assertCondition (rs_.getString ("C_VARCHAR_50").equals ("South Carolina")); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } + /** + * updateObject() - Should be reflected by get, after update has been issued and + * cursor has been repositioned. + **/ + public void Var016() { + setupRs(); + if (checkJdbc42()) { + + try { + + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateObject", "C_VARCHAR_50", "Georgia", getSQLType(Types.VARCHAR)); + rs_.updateRow(); + rs_.beforeFirst(); + JDRSTest.position(rs_, key_); + String v = rs_.getString("C_VARCHAR_50"); + assertCondition(v.equals("Georgia")); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } } + } + /** + * updateObject() - Should work when the current row is the insert row. + **/ + public void Var017() { + setupRs(); + if (checkJdbc42()) { + + try { + + rs_.moveToInsertRow(); + rs_.updateString("C_KEY", "JDRSUpdateObjectSQLType 1"); + JDReflectionUtil.callMethod_V(rs_, "updateObject", "C_VARCHAR_50", "Florida", getSQLType(Types.VARCHAR)); + rs_.insertRow(); + JDRSTest.position(rs_, "JDRSUpdateObjectSQLType 1"); + assertCondition(rs_.getString("C_VARCHAR_50").equals("Florida")); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + /** + * updateObject() - Should be reflected by get on insert row, even if insert has + * not yet been issued (i.e. insert is still pending). + **/ + public void Var018() { + setupRs(); + if (checkJdbc42()) { + + try { + + rs_.moveToInsertRow(); + JDReflectionUtil.callMethod_V(rs_, "updateObject", "C_VARCHAR_50", "Ohio", getSQLType(Types.VARCHAR)); + assertCondition(rs_.getString("C_VARCHAR_50").equals("Ohio")); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } - -/** -updateObject() - Should be reflected by get, after update has -been issued and cursor has been repositioned. -**/ - public void Var016() - { - setupRs(); - if (checkJdbc42 ()) { - try { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_,"updateObject","C_VARCHAR_50", "Georgia", getSQLType(Types.VARCHAR)); - rs_.updateRow (); - rs_.beforeFirst (); - JDRSTest.position (rs_, key_); - String v = rs_.getString ("C_VARCHAR_50"); - assertCondition (v.equals ("Georgia")); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } + /** + * updateObject() - Should throw an exception on a deleted row. + **/ + public void Var019() { + setupRs(); + if (checkJdbc42()) { + + try { + + JDRSTest.position(rs_, "DUMMY_UPDOBJST"); + rs_.deleteRow(); + JDReflectionUtil.callMethod_V(rs_, "updateObject", "C_VARCHAR_50", "Kentucky", getSQLType(Types.VARCHAR)); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } + } + /** + * updateObject() - Update a SMALLINT. + **/ + public void Var020() { + setupRs(); + if (checkJdbc42()) { + + try { + + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateObject", "C_SMALLINT", Short.valueOf((short) 243), + getSQLType(Types.SMALLINT)); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + short v = rs2.getShort("C_SMALLINT"); + rs2.close(); + assertCondition(v == 243); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + /** + * updateObject() - Update a SMALLINT, when the integer is too big. + **/ + public void Var021() { + setupRs(); + if (checkJdbc42()) { + int expectedColumn = -1; + + try { + + JDRSTest.position(rs_, key_); + expectedColumn = rs_.findColumn("C_SMALLINT"); + JDReflectionUtil.callMethod_V(rs_, "updateObject", "C_SMALLINT", Integer.valueOf(4873423), + getSQLType(Types.SMALLINT)); + rs_.updateRow(); + failed("Didn't throw SQLException"); + } catch (Exception e) { + if (e instanceof DataTruncation) { + DataTruncation dt = (DataTruncation) e; + assertCondition((dt.getIndex() == expectedColumn) && (dt.getParameter() == false) && (dt.getRead() == false) + && (dt.getDataSize() == 8) && (dt.getTransferSize() == 2)); + } else { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } + } + } + } -/** -updateObject() - Should work when the current row is the insert -row. -**/ - public void Var017() - { - setupRs(); - if (checkJdbc42 ()) { - try { - rs_.moveToInsertRow (); - rs_.updateString ("C_KEY", "JDRSUpdateObjectSQLType 1"); - JDReflectionUtil.callMethod_V(rs_,"updateObject","C_VARCHAR_50", "Florida", getSQLType(Types.VARCHAR)); - rs_.insertRow (); - JDRSTest.position (rs_, "JDRSUpdateObjectSQLType 1"); - assertCondition (rs_.getString ("C_VARCHAR_50").equals ("Florida")); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } + /** + * updateObject() - Update a SMALLINT with an object that has a fraction. This + * should work. + **/ + public void Var022() { + setupRs(); + if (checkJdbc42()) { + + try { + + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateObject", "C_SMALLINT", Float.valueOf(243.6f), + getSQLType(Types.SMALLINT)); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + short v = rs2.getShort("C_SMALLINT"); + rs2.close(); + assertCondition(v == 243); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } } + } + /** + * updateObject() - Update a SMALLINT, when the object is not a number. + **/ + public void Var023() { + setupRs(); + if (checkJdbc42()) { + + try { + + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateObject", "C_SMALLINT", "West Virginia", getSQLType(Types.SMALLINT)); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } + } + } + /** + * updateObject() - Update an INTEGER. + **/ + public void Var024() { + setupRs(); + if (checkJdbc42()) { + + try { + + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateObject", "C_INTEGER", Integer.valueOf(-122833), + getSQLType(Types.INTEGER)); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + int v = rs2.getInt("C_INTEGER"); + rs2.close(); + assertCondition(v == -122833); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } -/** -updateObject() - Should be reflected by get on insert row, even if -insert has not yet been issued (i.e. insert is still pending). -**/ - public void Var018() - { - setupRs(); - if (checkJdbc42 ()) { - try { - rs_.moveToInsertRow (); - JDReflectionUtil.callMethod_V(rs_,"updateObject","C_VARCHAR_50", "Ohio", getSQLType(Types.VARCHAR)); - assertCondition (rs_.getString ("C_VARCHAR_50").equals ("Ohio")); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } + /** + * updateObject() - Update an INTEGER, when the integer is too big. + **/ + public void Var025() { + setupRs(); + if (checkJdbc42()) { + int expectedColumn = -1; + + try { + + JDRSTest.position(rs_, key_); + expectedColumn = rs_.findColumn("C_INTEGER"); + JDReflectionUtil.callMethod_V(rs_, "updateObject", "C_INTEGER", Long.valueOf(245545147483647L), + getSQLType(Types.INTEGER)); + rs_.updateRow(); + failed("Didn't throw SQLException"); + } catch (Exception e) { + if (e instanceof DataTruncation) { + DataTruncation dt = (DataTruncation) e; + assertCondition((dt.getIndex() == expectedColumn) && (dt.getParameter() == false) && (dt.getRead() == false) + && (dt.getDataSize() == 8) && (dt.getTransferSize() == 4)); + } else { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); } + + } } + } + /** + * updateObject() - Update an INTEGER with an object that has a fraction. This + * should work. + **/ + public void Var026() { + setupRs(); + if (checkJdbc42()) { + + try { + + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateObject", "C_INTEGER", Float.valueOf(-122833.6f), + getSQLType(Types.INTEGER)); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + int v = rs2.getInt("C_INTEGER"); + rs2.close(); + assertCondition(v == -122833); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } -/** -updateObject() - Should throw an exception on a deleted row. -**/ - public void Var019() - { - setupRs(); - if (checkJdbc42 ()) { - try { - JDRSTest.position (rs_, "DUMMY_ROW"); - rs_.deleteRow (); - JDReflectionUtil.callMethod_V(rs_,"updateObject","C_VARCHAR_50", "Kentucky", getSQLType(Types.VARCHAR)); - failed ("Didn't throw SQLException"); - } - catch (Exception e) { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + /** + * updateObject() - Update an INTEGER, when the object is not a number. + **/ + public void Var027() { + setupRs(); + if (checkJdbc42()) { + + try { + + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateObject", "C_INTEGER", "Tennessee", getSQLType(Types.INTEGER)); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } + } + /** + * updateObject() - Update a REAL. + **/ + public void Var028() { + setupRs(); + if (checkJdbc42()) { + + try { + + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateObject", "C_REAL", Float.valueOf(31.53f), getSQLType(Types.REAL)); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + float v = rs2.getFloat("C_REAL"); + rs2.close(); + assertCondition(v == 31.53f); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } -/** -updateObject() - Update a SMALLINT. -**/ - public void Var020 () - { - setupRs(); - if (checkJdbc42 ()) { - try { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_,"updateObject","C_SMALLINT", Short.valueOf((short) 243), getSQLType(Types.SMALLINT)); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - short v = rs2.getShort ("C_SMALLINT"); - rs2.close (); - assertCondition (v == 243); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } + /** + * updateObject() - Update a REAL, when the object is not a number. + **/ + public void Var029() { + setupRs(); + if (checkJdbc42()) { + + try { + + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateObject", "C_INTEGER", "Alabama", getSQLType(Types.REAL)); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } + } + /** + * updateObject() - Update a FLOAT. + **/ + public void Var030() { + setupRs(); + if (checkJdbc42()) { + + try { + + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateObject", "C_FLOAT", Float.valueOf(-9845.32f), + getSQLType(Types.FLOAT)); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + float v = rs2.getFloat("C_FLOAT"); + rs2.close(); + assertCondition(v == -9845.32f); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + /** + * updateObject() - Update a FLOAT, when the object is not a number. + **/ + public void Var031() { + setupRs(); + if (checkJdbc42()) { + + try { + + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateObject", "C_FLOAT", "Mississippi", getSQLType(Types.FLOAT)); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } + } + } -/** -updateObject() - Update a SMALLINT, when the integer is too big. -**/ - public void Var021 () - { - setupRs(); - if (checkJdbc42 ()) { - int expectedColumn = -1; - try { - JDRSTest.position (rs_, key_); - expectedColumn = rs_.findColumn ("C_SMALLINT"); - JDReflectionUtil.callMethod_V(rs_,"updateObject","C_SMALLINT", Integer.valueOf(4873423), getSQLType(Types.SMALLINT)); - rs_.updateRow (); - failed ("Didn't throw SQLException"); - } - catch (Exception e) { - if (e instanceof DataTruncation) { - DataTruncation dt = (DataTruncation)e; - assertCondition ((dt.getIndex() == expectedColumn) - && (dt.getParameter() == false) - && (dt.getRead() == false) - && (dt.getDataSize() == 8) - && (dt.getTransferSize() == 2)); - } else { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } + /** + * updateObject() - Update a DOUBLE. + **/ + public void Var032() { + setupRs(); + if (checkJdbc42()) { + + try { + + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateObject", "C_DOUBLE", Double.valueOf(19845.987987), + getSQLType(Types.DOUBLE)); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + double v = rs2.getDouble("C_DOUBLE"); + rs2.close(); + assertCondition(v == 19845.987987); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } - } - } + /** + * updateObject() - Update a DOUBLE, when the object is not a number. + **/ + public void Var033() { + setupRs(); + if (checkJdbc42()) { + + try { + + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateObject", "C_DOUBLE", "Louisiana", getSQLType(Types.DOUBLE)); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } + } + /** + * updateObject() - Update a DECIMAL, with no scale specified. + **/ + public void Var034() { + setupRs(); + if (checkJdbc42()) { + + try { + + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateObject", "C_DECIMAL_105", new BigDecimal(-4539.9), + getSQLType(Types.DECIMAL)); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + BigDecimal v = rs2.getBigDecimal("C_DECIMAL_105"); + rs2.close(); + assertCondition(v.floatValue() == -4539.9f); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + /** + * updateObject() - Update a DECIMAL, when the fraction will truncate. This is + * ok. + **/ + public void Var035() { + setupRs(); + if (checkJdbc42()) { + + try { + + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateObject", "C_DECIMAL_105", new BigDecimal(-4539.987666666), + getSQLType(Types.DECIMAL)); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + BigDecimal v = rs2.getBigDecimal("C_DECIMAL_105"); + rs2.close(); + assertCondition(v.equals(new BigDecimal("-4539.98766"))); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } -/** -updateObject() - Update a SMALLINT with an object that has a fraction. -This should work. -**/ - public void Var022 () - { - setupRs(); - if (checkJdbc42 ()) { - try { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_,"updateObject","C_SMALLINT", Float.valueOf(243.6f), getSQLType(Types.SMALLINT)); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - short v = rs2.getShort ("C_SMALLINT"); - rs2.close (); - assertCondition (v == 243); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } + /** + * updateObject() - Update a DECIMAL, with scale -1 specified. + **/ + public void Var036() { + setupRs(); + if (checkJdbc42()) { + + try { + + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateObject", "C_DECIMAL_105", new BigDecimal(-4532.9), + getSQLType(Types.DECIMAL), -1); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } + } + /** + * updateObject() - Update a DECIMAL, with scale 0 specified. + **/ + public void Var037() { + setupRs(); + if (checkJdbc42()) { + + try { + + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateObject", "C_DECIMAL_105", new BigDecimal(39455.58734), + getSQLType(Types.DECIMAL), 0); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + BigDecimal v = rs2.getBigDecimal("C_DECIMAL_105"); + rs2.close(); + assertCondition(v.floatValue() == 39455); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + /** + * updateObject() - Update a DECIMAL, with scale less than the value's scale. + **/ + public void Var038() { + setupRs(); + if (checkJdbc42()) { + + try { + + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateObject", "C_DECIMAL_105", new BigDecimal(34255.53434), + getSQLType(Types.DECIMAL), 3); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + BigDecimal v = rs2.getBigDecimal("C_DECIMAL_105"); + rs2.close(); + assertCondition(v.floatValue() == 34255.534f); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } -/** -updateObject() - Update a SMALLINT, when the object is not a number. -**/ - public void Var023 () - { - setupRs(); - if (checkJdbc42 ()) { - try { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_,"updateObject","C_SMALLINT", "West Virginia", getSQLType(Types.SMALLINT)); - failed ("Didn't throw SQLException"); - } - catch (Exception e) { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + /** + * updateObject() - Update a DECIMAL, with scale equal to the value's scale. + **/ + public void Var039() { + setupRs(); + if (checkJdbc42()) { + + try { + + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateObject", "C_DECIMAL_105", new BigDecimal(54321.12345), + getSQLType(Types.DECIMAL), 5); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + BigDecimal v = rs2.getBigDecimal("C_DECIMAL_105"); + rs2.close(); + assertCondition(v.floatValue() == 54321.12345f); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } } + } + /** + * updateObject() - Update a DECIMAL, with scale greater the value's scale. + **/ + public void Var040() { + setupRs(); + if (checkJdbc42()) { + + try { + + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateObject", "C_DECIMAL_105", new BigDecimal(54321.12345), + getSQLType(Types.DECIMAL), 8); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + BigDecimal v = rs2.getBigDecimal("C_DECIMAL_105"); + rs2.close(); + assertCondition(v.floatValue() == 54321.12345f); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + /** + * updateObject() - Update a DECIMAL, when the value is too big. + **/ + public void Var041() { + setupRs(); + if (checkJdbc42()) { + int expectedColumn = -1; + + try { + + JDRSTest.position(rs_, key_); + expectedColumn = rs_.findColumn("C_DECIMAL_105"); + JDReflectionUtil.callMethod_V(rs_, "updateObject", "C_DECIMAL_105", new BigDecimal("394585.432389445"), + getSQLType(Types.DECIMAL)); + rs_.updateRow(); + failed("Didn't throw SQLException"); + } catch (Exception e) { + if (e instanceof DataTruncation) { + DataTruncation dt = (DataTruncation) e; + assertCondition((dt.getIndex() == expectedColumn) && (dt.getParameter() == false) && (dt.getRead() == false) + && (dt.getDataSize() == 15) && (dt.getTransferSize() == 10)); + } else { + assertSqlException(e, -99999, "07006", "Data type mismatch", + "Mismatch instead of truncation in latest toolbox"); -/** -updateObject() - Update an INTEGER. -**/ - public void Var024 () - { - setupRs(); - if (checkJdbc42 ()) { - try { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_,"updateObject","C_INTEGER", Integer.valueOf(-122833), getSQLType(Types.INTEGER)); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - int v = rs2.getInt ("C_INTEGER"); - rs2.close (); - assertCondition (v == -122833); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } } - } + } + } + } + /** + * updateObject() - Update a DECIMAL, when the object is not a number. + **/ + public void Var042() { + setupRs(); + if (checkJdbc42()) { + + try { + + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateObject", "C_DECIMAL_105", "Arkansas", getSQLType(Types.DECIMAL)); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } + } + } -/** -updateObject() - Update an INTEGER, when the integer is too big. -**/ - public void Var025 () - { - setupRs(); - if (checkJdbc42 ()) { - int expectedColumn = -1; - try { - JDRSTest.position (rs_, key_); - expectedColumn = rs_.findColumn ("C_INTEGER"); - JDReflectionUtil.callMethod_V(rs_,"updateObject","C_INTEGER", Long.valueOf(245545147483647L), getSQLType(Types.INTEGER)); - rs_.updateRow (); - failed ("Didn't throw SQLException"); - } - catch (Exception e) { - if (e instanceof DataTruncation) { - DataTruncation dt = (DataTruncation)e; - assertCondition ((dt.getIndex() == expectedColumn) - && (dt.getParameter() == false) - && (dt.getRead() == false) - && (dt.getDataSize() == 8) - && (dt.getTransferSize() == 4)); - } else { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - - } - } + /** + * updateObject() - Update a NUMERIC, with no scale specified. + **/ + public void Var043() { + setupRs(); + if (checkJdbc42()) { + try { + + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateObject", "C_NUMERIC_105", new BigDecimal(-6639.95), + getSQLType(Types.NUMERIC)); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + BigDecimal v = rs2.getBigDecimal("C_NUMERIC_105"); + rs2.close(); + assertCondition(v.floatValue() == -6639.95f); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } } + } + /** + * updateObject() - Update a NUMERIC, when the fraction will truncate. + **/ + public void Var044() { + setupRs(); + if (checkJdbc42()) { + + try { + + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateObject", "C_NUMERIC_40", new BigDecimal(-4539.98), + getSQLType(Types.NUMERIC)); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + BigDecimal v = rs2.getBigDecimal("C_NUMERIC_40"); + rs2.close(); + assertCondition(v.equals(new BigDecimal(-4539.0))); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + /** + * updateObject() - Update a NUMERIC, with scale -1 specified. + **/ + public void Var045() { + setupRs(); + if (checkJdbc42()) { + + try { + + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateObject", "C_NUMERIC_105", new BigDecimal(-4432.9), + getSQLType(Types.NUMERIC), -1); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } + } + } -/** -updateObject() - Update an INTEGER with an object that has a fraction. This -should work. -**/ - public void Var026 () - { - setupRs(); - if (checkJdbc42 ()) { - try { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_,"updateObject","C_INTEGER", Float.valueOf(-122833.6f), getSQLType(Types.INTEGER)); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - int v = rs2.getInt ("C_INTEGER"); - rs2.close (); - assertCondition (v == -122833); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } + /** + * updateObject() - Update a NUMERIC, with scale 0 specified. + **/ + public void Var046() { + setupRs(); + if (checkJdbc42()) { + + try { + + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateObject", "C_NUMERIC_105", new BigDecimal(39458.88734), + getSQLType(Types.NUMERIC), 0); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + BigDecimal v = rs2.getBigDecimal("C_NUMERIC_105"); + rs2.close(); + assertCondition(v.floatValue() == 39458); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } } + } - - -/** -updateObject() - Update an INTEGER, when the object is not a number. -**/ - public void Var027 () - { - setupRs(); - if (checkJdbc42 ()) { - try { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_,"updateObject","C_INTEGER", "Tennessee", getSQLType(Types.INTEGER)); - failed ("Didn't throw SQLException"); - } - catch (Exception e) { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + /** + * updateObject() - Update a NUMERIC, with scale less than the value's scale. + **/ + public void Var047() { + setupRs(); + if (checkJdbc42()) { + + try { + + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateObject", "C_NUMERIC_105", new BigDecimal(34255.53434), + getSQLType(Types.NUMERIC), 3); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + BigDecimal v = rs2.getBigDecimal("C_NUMERIC_105"); + rs2.close(); + assertCondition(v.floatValue() == 34255.534f); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } } + } - - -/** -updateObject() - Update a REAL. -**/ - public void Var028 () - { - setupRs(); - if (checkJdbc42 ()) { - try { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_,"updateObject","C_REAL", Float.valueOf(31.53f), getSQLType(Types.REAL)); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - float v = rs2.getFloat ("C_REAL"); - rs2.close (); - assertCondition (v == 31.53f); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } + /** + * updateObject() - Update a NUMERIC, with scale equal to the value's scale. + **/ + public void Var048() { + setupRs(); + if (checkJdbc42()) { + + try { + + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateObject", "C_NUMERIC_105", new BigDecimal(54321.12345), + getSQLType(Types.NUMERIC), 5); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + BigDecimal v = rs2.getBigDecimal("C_NUMERIC_105"); + rs2.close(); + assertCondition(v.floatValue() == 54321.12345f); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } } + } - -/** -updateObject() - Update a REAL, when the object is not a number. -**/ - public void Var029 () - { - setupRs(); - if (checkJdbc42 ()) { - try { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_,"updateObject","C_INTEGER", "Alabama", getSQLType(Types.REAL)); - failed ("Didn't throw SQLException"); - } - catch (Exception e) { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + /** + * updateObject() - Update a NUMERIC, with scale greater the value's scale. + **/ + public void Var049() { + setupRs(); + if (checkJdbc42()) { + + try { + + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateObject", "C_NUMERIC_105", new BigDecimal(54321.12345), + getSQLType(Types.NUMERIC), 8); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + BigDecimal v = rs2.getBigDecimal("C_NUMERIC_105"); + rs2.close(); + assertCondition(v.floatValue() == 54321.12345f); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } } + } + /** + * updateObject() - Update a NUMERIC, when the value is too big. + **/ + public void Var050() { + setupRs(); + if (checkJdbc42()) { + int expectedColumn = -1; + + try { + + JDRSTest.position(rs_, key_); + expectedColumn = rs_.findColumn("C_NUMERIC_40"); + JDReflectionUtil.callMethod_V(rs_, "updateObject", "C_NUMERIC_40", new BigDecimal(394585.0), + getSQLType(Types.NUMERIC)); + rs_.updateRow(); + failed("Didn't throw SQLException"); + } catch (Exception e) { + if (e instanceof DataTruncation) { + DataTruncation dt = (DataTruncation) e; + assertCondition((dt.getIndex() == expectedColumn) && (dt.getParameter() == false) && (dt.getRead() == false) + && (dt.getDataSize() == 6) && (dt.getTransferSize() == 4)); + } else { + assertSqlException(e, -99999, "07006", "Data type mismatch", + "Mismatch instead of truncation in latest toolbox"); - -/** -updateObject() - Update a FLOAT. -**/ - public void Var030 () - { - setupRs(); - if (checkJdbc42 ()) { - try { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_,"updateObject","C_FLOAT", Float.valueOf(-9845.32f), getSQLType(Types.FLOAT)); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - float v = rs2.getFloat ("C_FLOAT"); - rs2.close (); - assertCondition (v == -9845.32f); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } } - } - - -/** -updateObject() - Update a FLOAT, when the object is not a number. -**/ - public void Var031 () - { - setupRs(); - if (checkJdbc42 ()) { - try { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_,"updateObject","C_FLOAT", "Mississippi", getSQLType(Types.FLOAT)); - failed ("Didn't throw SQLException"); - } - catch (Exception e) { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + } } + } - -/** -updateObject() - Update a DOUBLE. -**/ - public void Var032 () - { - setupRs(); - if (checkJdbc42 ()) { - try { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_,"updateObject","C_DOUBLE", Double.valueOf(19845.987987), getSQLType(Types.DOUBLE)); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - double v = rs2.getDouble ("C_DOUBLE"); - rs2.close (); - assertCondition (v == 19845.987987); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } + /** + * updateObject() - Update a NUMERIC, when the object is not a number. + **/ + public void Var051() { + setupRs(); + if (checkJdbc42()) { + + try { + + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateObject", "C_NUMERIC_40", "Missouri", getSQLType(Types.NUMERIC)); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } + } - - -/** -updateObject() - Update a DOUBLE, when the object is not a number. -**/ - public void Var033 () - { - setupRs(); - if (checkJdbc42 ()) { - try { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_,"updateObject","C_DOUBLE", "Louisiana", getSQLType(Types.DOUBLE)); - failed ("Didn't throw SQLException"); - } - catch (Exception e) { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + /** + * updateObject() - Update a CHAR. + **/ + public void Var052() { + setupRs(); + if (checkJdbc42()) { + + try { + + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateObject", "C_CHAR_50", "Iowa", getSQLType(Types.CHAR)); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + String v = rs2.getString("C_CHAR_50"); + rs2.close(); + assertCondition(v.equals("Iowa ")); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } } + } + /** + * updateObject() - Update a CHAR, when the value is too big. + **/ + public void Var053() { + setupRs(); + if (checkJdbc42()) { + int expectedColumn = -1; + + try { + + JDRSTest.position(rs_, key_); + expectedColumn = rs_.findColumn("C_CHAR_1"); + JDReflectionUtil.callMethod_V(rs_, "updateObject", "C_CHAR_1", "Minnesota", getSQLType(Types.CHAR)); + rs_.updateRow(); + failed("Didn't throw SQLException"); + } catch (Exception e) { + DataTruncation dt = (DataTruncation) e; + assertCondition((dt.getIndex() == expectedColumn) && (dt.getParameter() == false) && (dt.getRead() == false) + && (dt.getDataSize() == 9) && (dt.getTransferSize() == 1)); -/** -updateObject() - Update a DECIMAL, with no scale specified. -**/ - public void Var034 () - { - setupRs(); - if (checkJdbc42 ()) { - try { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_,"updateObject","C_DECIMAL_105", new BigDecimal (-4539.9), getSQLType(Types.DECIMAL)); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - BigDecimal v = rs2.getBigDecimal ("C_DECIMAL_105"); - rs2.close (); - assertCondition (v.floatValue() == -4539.9f); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } + } } + } - - -/** -updateObject() - Update a DECIMAL, when the fraction will truncate. This is ok. -**/ - public void Var035 () - { - setupRs(); - if (checkJdbc42 ()) { - try { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_,"updateObject","C_DECIMAL_105", new BigDecimal (-4539.987666666), getSQLType(Types.DECIMAL)); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - BigDecimal v = rs2.getBigDecimal ("C_DECIMAL_105"); - rs2.close (); - assertCondition (v.equals(new BigDecimal("-4539.98766"))); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } + /** + * updateObject() - Update a VARCHAR. + **/ + public void Var054() { + setupRs(); + if (checkJdbc42()) { + + try { + + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateObject", "C_VARCHAR_50", "Wisconsin", getSQLType(Types.VARCHAR)); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + String v = rs2.getString("C_VARCHAR_50"); + rs2.close(); + assertCondition(v.equals("Wisconsin")); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } } + } + /** + * updateObject() - Update a VARCHAR, when the value is too big. + **/ + public void Var055() { + setupRs(); + if (checkJdbc42()) { + int expectedColumn = -1; + + try { + + JDRSTest.position(rs_, key_); + expectedColumn = rs_.findColumn("C_VARCHAR_50"); + JDReflectionUtil.callMethod_V(rs_, "updateObject", "C_VARCHAR_50", + "Michigan, Illinois, Indiana, and whatever states around there that I have missed.", + getSQLType(Types.VARCHAR)); + rs_.updateRow(); + failed("Didn't throw SQLException"); + } catch (Exception e) { + DataTruncation dt = (DataTruncation) e; + assertCondition((dt.getIndex() == expectedColumn) && (dt.getParameter() == false) && (dt.getRead() == false) + && (dt.getDataSize() == 81) && (dt.getTransferSize() == 50)); - -/** -updateObject() - Update a DECIMAL, with scale -1 specified. -**/ - public void Var036 () - { - setupRs(); - if (checkJdbc42 ()) { - try { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_,"updateObject","C_DECIMAL_105", new BigDecimal (-4532.9), getSQLType(Types.DECIMAL), -1); - failed ("Didn't throw SQLException"); - } - catch (Exception e) { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + } } + } + /** + * updateObject() - Update a BINARY. + **/ + public void Var056() { + setupRs(); + if (checkJdbc42()) { + + try { + + String expected; + if (isToolboxDriver()) + expected = "F1F2"; + else + expected = "Ford"; -/** -updateObject() - Update a DECIMAL, with scale 0 specified. -**/ - public void Var037 () - { - setupRs(); - if (checkJdbc42 ()) { - try { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_,"updateObject","C_DECIMAL_105", new BigDecimal (39455.58734), getSQLType(Types.DECIMAL), 0); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - BigDecimal v = rs2.getBigDecimal ("C_DECIMAL_105"); - rs2.close (); - assertCondition (v.floatValue() == 39455); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateObject", "C_BINARY_20", expected, getSQLType(Types.BINARY)); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + String v = rs2.getString("C_BINARY_20"); + rs2.close(); + assertCondition(v.startsWith(expected)); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } } + } + /** + * updateObject() - Update a BINARY, when the value is too big. + **/ + public void Var057() { + setupRs(); + if (checkJdbc42()) { + int expectedColumn = -1; + + try { + + JDRSTest.position(rs_, key_); + expectedColumn = rs_.findColumn("C_BINARY_1"); + JDReflectionUtil.callMethod_V(rs_, "updateObject", "C_BINARY_1", "F1F2F3F4", getSQLType(Types.BINARY)); + rs_.updateRow(); + failed("Didn't throw SQLException"); + } catch (Exception e) { + DataTruncation dt = (DataTruncation) e; + assertCondition((dt.getIndex() == expectedColumn) && (dt.getParameter() == false) && (dt.getRead() == false) + && (dt.getTransferSize() == 1)); -/** -updateObject() - Update a DECIMAL, with scale less than the value's scale. -**/ - public void Var038 () - { - setupRs(); - if (checkJdbc42 ()) { - try { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_,"updateObject","C_DECIMAL_105", new BigDecimal (34255.53434), getSQLType(Types.DECIMAL), 3); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - BigDecimal v = rs2.getBigDecimal ("C_DECIMAL_105"); - rs2.close (); - assertCondition (v.floatValue() == 34255.534f); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } + } } + } + /** + * updateObject() - Update a VARBINARY. + **/ + public void Var058() { + setupRs(); + if (checkJdbc42()) { + + try { + + String expected; + if (isToolboxDriver()) + expected = "F1F2"; + else + expected = "Ford"; -/** -updateObject() - Update a DECIMAL, with scale equal to the value's scale. -**/ - public void Var039 () - { - setupRs(); - if (checkJdbc42 ()) { - try { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_,"updateObject","C_DECIMAL_105", new BigDecimal (54321.12345), getSQLType(Types.DECIMAL), 5); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - BigDecimal v = rs2.getBigDecimal ("C_DECIMAL_105"); - rs2.close (); - assertCondition (v.floatValue() == 54321.12345f); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateObject", "C_VARBINARY_20", expected, getSQLType(Types.VARBINARY)); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + String v = rs2.getString("C_VARBINARY_20"); + rs2.close(); + assertCondition(v.equals(expected)); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } } + } + /** + * updateObject() - Update a VARBINARY, when the value is too big. + **/ + public void Var059() { + setupRs(); + if (checkJdbc42()) { + int expectedColumn = -1; + + try { + + JDRSTest.position(rs_, key_); + expectedColumn = rs_.findColumn("C_VARBINARY_20"); + JDReflectionUtil.callMethod_V(rs_, "updateObject", "C_VARBINARY_20", + "E1E2E3E4E5F1F2F3F4F5C1C2C3C4C5D1D2D3D3D5E1E2E3E4E5F1F2F3F4F5C1C2C3C4C5D1D2D3D3D5", + getSQLType(Types.VARBINARY)); + rs_.updateRow(); + failed("Didn't throw SQLException"); + } catch (Exception e) { + DataTruncation dt = (DataTruncation) e; + assertCondition((dt.getIndex() == expectedColumn) && (dt.getParameter() == false) && (dt.getRead() == false) + && (dt.getTransferSize() == 20)); -/** -updateObject() - Update a DECIMAL, with scale greater the value's scale. -**/ - public void Var040 () - { - setupRs(); - if (checkJdbc42 ()) { - try { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_,"updateObject","C_DECIMAL_105", new BigDecimal (54321.12345), getSQLType(Types.DECIMAL), 8); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - BigDecimal v = rs2.getBigDecimal ("C_DECIMAL_105"); - rs2.close (); - assertCondition (v.floatValue() ==54321.12345f); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } + } } + } - -/** -updateObject() - Update a DECIMAL, when the value is too big. -**/ - public void Var041 () - { - setupRs(); - if (checkJdbc42 ()) { - int expectedColumn = -1; + /** + * updateObject() - Update a CLOB, when the data is stored in the result set. + **/ + public void Var060() { + setupRs(); + if (checkJdbc42()) { + if (checkLobSupport()) { + try { - JDRSTest.position (rs_, key_); - expectedColumn = rs_.findColumn ("C_DECIMAL_105"); - JDReflectionUtil.callMethod_V(rs_,"updateObject","C_DECIMAL_105", new BigDecimal ("394585.432389445"), getSQLType(Types.DECIMAL)); - rs_.updateRow (); - failed ("Didn't throw SQLException"); - } - catch (Exception e) { - if (e instanceof DataTruncation) { - DataTruncation dt = (DataTruncation)e; - assertCondition ((dt.getIndex() == expectedColumn) - && (dt.getParameter() == false) - && (dt.getRead() == false) - && (dt.getDataSize() == 15) - && (dt.getTransferSize() == 10)); - } else { - assertSqlException(e, -99999, "07006", "Data type mismatch", - "Mismatch instead of truncation in latest toolbox"); - - } - - } - } + + JDRSTest.position(rs_, key_); + String s = "New Mexico"; + Clob c = new JDLobTest.JDTestClob(s); + JDReflectionUtil.callMethod_V(rs_, "updateObject", "C_CLOB", c, getSQLType(Types.CLOB)); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + String v = rs2.getString("C_CLOB"); + rs2.close(); + assertCondition(v.equals(s)); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } + } } + } - -/** -updateObject() - Update a DECIMAL, when the object is not a number. -**/ - public void Var042 () - { - setupRs(); - if (checkJdbc42 ()) { - try { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_,"updateObject","C_DECIMAL_105", "Arkansas", getSQLType(Types.DECIMAL)); - failed ("Didn't throw SQLException"); - } - catch (Exception e) { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + /** + * updateObject() - Update a CLOB, when the locator is stored in the result set. + **/ + public void Var061() { + setupRs(); + if (checkJdbc42()) { + if (checkLobSupport()) { + + try { + + JDRSTest.position(rs3_, key_); + String s = "New Mexico"; + Clob c = new JDLobTest.JDTestClob(s); + JDReflectionUtil.callMethod_V(rs3_, "updateObject", "C_CLOB", c, getSQLType(Types.CLOB)); + rs3_.updateRow(); + ResultSet rs2 = statement4_.executeQuery(select_); + JDRSTest.position(rs2, key_); + String v = rs2.getString("C_CLOB"); + rs2.close(); + assertCondition(v.equals(s)); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } + } } + } - - -/** -updateObject() - Update a NUMERIC, with no scale specified. -**/ - public void Var043 () - { - setupRs(); - if (checkJdbc42 ()) { - try { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_,"updateObject","C_NUMERIC_105", new BigDecimal (-6639.95), getSQLType(Types.NUMERIC)); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - BigDecimal v = rs2.getBigDecimal ("C_NUMERIC_105"); - rs2.close (); - assertCondition (v.floatValue() == -6639.95f); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } + /** + * updateObject() - Update a DBCLOB, when the data is stored in the result set. + **/ + public void Var062() { + setupRs(); + if (checkJdbc42()) { + if (checkLobSupport()) { + + try { + + JDRSTest.position(rs_, key_); + String s = "Arizona"; + Clob c = new JDLobTest.JDTestClob(s); + JDReflectionUtil.callMethod_V(rs_, "updateObject", "C_DBCLOB", c, getSQLType(Types.CLOB)); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + String v = rs2.getString("C_DBCLOB"); + rs2.close(); + assertCondition(v.equals(s)); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } + } } + } - - -/** -updateObject() - Update a NUMERIC, when the fraction will truncate. -**/ - public void Var044 () - { - setupRs(); - if (checkJdbc42 ()) { - try { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_,"updateObject","C_NUMERIC_40", new BigDecimal (-4539.98), getSQLType(Types.NUMERIC)); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - BigDecimal v = rs2.getBigDecimal ("C_NUMERIC_40"); - rs2.close (); - assertCondition (v.equals(new BigDecimal(-4539.0))); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } + /** + * updateObject() - Update a DBCLOB, when the locator is stored in the result + * set. + **/ + public void Var063() { + setupRs(); + if (checkJdbc42()) { + if (checkLobSupport()) { + + try { + + JDRSTest.position(rs3_, key_); + String s = "Arizona"; + Clob c = new JDLobTest.JDTestClob(s); + JDReflectionUtil.callMethod_V(rs3_, "updateObject", "C_DBCLOB", c, getSQLType(Types.CLOB)); + rs3_.updateRow(); + ResultSet rs2 = statement4_.executeQuery(select_); + JDRSTest.position(rs2, key_); + String v = rs2.getString("C_DBCLOB"); + rs2.close(); + assertCondition(v.equals(s)); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } + } } + } + /** + * updateObject() - Update a BLOB, when the data is stored in the result set. + **/ + public void Var064() { + setupRs(); + if (checkJdbc42()) { + if (checkLobSupport()) { + + try { + + JDRSTest.position(rs_, key_); + byte[] ba = { 54, 65, -34, 65, 0, -2, -1, 0 }; + Blob b = new JDLobTest.JDTestBlob(ba); + JDReflectionUtil.callMethod_V(rs_, "updateObject", "C_BLOB", b, getSQLType(Types.BLOB)); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + byte[] v = rs2.getBytes("C_BLOB"); + rs2.close(); + assertCondition(areEqual(v, ba)); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } + } + } + } - -/** -updateObject() - Update a NUMERIC, with scale -1 specified. -**/ - public void Var045 () - { - setupRs(); - if (checkJdbc42 ()) { - try { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_,"updateObject","C_NUMERIC_105", new BigDecimal (-4432.9), getSQLType(Types.NUMERIC), -1); - failed ("Didn't throw SQLException"); - } - catch (Exception e) { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + /** + * updateObject() - Update a BLOB, when the locator is stored in the result set. + **/ + public void Var065() { + setupRs(); + if (checkJdbc42()) { + if (checkLobSupport()) { + + try { + + JDRSTest.position(rs3_, key_); + byte[] ba = { 54, 65, -34, 65, 0, -2, -1, 0 }; + Blob b = new JDLobTest.JDTestBlob(ba); + JDReflectionUtil.callMethod_V(rs3_, "updateObject", "C_BLOB", b, getSQLType(Types.BLOB)); + rs3_.updateRow(); + ResultSet rs2 = statement4_.executeQuery(select_); + JDRSTest.position(rs2, key_); + byte[] v = rs2.getBytes("C_BLOB"); + rs2.close(); + assertCondition(areEqual(v, ba)); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } + } } + } + + /** + * updateObject() - Update a DATE. + **/ + public void Var066() { + setupRs(); + if (checkJdbc42()) { + + try { + + JDRSTest.position(rs_, key_); + Date d = new Date(1922400000); + JDReflectionUtil.callMethod_V(rs_, "updateObject", "C_DATE", d, getSQLType(Types.DATE)); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + Date v = rs2.getDate("C_DATE"); + rs2.close(); + assertCondition(v.toString().equals(d.toString())); -/** -updateObject() - Update a NUMERIC, with scale 0 specified. -**/ - public void Var046 () - { - setupRs(); - if (checkJdbc42 ()) { - try { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_,"updateObject","C_NUMERIC_105", new BigDecimal (39458.88734), getSQLType(Types.NUMERIC), 0); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - BigDecimal v = rs2.getBigDecimal ("C_NUMERIC_105"); - rs2.close (); - assertCondition (v.floatValue() == 39458); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } } + } - -/** -updateObject() - Update a NUMERIC, with scale less than the value's scale. -**/ - public void Var047 () - { - setupRs(); - if (checkJdbc42 ()) { - try { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_,"updateObject","C_NUMERIC_105", new BigDecimal (34255.53434), getSQLType(Types.NUMERIC), 3); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - BigDecimal v = rs2.getBigDecimal ("C_NUMERIC_105"); - rs2.close (); - assertCondition (v.floatValue() == 34255.534f); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } + /** + * updateObject() - Update a DATE, when the string is not a valid date. + **/ + public void Var067() { + setupRs(); + if (checkJdbc42()) { + + try { + + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateObject", "C_DATE", "Nevada", getSQLType(Types.DATE)); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } + } + /** + * updateObject() - Update a TIME. + **/ + public void Var068() { + setupRs(); + if (checkJdbc42()) { + + try { + + JDRSTest.position(rs_, key_); + Time t = Time.valueOf("07:36:00"); + JDReflectionUtil.callMethod_V(rs_, "updateObject", "C_TIME", t, getSQLType(Types.TIME)); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + Time v = rs2.getTime("C_TIME"); + rs2.close(); + assertCondition(v.toString().equals(t.toString())); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } -/** -updateObject() - Update a NUMERIC, with scale equal to the value's scale. -**/ - public void Var048 () - { - setupRs(); - if (checkJdbc42 ()) { - try { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_,"updateObject","C_NUMERIC_105", new BigDecimal (54321.12345), getSQLType(Types.NUMERIC), 5); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - BigDecimal v = rs2.getBigDecimal ("C_NUMERIC_105"); - rs2.close (); - assertCondition (v.floatValue() == 54321.12345f); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } + /** + * updateObject() - Update a TIME, when the string is not a valid time. + **/ + public void Var069() { + setupRs(); + if (checkJdbc42()) { + + try { + + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateObject", "C_TIME", "Wyoming", getSQLType(Types.TIME)); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } + } + /** + * updateObject() - Update a TIMESTAMP. + **/ + public void Var070() { + setupRs(); + if (checkJdbc42()) { + + try { + + JDRSTest.position(rs_, key_); + Timestamp ts = new Timestamp(425252435); + JDReflectionUtil.callMethod_V(rs_, "updateObject", "C_TIMESTAMP", ts, getSQLType(Types.TIMESTAMP)); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + Timestamp v = rs2.getTimestamp("C_TIMESTAMP"); + rs2.close(); + assertCondition(v.equals(ts)); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } -/** -updateObject() - Update a NUMERIC, with scale greater the value's scale. -**/ - public void Var049 () - { - setupRs(); - if (checkJdbc42 ()) { - try { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_,"updateObject","C_NUMERIC_105", new BigDecimal (54321.12345), getSQLType(Types.NUMERIC), 8); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - BigDecimal v = rs2.getBigDecimal ("C_NUMERIC_105"); - rs2.close (); - assertCondition (v.floatValue() == 54321.12345f); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } + /** + * updateObject() - Update a TIMESTAMP, when the string is not a vliad + * timestamp. + **/ + public void Var071() { + setupRs(); + if (checkJdbc42()) { + + try { + + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateObject", "C_TIMESTAMP", "Montana", getSQLType(Types.TIMESTAMP)); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } + } + /** + * updateObject() - Update a DATALINK. + **/ + public void Var072() { + setupRs(); + if (checkJdbc42()) { + if (checkLobSupport()) { + // We do not test updating datalinks, since it is not + // possible to open a updatable cursor/result set with + // a datalink column. + notApplicable("DATALINK update not supported."); + /* + * try { JDRSTest.position (rs_, key_); + * JDReflectionUtil.callMethod_V(rs_,"updateObject","C_DATALINK", "Idaho", + * getSQLType(Types.VARCHAR)); failed ("Didn't throw SQLException"); } catch + * (Exception e) { assertExceptionIsInstanceOf (e, "java.sql.SQLException"); } + */ + } + } + } -/** -updateObject() - Update a NUMERIC, when the value is too big. -**/ - public void Var050 () - { - - setupRs(); - if (checkJdbc42 ()) { - int expectedColumn = -1; + /** + * updateObject() - Update a DISTINCT. + **/ + public void Var073() { + setupRs(); + if (checkJdbc42()) { + if (checkLobSupport()) { + try { - JDRSTest.position (rs_, key_); - expectedColumn = rs_.findColumn ("C_NUMERIC_40"); - JDReflectionUtil.callMethod_V(rs_,"updateObject","C_NUMERIC_40", new BigDecimal (394585.0), getSQLType(Types.NUMERIC)); - rs_.updateRow (); - failed ("Didn't throw SQLException"); - } - catch (Exception e) { - if (e instanceof DataTruncation) { - DataTruncation dt = (DataTruncation)e; - assertCondition ((dt.getIndex() == expectedColumn) - && (dt.getParameter() == false) - && (dt.getRead() == false) - && (dt.getDataSize() == 6) - && (dt.getTransferSize() == 4)); - } else { - assertSqlException(e, -99999, "07006", "Data type mismatch", - "Mismatch instead of truncation in latest toolbox"); - - } - - } - } + + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateObject", "C_DISTINCT", "Washing", getSQLType(Types.VARCHAR)); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + String v = rs2.getString("C_DISTINCT"); + rs2.close(); + assertCondition(v.equals("Washing ")); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } } + } + /** + * updateObject() - Update a BIGINT. + **/ + public void Var074() { + setupRs(); + if (checkJdbc42()) { + if (checkBigintSupport()) { + + try { + + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateObject", "C_BIGINT", Integer.valueOf(223833), + getSQLType(Types.BIGINT)); + rs_.updateRow(); + ResultSet rs2 = statement2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + long v = rs2.getLong("C_BIGINT"); + rs2.close(); + assertCondition(v == 223833); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + } -/** -updateObject() - Update a NUMERIC, when the object is not a number. -**/ - public void Var051 () - { - setupRs(); - if (checkJdbc42 ()) { - try { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_,"updateObject","C_NUMERIC_40", "Missouri", getSQLType(Types.NUMERIC)); - failed ("Didn't throw SQLException"); - } - catch (Exception e) { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + /** + * updateObject() - Update an BIGINT, when the object is not a number. + **/ + public void Var075() { + setupRs(); + if (checkJdbc42()) { + if (checkBigintSupport()) { + + try { + + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateObject", "C_BIGINT", "Tennessee", getSQLType(Types.BIGINT)); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } + } } + } + /** + * B1A updateObject() - Update an BIGINT, when the integer is too big. + **/ + public void Var076() { + if (checkNative()) { + setupRs(); + if (checkJdbc42()) { + if (checkBigintSupport()) { + + try { + + JDRSTest.position(rs_, key_); + JDReflectionUtil.callMethod_V(rs_, "updateObject", "C_BIGINT", new BigDecimal("-994535874335432445653"), + getSQLType(Types.BIGINT)); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertSqlException(e, -99999, "07006", "Data type mismatch", "Mismatch instead of truncation in V7R1"); + /* + * DataTruncation dt = (DataTruncation)e; assertCondition ((dt.getIndex() == 24) + * && (dt.getParameter() == false) && (dt.getRead() == false) && + * (dt.getDataSize() == 18) && (dt.getTransferSize() == 8)); + */ -/** -updateObject() - Update a CHAR. -**/ - public void Var052 () - { - setupRs(); - if (checkJdbc42 ()) { - try { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_,"updateObject","C_CHAR_50", "Iowa", getSQLType(Types.CHAR)); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - String v = rs2.getString ("C_CHAR_50"); - rs2.close (); - assertCondition (v.equals ("Iowa ")); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } + } } + } } + } - - -/** -updateObject() - Update a CHAR, when the value is too big. -**/ - public void Var053 () - { - setupRs(); - if (checkJdbc42 ()) { - int expectedColumn = -1; + /** + * setObject() - Set a CHAR parameter using Types.BOOLEAN. This is by customer + * request. Property "translate boolean", true is default + * + * This is to test property to force toolbox to match native driver's behavior. + * It was decided that the native driver's behavior was correct, but we cannot + * break existing customers' apps, so added this property for customer. + **/ + public void Var077() { + if (checkJdbc42()) { + Connection conn = null; + Statement stmt = null; + // AS400JDBCDataSource ds = null; + + if (isToolboxDriver()) { try { - JDRSTest.position (rs_, key_); - expectedColumn = rs_.findColumn ("C_CHAR_1"); - JDReflectionUtil.callMethod_V(rs_,"updateObject","C_CHAR_1", "Minnesota", getSQLType(Types.CHAR)); - rs_.updateRow (); - failed ("Didn't throw SQLException"); - } - catch (Exception e) { - DataTruncation dt = (DataTruncation)e; - assertCondition ((dt.getIndex() == expectedColumn) - && (dt.getParameter() == false) - && (dt.getRead() == false) - && (dt.getDataSize() == 9) - && (dt.getTransferSize() == 1)); - - } - } - } + for (int x = 0; x < 2; x++) { + + // "boolean string" property setting "true" is default, and driver just used old + // boolean values in setOjbect + String trueString = null; + String falseString = null; + String url = null; + + if (x == 0) { + // first time in iteration, use "true" and "false" in setObject + trueString = "true"; // toolbox default + falseString = "false"; // toolbox default + // don't set the "boolean string" property, true should be default + url = baseURL_; // ;translate boolean=true by default + conn = testDriver_.getConnection(url, systemObject_.getUserId(), encryptedPassword_); + } else if (x == 1) { + // second time in iteration, use "0" and "1" in setObject + trueString = "1"; // toolbox matches Native here + falseString = "0"; // toolbox matches Native here + // this time, explicity set property "boolean string" false + url = baseURL_ + ";translate boolean=false"; + conn = testDriver_.getConnection(url, systemObject_.getUserId(), encryptedPassword_); + } + stmt = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); + + PreparedStatement ps = conn.prepareStatement( + "INSERT INTO " + JDRSTest.RSTEST_GET + " (C_KEY, C_CHAR_50, C_VARCHAR_50 ) " + " VALUES (?, ?, ?)"); + ps.setString(1, "PROP_CHAR_BOOL1"); + ps.setObject(2, Boolean.valueOf(true), Types.BOOLEAN); + ps.setObject(3, Boolean.valueOf(true), Types.BOOLEAN); + ps.executeUpdate(); + ps.setString(1, "PROP_CHAR_BOOL2"); + ps.setObject(2, Boolean.valueOf(false), Types.BOOLEAN); + ps.setObject(3, Boolean.valueOf(false), Types.BOOLEAN); + ps.executeUpdate(); + + ps.close(); + conn.setAutoCommit(false); + ResultSet rs = stmt.executeQuery( + "SELECT C_CHAR_50, C_VARCHAR_50 FROM " + JDRSTest.RSTEST_GET + " WHERE C_KEY like 'PROP_CHAR_BOOL%' "); + + while (rs.next()) { + + JDReflectionUtil.callMethod_V(rs, "updateObject", "C_CHAR_50", Boolean.valueOf(true), + getSQLType(Types.CHAR)); + JDReflectionUtil.callMethod_V(rs, "updateObject", "C_VARCHAR_50", Boolean.valueOf(true), + getSQLType(Types.VARCHAR)); + rs.updateRow(); /* unique table */ + conn.commit(); + String retVal = rs.getString("C_CHAR_50").trim(); + String retVal2 = rs.getString("C_VARCHAR_50"); + + if (((retVal.equals(falseString) == false) && (retVal.equals(trueString) == false)) + || ((retVal2.equals(falseString) == false) && (retVal2.equals(trueString) == false))) { + failed("SetObject(bool) should be stored as \"" + falseString + "\" or \"" + trueString + + "\" char. Values from select " + retVal + ", " + retVal2); + + rs.close(); + stmt.close(); + conn.close(); + + return; + } + } + rs.close(); + rs = stmt.executeQuery( + "SELECT C_CHAR_50, C_VARCHAR_50 FROM " + JDRSTest.RSTEST_GET + " WHERE C_KEY like 'PROP_CHAR_BOOL%' "); + while (rs.next()) { + String retVal = rs.getString("C_CHAR_50").trim(); + String retVal2 = rs.getString("C_VARCHAR_50"); + if ((retVal.equals(trueString) == false) || (retVal2.equals(trueString) == false)) { + failed("SetObject(bool) should be stored as \"" + trueString + "\" char. Values from select " + retVal + + ", " + retVal2); -/** -updateObject() - Update a VARCHAR. -**/ - public void Var054 () - { - setupRs(); - if (checkJdbc42 ()) { - try { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_,"updateObject","C_VARCHAR_50", "Wisconsin", getSQLType(Types.VARCHAR)); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - String v = rs2.getString ("C_VARCHAR_50"); - rs2.close (); - assertCondition (v.equals ("Wisconsin")); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); + rs.close(); + stmt.close(); + conn.close(); + return; + } } - } - } - + conn.setAutoCommit(true); + stmt.executeUpdate("DELETE FROM " + JDRSTest.RSTEST_GET + " WHERE C_KEY like 'PROP_CHAR_BOOL%' "); + rs.close(); + stmt.close(); + conn.close(); + } -/** -updateObject() - Update a VARCHAR, when the value is too big. -**/ - public void Var055 () - { - setupRs(); - if (checkJdbc42 ()) { - int expectedColumn = -1; - try { - JDRSTest.position (rs_, key_); - expectedColumn = rs_.findColumn ("C_VARCHAR_50"); - JDReflectionUtil.callMethod_V(rs_,"updateObject","C_VARCHAR_50", "Michigan, Illinois, Indiana, and whatever states around there that I have missed.", getSQLType(Types.VARCHAR)); - rs_.updateRow (); - failed ("Didn't throw SQLException"); - } - catch (Exception e) { - DataTruncation dt = (DataTruncation)e; - assertCondition ((dt.getIndex() == expectedColumn) - && (dt.getParameter() == false) - && (dt.getRead() == false) - && (dt.getDataSize() == 81) - && (dt.getTransferSize() == 50)); + assertCondition(true); + } catch (Exception e) { + failed(e, "Unexpected Exception"); } - } - } - - -/** -updateObject() - Update a BINARY. -**/ - public void Var056 () - { - setupRs(); - if (checkJdbc42 ()) - { - try - { - String expected; - if (isToolboxDriver()) - expected = "F1F2"; - else - expected = "Ford"; - - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_,"updateObject","C_BINARY_20", expected, getSQLType(Types.BINARY)); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - String v = rs2.getString ("C_BINARY_20"); - rs2.close (); - assertCondition (v.startsWith (expected)); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } + } else + notApplicable("Toolbox property"); } + } + public void dfpTest(String table, Object value, String expected) { + dfpTest(table, value, expected, expected); + } + public void dfpTest(String table, Object value, String expected, String expected2) { + dfpTest(table, value, expected, expected2, expected2); + } -/** -updateObject() - Update a BINARY, when the value is too big. -**/ - public void Var057 () - { - setupRs(); - if (checkJdbc42 ()) { - int expectedColumn = -1; + public void dfpTest(String table, Object value, String expected, String expected2, String expected3) { + if (checkJdbc42()) { + if (checkDecFloatSupport()) { + try { - JDRSTest.position (rs_, key_); - expectedColumn = rs_.findColumn ("C_BINARY_1"); - JDReflectionUtil.callMethod_V(rs_,"updateObject","C_BINARY_1", "F1F2F3F4", getSQLType(Types.BINARY)); - rs_.updateRow (); - failed ("Didn't throw SQLException"); - } - catch (Exception e) { - DataTruncation dt = (DataTruncation)e; - assertCondition ((dt.getIndex() == expectedColumn) - && (dt.getParameter() == false) - && (dt.getRead() == false) - && (dt.getTransferSize() == 1)); - - } - } + Statement s = connection_.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); + ResultSet rs = s.executeQuery("SELECT * FROM " + table + " FOR UPDATE "); + rs.next(); + // JDReflectionUtil.callMethod_V(rs,"updateObject",1, value, + // getSQLType(Types.OTHER)); + + Class[] argClasses = new Class[3]; + argClasses[0] = Integer.TYPE; + argClasses[1] = Class.forName("java.lang.Object"); + argClasses[2] = Class.forName("java.sql.SQLType"); + Object[] args = new Object[3]; + args[0] = Integer.valueOf(1); + args[1] = value; + args[2] = getSQLType(Types.OTHER); + JDReflectionUtil.callMethod_V(rs, "updateObject", argClasses, args); + + rs.updateRow(); /* serialized */ + + ResultSet rs2 = statement2f_.executeQuery("SELECT * FROM " + table); + rs2.next(); + String v = rs2.getString(1); + rs2.close(); + rs.close(); + s.close(); + try { + connection_.commit(); + } catch (Exception e) { + } + assertCondition( + (v == null && expected == null) || (v != null && v.equals(expected)) || (v != null && v.equals(expected2)) + || (v != null && v.equals(expected3)), + "Got " + v + " from " + value + " sb " + expected + " or " + expected2 + " or " + expected3); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } } + } + /** + * updateObject -- set DFP16 to different values and retrieve + */ + public void Var078() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, "4533.43", "4533.43"); + } + public void Var079() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, "NaN", "NaN"); + } -/** -updateObject() - Update a VARBINARY. -**/ - public void Var058 () - { - setupRs(); - if (checkJdbc42 ()) { - try - { - String expected; - if (isToolboxDriver()) - expected = "F1F2"; - else - expected = "Ford"; - - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_,"updateObject","C_VARBINARY_20", expected, getSQLType(Types.VARBINARY)); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - String v = rs2.getString ("C_VARBINARY_20"); - rs2.close (); - assertCondition (v.equals (expected)); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } + public void Var080() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, "NAN", "NaN"); + } + public void Var081() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+NaN", "NaN"); + } + public void Var082() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, "-NaN", "-NaN"); + } -/** -updateObject() - Update a VARBINARY, when the value is too big. -**/ - public void Var059 () - { - setupRs(); - if (checkJdbc42 ()) { - int expectedColumn = -1; - try { - JDRSTest.position (rs_, key_); - expectedColumn = rs_.findColumn ("C_VARBINARY_20"); - JDReflectionUtil.callMethod_V(rs_,"updateObject","C_VARBINARY_20", "E1E2E3E4E5F1F2F3F4F5C1C2C3C4C5D1D2D3D3D5E1E2E3E4E5F1F2F3F4F5C1C2C3C4C5D1D2D3D3D5", getSQLType(Types.VARBINARY)); - rs_.updateRow (); - failed ("Didn't throw SQLException"); - } - catch (Exception e) { - DataTruncation dt = (DataTruncation)e; - assertCondition ((dt.getIndex() == expectedColumn) - && (dt.getParameter() == false) - && (dt.getRead() == false) - && (dt.getTransferSize() == 20)); + public void Var083() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, "QNaN", "NaN"); + } - } - } - } + public void Var084() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+QNaN", "NaN"); + } + public void Var085() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, "-QNaN", "-NaN"); + } + public void Var086() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, "SNaN", "SNaN"); + } -/** -updateObject() - Update a CLOB, when the data is stored in the result -set. -**/ - public void Var060 () - { - setupRs(); - if (checkJdbc42 ()) { - if (checkLobSupport ()) { - try { - JDRSTest.position (rs_, key_); - String s = "New Mexico"; - Clob c = new JDLobTest.JDTestClob (s); - JDReflectionUtil.callMethod_V(rs_,"updateObject","C_CLOB", c, getSQLType(Types.CLOB)); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - String v = rs2.getString ("C_CLOB"); - rs2.close (); - assertCondition (v.equals (s)); - } - catch (Exception e) { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } - } - } + public void Var087() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+SNaN", "SNaN"); + } + public void Var088() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, "-SNaN", "-SNaN"); + } + public void Var089() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, "INF", "Infinity"); + } -/** -updateObject() - Update a CLOB, when the locator is stored in the result -set. -**/ - public void Var061 () - { - setupRs(); - if (checkJdbc42 ()) { - if (checkLobSupport ()) { - try { - JDRSTest.position (rs3_, key_); - String s = "New Mexico"; - Clob c = new JDLobTest.JDTestClob (s); - JDReflectionUtil.callMethod_V(rs3_,"updateObject","C_CLOB", c, getSQLType(Types.CLOB)); - rs3_.updateRow (); - ResultSet rs2 = statement4_.executeQuery (select_); - JDRSTest.position (rs2, key_); - String v = rs2.getString ("C_CLOB"); - rs2.close (); - assertCondition (v.equals (s)); - } - catch (Exception e) { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } - } - } + public void Var090() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+INF", "Infinity"); + } + public void Var091() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, "-INF", "-Infinity"); + } + public void Var092() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, "Infinity", "Infinity"); + } -/** -updateObject() - Update a DBCLOB, when the data is stored in the result -set. -**/ - public void Var062 () - { - setupRs(); - if (checkJdbc42 ()) { - if (checkLobSupport ()) { - try { - JDRSTest.position (rs_, key_); - String s = "Arizona"; - Clob c = new JDLobTest.JDTestClob (s); - JDReflectionUtil.callMethod_V(rs_,"updateObject","C_DBCLOB", c, getSQLType(Types.CLOB)); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - String v = rs2.getString ("C_DBCLOB"); - rs2.close (); - assertCondition (v.equals (s)); - } - catch (Exception e) { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } - } - } + public void Var093() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+Infinity", "Infinity"); + } + public void Var094() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, "-Infinity", "-Infinity"); + } + public void Var095() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, "1234567890123456", "1234567890123456"); + } -/** -updateObject() - Update a DBCLOB, when the locator is stored in the result -set. -**/ - public void Var063 () - { - setupRs(); - if (checkJdbc42 ()) { - if (checkLobSupport ()) { - try { - JDRSTest.position (rs3_, key_); - String s = "Arizona"; - Clob c = new JDLobTest.JDTestClob (s); - JDReflectionUtil.callMethod_V(rs3_,"updateObject","C_DBCLOB", c, getSQLType(Types.CLOB)); - rs3_.updateRow (); - ResultSet rs2 = statement4_.executeQuery (select_); - JDRSTest.position (rs2, key_); - String v = rs2.getString ("C_DBCLOB"); - rs2.close (); - assertCondition (v.equals (s)); - } - catch (Exception e) { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } - } - } + public void Var096() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, "-1234567890123456", "-1234567890123456"); + } + public void Var097() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+1234567890123456", "1234567890123456"); + } + public void Var098() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+1234567890123456E28", "1.234567890123456E+43"); + } -/** -updateObject() - Update a BLOB, when the data is stored in the result -set. -**/ - public void Var064 () - { - setupRs(); - if (checkJdbc42 ()) { - if (checkLobSupport ()) { - try { - JDRSTest.position (rs_, key_); - byte[] ba = { 54, 65, -34, 65, 0, -2, -1, 0}; - Blob b = new JDLobTest.JDTestBlob (ba); - JDReflectionUtil.callMethod_V(rs_,"updateObject","C_BLOB", b, getSQLType(Types.BLOB)); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - byte[] v = rs2.getBytes ("C_BLOB"); - rs2.close (); - assertCondition (areEqual (v, ba)); - } - catch (Exception e) { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } - } - } + public void Var099() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+1234567890123456E+28", "1.234567890123456E+43"); + } + public void Var100() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+123456789012345.6E+29", "1.234567890123456E+43"); + } + public void Var101() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+0.01234567890123456E+45", "1.234567890123456E+43"); + } -/** -updateObject() - Update a BLOB, when the locator is stored in the result -set. -**/ - public void Var065 () - { - setupRs(); - if (checkJdbc42 ()) { - if (checkLobSupport ()) { - try { - JDRSTest.position (rs3_, key_); - byte[] ba = { 54, 65, -34, 65, 0, -2, -1, 0}; - Blob b = new JDLobTest.JDTestBlob (ba); - JDReflectionUtil.callMethod_V(rs3_,"updateObject","C_BLOB", b, getSQLType(Types.BLOB)); - rs3_.updateRow (); - ResultSet rs2 = statement4_.executeQuery (select_); - JDRSTest.position (rs2, key_); - byte[] v = rs2.getBytes ("C_BLOB"); - rs2.close (); - assertCondition (areEqual (v, ba)); - } - catch (Exception e) { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } - } - } + public void Var102() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, "-1234567890123456E28", "-1.234567890123456E+43"); + } + public void Var103() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, "1E0", "1"); + } + public void Var104() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, "1.1", "1.1"); + } -/** -updateObject() - Update a DATE. -**/ - public void Var066 () - { - setupRs(); - if (checkJdbc42 ()) { - try - { - JDRSTest.position (rs_, key_); - Date d = new Date (1922400000); - JDReflectionUtil.callMethod_V(rs_,"updateObject","C_DATE", d, getSQLType(Types.DATE)); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - Date v = rs2.getDate ("C_DATE"); - rs2.close (); - - assertCondition (v.toString().equals(d.toString())); - - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } + public void Var105() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, "1.1E0", "1.1"); + } + public void Var106() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, null, null); + } + public void Var107() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, new BigDecimal("4533.43"), "4533.43"); + } -/** -updateObject() - Update a DATE, when the string is not a valid date. -**/ - public void Var067 () - { - setupRs(); - if (checkJdbc42 ()) { - try { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_,"updateObject","C_DATE", "Nevada", getSQLType(Types.DATE)); - failed ("Didn't throw SQLException"); - } - catch (Exception e) { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } - } + public void Var108() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, new BigDecimal("1234567890123456"), "1234567890123456"); + } + public void Var109() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, new BigDecimal("-1234567890123456"), "-1234567890123456"); + } + public void Var110() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, new BigDecimal("+1234567890123456"), "1234567890123456"); + } -/** -updateObject() - Update a TIME. -**/ - public void Var068 () - { - setupRs(); - if (checkJdbc42 ()) { - try { - JDRSTest.position (rs_, key_); - Time t = Time.valueOf("07:36:00"); - JDReflectionUtil.callMethod_V(rs_,"updateObject","C_TIME", t, getSQLType(Types.TIME)); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - Time v = rs2.getTime ("C_TIME"); - rs2.close (); - assertCondition (v.toString ().equals (t.toString ())); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } + public void Var111() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, new BigDecimal("+1234567890123456E28"), "1.234567890123456E+43"); + } + public void Var112() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, new BigDecimal("+1234567890123456E+28"), "1.234567890123456E+43"); + } + public void Var113() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, new BigDecimal("+123456789012345.6E+29"), "1.234567890123456E+43"); + } -/** -updateObject() - Update a TIME, when the string is not a valid time. -**/ - public void Var069 () - { - setupRs(); - if (checkJdbc42 ()) { - try { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_,"updateObject","C_TIME", "Wyoming", getSQLType(Types.TIME)); - failed ("Didn't throw SQLException"); - } - catch (Exception e) { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } - } + public void Var114() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, new BigDecimal("+0.01234567890123456E+45"), "1.234567890123456E+43"); + } + public void Var115() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, new BigDecimal("-1234567890123456E28"), "-1.234567890123456E+43"); + } + public void Var116() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, new BigDecimal("1E0"), "1"); + } -/** -updateObject() - Update a TIMESTAMP. -**/ - public void Var070 () - { - setupRs(); - if (checkJdbc42 ()) { - try { - JDRSTest.position (rs_, key_); - Timestamp ts = new Timestamp (425252435); - JDReflectionUtil.callMethod_V(rs_,"updateObject","C_TIMESTAMP", ts, getSQLType(Types.TIMESTAMP)); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - Timestamp v = rs2.getTimestamp ("C_TIMESTAMP"); - rs2.close (); - assertCondition (v.equals (ts)); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } + public void Var117() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, new BigDecimal("1.1"), "1.1"); + } + public void Var118() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, new BigDecimal("1.1E0"), "1.1"); + } + public void Var119() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, Float.valueOf(4533.43f), "4533.43"); + } -/** -updateObject() - Update a TIMESTAMP, when the string is not a vliad timestamp. -**/ - public void Var071 () - { - setupRs(); - if (checkJdbc42 ()) { - try { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_,"updateObject","C_TIMESTAMP", "Montana", getSQLType(Types.TIMESTAMP)); - failed ("Didn't throw SQLException"); - } - catch (Exception e) { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } - } + public void Var120() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, Float.valueOf(Float.NaN), "NaN"); + } + public void Var121() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, Float.valueOf(Float.POSITIVE_INFINITY), "Infinity"); + } + public void Var122() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, Float.valueOf(Float.NEGATIVE_INFINITY), "-Infinity"); + } -/** -updateObject() - Update a DATALINK. -**/ - public void Var072 () - { - setupRs(); - if (checkJdbc42 ()) { - if (checkLobSupport ()) { - // We do not test updating datalinks, since it is not - // possible to open a updatable cursor/result set with - // a datalink column. - notApplicable("DATALINK update not supported."); - /* - try { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_,"updateObject","C_DATALINK", "Idaho", getSQLType(Types.VARCHAR)); - failed ("Didn't throw SQLException"); - } - catch (Exception e) { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - */ - } - } - } + public void Var123() { + /* with the new native PASE support, this comes back with the zeros */ + /* + * Java 21, specifically starting from Java 19, changed the behavior of + * Double.toString() and Float.toString() to produce the smallest number of + * digits that still uniquely distinguish the float or double from its adjacent + * float or double. + */ + + dfpTest(JDRSTest.RSTEST_UPDDFP16, Float.valueOf(-1234567890123456.0f), "-1.23456795E+15", "-1234567950000000", + "-1.234568E+15"); + } + public void Var124() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, Double.valueOf(4533.43f), "4533.43017578125"); + } + public void Var125() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, Double.valueOf(Double.NaN), "NaN"); + } -/** -updateObject() - Update a DISTINCT. -**/ - public void Var073 () - { - setupRs(); - if (checkJdbc42 ()) { - if (checkLobSupport ()) { - try { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_,"updateObject","C_DISTINCT", "Washing", getSQLType(Types.VARCHAR)); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - String v = rs2.getString ("C_DISTINCT"); - rs2.close (); - assertCondition (v.equals ("Washing ")); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } - } + public void Var126() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, Double.valueOf(Double.POSITIVE_INFINITY), "Infinity"); + } + public void Var127() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, Double.valueOf(Double.NEGATIVE_INFINITY), "-Infinity"); + } + public void Var128() { + dfpTest(JDRSTest.RSTEST_UPDDFP16, Double.valueOf(-1234567890123456.0), "-1234567890123456"); + } -/** -updateObject() - Update a BIGINT. -**/ - public void Var074() - { - setupRs(); - if (checkJdbc42 ()) { - if (checkBigintSupport()) { - try { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_,"updateObject","C_BIGINT", Integer.valueOf(223833), getSQLType(Types.BIGINT)); - rs_.updateRow (); - ResultSet rs2 = statement2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - long v = rs2.getLong("C_BIGINT"); - rs2.close (); - assertCondition (v == 223833); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } - } + /** + * New comma decimal separator tests + **/ + /** + * updateObject() - Update a DECIMAL, with no scale specified. + **/ + public void Var129() { + String added = " -- added 12/17/2009 to test native driver for CPS 7YSU2X"; + setupRsCommaSeparator(); + if (checkJdbc42()) { + + try { + + JDRSTest.position(rsCommaSeparator_, key_); + JDReflectionUtil.callMethod_V(rsCommaSeparator_, "updateObject", "C_DECIMAL_105", new BigDecimal(-4539.9), + getSQLType(Types.DECIMAL)); + rsCommaSeparator_.updateRow(); + ResultSet rs2 = statementCommaSeparator2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + BigDecimal v = rs2.getBigDecimal("C_DECIMAL_105"); + rs2.close(); + assertCondition(v.floatValue() == -4539.9f, added); + } catch (Exception e) { + failed(e, "Unexpected Exception" + added); + } + } + } -/** -updateObject() - Update an BIGINT, when the object is not a number. -**/ - public void Var075() - { - setupRs(); - if (checkJdbc42 ()) { - if (checkBigintSupport()) { - try { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_,"updateObject","C_BIGINT", "Tennessee", getSQLType(Types.BIGINT)); - failed ("Didn't throw SQLException"); - } - catch (Exception e) { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } - } + /** + * updateObject() - Update a DECIMAL, when the fraction will truncate. This is + * ok. + **/ + public void Var130() { + String added = " -- added 12/17/2009 to test native driver for CPS 7YSU2X"; + setupRsCommaSeparator(); + if (checkJdbc42()) { + + try { + + JDRSTest.position(rsCommaSeparator_, key_); + JDReflectionUtil.callMethod_V(rsCommaSeparator_, "updateObject", "C_DECIMAL_105", + new BigDecimal(-4539.987666666), getSQLType(Types.DECIMAL)); + rsCommaSeparator_.updateRow(); + ResultSet rs2 = statementCommaSeparator2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + BigDecimal v = rs2.getBigDecimal("C_DECIMAL_105"); + rs2.close(); + assertCondition(v.equals(new BigDecimal("-4539.98766")), added); + } catch (Exception e) { + failed(e, "Unexpected Exception" + added); + } } + } -/** B1A -updateObject() - Update an BIGINT, when the integer is too big. -**/ - public void Var076() - { - if (checkNative()) { - setupRs(); - if (checkJdbc42 ()) { - if (checkBigintSupport()) { - try { - JDRSTest.position (rs_, key_); - JDReflectionUtil.callMethod_V(rs_,"updateObject","C_BIGINT", new BigDecimal ("-994535874335432445653"), getSQLType(Types.BIGINT)); - failed ("Didn't throw SQLException"); - } catch (Exception e) { - - assertSqlException(e, -99999, "07006", "Data type mismatch", - "Mismatch instead of truncation in V7R1"); - /* - DataTruncation dt = (DataTruncation)e; - assertCondition ((dt.getIndex() == 24) - && (dt.getParameter() == false) - && (dt.getRead() == false) - && (dt.getDataSize() == 18) - && (dt.getTransferSize() == 8)); - */ - - } - } - } - } + /** + * updateObject() - Update a DECIMAL, with scale 0 specified. + **/ + public void Var131() { + String added = " -- added 12/17/2009 to test native driver for CPS 7YSU2X"; + setupRsCommaSeparator(); + if (checkJdbc42()) { + + try { + + JDRSTest.position(rsCommaSeparator_, key_); + JDReflectionUtil.callMethod_V(rsCommaSeparator_, "updateObject", "C_DECIMAL_105", new BigDecimal(39455.58734), + getSQLType(Types.DECIMAL), 0); + rsCommaSeparator_.updateRow(); + ResultSet rs2 = statementCommaSeparator2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + BigDecimal v = rs2.getBigDecimal("C_DECIMAL_105"); + rs2.close(); + assertCondition(v.floatValue() == 39455, added); + } catch (Exception e) { + failed(e, "Unexpected Exception" + added); + } } + } + /** + * updateObject() - Update a DECIMAL, with scale less than the value's scale. + **/ + public void Var132() { + String added = " -- added 12/17/2009 to test native driver for CPS 7YSU2X"; + setupRsCommaSeparator(); + if (checkJdbc42()) { + + try { + + JDRSTest.position(rsCommaSeparator_, key_); + JDReflectionUtil.callMethod_V(rsCommaSeparator_, "updateObject", "C_DECIMAL_105", new BigDecimal(34255.53434), + getSQLType(Types.DECIMAL), 3); + rsCommaSeparator_.updateRow(); + ResultSet rs2 = statementCommaSeparator2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + BigDecimal v = rs2.getBigDecimal("C_DECIMAL_105"); + rs2.close(); + assertCondition(v.floatValue() == 34255.534f, added); + } catch (Exception e) { + failed(e, "Unexpected Exception" + added); + } + } + } - /** - setObject() - Set a CHAR parameter using Types.BOOLEAN. - This is by customer request. Property "translate boolean", true is default - - This is to test property to force toolbox to match native driver's behavior. - It was decided that the native driver's behavior was correct, but we cannot - break existing customers' apps, so added this property for customer. - **/ - public void Var077() { - if (checkJdbc42 ()) { - Connection conn = null; - Statement stmt = null; - // AS400JDBCDataSource ds = null; - - if (isToolboxDriver()) { - try { - for (int x = 0; x < 2; x++) { - - //"boolean string" property setting "true" is default, and driver just used old boolean values in setOjbect - String trueString = null; - String falseString = null; - String url = null; - - if (x == 0) { - //first time in iteration, use "true" and "false" in setObject - trueString = "true"; //toolbox default - falseString = "false"; //toolbox default - //don't set the "boolean string" property, true should be default - url = baseURL_; //;translate boolean=true by default - conn = testDriver_.getConnection (url,systemObject_.getUserId(), encryptedPassword_); - } else if (x == 1) { - //second time in iteration, use "0" and "1" in setObject - trueString = "1"; //toolbox matches Native here - falseString = "0"; //toolbox matches Native here - //this time, explicity set property "boolean string" false - url = baseURL_ + ";translate boolean=false"; - conn = testDriver_.getConnection (url,systemObject_.getUserId(), encryptedPassword_); - } - if (conn == null ) { - assertCondition(false, "Connect is null "); - return; - } - stmt = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, - ResultSet.CONCUR_UPDATABLE); - - - - PreparedStatement ps = conn.prepareStatement("INSERT INTO " + JDRSTest.RSTEST_GET - + " (C_KEY, C_CHAR_50, C_VARCHAR_50 ) " + - " VALUES (?, ?, ?)"); - ps.setString(1, "PROP_CHAR_BOOL1"); - ps.setObject(2, Boolean.valueOf(true), Types.BOOLEAN); - ps.setObject(3, Boolean.valueOf(true), Types.BOOLEAN); - ps.executeUpdate(); - ps.setString(1, "PROP_CHAR_BOOL2"); - ps.setObject(2, Boolean.valueOf(false), Types.BOOLEAN); - ps.setObject(3, Boolean.valueOf(false), Types.BOOLEAN); - ps.executeUpdate(); - - ps.close(); - conn.setAutoCommit(false); - ResultSet rs = stmt.executeQuery("SELECT C_CHAR_50, C_VARCHAR_50 FROM " - + JDRSTest.RSTEST_GET - + " WHERE C_KEY like 'PROP_CHAR_BOOL%' "); - - while (rs.next()) { - - JDReflectionUtil.callMethod_V(rs,"updateObject","C_CHAR_50", Boolean.valueOf(true), getSQLType(Types.CHAR)); - JDReflectionUtil.callMethod_V(rs,"updateObject","C_VARCHAR_50", Boolean.valueOf(true), getSQLType(Types.VARCHAR)); - rs.updateRow(); - conn.commit(); - String retVal = rs.getString("C_CHAR_50").trim(); - String retVal2 = rs.getString("C_VARCHAR_50"); - - if ( ((retVal.equals( falseString ) == false) && (retVal.equals( trueString ) == false)) - || ((retVal2.equals( falseString ) == false) && (retVal2.equals( trueString ) == false)) ) { - failed("SetObject(bool) should be stored as \"" + falseString + "\" or \"" + trueString - + "\" char. Values from select " + retVal + ", " + retVal2 ); - - stmt.close(); - conn.close(); - return; - } - } - - - rs = stmt.executeQuery("SELECT C_CHAR_50, C_VARCHAR_50 FROM " - + JDRSTest.RSTEST_GET - + " WHERE C_KEY like 'PROP_CHAR_BOOL%' "); - - while (rs.next()) { - String retVal = rs.getString("C_CHAR_50").trim(); - String retVal2 = rs.getString("C_VARCHAR_50"); - if ( (retVal.equals( trueString ) == false) - || (retVal2.equals( trueString ) == false) ) { - failed("SetObject(bool) should be stored as \"" + trueString - + "\" char. Values from select " + retVal + ", " + retVal2 ); - - stmt.close(); - conn.close(); - return; - } - } - conn.setAutoCommit(true); - stmt.executeUpdate("DELETE FROM " + JDRSTest.RSTEST_GET + " WHERE C_KEY like 'PROP_CHAR_BOOL%' "); - - } - - assertCondition(true); - - } catch (Exception e) { - failed(e, "Unexpected Exception"); - } - - } else - notApplicable("Toolbox property"); - } - } - - public void dfpTest(String table, Object value, String expected) { - dfpTest(table, value, expected, expected); + /** + * updateObject() - Update a DECIMAL, with scale equal to the value's scale. + **/ + public void Var133() { + String added = " -- added 12/17/2009 to test native driver for CPS 7YSU2X"; + setupRsCommaSeparator(); + if (checkJdbc42()) { + + try { + + JDRSTest.position(rsCommaSeparator_, key_); + JDReflectionUtil.callMethod_V(rsCommaSeparator_, "updateObject", "C_DECIMAL_105", new BigDecimal(54321.12345), + getSQLType(Types.DECIMAL), 5); + rsCommaSeparator_.updateRow(); + ResultSet rs2 = statementCommaSeparator2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + BigDecimal v = rs2.getBigDecimal("C_DECIMAL_105"); + rs2.close(); + assertCondition(v.floatValue() == 54321.12345f, added); + } catch (Exception e) { + failed(e, "Unexpected Exception" + added); + } + } } - public void dfpTest(String table, Object value, String expected, String expected2) { - dfpTest(table, value, expected, expected2, expected2); - } - public void dfpTest(String table, Object value, String expected, String expected2, String expected3 ) { - if (checkJdbc42 ()) { - if (checkDecFloatSupport()) { - try { - Statement s = connection_.createStatement( - ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); - ResultSet rs = s.executeQuery("SELECT * FROM " + table + " FOR UPDATE "); - rs.next(); - // JDReflectionUtil.callMethod_V(rs,"updateObject",1, value, getSQLType(Types.OTHER)); - - Class[] argClasses = new Class[3]; - argClasses[0] = Integer.TYPE; - argClasses[1] = Class.forName("java.lang.Object"); - argClasses[2] = Class.forName("java.sql.SQLType"); - Object[] args = new Object[3]; - args[0] = Integer.valueOf(1); - args[1] = value; - args[2] = getSQLType(Types.OTHER); - JDReflectionUtil.callMethod_V(rs,"updateObject",argClasses, args ); - - rs.updateRow(); - - ResultSet rs2 = statement2f_.executeQuery("SELECT * FROM " + table); - rs2.next(); - String v = rs2.getString(1); - rs2.close(); - s.close(); - try { - connection_.commit(); - } catch (Exception e) {} - assertCondition((v==null && expected==null) || - (v!=null && v.equals(expected)) || - (v!=null && v.equals(expected2)) || - (v!=null && v.equals(expected3)), "Got " + v + " from "+ value +" sb " + expected+" or "+expected2+" or "+expected3); - } catch (Exception e) { - failed(e, "Unexpected Exception"); - } - } - } + + /** + * updateObject() - Update a DECIMAL, with scale greater the value's scale. + **/ + public void Var134() { + String added = " -- added 12/17/2009 to test native driver for CPS 7YSU2X"; + setupRsCommaSeparator(); + if (checkJdbc42()) { + + try { + + JDRSTest.position(rsCommaSeparator_, key_); + JDReflectionUtil.callMethod_V(rsCommaSeparator_, "updateObject", "C_DECIMAL_105", new BigDecimal(54321.12345), + getSQLType(Types.DECIMAL), 8); + rsCommaSeparator_.updateRow(); + ResultSet rs2 = statementCommaSeparator2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + BigDecimal v = rs2.getBigDecimal("C_DECIMAL_105"); + rs2.close(); + assertCondition(v.floatValue() == 54321.12345f, added); + } catch (Exception e) { + failed(e, "Unexpected Exception" + added); + } + } } + /** + * updateObject() - Update a DECIMAL, when the value is too big. + **/ + public void Var135() { + String added = " -- added 12/17/2009 to test native driver for CPS 7YSU2X"; + setupRsCommaSeparator(); + if (checkJdbc42()) { + int expectedColumn = -1; + + try { + + JDRSTest.position(rsCommaSeparator_, key_); + expectedColumn = rsCommaSeparator_.findColumn("C_DECIMAL_105"); + JDReflectionUtil.callMethod_V(rsCommaSeparator_, "updateObject", "C_DECIMAL_105", + new BigDecimal("394585.432389445"), getSQLType(Types.DECIMAL)); + rsCommaSeparator_.updateRow(); + failed("Didn't throw SQLException"); + } catch (Exception e) { + if (e instanceof DataTruncation) { + DataTruncation dt = (DataTruncation) e; + assertCondition((dt.getIndex() == expectedColumn) && (dt.getParameter() == false) && (dt.getRead() == false) + && (dt.getDataSize() == 15) && (dt.getTransferSize() == 10), added); + } else { + assertSqlException(e, -99999, "07006", "Data type mismatch", + "Mismatch instead of truncation in latest toolbox "); + } - /** - * updateObject -- set DFP16 to different values and retrieve - */ - public void Var078 () { dfpTest(JDRSTest.RSTEST_DFP16, "4533.43", "4533.43"); } - public void Var079 () { dfpTest(JDRSTest.RSTEST_DFP16, "NaN", "NaN");} - public void Var080 () { dfpTest(JDRSTest.RSTEST_DFP16, "NAN", "NaN");} - public void Var081 () { dfpTest(JDRSTest.RSTEST_DFP16, "+NaN", "NaN");} - public void Var082 () { dfpTest(JDRSTest.RSTEST_DFP16, "-NaN", "-NaN");} - public void Var083 () { dfpTest(JDRSTest.RSTEST_DFP16, "QNaN", "NaN");} - public void Var084 () { dfpTest(JDRSTest.RSTEST_DFP16, "+QNaN", "NaN");} - public void Var085 () { dfpTest(JDRSTest.RSTEST_DFP16, "-QNaN", "-NaN");} - public void Var086 () { dfpTest(JDRSTest.RSTEST_DFP16, "SNaN", "SNaN");} - public void Var087 () { dfpTest(JDRSTest.RSTEST_DFP16, "+SNaN", "SNaN");} - public void Var088 () { dfpTest(JDRSTest.RSTEST_DFP16, "-SNaN", "-SNaN");} - public void Var089 () { dfpTest(JDRSTest.RSTEST_DFP16, "INF", "Infinity");} - public void Var090 () { dfpTest(JDRSTest.RSTEST_DFP16, "+INF", "Infinity");} - public void Var091 () { dfpTest(JDRSTest.RSTEST_DFP16, "-INF", "-Infinity");} - public void Var092 () { dfpTest(JDRSTest.RSTEST_DFP16, "Infinity", "Infinity");} - public void Var093 () { dfpTest(JDRSTest.RSTEST_DFP16, "+Infinity", "Infinity");} - public void Var094 () { dfpTest(JDRSTest.RSTEST_DFP16, "-Infinity", "-Infinity");} - public void Var095 () { dfpTest(JDRSTest.RSTEST_DFP16, "1234567890123456", "1234567890123456");} - public void Var096 () { dfpTest(JDRSTest.RSTEST_DFP16, "-1234567890123456", "-1234567890123456");} - public void Var097 () { dfpTest(JDRSTest.RSTEST_DFP16, "+1234567890123456","1234567890123456");} - public void Var098 () { - dfpTest(JDRSTest.RSTEST_DFP16, "+1234567890123456E28","1.234567890123456E+43"); - } - public void Var099 () { - dfpTest(JDRSTest.RSTEST_DFP16, "+1234567890123456E+28","1.234567890123456E+43"); - } - public void Var100 () { - dfpTest(JDRSTest.RSTEST_DFP16, "+123456789012345.6E+29","1.234567890123456E+43"); - } - public void Var101 () { - dfpTest(JDRSTest.RSTEST_DFP16, "+0.01234567890123456E+45","1.234567890123456E+43"); - } - public void Var102 () { - dfpTest(JDRSTest.RSTEST_DFP16, "-1234567890123456E28","-1.234567890123456E+43"); - } - - public void Var103 () { dfpTest(JDRSTest.RSTEST_DFP16, "1E0", "1");} - public void Var104 () { dfpTest(JDRSTest.RSTEST_DFP16, "1.1", "1.1");} - public void Var105 () { dfpTest(JDRSTest.RSTEST_DFP16, "1.1E0", "1.1");} - public void Var106 () { dfpTest(JDRSTest.RSTEST_DFP16, null, null);} - - public void Var107 () { dfpTest(JDRSTest.RSTEST_DFP16, new BigDecimal("4533.43"), "4533.43"); } - public void Var108 () { dfpTest(JDRSTest.RSTEST_DFP16, new BigDecimal("1234567890123456"), "1234567890123456");} - public void Var109 () { dfpTest(JDRSTest.RSTEST_DFP16, new BigDecimal("-1234567890123456"), "-1234567890123456");} - public void Var110 () { dfpTest(JDRSTest.RSTEST_DFP16, new BigDecimal("+1234567890123456"),"1234567890123456");} - public void Var111 () { - dfpTest(JDRSTest.RSTEST_DFP16, new BigDecimal("+1234567890123456E28"),"1.234567890123456E+43"); - } - public void Var112 () { - dfpTest(JDRSTest.RSTEST_DFP16, new BigDecimal("+1234567890123456E+28"),"1.234567890123456E+43"); - } - public void Var113 () { - dfpTest(JDRSTest.RSTEST_DFP16, new BigDecimal("+123456789012345.6E+29"),"1.234567890123456E+43"); - } - public void Var114 () { - dfpTest(JDRSTest.RSTEST_DFP16, new BigDecimal("+0.01234567890123456E+45"),"1.234567890123456E+43"); - } - public void Var115 () { - dfpTest(JDRSTest.RSTEST_DFP16, new BigDecimal("-1234567890123456E28"),"-1.234567890123456E+43"); - } - - public void Var116 () { dfpTest(JDRSTest.RSTEST_DFP16, new BigDecimal("1E0"), "1");} - public void Var117 () { dfpTest(JDRSTest.RSTEST_DFP16, new BigDecimal("1.1"), "1.1");} - public void Var118 () { dfpTest(JDRSTest.RSTEST_DFP16, new BigDecimal("1.1E0"), "1.1");} - - - public void Var119 () { dfpTest(JDRSTest.RSTEST_DFP16, Float.valueOf(4533.43f), "4533.43"); } - public void Var120 () { dfpTest(JDRSTest.RSTEST_DFP16, Float.valueOf(Float.NaN), "NaN");} - public void Var121 () { dfpTest(JDRSTest.RSTEST_DFP16, Float.valueOf(Float.POSITIVE_INFINITY), "Infinity");} - public void Var122 () { dfpTest(JDRSTest.RSTEST_DFP16, Float.valueOf(Float.NEGATIVE_INFINITY), "-Infinity");} - public void Var123 () { - /* with the new native PASE support, this comes back with the zeros*/ - /* Java 21, specifically starting from Java 19, changed the behavior of Double.toString() - * and Float.toString() to produce the smallest number of digits that still uniquely - * distinguish the float or double from its adjacent float or double. */ - - dfpTest(JDRSTest.RSTEST_DFP16, Float.valueOf(-1234567890123456.0f), "-1.23456795E+15", "-1234567950000000","-1.234568E+15"); + } } - public void Var124 () { dfpTest(JDRSTest.RSTEST_DFP16, Double.valueOf(4533.43f), "4533.43017578125"); } - public void Var125 () { dfpTest(JDRSTest.RSTEST_DFP16, Double.valueOf(Double.NaN), "NaN");} - public void Var126 () { dfpTest(JDRSTest.RSTEST_DFP16, Double.valueOf(Double.POSITIVE_INFINITY), "Infinity");} - public void Var127 () { dfpTest(JDRSTest.RSTEST_DFP16, Double.valueOf(Double.NEGATIVE_INFINITY), "-Infinity");} - public void Var128 () { dfpTest(JDRSTest.RSTEST_DFP16, Double.valueOf(-1234567890123456.0), "-1234567890123456");} + } + /** + * updateObject() - Update a NUMERIC, with no scale specified. + **/ + public void Var136() { + String added = " -- added 12/17/2009 to test native driver for CPS 7YSU2X"; + setupRsCommaSeparator(); + if (checkJdbc42()) { + + try { + + JDRSTest.position(rsCommaSeparator_, key_); + JDReflectionUtil.callMethod_V(rsCommaSeparator_, "updateObject", "C_NUMERIC_105", new BigDecimal(-6639.95), + getSQLType(Types.NUMERIC)); + rsCommaSeparator_.updateRow(); + ResultSet rs2 = statementCommaSeparator2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + BigDecimal v = rs2.getBigDecimal("C_NUMERIC_105"); + rs2.close(); + assertCondition(v.floatValue() == -6639.95f, added); + } catch (Exception e) { + failed(e, "Unexpected Exception" + added); + } + } + } + /** + * updateObject() - Update a NUMERIC, when the fraction will truncate. + **/ + public void Var137() { + String added = " -- added 12/17/2009 to test native driver for CPS 7YSU2X"; + setupRsCommaSeparator(); + if (checkJdbc42()) { + + try { + + JDRSTest.position(rsCommaSeparator_, key_); + JDReflectionUtil.callMethod_V(rsCommaSeparator_, "updateObject", "C_NUMERIC_40", new BigDecimal(-4539.98), + getSQLType(Types.NUMERIC)); + rsCommaSeparator_.updateRow(); + ResultSet rs2 = statementCommaSeparator2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + BigDecimal v = rs2.getBigDecimal("C_NUMERIC_40"); + rs2.close(); + assertCondition(v.equals(new BigDecimal(-4539.0)), added); + } catch (Exception e) { + failed(e, "Unexpected Exception" + added); + } + } + } -/** - New comma decimal separator tests -**/ + /** + * updateObject() - Update a NUMERIC, with scale 0 specified. + **/ + public void Var138() { + String added = " -- added 12/17/2009 to test native driver for CPS 7YSU2X"; + setupRsCommaSeparator(); + if (checkJdbc42()) { + + try { + + JDRSTest.position(rsCommaSeparator_, key_); + JDReflectionUtil.callMethod_V(rsCommaSeparator_, "updateObject", "C_NUMERIC_105", new BigDecimal(39458.88734), + getSQLType(Types.NUMERIC), 0); + rsCommaSeparator_.updateRow(); + ResultSet rs2 = statementCommaSeparator2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + BigDecimal v = rs2.getBigDecimal("C_NUMERIC_105"); + rs2.close(); + assertCondition(v.floatValue() == 39458, added); + } catch (Exception e) { + failed(e, "Unexpected Exception" + added); + } + } + } -/** -updateObject() - Update a DECIMAL, with no scale specified. -**/ - public void Var129 () - { - - String added = " -- added 12/17/2009 to test native driver for CPS 7YSU2X"; - setupRsCommaSeparator(); - if (checkJdbc42 ()) { - try { - JDRSTest.position (rsCommaSeparator_, key_); - JDReflectionUtil.callMethod_V(rsCommaSeparator_,"updateObject", "C_DECIMAL_105", new BigDecimal (-4539.9), getSQLType(Types.DECIMAL)); - rsCommaSeparator_.updateRow (); - ResultSet rs2 = statementCommaSeparator2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - BigDecimal v = rs2.getBigDecimal ("C_DECIMAL_105"); - rs2.close (); - assertCondition (v.floatValue() == -4539.9f, added); - } - catch (Exception e) { - failed (e, "Unexpected Exception"+added); - } - } + /** + * updateObject() - Update a NUMERIC, with scale less than the value's scale. + **/ + public void Var139() { + String added = " -- added 12/17/2009 to test native driver for CPS 7YSU2X"; + setupRsCommaSeparator(); + if (checkJdbc42()) { + + try { + + JDRSTest.position(rsCommaSeparator_, key_); + JDReflectionUtil.callMethod_V(rsCommaSeparator_, "updateObject", "C_NUMERIC_105", new BigDecimal(34255.53434), + getSQLType(Types.NUMERIC), 3); + rsCommaSeparator_.updateRow(); + ResultSet rs2 = statementCommaSeparator2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + BigDecimal v = rs2.getBigDecimal("C_NUMERIC_105"); + rs2.close(); + assertCondition(v.floatValue() == 34255.534f, added); + } catch (Exception e) { + failed(e, "Unexpected Exception" + added); + } } + } + /** + * updateObject() - Update a NUMERIC, with scale equal to the value's scale. + **/ + public void Var140() { + String added = " -- added 12/17/2009 to test native driver for CPS 7YSU2X"; + setupRsCommaSeparator(); + if (checkJdbc42()) { + + try { + + JDRSTest.position(rsCommaSeparator_, key_); + JDReflectionUtil.callMethod_V(rsCommaSeparator_, "updateObject", "C_NUMERIC_105", new BigDecimal(54321.12345), + getSQLType(Types.NUMERIC), 5); + rsCommaSeparator_.updateRow(); + ResultSet rs2 = statementCommaSeparator2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + BigDecimal v = rs2.getBigDecimal("C_NUMERIC_105"); + rs2.close(); + assertCondition(v.floatValue() == 54321.12345f, added); + } catch (Exception e) { + failed(e, "Unexpected Exception" + added); + } + } + } -/** -updateObject() - Update a DECIMAL, when the fraction will truncate. This is ok. -**/ - public void Var130 () - { - String added = " -- added 12/17/2009 to test native driver for CPS 7YSU2X"; - setupRsCommaSeparator(); - if (checkJdbc42 ()) { - try { - JDRSTest.position (rsCommaSeparator_, key_); - JDReflectionUtil.callMethod_V(rsCommaSeparator_,"updateObject", "C_DECIMAL_105", new BigDecimal (-4539.987666666), getSQLType(Types.DECIMAL)); - rsCommaSeparator_.updateRow (); - ResultSet rs2 = statementCommaSeparator2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - BigDecimal v = rs2.getBigDecimal ("C_DECIMAL_105"); - rs2.close (); - assertCondition (v.equals(new BigDecimal("-4539.98766")), added); - } - catch (Exception e) { - failed (e, "Unexpected Exception"+added); - } - } + /** + * updateObject() - Update a NUMERIC, with scale greater the value's scale. + **/ + public void Var141() { + String added = " -- added 12/17/2009 to test native driver for CPS 7YSU2X"; + setupRsCommaSeparator(); + if (checkJdbc42()) { + + try { + + JDRSTest.position(rsCommaSeparator_, key_); + JDReflectionUtil.callMethod_V(rsCommaSeparator_, "updateObject", "C_NUMERIC_105", new BigDecimal(54321.12345), + getSQLType(Types.NUMERIC), 8); + rsCommaSeparator_.updateRow(); + ResultSet rs2 = statementCommaSeparator2_.executeQuery(select_); + JDRSTest.position(rs2, key_); + BigDecimal v = rs2.getBigDecimal("C_NUMERIC_105"); + rs2.close(); + assertCondition(v.floatValue() == 54321.12345f, added); + } catch (Exception e) { + failed(e, "Unexpected Exception" + added); + } } + } + public void dfpTestCommaSeparator(String table, Object value, String expected) { + dfpTestCommaSeparator(table, value, expected, expected); + } + public void dfpTestCommaSeparator(String table, Object value, String expected, String expected2) { + dfpTestCommaSeparator(table, value, expected, expected2, expected2); + } -/** -updateObject() - Update a DECIMAL, with scale 0 specified. -**/ - public void Var131 () - { - String added = " -- added 12/17/2009 to test native driver for CPS 7YSU2X"; - setupRsCommaSeparator(); - if (checkJdbc42 ()) { - try { - JDRSTest.position (rsCommaSeparator_, key_); - JDReflectionUtil.callMethod_V(rsCommaSeparator_,"updateObject", "C_DECIMAL_105", new BigDecimal (39455.58734), getSQLType(Types.DECIMAL), 0); - rsCommaSeparator_.updateRow (); - ResultSet rs2 = statementCommaSeparator2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - BigDecimal v = rs2.getBigDecimal ("C_DECIMAL_105"); - rs2.close (); - assertCondition (v.floatValue() == 39455, added); - } - catch (Exception e) { - failed (e, "Unexpected Exception"+added); - } - } + public void dfpTestCommaSeparator(String table, Object value, String expected, String expected2, String expected3) { + String added = " -- added 12/17/2009 to test native driver for CPS 7YSU2X"; + if (checkJdbc42()) { + if (checkDecFloatSupport()) { + + try { + + setupRsCommaSeparator(); + Statement s = connectionCommaSeparator_.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, + ResultSet.CONCUR_UPDATABLE); + ResultSet rs = s.executeQuery("SELECT * FROM " + table + " FOR UPDATE "); + rs.next(); + // JDReflectionUtil.callMethod_V(rs,"updateObject",1, value, + // getSQLType(Types.OTHER)); + Class[] argClasses = new Class[3]; + argClasses[0] = Integer.TYPE; + argClasses[1] = Class.forName("java.lang.Object"); + argClasses[2] = Class.forName("java.sql.SQLType"); + Object[] args = new Object[3]; + args[0] = Integer.valueOf(1); + args[1] = value; + args[2] = getSQLType(Types.OTHER); + JDReflectionUtil.callMethod_V(rs, "updateObject", argClasses, args); + + rs.updateRow(); /* seriralized */ + + ResultSet rs2 = statementCommaSeparator2f_.executeQuery("SELECT * FROM " + table); + rs2.next(); + String v = rs2.getString(1); + rs2.close(); + rs.close(); + s.close(); + try { + connection_.commit(); + } catch (Exception e) { + } + assertCondition( + (v == null && expected == null) || (v != null && v.equals(expected)) || (v != null && v.equals(expected2)) + || (v != null && v.equals(expected3)), + "Got " + v + " from " + value + " sb " + expected + " or " + expected2 + " or " + expected3 + added); + } catch (Exception e) { + failed(e, "Unexpected Exception" + added); + } + } } + } + /** + * updateObject -- set DFP16 to different values and retrieve + */ + public void Var142() { + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP16, "4533,43", "4533,43"); + } -/** -updateObject() - Update a DECIMAL, with scale less than the value's scale. -**/ - public void Var132 () - { - String added = " -- added 12/17/2009 to test native driver for CPS 7YSU2X"; - setupRsCommaSeparator(); - if (checkJdbc42 ()) { - try { - JDRSTest.position (rsCommaSeparator_, key_); - JDReflectionUtil.callMethod_V(rsCommaSeparator_,"updateObject", "C_DECIMAL_105", new BigDecimal (34255.53434), getSQLType(Types.DECIMAL), 3); - rsCommaSeparator_.updateRow (); - ResultSet rs2 = statementCommaSeparator2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - BigDecimal v = rs2.getBigDecimal ("C_DECIMAL_105"); - rs2.close (); - assertCondition (v.floatValue() == 34255.534f, added); - } - catch (Exception e) { - failed (e, "Unexpected Exception"+added); - } - } - } + public void Var143() { + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP16, "1234567890123456", "1234567890123456"); + } + public void Var144() { + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP16, "-1234567890123456", "-1234567890123456"); + } -/** -updateObject() - Update a DECIMAL, with scale equal to the value's scale. -**/ - public void Var133 () - { - String added = " -- added 12/17/2009 to test native driver for CPS 7YSU2X"; - setupRsCommaSeparator(); - if (checkJdbc42 ()) { - try { - JDRSTest.position (rsCommaSeparator_, key_); - JDReflectionUtil.callMethod_V(rsCommaSeparator_,"updateObject", "C_DECIMAL_105", new BigDecimal (54321.12345), getSQLType(Types.DECIMAL), 5); - rsCommaSeparator_.updateRow (); - ResultSet rs2 = statementCommaSeparator2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - BigDecimal v = rs2.getBigDecimal ("C_DECIMAL_105"); - rs2.close (); - assertCondition (v.floatValue() == 54321.12345f, added); - } - catch (Exception e) { - failed (e, "Unexpected Exception"+added); - } - } - } + public void Var145() { + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP16, "+1234567890123456", "1234567890123456"); + } + public void Var146() { + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP16, "+1234567890123456E28", "1,234567890123456E+43"); + } -/** -updateObject() - Update a DECIMAL, with scale greater the value's scale. -**/ - public void Var134 () - { - String added = " -- added 12/17/2009 to test native driver for CPS 7YSU2X"; - setupRsCommaSeparator(); - if (checkJdbc42 ()) { - try { - JDRSTest.position (rsCommaSeparator_, key_); - JDReflectionUtil.callMethod_V(rsCommaSeparator_,"updateObject", "C_DECIMAL_105", new BigDecimal (54321.12345), getSQLType(Types.DECIMAL), 8); - rsCommaSeparator_.updateRow (); - ResultSet rs2 = statementCommaSeparator2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - BigDecimal v = rs2.getBigDecimal ("C_DECIMAL_105"); - rs2.close (); - assertCondition (v.floatValue() ==54321.12345f, added); - } - catch (Exception e) { - failed (e, "Unexpected Exception"+added); - } - } - } + public void Var147() { + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP16, "+1234567890123456E+28", "1,234567890123456E+43"); + } + public void Var148() { + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP16, "+123456789012345.6E+29", "1,234567890123456E+43"); + } -/** -updateObject() - Update a DECIMAL, when the value is too big. -**/ - public void Var135 () - { - String added = " -- added 12/17/2009 to test native driver for CPS 7YSU2X"; - setupRsCommaSeparator(); - if (checkJdbc42 ()) { - int expectedColumn = -1; - try { - JDRSTest.position (rsCommaSeparator_, key_); - expectedColumn = rsCommaSeparator_.findColumn ("C_DECIMAL_105"); - JDReflectionUtil.callMethod_V(rsCommaSeparator_,"updateObject", "C_DECIMAL_105", new BigDecimal ("394585.432389445"), getSQLType(Types.DECIMAL)); - rsCommaSeparator_.updateRow (); - failed ("Didn't throw SQLException"); - } - catch (Exception e) { - if (e instanceof DataTruncation) { - DataTruncation dt = (DataTruncation)e; - assertCondition ((dt.getIndex() == expectedColumn) - && (dt.getParameter() == false) - && (dt.getRead() == false) - && (dt.getDataSize() == 15) - && (dt.getTransferSize() == 10), added); - } else { - assertSqlException(e, -99999, "07006", "Data type mismatch", "Mismatch instead of truncation in latest toolbox "); - } + public void Var149() { + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP16, "+0.01234567890123456E+45", "1,234567890123456E+43"); + } - } - } - } + public void Var150() { + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP16, "-1234567890123456E28", "-1,234567890123456E+43"); + } + public void Var151() { + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP16, "1E0", "1"); + } + public void Var152() { + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP16, "1,1", "1,1"); + } + public void Var153() { + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP16, "1.1E0", "1,1"); + } -/** -updateObject() - Update a NUMERIC, with no scale specified. -**/ - public void Var136 () - { - String added = " -- added 12/17/2009 to test native driver for CPS 7YSU2X"; - setupRsCommaSeparator(); - if (checkJdbc42 ()) { - try { - JDRSTest.position (rsCommaSeparator_, key_); - JDReflectionUtil.callMethod_V(rsCommaSeparator_,"updateObject", "C_NUMERIC_105", new BigDecimal (-6639.95), getSQLType(Types.NUMERIC)); - rsCommaSeparator_.updateRow (); - ResultSet rs2 = statementCommaSeparator2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - BigDecimal v = rs2.getBigDecimal ("C_NUMERIC_105"); - rs2.close (); - assertCondition (v.floatValue() == -6639.95f, added); - } - catch (Exception e) { - failed (e, "Unexpected Exception"+added); - } - } - } + public void Var154() { + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP16, null, null); + } + public void Var155() { + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP16, new BigDecimal("4533.43"), "4533,43"); + } + public void Var156() { + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP16, new BigDecimal("1234567890123456"), "1234567890123456"); + } -/** -updateObject() - Update a NUMERIC, when the fraction will truncate. -**/ - public void Var137 () - { - String added = " -- added 12/17/2009 to test native driver for CPS 7YSU2X"; - setupRsCommaSeparator(); - if (checkJdbc42 ()) { - try { - JDRSTest.position (rsCommaSeparator_, key_); - JDReflectionUtil.callMethod_V(rsCommaSeparator_,"updateObject", "C_NUMERIC_40", new BigDecimal (-4539.98), getSQLType(Types.NUMERIC)); - rsCommaSeparator_.updateRow (); - ResultSet rs2 = statementCommaSeparator2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - BigDecimal v = rs2.getBigDecimal ("C_NUMERIC_40"); - rs2.close (); - assertCondition (v.equals(new BigDecimal(-4539.0)), added); - } - catch (Exception e) { - failed (e, "Unexpected Exception"+added); - } - } - } + public void Var157() { + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP16, new BigDecimal("-1234567890123456"), "-1234567890123456"); + } + public void Var158() { + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP16, new BigDecimal("+1234567890123456"), "1234567890123456"); + } -/** -updateObject() - Update a NUMERIC, with scale 0 specified. -**/ - public void Var138 () - { - String added = " -- added 12/17/2009 to test native driver for CPS 7YSU2X"; - setupRsCommaSeparator(); - if (checkJdbc42 ()) { - try { - JDRSTest.position (rsCommaSeparator_, key_); - JDReflectionUtil.callMethod_V(rsCommaSeparator_,"updateObject", "C_NUMERIC_105", new BigDecimal (39458.88734), getSQLType(Types.NUMERIC), 0); - rsCommaSeparator_.updateRow (); - ResultSet rs2 = statementCommaSeparator2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - BigDecimal v = rs2.getBigDecimal ("C_NUMERIC_105"); - rs2.close (); - assertCondition (v.floatValue() == 39458, added); - } - catch (Exception e) { - failed (e, "Unexpected Exception"+added); - } - } - } + public void Var159() { + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP16, new BigDecimal("+1234567890123456E28"), "1,234567890123456E+43"); + } + public void Var160() { + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP16, new BigDecimal("+1234567890123456E+28"), "1,234567890123456E+43"); + } -/** -updateObject() - Update a NUMERIC, with scale less than the value's scale. -**/ - public void Var139 () - { - String added = " -- added 12/17/2009 to test native driver for CPS 7YSU2X"; - setupRsCommaSeparator(); - if (checkJdbc42 ()) { - try { - JDRSTest.position (rsCommaSeparator_, key_); - JDReflectionUtil.callMethod_V(rsCommaSeparator_,"updateObject", "C_NUMERIC_105", new BigDecimal (34255.53434), getSQLType(Types.NUMERIC), 3); - rsCommaSeparator_.updateRow (); - ResultSet rs2 = statementCommaSeparator2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - BigDecimal v = rs2.getBigDecimal ("C_NUMERIC_105"); - rs2.close (); - assertCondition (v.floatValue() == 34255.534f, added); - } - catch (Exception e) { - failed (e, "Unexpected Exception"+added); - } - } - } + public void Var161() { + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP16, new BigDecimal("+123456789012345.6E+29"), "1,234567890123456E+43"); + } + public void Var162() { + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP16, new BigDecimal("+0.01234567890123456E+45"), + "1,234567890123456E+43"); + } -/** -updateObject() - Update a NUMERIC, with scale equal to the value's scale. -**/ - public void Var140 () - { - String added = " -- added 12/17/2009 to test native driver for CPS 7YSU2X"; - setupRsCommaSeparator(); - if (checkJdbc42 ()) { - try { - JDRSTest.position (rsCommaSeparator_, key_); - JDReflectionUtil.callMethod_V(rsCommaSeparator_,"updateObject", "C_NUMERIC_105", new BigDecimal (54321.12345), getSQLType(Types.NUMERIC), 5); - rsCommaSeparator_.updateRow (); - ResultSet rs2 = statementCommaSeparator2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - BigDecimal v = rs2.getBigDecimal ("C_NUMERIC_105"); - rs2.close (); - assertCondition (v.floatValue() == 54321.12345f, added); - } - catch (Exception e) { - failed (e, "Unexpected Exception"+added); - } - } - } + public void Var163() { + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP16, new BigDecimal("-1234567890123456E28"), "-1,234567890123456E+43"); + } + public void Var164() { + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP16, new BigDecimal("1E0"), "1"); + } -/** -updateObject() - Update a NUMERIC, with scale greater the value's scale. -**/ - public void Var141 () - { - String added = " -- added 12/17/2009 to test native driver for CPS 7YSU2X"; - setupRsCommaSeparator(); - if (checkJdbc42 ()) { - try { - JDRSTest.position (rsCommaSeparator_, key_); - JDReflectionUtil.callMethod_V(rsCommaSeparator_,"updateObject", "C_NUMERIC_105", new BigDecimal (54321.12345), getSQLType(Types.NUMERIC), 8); - rsCommaSeparator_.updateRow (); - ResultSet rs2 = statementCommaSeparator2_.executeQuery (select_); - JDRSTest.position (rs2, key_); - BigDecimal v = rs2.getBigDecimal ("C_NUMERIC_105"); - rs2.close (); - assertCondition (v.floatValue() == 54321.12345f, added); - } - catch (Exception e) { - failed (e, "Unexpected Exception"+added); - } - } - } + public void Var165() { + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP16, new BigDecimal("1.1"), "1,1"); + } + public void Var166() { + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP16, new BigDecimal("1.1E0"), "1,1"); + } - public void dfpTestCommaSeparator(String table, Object value, String expected) { - dfpTestCommaSeparator(table, value, expected, expected); + public void Var167() { + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP16, Float.valueOf(4533.43f), "4533,43"); } - public void dfpTestCommaSeparator(String table, Object value, String expected, String expected2) { - dfpTestCommaSeparator(table, value, expected, expected2, expected2); -} + public void Var168() { + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP16, Float.valueOf(Float.NaN), "NaN"); + } - public void dfpTestCommaSeparator(String table, Object value, String expected, String expected2, String expected3) { - String added = " -- added 12/17/2009 to test native driver for CPS 7YSU2X"; - if (checkJdbc42()) { - if (checkDecFloatSupport()) { - try { - - setupRsCommaSeparator(); - Statement s = connectionCommaSeparator_.createStatement( - ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); - ResultSet rs = s.executeQuery("SELECT * FROM " + table + " FOR UPDATE "); - rs.next(); - // JDReflectionUtil.callMethod_V(rs,"updateObject",1, value, getSQLType(Types.OTHER)); - Class[] argClasses = new Class[3]; - argClasses[0] = Integer.TYPE; - argClasses[1] = Class.forName("java.lang.Object"); - argClasses[2] = Class.forName("java.sql.SQLType"); - Object[] args = new Object[3]; - args[0] = Integer.valueOf(1); - args[1] = value; - args[2] = getSQLType(Types.OTHER); - JDReflectionUtil.callMethod_V(rs,"updateObject",argClasses, args ); - - rs.updateRow(); - - ResultSet rs2 = statementCommaSeparator2f_.executeQuery("SELECT * FROM " + table); - rs2.next(); - String v = rs2.getString(1); - rs2.close(); - s.close(); - try { - connection_.commit(); - } catch (Exception e) {} - assertCondition((v==null && expected==null) || - (v!=null && v.equals(expected)) || - (v!=null && v.equals(expected2))|| - (v!=null && v.equals(expected3)) , "Got " + v + " from "+ value +" sb " + expected+" or "+expected2+" or "+expected3+added); - } catch (Exception e) { - failed(e, "Unexpected Exception"+added); - } - } - } - } - - /** - * updateObject -- set DFP16 to different values and retrieve - */ - public void Var142 () { dfpTestCommaSeparator(JDRSTest.RSTEST_DFP16, "4533,43", "4533,43"); } - public void Var143 () { dfpTestCommaSeparator(JDRSTest.RSTEST_DFP16, "1234567890123456", "1234567890123456");} - public void Var144 () { dfpTestCommaSeparator(JDRSTest.RSTEST_DFP16, "-1234567890123456", "-1234567890123456");} - public void Var145 () { dfpTestCommaSeparator(JDRSTest.RSTEST_DFP16, "+1234567890123456","1234567890123456");} - public void Var146 () { - dfpTestCommaSeparator(JDRSTest.RSTEST_DFP16, "+1234567890123456E28","1,234567890123456E+43"); - } - public void Var147 () { - dfpTestCommaSeparator(JDRSTest.RSTEST_DFP16, "+1234567890123456E+28","1,234567890123456E+43"); - } - public void Var148 () { - dfpTestCommaSeparator(JDRSTest.RSTEST_DFP16, "+123456789012345.6E+29","1,234567890123456E+43"); - } - public void Var149 () { - dfpTestCommaSeparator(JDRSTest.RSTEST_DFP16, "+0.01234567890123456E+45","1,234567890123456E+43"); - } - public void Var150 () { - dfpTestCommaSeparator(JDRSTest.RSTEST_DFP16, "-1234567890123456E28","-1,234567890123456E+43"); - } - - public void Var151 () { dfpTestCommaSeparator(JDRSTest.RSTEST_DFP16, "1E0", "1");} - public void Var152 () { dfpTestCommaSeparator(JDRSTest.RSTEST_DFP16, "1,1", "1,1");} - public void Var153 () { dfpTestCommaSeparator(JDRSTest.RSTEST_DFP16, "1.1E0", "1,1");} - public void Var154 () { dfpTestCommaSeparator(JDRSTest.RSTEST_DFP16, null, null);} + public void Var169() { + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP16, Float.valueOf(Float.POSITIVE_INFINITY), "Infinity"); + } - public void Var155 () { dfpTestCommaSeparator(JDRSTest.RSTEST_DFP16, new BigDecimal("4533.43"), "4533,43"); } - public void Var156 () { dfpTestCommaSeparator(JDRSTest.RSTEST_DFP16, new BigDecimal("1234567890123456"), "1234567890123456");} - public void Var157 () { dfpTestCommaSeparator(JDRSTest.RSTEST_DFP16, new BigDecimal("-1234567890123456"), "-1234567890123456");} - public void Var158 () { dfpTestCommaSeparator(JDRSTest.RSTEST_DFP16, new BigDecimal("+1234567890123456"),"1234567890123456");} - public void Var159 () { - dfpTestCommaSeparator(JDRSTest.RSTEST_DFP16, new BigDecimal("+1234567890123456E28"),"1,234567890123456E+43"); - } - public void Var160 () { - dfpTestCommaSeparator(JDRSTest.RSTEST_DFP16, new BigDecimal("+1234567890123456E+28"),"1,234567890123456E+43"); - } - public void Var161 () { - dfpTestCommaSeparator(JDRSTest.RSTEST_DFP16, new BigDecimal("+123456789012345.6E+29"),"1,234567890123456E+43"); - } - public void Var162 () { - dfpTestCommaSeparator(JDRSTest.RSTEST_DFP16, new BigDecimal("+0.01234567890123456E+45"),"1,234567890123456E+43"); - } - public void Var163 () { - dfpTestCommaSeparator(JDRSTest.RSTEST_DFP16, new BigDecimal("-1234567890123456E28"),"-1,234567890123456E+43"); - } - - public void Var164 () { dfpTestCommaSeparator(JDRSTest.RSTEST_DFP16, new BigDecimal("1E0"), "1");} - public void Var165 () { dfpTestCommaSeparator(JDRSTest.RSTEST_DFP16, new BigDecimal("1.1"), "1,1");} - public void Var166 () { dfpTestCommaSeparator(JDRSTest.RSTEST_DFP16, new BigDecimal("1.1E0"), "1,1");} + public void Var170() { + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP16, Float.valueOf(Float.NEGATIVE_INFINITY), "-Infinity"); + } + public void Var171() { + /* with the new native PASE support, this comes back with the zeros */ + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP16, Float.valueOf(-1234567890123456.0f), "-1,23456795E+15", + "-1234567950000000", "-1,234568E+15"); + } - public void Var167 () { dfpTestCommaSeparator(JDRSTest.RSTEST_DFP16, Float.valueOf(4533.43f), "4533,43"); } - public void Var168 () { dfpTestCommaSeparator(JDRSTest.RSTEST_DFP16, Float.valueOf(Float.NaN), "NaN");} - public void Var169 () { dfpTestCommaSeparator(JDRSTest.RSTEST_DFP16, Float.valueOf(Float.POSITIVE_INFINITY), "Infinity");} - public void Var170 () { dfpTestCommaSeparator(JDRSTest.RSTEST_DFP16, Float.valueOf(Float.NEGATIVE_INFINITY), "-Infinity");} - public void Var171 () { - /* with the new native PASE support, this comes back with the zeros*/ - dfpTestCommaSeparator(JDRSTest.RSTEST_DFP16, Float.valueOf(-1234567890123456.0f), "-1,23456795E+15", "-1234567950000000","-1,234568E+15"); - } - public void Var172 () { dfpTestCommaSeparator(JDRSTest.RSTEST_DFP16, Double.valueOf(4533.43f), "4533,43017578125"); } - public void Var173 () { dfpTestCommaSeparator(JDRSTest.RSTEST_DFP16, Double.valueOf(Double.NaN), "NaN");} - public void Var174 () { dfpTestCommaSeparator(JDRSTest.RSTEST_DFP16, Double.valueOf(Double.POSITIVE_INFINITY), "Infinity");} - public void Var175 () { dfpTestCommaSeparator(JDRSTest.RSTEST_DFP16, Double.valueOf(Double.NEGATIVE_INFINITY), "-Infinity");} - public void Var176 () { dfpTestCommaSeparator(JDRSTest.RSTEST_DFP16, Double.valueOf(-1234567890123456.0), "-1234567890123456");} + public void Var172() { + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP16, Double.valueOf(4533.43f), "4533,43017578125"); + } + + public void Var173() { + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP16, Double.valueOf(Double.NaN), "NaN"); + } + + public void Var174() { + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP16, Double.valueOf(Double.POSITIVE_INFINITY), "Infinity"); + } + public void Var175() { + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP16, Double.valueOf(Double.NEGATIVE_INFINITY), "-Infinity"); + } + public void Var176() { + dfpTestCommaSeparator(JDRSTest.RSTEST_UPDDFP16, Double.valueOf(-1234567890123456.0), "-1234567890123456"); + } - /** -updateBooleanObject() - Update a BOOLEAN. -**/ + /** + * updateBooleanObject() - Update a BOOLEAN. + **/ public void updateBooleanObject(Object inObject, String outString, int SQLType) { setupRs(); if (checkBooleanSupport()) { + try { + JDRSTest.position(rs_, key_); - JDReflectionUtil.callMethod_V(rs_,"updateObject","C_BOOLEAN", inObject, getSQLType(Types.BIGINT)); - rs_.updateRow(); + JDReflectionUtil.callMethod_V(rs_, "updateObject", "C_BOOLEAN", inObject, getSQLType(Types.BIGINT)); + rs_.updateRow(); /* serialized */ ResultSet rs2 = statement2_.executeQuery(select_); JDRSTest.position(rs2, key_); String v = rs2.getString("C_BOOLEAN"); @@ -2944,60 +2960,96 @@ public void updateBooleanObject(Object inObject, String outString, int SQLType) assertCondition(outString.equals(v), "got " + v + " sb " + outString); } catch (Exception e) { failed(e, "Unexpected Exception"); - } + } } } - public void Var177() { updateBooleanObject(Boolean.valueOf(true),"1",Types.BOOLEAN); } - public void Var178() { updateBooleanObject(Boolean.valueOf(false),"0",Types.BOOLEAN); } - public void Var179() {updateBooleanObject("1", "1",Types.VARCHAR); } - public void Var180() {updateBooleanObject("0", "0",Types.VARCHAR); } - public void Var181() { updateBooleanObject("1000", "1",Types.VARCHAR);} - + public void Var177() { + updateBooleanObject(Boolean.valueOf(true), "1", Types.BOOLEAN); + } + + public void Var178() { + updateBooleanObject(Boolean.valueOf(false), "0", Types.BOOLEAN); + } + + public void Var179() { + updateBooleanObject("1", "1", Types.VARCHAR); + } + + public void Var180() { + updateBooleanObject("0", "0", Types.VARCHAR); + } + + public void Var181() { + updateBooleanObject("1000", "1", Types.VARCHAR); + } + public void Var182() { - updateBooleanObject("-100", "1",Types.VARCHAR); + updateBooleanObject("-100", "1", Types.VARCHAR); } public void Var183() { - updateBooleanObject("true", "1",Types.VARCHAR); + updateBooleanObject("true", "1", Types.VARCHAR); } public void Var184() { - updateBooleanObject("false", "0",Types.VARCHAR); + updateBooleanObject("false", "0", Types.VARCHAR); } public void Var185() { - updateBooleanObject("T", "1",Types.VARCHAR); + updateBooleanObject("T", "1", Types.VARCHAR); } public void Var186() { - updateBooleanObject("F", "0",Types.VARCHAR); + updateBooleanObject("F", "0", Types.VARCHAR); } public void Var187() { - updateBooleanObject("yes", "1",Types.VARCHAR); + updateBooleanObject("yes", "1", Types.VARCHAR); } public void Var188() { - updateBooleanObject("no", "0",Types.VARCHAR); + updateBooleanObject("no", "0", Types.VARCHAR); } - public void Var189() { updateBooleanObject(Integer.valueOf(1),"1",Types.INTEGER); } - public void Var190() { updateBooleanObject(Integer.valueOf(0),"0",Types.INTEGER); } - public void Var191() { updateBooleanObject(Long.valueOf(1),"1",Types.BIGINT); } - public void Var192() { updateBooleanObject(Long.valueOf(0),"0",Types.BIGINT); } - public void Var193() { updateBooleanObject(Float.valueOf(3.0f),"1",Types.FLOAT); } - public void Var194() { updateBooleanObject(Float.valueOf(0.0f),"0",Types.FLOAT); } - public void Var195() { updateBooleanObject(Double.valueOf(2.0),"1",Types.DOUBLE); } - public void Var196() { updateBooleanObject(Double.valueOf(0.0),"0",Types.DOUBLE); } - public void Var197() { updateBooleanObject(new BigDecimal(3.14),"1",Types.DECIMAL); } - public void Var198() { updateBooleanObject(new BigDecimal(0.0),"0",Types.DECIMAL); } + public void Var189() { + updateBooleanObject(Integer.valueOf(1), "1", Types.INTEGER); + } + public void Var190() { + updateBooleanObject(Integer.valueOf(0), "0", Types.INTEGER); + } + public void Var191() { + updateBooleanObject(Long.valueOf(1), "1", Types.BIGINT); + } + public void Var192() { + updateBooleanObject(Long.valueOf(0), "0", Types.BIGINT); + } + public void Var193() { + updateBooleanObject(Float.valueOf(3.0f), "1", Types.FLOAT); + } -} + public void Var194() { + updateBooleanObject(Float.valueOf(0.0f), "0", Types.FLOAT); + } + + public void Var195() { + updateBooleanObject(Double.valueOf(2.0), "1", Types.DOUBLE); + } + + public void Var196() { + updateBooleanObject(Double.valueOf(0.0), "0", Types.DOUBLE); + } + public void Var197() { + updateBooleanObject(new BigDecimal(3.14), "1", Types.DECIMAL); + } + public void Var198() { + updateBooleanObject(new BigDecimal(0.0), "0", Types.DECIMAL); + } +} diff --git a/src/test/JD/RS/JDRSUpdateRow.java b/src/test/JD/RS/JDRSUpdateRow.java index 62ba918d..ed3d5ecc 100644 --- a/src/test/JD/RS/JDRSUpdateRow.java +++ b/src/test/JD/RS/JDRSUpdateRow.java @@ -17,6 +17,7 @@ import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; +import java.sql.SQLException; import java.sql.Statement; import java.util.Hashtable; import java.util.Vector; @@ -25,6 +26,7 @@ import test.JDRSTest; import test.JDTestcase; +import test.JD.JDSerializeFile; /** * Testcase JDRSUpdateRow. This tests the following method of the JDBC ResultSet @@ -58,6 +60,7 @@ public static void main(String args[]) throws Exception { private String table1 = "JDTESTRS.RSSUBUPDATE"; // @E1A private String table2 = "JDTESTRS.RSSUBUPDATE2"; // @E1A private String table3 = "JDTESTRS.RSALIASUPD"; // @E3A + private JDSerializeFile serializeUpdateFile_; /** * Constructor. @@ -89,7 +92,9 @@ protected void setup() throws Exception { ; connection_ = testDriver_.getConnection(url, systemObject_.getUserId(), encryptedPassword_); connection_.setAutoCommit(false); // @C1A - statement_ = connection_.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); + serializeUpdateFile_ = new JDSerializeFile(connection_, JDRSTest.RSTEST_UPDATE); + connection_.commit(); + statement_ = connection_.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); statement2_ = connection_.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); statement_.executeUpdate("INSERT INTO " + JDRSTest.RSTEST_UPDATE + " (C_KEY) VALUES ('" + key_ + "')"); @@ -117,6 +122,8 @@ protected void cleanup() throws Exception { cleanupTable(statement_, table3); // @E3A statement_.close(); connection_.commit(); // @C1A + serializeUpdateFile_.close(); + connection_.commit(); connection_.close(); } } @@ -183,7 +190,7 @@ public void Var002() { s = connection_.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); rs = s.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_UPDATE); rs.next(); - rs.updateRow(); + rs.updateRow(); /* exception */ failed("Didn't throw SQLException"); } catch (Exception e) { assertExceptionIsInstanceOf(e, "java.sql.SQLException"); @@ -209,7 +216,7 @@ public void Var003() { if (checkJdbc20()) { try { JDRSTest.position(rs_, null); - rs_.updateRow(); + rs_.updateRow(); /* exception */ failed("Didn't throw SQLException"); } catch (Exception e) { assertExceptionIsInstanceOf(e, "java.sql.SQLException"); @@ -286,7 +293,9 @@ public boolean compareColumns(int i, Object[] before, Object[] after, boolean[] public void Var004() { StringBuffer message = new StringBuffer(); if (checkJdbc20()) { + try { + JDRSTest.position(rs_, key_); int columnCount = rs_.getMetaData().getColumnCount(); Object[] before = new Object[columnCount]; @@ -296,7 +305,7 @@ public void Var004() { beforeNulls[i] = rs_.wasNull(); } - rs_.updateRow(); + rs_.updateRow(); /* serialized */ ResultSet rs2 = statement2_.executeQuery(select_); JDRSTest.position(rs2, key_); @@ -316,7 +325,7 @@ public void Var004() { assertCondition(success, message.toString()); } catch (Exception e) { failed(e, "Unexpected Exception"); - } + } } } @@ -326,7 +335,9 @@ public void Var004() { public void Var005() { StringBuffer message = new StringBuffer(); if (checkJdbc20()) { + try { + JDRSTest.position(rs_, key_); int columnCount = rs_.getMetaData().getColumnCount(); Object[] before = new Object[columnCount]; @@ -337,7 +348,7 @@ public void Var005() { } rs_.updateString("C_VARCHAR_50", "Hi Mom!"); - rs_.updateRow(); + rs_.updateRow();/* serialized */ ResultSet rs2 = statement2_.executeQuery(select_); JDRSTest.position(rs2, key_); @@ -363,7 +374,7 @@ public void Var005() { assertCondition(success, message.toString()); } catch (Exception e) { failed(e, "Unexpected Exception"); - } + } } } @@ -373,7 +384,9 @@ public void Var005() { public void Var006() { StringBuffer message = new StringBuffer(); if (checkJdbc20()) { + try { + JDRSTest.position(rs_, key_); int columnCount = rs_.getMetaData().getColumnCount(); Object[] before = new Object[columnCount]; @@ -386,7 +399,7 @@ public void Var006() { rs_.updateInt("C_INTEGER", 9876); rs_.updateNull("C_SMALLINT"); rs_.updateFloat("C_FLOAT", -4.25f); - rs_.updateRow(); + rs_.updateRow();/* serialized */ ResultSet rs2 = statement2_.executeQuery(select_); JDRSTest.position(rs2, key_); @@ -420,7 +433,7 @@ public void Var006() { assertCondition(success, message.toString()); } catch (Exception e) { failed(e, "Unexpected Exception"); - } + } } } @@ -430,17 +443,19 @@ public void Var006() { **/ public void Var007() { if (checkJdbc20()) { + try { + JDRSTest.position(rs_, key_); rs_.getMetaData().getColumnCount(); rs_.updateString("C_VARCHAR_50", "Hola Mama!"); - rs_.updateRow(); + rs_.updateRow();/* serialized */ assertCondition(rs_.getString("C_VARCHAR_50").equals("Hola Mama!")); } catch (Exception e) { failed(e, "Unexpected Exception"); - } + } } } @@ -450,19 +465,21 @@ public void Var007() { **/ public void Var008() { if (checkJdbc20()) { + try { + JDRSTest.position(rs_, key_); rs_.getMetaData().getColumnCount(); rs_.updateString("C_VARCHAR_50", "Hola Mama!"); - rs_.updateRow(); + rs_.updateRow();/* serialized */ rs_.beforeFirst(); JDRSTest.position(rs_, key_); assertCondition(rs_.getString("C_VARCHAR_50").equals("Hola Mama!")); } catch (Exception e) { failed(e, "Unexpected Exception"); - } + } } } @@ -478,7 +495,9 @@ public void Var008() { public void Var009() { StringBuffer message = new StringBuffer(); if (checkJdbc20()) { + try { + Statement s = connection_.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); ResultSet rs1 = s.executeQuery(select_ + " AS TESTCORR FOR UPDATE"); @@ -492,7 +511,7 @@ public void Var009() { } rs1.updateShort("C_SMALLINT", (short) -123); - rs1.updateRow(); + rs1.updateRow();/* serialized */ rs1.close(); s.close(); @@ -520,7 +539,7 @@ public void Var009() { assertCondition(success, message.toString()); } catch (Exception e) { failed(e, "Unexpected Exception"); - } + } } } @@ -531,7 +550,9 @@ public void Var009() { public void Var010() { StringBuffer message = new StringBuffer(); if (checkJdbc20()) { + try { + ResultSet rs2 = statement2_.executeQuery(select_); JDRSTest.position(rs2, key_); int columnCount = rs2.getMetaData().getColumnCount(); @@ -545,11 +566,11 @@ public void Var010() { JDRSTest.position(rs_, key2_); rs_.updateString("C_VARCHAR_50", "Computer"); - rs_.updateRow(); + rs_.updateRow();/* serialized */ JDRSTest.position(rs_, key_); rs_.updateInt("C_INTEGER", 3343); - rs_.updateRow(); + rs_.updateRow();/* serialized */ rs2 = statement2_.executeQuery(select_); JDRSTest.position(rs2, key_); @@ -577,7 +598,7 @@ public void Var010() { assertCondition(success, message.toString()); } catch (Exception e) { failed(e, "Unexpected Exception"); - } + } } } @@ -598,7 +619,9 @@ public void Var010() { public void Var011() { StringBuffer message = new StringBuffer(); if (checkJdbc20()) { + try { + Statement statement = connection_.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); if (isToolboxDriver()) statement.setCursorName("MiXeD CaSe"); @@ -616,7 +639,7 @@ public void Var011() { rs.updateNull("C_INTEGER"); rs.updateShort("C_SMALLINT", (short) -44); - rs.updateRow(); + rs.updateRow(); /* serialized */ ResultSet rs2 = statement2_.executeQuery(select_); JDRSTest.position(rs2, key_); @@ -643,11 +666,12 @@ public void Var011() { success = compareColumns(i, before, after, beforeNulls, afterNulls, message) && success; } } - + rs.close(); + statement.close(); assertCondition(success, message.toString()); } catch (Exception e) { failed(e, "Unexpected Exception"); - } + } } } @@ -657,12 +681,14 @@ public void Var011() { **/ public void Var012() { if (checkJdbc20()) { + try { + JDRSTest.position(rs_, key_); rs_.updateInt("C_INTEGER", 98276); rs_.updateNull("C_SMALLINT"); rs_.updateFloat("C_FLOAT", -4.225f); - rs_.updateRow(); + rs_.updateRow();/* serialized */ ResultSet rs2 = statement2_.executeQuery(select_); boolean success = true; @@ -674,7 +700,7 @@ public void Var012() { assertCondition(success); } catch (Exception e) { failed(e, "Unexpected Exception"); - } + } } } @@ -684,12 +710,14 @@ public void Var012() { **/ public void Var013() { if (checkJdbc20()) { + try { + JDRSTest.position(rs_, key_); rs_.updateInt("C_INTEGER", 98276); rs_.updateNull("C_SMALLINT"); rs_.updateFloat("C_FLOAT", -4.225f); - rs_.updateRow(); + rs_.updateRow();/* serialized */ rs_.beforeFirst(); boolean success = true; @@ -700,7 +728,7 @@ public void Var013() { assertCondition(success); } catch (Exception e) { failed(e, "Unexpected Exception"); - } + } } } @@ -715,6 +743,7 @@ public void Var014() { rs.next(); rs.close(); rs.cancelRowUpdates(); + s.close(); failed("Didn't throw SQLException"); } catch (Exception e) { assertExceptionIsInstanceOf(e, "java.sql.SQLException"); @@ -733,6 +762,8 @@ public void Var015() { ResultSet rs = s.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_UPDATE); rs.next(); rs.cancelRowUpdates(); + rs.close(); + s.close(); failed("Didn't throw SQLException"); } catch (Exception e) { assertExceptionIsInstanceOf(e, "java.sql.SQLException"); @@ -804,7 +835,9 @@ public void Var018() { StringBuffer message = new StringBuffer(); if (checkJdbc20()) { + try { + JDRSTest.position(rs_, key_); int columnCount = rs_.getMetaData().getColumnCount(); Object[] before = new Object[columnCount]; @@ -818,7 +851,7 @@ public void Var018() rs_.updateNull("C_SMALLINT"); rs_.updateFloat("C_FLOAT", -9.25f); rs_.cancelRowUpdates(); - rs_.updateRow(); + rs_.updateRow();/* serialized */ ResultSet rs2 = statement2_.executeQuery(select_); JDRSTest.position(rs2, key_); @@ -838,7 +871,7 @@ public void Var018() assertCondition(success, message.toString()); } catch (Exception e) { failed(e, "Unexpected Exception"); - } + } } } @@ -848,7 +881,9 @@ public void Var018() public void Var019() { StringBuffer message = new StringBuffer(); if (checkJdbc20()) { + try { + JDRSTest.position(rs_, key_); int columnCount = rs_.getMetaData().getColumnCount(); Object[] before = new Object[columnCount]; @@ -865,7 +900,7 @@ public void Var019() { rs_.updateInt("C_INTEGER", 444); rs_.updateNull("C_SMALLINT"); rs_.updateFloat("C_FLOAT", 34.53f); - rs_.updateRow(); + rs_.updateRow();/* serialized */ ResultSet rs2 = statement2_.executeQuery(select_); JDRSTest.position(rs2, key_); @@ -899,7 +934,7 @@ public void Var019() { assertCondition(success, message.toString()); } catch (Exception e) { failed(e, "Unexpected Exception"); - } + } } } @@ -915,7 +950,7 @@ public void Var020() { rs = s.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_UPDATE + " FOR UPDATE"); rs.next(); rs.close(); - rs.updateRow(); + rs.updateRow(); /* exception */ failed("Didn't throw SQLException"); } catch (Exception e) { assertExceptionIsInstanceOf(e, "java.sql.SQLException"); @@ -942,12 +977,14 @@ public void Var021() { ResultSet rs3 = null; Statement s = null; + try { + s = connection_.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); rs2 = s.executeQuery(select_); JDRSTest.position(rs2, key_); rs2.updateShort("C_SMALLINT", (short) 654); - rs2.updateRow(); + rs2.updateRow();/* serialized */ rs3 = s.executeQuery(select_); JDRSTest.position(rs3, key_); @@ -965,7 +1002,7 @@ public void Var021() { s = null; } catch (Exception e) { failed(e, "Unexpected Exception"); - } + } if (rs2 != null) try { @@ -994,14 +1031,16 @@ public void Var022() { ResultSet rs3 = null; PreparedStatement ps = null; + try { + ps = connection_.prepareStatement("SELECT * FROM " + JDRSTest.RSTEST_UPDATE + " where C_SMALLINT = ?", ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); ps.setShort(1, (short) 654); rs2 = ps.executeQuery(); rs2.next(); rs2.updateShort("C_SMALLINT", (short) 444); - rs2.updateRow(); + rs2.updateRow(); /* serialized */ rs3 = statement2_.executeQuery(select_ + " where C_SMALLINT = 444"); if (rs3.next()) @@ -1017,7 +1056,7 @@ public void Var022() { ps = null; } catch (Exception e) { failed(e, "Unexpected Exception"); - } + } if (rs2 != null) try { @@ -1054,9 +1093,10 @@ public void Var023() { rs.updateString(1, "369258147"); after = rs.getString(1); } - rs.updateRow(); + rs.updateRow(); /* unique table */ rs.last(); int numRows = rs.getRow(); + rs.close(); rs = s.executeQuery( "SELECT * FROM " + table1 + " WHERE SSN IS NOT NULL AND SSN NOT IN (SELECT SSN FROM " + table2 + ")"); if (rs.next()) @@ -1087,33 +1127,29 @@ public void Var024() { Connection c = null; String city = ""; try { - + c = testDriver_.getConnection(url, systemObject_.getUserId(), encryptedPassword_); - + Statement s = c.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); ResultSet rs = s.executeQuery("SELECT CITY AS TOWN FROM " + table3); if (rs.next()) { rs.updateString(1, "Manhatten"); - rs.updateRow(); + rs.updateRow(); /* unique table */ rs.close(); ResultSet rs1 = s.executeQuery("SELECT * FROM " + table3); rs1.next(); city = rs1.getString(1); rs1.close(); + } else { + rs.close(); } s.close(); assertCondition(city.equals("Manhatten")); } catch (Exception e) { failed(e, "Unexpected Exception-New Testcase added by toolbox to test column alias support 9/17/03"); - } finally { - try { - if (c != null) { - c.close(); - } - } catch (Exception e) { - } + } } } @@ -1136,18 +1172,14 @@ public void Var025() { if (rs.next()) { rs.updateString(1, "Manhatten"); - rs.updateRow(); + rs.updateRow(); /* exception */ } + rs.close(); + s.close(); failed("Didn't throw SQLException - New Testcase added by toolbox to test column alias support 9/17/03"); } catch (Exception e) { assertExceptionIsInstanceOf(e, "java.sql.SQLException"); - } finally { - try { - if (c != null) { - c.close(); - } - } catch (Exception e) { - } + } } } @@ -1173,13 +1205,15 @@ public void Var026() { if (rs.next()) { rs.updateString(1, "Rochester"); rs.updateString(2, "MN"); - rs.updateRow(); + rs.updateRow(); /* unique table */ rs.close(); ResultSet rs1 = s.executeQuery("SELECT * FROM " + table3); rs1.next(); city = rs1.getString(1); state = rs1.getString(2); rs1.close(); + } else { + rs.close(); } s.close(); @@ -1187,14 +1221,7 @@ public void Var026() { assertCondition(city.equals("Rochester") && state.equals("MN")); } catch (Exception e) { failed(e, "Unexpected Exception-New Testcase added by toolbox to test column alias support 9/17/03"); - } finally { - try { - if (c != null) { - c.close(); - } - } catch (Exception e) { - } - } + } } } } diff --git a/src/test/JD/RS/JDRSUpdateRowId.java b/src/test/JD/RS/JDRSUpdateRowId.java index a2fcf84e..1d2dc4b3 100644 --- a/src/test/JD/RS/JDRSUpdateRowId.java +++ b/src/test/JD/RS/JDRSUpdateRowId.java @@ -27,6 +27,7 @@ import test.JDReflectionUtil; import test.JDTestDriver; import test.JDTestcase; +import test.JD.JDSerializeFile; @@ -63,7 +64,8 @@ public static void main(String args[]) throws Exception { private ResultSet rs_; - private String baseAdded = " -- Added 02/07/2007 by native driver to test JDBC40 RowId support -- based on JDRSUpdateBytes "; + private String baseAdded = " -- Added 02/07/2007 by native driver to test JDBC40 RowId support -- based on JDRSUpdateBytes "; + private JDSerializeFile serializeUpdateFile_; /** Constructor. @@ -102,13 +104,15 @@ protected void setup () + ";data truncation=true"; connection_ = testDriver_.getConnection (url,systemObject_.getUserId(), encryptedPassword_); connection_.setAutoCommit(false); // @C1A - statement_ = connection_.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, + serializeUpdateFile_ = new JDSerializeFile(connection_, JDRSTest.RSTEST_UPDATE); + connection_.commit(); + statement_ = connection_.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); statement2_ = connection_.createStatement (ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); statement_.executeUpdate ("INSERT INTO " + JDRSTest.RSTEST_UPDATE - + " (C_KEY) VALUES ('DUMMY_ROW')"); + + " (C_KEY) VALUES ('DUMMY_UPDRID')"); statement_.executeUpdate ("INSERT INTO " + JDRSTest.RSTEST_UPDATE + " (C_KEY) VALUES ('" + key_ + "')"); @@ -130,7 +134,9 @@ protected void cleanup () rs_.close (); statement_.close (); connection_.commit(); // @C1A - connection_.close (); + serializeUpdateFile_.close(); + connection_.commit(); + connection_.close (); } } @@ -597,7 +603,7 @@ public void Var018() { if (checkJdbc40 ()) { try { - JDRSTest.position (rs_, "DUMMY_ROW"); + JDRSTest.position (rs_, "DUMMY_UPDRID"); rs_.deleteRow (); byte[] ba = new byte[] { (byte) 121, (byte) 0, (byte) 2, (byte) -2 }; JDReflectionUtil.callMethod_V(rs_, "updateRowId", "C_VARBINARY_20", createRowId(ba)); @@ -1231,7 +1237,7 @@ public void Var043() sql="updateRowId"; try { JDReflectionUtil.callMethod_V(rs, "updateRowId",1, rid); - rs.updateRow (); + rs.updateRow (); /* exception */ passed=false; message="Did not throw Exception"; } catch (Exception e) { diff --git a/src/test/JD/RS/JDRSUpdateSQLXML.java b/src/test/JD/RS/JDRSUpdateSQLXML.java index e7da7980..ac3adba4 100644 --- a/src/test/JD/RS/JDRSUpdateSQLXML.java +++ b/src/test/JD/RS/JDRSUpdateSQLXML.java @@ -11,12 +11,12 @@ // /////////////////////////////////////////////////////////////////////////////// - package test.JD.RS; import java.io.FileOutputStream; -/* import java.sql.DataTruncation; */ +/* import java.sql.DataTruncation; */ import java.sql.ResultSet; +import java.sql.SQLException; import java.sql.Statement; import java.util.Hashtable; import java.util.Vector; @@ -27,2105 +27,1525 @@ import test.JDReflectionUtil; import test.JDTestDriver; import test.JDTestcase; +import test.JD.JDSerializeFile; import test.JD.JDTestUtilities; - - /** -Testcase JDRSUpdateSQLXML. This tests the following method -of the JDBC ResultSet class: - -
    -
  • updateSQLXML() -
-**/ -public class JDRSUpdateSQLXML -extends JDTestcase -{ + * Testcase JDRSUpdateSQLXML. This tests the following method of the JDBC + * ResultSet class: + * + *
    + *
  • updateSQLXML() + *
+ **/ +public class JDRSUpdateSQLXML extends JDTestcase { public static void main(String args[]) throws Exception { - String[] newArgs = new String[args.length+2]; - newArgs[0] = "-tc"; - newArgs[1] = "JDRSUpdateSQLXML"; - for (int i = 0; i < args.length; i++) { - newArgs[2+i]=args[i]; - } - test.JDRSTest.main(newArgs); - } - - - - // Private data. - private static final String key_ = "JDRSUpdateSQLXML"; - private static String select_ = "SELECT * FROM " - + JDRSTest.RSTEST_UPDATE; - private static String selectXML_ = "SELECT * FROM " + JDRSTest.RSTEST_UPDATEXML; - - - private Statement statementOther_; - private Statement statement2Other_; - private ResultSet rsOther_; - private Statement statementXML_; - private Statement statement2XML_; - private ResultSet rsXML_; - private Object sqlxml_; - - private boolean nodecl = false; - /** - Constructor. - **/ - public JDRSUpdateSQLXML (AS400 systemObject, - Hashtable> namesAndVars, - int runMode, - FileOutputStream fileOutputStream, - - String password) - { - super (systemObject, "JDRSUpdateSQLXML", - namesAndVars, runMode, fileOutputStream, - password); - } - - - - /** - Performs setup needed before running variations. - - @exception Exception If an exception occurs. - **/ - protected void setup () - throws Exception - { - select_ = "SELECT * FROM " + JDRSTest.RSTEST_UPDATE; - selectXML_ = "SELECT * FROM " + JDRSTest.RSTEST_UPDATEXML; - - - nodecl = (isToolboxDriver()) || (true); - - if(isJdbc40 ()) - { - String url = baseURL_ - - - + ";date format=iso" - + ";data truncation=true"; - connection_ = testDriver_.getConnection (url,systemObject_.getUserId(), encryptedPassword_); - connection_.setAutoCommit(false); // @C1A - - - statementOther_ = connection_.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, - ResultSet.CONCUR_UPDATABLE); - statement2Other_ = connection_.createStatement (ResultSet.TYPE_SCROLL_INSENSITIVE, - ResultSet.CONCUR_READ_ONLY); - - statementOther_.executeUpdate ("INSERT INTO " + JDRSTest.RSTEST_UPDATE - + " (C_KEY) VALUES ('DUMMY_ROW')"); - statementOther_.executeUpdate ("INSERT INTO " + JDRSTest.RSTEST_UPDATE - + " (C_KEY) VALUES ('" + key_ + "')"); - - rsOther_ = statementOther_.executeQuery (select_ + " FOR UPDATE"); - - - - statementXML_ = connection_.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, - ResultSet.CONCUR_UPDATABLE); - - - - statement2XML_ = connection_.createStatement (ResultSet.TYPE_SCROLL_INSENSITIVE, - ResultSet.CONCUR_READ_ONLY); - - if (true){ - //table is only on 54+ - rsXML_ = statementXML_.executeQuery (selectXML_ + " FOR UPDATE"); - } + String[] newArgs = new String[args.length + 2]; + newArgs[0] = "-tc"; + newArgs[1] = "JDRSUpdateSQLXML"; + for (int i = 0; i < args.length; i++) { + newArgs[2 + i] = args[i]; + } + test.JDRSTest.main(newArgs); + } + + // Private data. + private static final String key_ = "JDRSUpdateSQLXML"; + private static String select_ = "SELECT * FROM " + JDRSTest.RSTEST_UPDATE; + private static String selectXML_ = "SELECT * FROM " + JDRSTest.RSTEST_UPDATEXML; + + private Statement statementOther_; + private Statement statement2Other_; + private ResultSet rsOther_; + private Statement statementXML_; + private Statement statement2XML_; + private ResultSet rsXML_; + private Object sqlxml_; + + private boolean nodecl = false; + private JDSerializeFile serializeUpdateFile_; + + /** + * Constructor. + **/ + public JDRSUpdateSQLXML(AS400 systemObject, Hashtable> namesAndVars, int runMode, + FileOutputStream fileOutputStream, + + String password) { + super(systemObject, "JDRSUpdateSQLXML", namesAndVars, runMode, fileOutputStream, password); + } + + /** + * Performs setup needed before running variations. + * + * @exception Exception If an exception occurs. + **/ + protected void setup() throws Exception { + select_ = "SELECT * FROM " + JDRSTest.RSTEST_UPDATE; + selectXML_ = "SELECT * FROM " + JDRSTest.RSTEST_UPDATEXML; + + nodecl = (isToolboxDriver()) || (true); + + if (isJdbc40()) { + String url = baseURL_ + + + ";date format=iso" + ";data truncation=true"; + connection_ = testDriver_.getConnection(url, systemObject_.getUserId(), encryptedPassword_); + connection_.setAutoCommit(false); // @C1A + serializeUpdateFile_ = new JDSerializeFile(connection_, JDRSTest.RSTEST_UPDATE); + connection_.commit(); + + statementOther_ = connection_.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); + statement2Other_ = connection_.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); + + statementOther_.executeUpdate("INSERT INTO " + JDRSTest.RSTEST_UPDATE + " (C_KEY) VALUES ('DUMMY_UPDSQLXML')"); + statementOther_.executeUpdate("INSERT INTO " + JDRSTest.RSTEST_UPDATE + " (C_KEY) VALUES ('" + key_ + "')"); + + rsOther_ = statementOther_.executeQuery(select_ + " FOR UPDATE"); + + statementXML_ = connection_.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); + + statement2XML_ = connection_.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); + + if (true) { + // table is only on 54+ + rsXML_ = statementXML_.executeQuery(selectXML_ + " FOR UPDATE"); + } - - sqlxml_ = JDReflectionUtil.callMethod_O(connection_, "createSQLXML"); - JDReflectionUtil.callMethod_V(sqlxml_, "setString", JDRSTest.SAMPLE_XML2); + sqlxml_ = JDReflectionUtil.callMethod_O(connection_, "createSQLXML"); + JDReflectionUtil.callMethod_V(sqlxml_, "setString", JDRSTest.SAMPLE_XML2); - } } + } - - - /** - Performs cleanup needed after running variations. - - @exception Exception If an exception occurs. - **/ - protected void cleanup () - throws Exception - { - if(isJdbc40 ()) - { - rsOther_.close (); - statementOther_.close (); - if (true){ - //table is only on 54+ - rsXML_.close (); - } - statementXML_.close (); - connection_.commit(); // @C1A - connection_.close (); - } + /** + * Performs cleanup needed after running variations. + * + * @exception Exception If an exception occurs. + **/ + protected void cleanup() throws Exception { + if (isJdbc40()) { + rsOther_.close(); + statementOther_.close(); + if (true) { + // table is only on 54+ + rsXML_.close(); + } + statementXML_.close(); + connection_.commit(); // @C1A + serializeUpdateFile_.close(); + connection_.commit(); + connection_.close(); + } + } + + /** + * updateSQLXML() - Should throw exception when the result set is closed. + **/ + public void Var001() { + + if (checkJdbc40()) { + + ResultSet rs = null; + try { + Statement s = null; + if (isToolboxDriver()) { + // per issue 36333, diff between zda/cli in scrollable/updatable cursors + // Note: if we open up the rs as scrollable/updatable, then vars7,11,12,15,16 + // will fail + // with [SQL0508] Cursor SCRSR0001 not positioned on locked row. + s = connection_.createStatement(); + rs = s.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_UPDATEXML); + } else { + s = connection_.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); + rs = s.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_UPDATEXML + " FOR UPDATE"); + } + + rs.next(); + rs.close(); + + JDReflectionUtil.callMethod_V(rs, "updateSQLXML", "C_CLOB0037", sqlxml_); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } finally { + + } } - - - - /** - updateSQLXML() - Should throw exception when the result set is - closed. - **/ - public void Var001() - { - - if(checkJdbc40 ()) - { - - ResultSet rs = null; - try - { - Statement s = null; - if(isToolboxDriver()){ - //per issue 36333, diff between zda/cli in scrollable/updatable cursors - //Note: if we open up the rs as scrollable/updatable, then vars7,11,12,15,16 will fail - //with [SQL0508] Cursor SCRSR0001 not positioned on locked row. - s = connection_.createStatement (); - rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_UPDATEXML ); - }else - { - s = connection_.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, - ResultSet.CONCUR_UPDATABLE); - rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_UPDATEXML + " FOR UPDATE"); - } - - - rs.next (); - rs.close (); - - JDReflectionUtil.callMethod_V(rs, "updateSQLXML", "C_CLOB0037", sqlxml_); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - finally - { - try - { - if (rs != null) rs.close(); - } - catch(Exception e) - { } - } - } + } + + /** + * updateSQLXML() - Should throw exception when the result set is not updatable. + **/ + public void Var002() { + if (checkJdbc40()) { + try { + Statement s = connection_.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); + ResultSet rs = s.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_UPDATEXML); + rs.next(); + JDReflectionUtil.callMethod_V(rs, "updateSQLXML", "C_CLOB0037", sqlxml_); + + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } - - - - /** - updateSQLXML() - Should throw exception when the result set is - not updatable. - **/ - public void Var002() - { - if(checkJdbc40 ()) - { - try - { - Statement s = connection_.createStatement (ResultSet.TYPE_SCROLL_INSENSITIVE, - ResultSet.CONCUR_READ_ONLY); - ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_UPDATEXML); - rs.next (); - JDReflectionUtil.callMethod_V(rs, "updateSQLXML", "C_CLOB0037", sqlxml_); - - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + } + + /** + * updateSQLXML() - Should throw exception when cursor is not pointing to a row. + **/ + public void Var003() { + if (checkJdbc40()) { + try { + rsXML_.beforeFirst(); + JDReflectionUtil.callMethod_V(rsXML_, "updateSQLXML", "C_CLOB0037", sqlxml_); + rsXML_.updateRow(); /* exception */ + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } - - - - /** - updateSQLXML() - Should throw exception when cursor is not pointing - to a row. - **/ - public void Var003() - { - if(checkJdbc40 ()) - { - try - { - rsXML_.beforeFirst(); - JDReflectionUtil.callMethod_V(rsXML_, "updateSQLXML", "C_CLOB0037", sqlxml_); - rsXML_.updateRow(); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + } + + /** + * updateSQLXML() - Should throw an exception when the column is an invalid + * index. + **/ + public void Var004() { + if (checkJdbc40()) { + try { + rsXML_.first(); + JDReflectionUtil.callMethod_V(rsXML_, "updateSQLXML", 100, sqlxml_); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } - - - - /** - updateSQLXML() - Should throw an exception when the column - is an invalid index. - **/ - public void Var004() - { - if(checkJdbc40 ()) - { - try - { - rsXML_.first(); - JDReflectionUtil.callMethod_V(rsXML_, "updateSQLXML", 100, sqlxml_); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + } + + /** + * updateSQLXML() - Should throw an exception when the column is 0. + **/ + public void Var005() { + if (checkJdbc40()) { + try { + rsXML_.first(); + JDReflectionUtil.callMethod_V(rsXML_, "updateSQLXML", 0, sqlxml_); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } - - - - /** - updateSQLXML() - Should throw an exception when the column - is 0. - **/ - public void Var005() - { - if(checkJdbc40 ()) - { - try - { - rsXML_.first(); - JDReflectionUtil.callMethod_V(rsXML_, "updateSQLXML", 0, sqlxml_); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + } + + /** + * updateSQLXML() - Should throw an exception when the column is -1. + **/ + public void Var006() { + if (checkJdbc40()) { + try { + rsXML_.first(); + JDReflectionUtil.callMethod_V(rsXML_, "updateSQLXML", -1, sqlxml_); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } - - - - /** - updateSQLXML() - Should throw an exception when the column - is -1. - **/ - public void Var006() - { - if(checkJdbc40 ()) - { - try - { - rsXML_.first(); - JDReflectionUtil.callMethod_V(rsXML_, "updateSQLXML", -1, sqlxml_); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + } + + /** + * updateSQLXML() - Should work when the column index is valid. + **/ + public void Var007() { + if (checkJdbc40()) { + try { + // rsXML_ = statementXML_.executeQuery (selectXML_ + " FOR UPDATE"); + rsXML_.first(); + Object sqlxml = JDReflectionUtil.callMethod_O(connection_, "createSQLXML"); + JDReflectionUtil.callMethod_V(sqlxml, "setString", JDRSTest.SAMPLE_XML2); + + JDReflectionUtil.callMethod_V(rsXML_, "updateSQLXML", 2, sqlxml); + rsXML_.updateRow(); + ResultSet rs2 = statement2XML_.executeQuery(selectXML_); + rs2.first(); + String v = rs2.getString("C_CLOB0037"); + rs2.close(); + String expected = JDRSTest.SAMPLE_XML2; + if (nodecl) { + expected = JDRSTest.SAMPLE_XML2_NODECL; + } + assertCondition(v.equals(expected), "Expected " + expected + " got " + v); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } } - - - - /** - updateSQLXML() - Should work when the column index is valid. - **/ - public void Var007() - { - if(checkJdbc40 ()) - { - try - { - //rsXML_ = statementXML_.executeQuery (selectXML_ + " FOR UPDATE"); - rsXML_.first(); - Object sqlxml = JDReflectionUtil.callMethod_O(connection_, "createSQLXML"); - JDReflectionUtil.callMethod_V(sqlxml, "setString", JDRSTest.SAMPLE_XML2); - - JDReflectionUtil.callMethod_V(rsXML_, "updateSQLXML", 2, sqlxml); - rsXML_.updateRow (); - ResultSet rs2 = statement2XML_.executeQuery (selectXML_); - rs2.first(); - String v = rs2.getString ("C_CLOB0037"); - rs2.close (); - String expected = JDRSTest.SAMPLE_XML2; - if (nodecl) { - expected = JDRSTest.SAMPLE_XML2_NODECL; - } - assertCondition (v.equals (expected), "Expected "+expected+" got "+v); - } - catch(Exception e) - { - failed (e, "Unexpected Exception"); - } + } + + /** + * updateSQLXML() - Should throw an exception when the column name is null. + **/ + public void Var008() { + if (checkJdbc40()) { + if (getDriver() == JDTestDriver.DRIVER_JCC) { + notApplicable("JCC throws null pointer exception when column name is null "); + } else { + try { + rsXML_.first(); + JDReflectionUtil.callMethod_V(rsXML_, "updateSQLXML", null, sqlxml_); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); } + } } - - - - /** - updateSQLXML() - Should throw an exception when the column - name is null. - **/ - public void Var008() - { - if(checkJdbc40 ()) - { - if (getDriver() == JDTestDriver.DRIVER_JCC) { - notApplicable("JCC throws null pointer exception when column name is null "); - } else { - try - { - rsXML_.first(); - JDReflectionUtil.callMethod_V(rsXML_, "updateSQLXML", null, sqlxml_); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + } + + /** + * updateSQLXML() - Should throw an exception when the column name is an empty + * string. + **/ + public void Var009() { + if (checkJdbc40()) { + try { + rsXML_.first(); + JDReflectionUtil.callMethod_V(rsXML_, "updateSQLXML", "", sqlxml_); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); } } - - - /** - updateSQLXML() - Should throw an exception when the column - name is an empty string. - **/ - public void Var009() - { - if(checkJdbc40 ()) - { - try - { - rsXML_.first(); - JDReflectionUtil.callMethod_V(rsXML_, "updateSQLXML", "", sqlxml_); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + } + + /** + * updateSQLXML() - Should throw an exception when the column name is invalid. + **/ + public void Var010() { + if (checkJdbc40()) { + try { + rsXML_.first(); + JDReflectionUtil.callMethod_V(rsXML_, "updateSQLXML", "INVALID", sqlxml_); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } - - - - /** updateSQLXML() - Should throw an exception when the column - name is invalid. - **/ - public void Var010() - { - if(checkJdbc40 ()) - { - try - { - rsXML_.first(); - JDReflectionUtil.callMethod_V(rsXML_, "updateSQLXML", "INVALID", sqlxml_); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + } + + /** + * updateSQLXML() - Should work when the column name is valid. + **/ + public void Var011() { + if (checkJdbc40()) { + try { + rsXML_.first(); + JDReflectionUtil.callMethod_V(rsXML_, "updateSQLXML", "C_CLOB0037", sqlxml_); + rsXML_.updateRow(); + ResultSet rs2 = statement2XML_.executeQuery(selectXML_); + rs2.next(); + String v = rs2.getString("C_CLOB0037"); + rs2.close(); + String expected = JDRSTest.SAMPLE_XML2; + if (nodecl) { + expected = JDRSTest.SAMPLE_XML2_NODECL; + } + assertCondition(v.equals(expected), "\ngot:\n " + v + " \nexpected:\n" + expected); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } } - - - - /** - updateSQLXML() - Should work when the column name is valid. - **/ - public void Var011() - { - if(checkJdbc40 ()) - { - try - { - rsXML_.first(); - JDReflectionUtil.callMethod_V(rsXML_, "updateSQLXML", "C_CLOB0037", sqlxml_); - rsXML_.updateRow (); - ResultSet rs2 = statement2XML_.executeQuery (selectXML_); - rs2.next (); - String v = rs2.getString ("C_CLOB0037"); - rs2.close (); - String expected = JDRSTest.SAMPLE_XML2; - if (nodecl) { - expected = JDRSTest.SAMPLE_XML2_NODECL; - } - assertCondition (v.equals (expected), "\ngot:\n "+v+" \nexpected:\n"+expected); - } - catch(Exception e) - { - failed (e, "Unexpected Exception"); - } - } + } + + /** + * updateSQLXML() - Should update to SQL NULL when the column value is null. + **/ + public void Var012() { + if (checkJdbc40()) { + try { + rsXML_.first(); + + Class[] argTypes = new Class[2]; + argTypes[0] = Integer.TYPE; + try { + argTypes[1] = Class.forName("java.sql.SQLXML"); + } catch (Exception e) { + argTypes[1] = Class.forName("com.ibm.db2.jdbc.app.SQLXML"); + } + Object[] args = new Object[2]; + args[0] = Integer.valueOf(2); + args[1] = null; + + JDReflectionUtil.callMethod_V(rsXML_, "updateSQLXML", argTypes, args); + + rsXML_.updateRow(); + ResultSet rs2 = statement2XML_.executeQuery(selectXML_); + rs2.first(); + String v = rs2.getString("C_CLOB0037"); + boolean wn = rs2.wasNull(); + rs2.close(); + assertCondition((v == null) && (wn == true)); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } } + } + + /** + * updateSQLXML() - Should throw an exception when the length is invalid. + **/ + public void Var013() { + notApplicable(); + } + + /** + * updateSQLXML() - Should be reflected by get, even if update has not yet been + * issued (i.e. update is still pending). + **/ + public void Var014() { + if (checkJdbc40()) { + + try { + String expected = " Var014"; + if (nodecl) { + expected = " Var014"; + } + Object sqlxml = JDReflectionUtil.callMethod_O(connection_, "createSQLXML"); + JDReflectionUtil.callMethod_V(sqlxml, "setString", expected); + + rsXML_.first(); + JDReflectionUtil.callMethod_V(rsXML_, "updateSQLXML", "C_CLOB0037", sqlxml); + assertCondition(rsXML_.getString("C_CLOB0037").equals(expected)); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } + /** + * updateSQLXML() - Should be reflected by get, after update has been issued, + * but cursor has not been repositioned. + **/ + public void Var015() { + if (checkJdbc40()) { - - /** - updateSQLXML() - Should update to SQL NULL when the column - value is null. - **/ - public void Var012() - { - if(checkJdbc40 ()) - { - try - { - rsXML_.first(); - - Class[] argTypes = new Class[2]; - argTypes[0] = Integer.TYPE; - try { - argTypes[1] = Class.forName("java.sql.SQLXML"); - } catch (Exception e) { - argTypes[1] = Class.forName("com.ibm.db2.jdbc.app.SQLXML"); - } - Object[] args = new Object[2]; - args[0] = Integer.valueOf(2); - args[1] = null; - - JDReflectionUtil.callMethod_V(rsXML_, "updateSQLXML", argTypes, args); - - rsXML_.updateRow (); - ResultSet rs2 = statement2XML_.executeQuery (selectXML_); - rs2.first(); - String v = rs2.getString ("C_CLOB0037"); - boolean wn = rs2.wasNull (); - rs2.close (); - assertCondition ((v == null) && (wn == true)); - } - catch(Exception e) - { - failed (e, "Unexpected Exception"); - } + try { + String expected = " Var015"; + if (nodecl) { + expected = " Var015"; } - } - + Object sqlxml = JDReflectionUtil.callMethod_O(connection_, "createSQLXML"); + JDReflectionUtil.callMethod_V(sqlxml, "setString", expected); - /** - updateSQLXML() - Should throw an exception when the length is invalid. - **/ - public void Var013() - { - notApplicable(); + rsXML_.first(); + JDReflectionUtil.callMethod_V(rsXML_, "updateSQLXML", "C_CLOB0037", sqlxml); + rsXML_.updateRow(); + assertCondition(rsXML_.getString("C_CLOB0037").equals(expected)); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } } - - - - /** - updateSQLXML() - Should be reflected by get, even if update has - not yet been issued (i.e. update is still pending). - **/ - public void Var014() - { - if(checkJdbc40 ()) - { - - try - { - String expected = " Var014"; - if (nodecl) { - expected = " Var014"; - } - Object sqlxml = JDReflectionUtil.callMethod_O(connection_, "createSQLXML"); - JDReflectionUtil.callMethod_V(sqlxml, "setString", expected); - - rsXML_.first(); - JDReflectionUtil.callMethod_V(rsXML_, "updateSQLXML", "C_CLOB0037", sqlxml); - assertCondition (rsXML_.getString ("C_CLOB0037").equals (expected)); - } - catch(Exception e) - { - failed (e, "Unexpected Exception"); - } + } + + /** + * updateSQLXML() - Should be reflected by get, after update has been issued and + * cursor has been repositioned. + **/ + public void Var016() { + if (checkJdbc40()) { + try { + String expected = " Var016"; + if (nodecl) { + expected = " Var016"; + } + Object sqlxml = JDReflectionUtil.callMethod_O(connection_, "createSQLXML"); + JDReflectionUtil.callMethod_V(sqlxml, "setString", expected); + + rsXML_.first(); + JDReflectionUtil.callMethod_V(rsXML_, "updateSQLXML", "C_CLOB0037", sqlxml); + rsXML_.updateRow(); + rsXML_.beforeFirst(); + rsXML_.first(); + String v = rsXML_.getString("C_CLOB0037"); + assertCondition(v.equals(expected), "v=" + v + " sb=" + expected); + } catch (Exception e) { + failed(e, "Unexpected Exception"); } } - - - - - /** - updateSQLXML() - Should be reflected by get, after update has - been issued, but cursor has not been repositioned. - **/ - public void Var015() - { - if(checkJdbc40 ()) - { - - try - { - String expected = " Var015"; - if (nodecl) { - expected = " Var015"; - } - - Object sqlxml = JDReflectionUtil.callMethod_O(connection_, "createSQLXML"); - JDReflectionUtil.callMethod_V(sqlxml, "setString", expected); - - rsXML_.first(); - JDReflectionUtil.callMethod_V(rsXML_, "updateSQLXML", "C_CLOB0037", sqlxml); - rsXML_.updateRow (); - assertCondition (rsXML_.getString ("C_CLOB0037").equals (expected)); - } - catch(Exception e) - { - failed (e, "Unexpected Exception"); - } - } + } + + /** + * updateSQLXML() - Should work when the current row is the insert row. + **/ + public void Var017() { + if (checkJdbc40()) { + try { + String expected = " Var017"; + if (nodecl) { + expected = " Var017"; + } + + Object sqlxml = JDReflectionUtil.callMethod_O(connection_, "createSQLXML"); + JDReflectionUtil.callMethod_V(sqlxml, "setString", expected); + + rsXML_.moveToInsertRow(); + rsXML_.updateInt("C_KEY", 170); + JDReflectionUtil.callMethod_V(rsXML_, "updateSQLXML", "C_CLOB0037", sqlxml); + rsXML_.insertRow(); + rsXML_.beforeFirst(); + while (rsXML_.next() && rsXML_.getInt(1) != 170) { + } + assertCondition(rsXML_.getString("C_CLOB0037").equals(expected), + "v=" + rsXML_.getString("C_CLOB0037") + " sb=" + expected); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } } + } + /** + * updateSQLXML() - Should be reflected by get on insert row, even if insert has + * not yet been issued (i.e. insert is still pending). + **/ + public void Var018() { + if (checkJdbc40()) { - - /** - updateSQLXML() - Should be reflected by get, after update has - been issued and cursor has been repositioned. - **/ - public void Var016() - { - if(checkJdbc40 ()) - { - try - { - String expected = " Var016"; - if (nodecl){ - expected = " Var016"; - } - Object sqlxml = JDReflectionUtil.callMethod_O(connection_, "createSQLXML"); - JDReflectionUtil.callMethod_V(sqlxml, "setString", expected); - - rsXML_.first(); - JDReflectionUtil.callMethod_V(rsXML_, "updateSQLXML", "C_CLOB0037", sqlxml); - rsXML_.updateRow (); - rsXML_.beforeFirst (); - rsXML_.first(); - String v = rsXML_.getString ("C_CLOB0037"); - assertCondition (v.equals (expected), "v="+v+" sb="+expected); - } - catch(Exception e) - { - failed (e, "Unexpected Exception"); - } + try { + String expected = " Var018"; + if (nodecl) { + expected = " Var018"; } - } - + Object sqlxml = JDReflectionUtil.callMethod_O(connection_, "createSQLXML"); + JDReflectionUtil.callMethod_V(sqlxml, "setString", expected); - - - /** - updateSQLXML() - Should work when the current row is the insert - row. - **/ - public void Var017() - { - if(checkJdbc40 ()) - { - try - { - String expected = " Var017"; - if (nodecl){ - expected = " Var017"; - } - - Object sqlxml = JDReflectionUtil.callMethod_O(connection_, "createSQLXML"); - JDReflectionUtil.callMethod_V(sqlxml, "setString", expected); - - rsXML_.moveToInsertRow (); - rsXML_.updateInt ("C_KEY", 170); - JDReflectionUtil.callMethod_V(rsXML_, "updateSQLXML", "C_CLOB0037", sqlxml); - rsXML_.insertRow (); - rsXML_.beforeFirst(); - while (rsXML_.next() && rsXML_.getInt(1) != 170) { - } - assertCondition (rsXML_.getString ("C_CLOB0037").equals (expected),"v="+rsXML_.getString ("C_CLOB0037")+" sb="+expected); - } - catch(Exception e) - { - failed (e, "Unexpected Exception"); - } - } + rsXML_.moveToInsertRow(); + JDReflectionUtil.callMethod_V(rsXML_, "updateSQLXML", "C_CLOB0037", sqlxml); + assertCondition(rsXML_.getString("C_CLOB0037").equals(expected), + "v=" + rsXML_.getString("C_CLOB0037") + " sb=" + expected); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } } - - - - /** - updateSQLXML() - Should be reflected by get on insert row, even if - insert has not yet been issued (i.e. insert is still pending). - **/ - public void Var018() - { - - if(checkJdbc40 ()) - { - - try - { - String expected = " Var018"; - if (nodecl){ - expected = " Var018"; - } - Object sqlxml = JDReflectionUtil.callMethod_O(connection_, "createSQLXML"); - JDReflectionUtil.callMethod_V(sqlxml, "setString", expected); - - rsXML_.moveToInsertRow (); - JDReflectionUtil.callMethod_V(rsXML_, "updateSQLXML", "C_CLOB0037", sqlxml); - assertCondition (rsXML_.getString ("C_CLOB0037").equals (expected),"v="+rsXML_.getString ("C_CLOB0037")+" sb="+expected); - } - catch(Exception e) - { - failed (e, "Unexpected Exception"); - } - } + } + + /** + * updateSQLXML() - Should throw an exception on a deleted row. + **/ + public void Var019() { + if (checkJdbc40()) { + try { + rsXML_.last(); + rsXML_.deleteRow(); + JDReflectionUtil.callMethod_V(rsXML_, "updateSQLXML", "C_CLOB0037", sqlxml_); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } + } + /** + * updateSQLXML() - Update a SMALLINT. + **/ + public void Var020() { + if (checkJdbc40()) { + try { + JDRSTest.position(rsOther_, key_); + JDReflectionUtil.callMethod_V(rsOther_, "updateSQLXML", "C_SMALLINT", sqlxml_); + rsOther_.updateRow(); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); - /** - updateSQLXML() - Should throw an exception on a deleted row. - **/ - public void Var019() - { - if(checkJdbc40 ()) - { - try - { - rsXML_.last(); - rsXML_.deleteRow (); - JDReflectionUtil.callMethod_V(rsXML_, "updateSQLXML", "C_CLOB0037", sqlxml_); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + } } - - - /** - updateSQLXML() - Update a SMALLINT. - **/ - public void Var020 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rsOther_, key_); - JDReflectionUtil.callMethod_V(rsOther_, "updateSQLXML", "C_SMALLINT", sqlxml_); - rsOther_.updateRow (); - - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - - - } - } + } + + /** + * updateSQLXML() - Update a SMALLINT, when the integer is too big. + **/ + public void Var021() { + if (checkJdbc40()) { + try { + JDRSTest.position(rsOther_, key_); + JDReflectionUtil.callMethod_V(rsOther_, "updateSQLXML", "C_SMALLINT", sqlxml_); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } - - - - /** - updateSQLXML() - Update a SMALLINT, when the integer is too big. - **/ - public void Var021 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rsOther_, key_); - JDReflectionUtil.callMethod_V(rsOther_, "updateSQLXML", "C_SMALLINT", sqlxml_); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + } + + /** + * updateSQLXML() - Update a SMALLINT, when the string is not a number. + **/ + public void Var022() { + if (checkJdbc40()) { + try { + JDRSTest.position(rsOther_, key_); + JDReflectionUtil.callMethod_V(rsOther_, "updateSQLXML", "C_SMALLINT", sqlxml_); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } - - - - /** - updateSQLXML() - Update a SMALLINT, when the string is not a number. - **/ - public void Var022 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rsOther_, key_); - JDReflectionUtil.callMethod_V(rsOther_, "updateSQLXML", "C_SMALLINT", sqlxml_); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + } + + /** + * updateSQLXML() - Update an INTEGER. + **/ + public void Var023() { + if (checkJdbc40()) { + try { + JDRSTest.position(rsOther_, key_); + JDReflectionUtil.callMethod_V(rsOther_, "updateSQLXML", "C_INTEGER", sqlxml_); + rsOther_.updateRow(); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } - - - - /** - updateSQLXML() - Update an INTEGER. - **/ - public void Var023 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rsOther_, key_); - JDReflectionUtil.callMethod_V(rsOther_, "updateSQLXML", "C_INTEGER", sqlxml_); - rsOther_.updateRow (); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + } + + /** + * updateSQLXML() - Update an INTEGER, when the integer is too big. + **/ + public void Var024() { + if (checkJdbc40()) { + try { + JDRSTest.position(rsOther_, key_); + JDReflectionUtil.callMethod_V(rsOther_, "updateSQLXML", "C_INTEGER", sqlxml_); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } - - - - /** - updateSQLXML() - Update an INTEGER, when the integer is too big. - **/ - public void Var024 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rsOther_, key_); - JDReflectionUtil.callMethod_V(rsOther_, "updateSQLXML", "C_INTEGER", sqlxml_); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + } + + /** + * updateSQLXML() - Update an INTEGER, when the string is not a number. + **/ + public void Var025() { + if (checkJdbc40()) { + try { + JDRSTest.position(rsOther_, key_); + JDReflectionUtil.callMethod_V(rsOther_, "updateSQLXML", "C_INTEGER", sqlxml_); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } - - - - /** - updateSQLXML() - Update an INTEGER, when the string is not a number. - **/ - public void Var025 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rsOther_, key_); - JDReflectionUtil.callMethod_V(rsOther_, "updateSQLXML", "C_INTEGER", sqlxml_); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + } + + /** + * updateSQLXML() - Update a REAL. + **/ + public void Var026() { + if (checkJdbc40()) { + try { + JDRSTest.position(rsOther_, key_); + JDReflectionUtil.callMethod_V(rsOther_, "updateSQLXML", "C_REAL", sqlxml_); + rsOther_.updateRow(); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } - - - - /** - updateSQLXML() - Update a REAL. - **/ - public void Var026 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rsOther_, key_); - JDReflectionUtil.callMethod_V(rsOther_, "updateSQLXML", "C_REAL", sqlxml_); - rsOther_.updateRow (); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + } + + /** + * updateSQLXML() - Update a REAL, when the number is too big. + * + * Note: Given the new data truncation rules for JDBC, this testcase is expected + * to work without throwing a DataTruncation exception. + **/ + public void Var027() { + if (checkJdbc40()) { + try { + JDRSTest.position(rsOther_, key_); + JDReflectionUtil.callMethod_V(rsOther_, "updateSQLXML", "C_REAL", sqlxml_); + rsOther_.updateRow(); + + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } - - - /** - updateSQLXML() - Update a REAL, when the number is too big. - - Note: Given the new data truncation rules for JDBC, this testcase - is expected to work without throwing a DataTruncation exception. - **/ - public void Var027 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rsOther_, key_); - JDReflectionUtil.callMethod_V(rsOther_, "updateSQLXML", "C_REAL", sqlxml_); - rsOther_.updateRow (); - - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } - /* - failed ("Didn't throw SQLException"); - } - catch (Exception e) { - DataTruncation dt = (DataTruncation)e; - assertCondition ((dt.getIndex() == expectedColumn) - && (dt.getParameter() == false) - && (dt.getRead() == false) - && (dt.getDataSize() == 15) - && (dt.getTransferSize() == 10)); - - } - } - */ - } - - - - /** - updateSQLXML() - Update a REAL, when the string is not a number. - **/ public void Var028 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rsOther_, key_); - JDReflectionUtil.callMethod_V(rsOther_, "updateSQLXML", "C_INTEGER", sqlxml_); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + /* + * failed ("Didn't throw SQLException"); } catch (Exception e) { DataTruncation + * dt = (DataTruncation)e; assertCondition ((dt.getIndex() == expectedColumn) && + * (dt.getParameter() == false) && (dt.getRead() == false) && (dt.getDataSize() + * == 15) && (dt.getTransferSize() == 10)); + * + * } } + */ + } + + /** + * updateSQLXML() - Update a REAL, when the string is not a number. + **/ + public void Var028() { + if (checkJdbc40()) { + try { + JDRSTest.position(rsOther_, key_); + JDReflectionUtil.callMethod_V(rsOther_, "updateSQLXML", "C_INTEGER", sqlxml_); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } - - - - - /** - updateSQLXML() - Update a FLOAT. - **/ - public void Var029 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rsOther_, key_); - JDReflectionUtil.callMethod_V(rsOther_, "updateSQLXML", "C_FLOAT", sqlxml_); - rsOther_.updateRow (); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + } + + /** + * updateSQLXML() - Update a FLOAT. + **/ + public void Var029() { + if (checkJdbc40()) { + try { + JDRSTest.position(rsOther_, key_); + JDReflectionUtil.callMethod_V(rsOther_, "updateSQLXML", "C_FLOAT", sqlxml_); + rsOther_.updateRow(); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } - - - - /** - updateSQLXML() - Update a FLOAT, when the number is too big. - - Note: Given the new data truncation rules for JDBC, this testcase - is expected to work without throwing a DataTruncation exception. - **/ - public void Var030 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rsOther_, key_); - JDReflectionUtil.callMethod_V(rsOther_, "updateSQLXML", "C_FLOAT", sqlxml_); - rsOther_.updateRow (); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } - /* - failed ("Didn't throw SQLException"); - } - catch (Exception e) { - DataTruncation dt = (DataTruncation)e; - assertCondition ((dt.getIndex() == expectedColumn) - && (dt.getParameter() == false) - && (dt.getRead() == false) - && (dt.getDataSize() == 19) - && (dt.getTransferSize() == 17)); - - } - } - */ - } - - - - /** - updateSQLXML() - Update a FLOAT, when the string is not a number. - **/ - public void Var031 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rsOther_, key_); - JDReflectionUtil.callMethod_V(rsOther_, "updateSQLXML", "C_FLOAT", sqlxml_); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + } + + /** + * updateSQLXML() - Update a FLOAT, when the number is too big. + * + * Note: Given the new data truncation rules for JDBC, this testcase is expected + * to work without throwing a DataTruncation exception. + **/ + public void Var030() { + if (checkJdbc40()) { + try { + JDRSTest.position(rsOther_, key_); + JDReflectionUtil.callMethod_V(rsOther_, "updateSQLXML", "C_FLOAT", sqlxml_); + rsOther_.updateRow(); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } - - - /** - updateSQLXML() - Update a DOUBLE. - **/ - public void Var032 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rsOther_, key_); - JDReflectionUtil.callMethod_V(rsOther_, "updateSQLXML", "C_DOUBLE", sqlxml_); - rsOther_.updateRow (); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + /* + * failed ("Didn't throw SQLException"); } catch (Exception e) { DataTruncation + * dt = (DataTruncation)e; assertCondition ((dt.getIndex() == expectedColumn) && + * (dt.getParameter() == false) && (dt.getRead() == false) && (dt.getDataSize() + * == 19) && (dt.getTransferSize() == 17)); + * + * } } + */ + } + + /** + * updateSQLXML() - Update a FLOAT, when the string is not a number. + **/ + public void Var031() { + if (checkJdbc40()) { + try { + JDRSTest.position(rsOther_, key_); + JDReflectionUtil.callMethod_V(rsOther_, "updateSQLXML", "C_FLOAT", sqlxml_); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } - - - - /** - updateSQLXML() - Update a DOUBLE, when the number is too big. - - Note: Given the new data truncation rules for JDBC, this testcase - is expected to work without throwing a DataTruncation exception. - **/ - public void Var033 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rsOther_, key_); - JDReflectionUtil.callMethod_V(rsOther_, "updateSQLXML", "C_DOUBLE", sqlxml_); - rsOther_.updateRow (); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } - /* - failed ("Didn't throw SQLException"); - } - catch (Exception e) { - DataTruncation dt = (DataTruncation)e; - assertCondition ((dt.getIndex() == expectedColumn) - && (dt.getParameter() == false) - && (dt.getRead() == false) - && (dt.getDataSize() == 19) - && (dt.getTransferSize() == 17)); - - } - } - */ - } - - - - /** - updateSQLXML() - Update a DOUBLE, when the string is not a number. - **/ - public void Var034 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rsOther_, key_); - JDReflectionUtil.callMethod_V(rsOther_, "updateSQLXML", "C_DOUBLE", sqlxml_); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + } + + /** + * updateSQLXML() - Update a DOUBLE. + **/ + public void Var032() { + if (checkJdbc40()) { + try { + JDRSTest.position(rsOther_, key_); + JDReflectionUtil.callMethod_V(rsOther_, "updateSQLXML", "C_DOUBLE", sqlxml_); + rsOther_.updateRow(); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } - - - /** - updateSQLXML() - Update a DECIMAL. - **/ - public void Var035 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rsOther_, key_); - JDReflectionUtil.callMethod_V(rsOther_, "updateSQLXML", "C_DECIMAL_105", sqlxml_); - rsOther_.updateRow (); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + } + + /** + * updateSQLXML() - Update a DOUBLE, when the number is too big. + * + * Note: Given the new data truncation rules for JDBC, this testcase is expected + * to work without throwing a DataTruncation exception. + **/ + public void Var033() { + if (checkJdbc40()) { + try { + JDRSTest.position(rsOther_, key_); + JDReflectionUtil.callMethod_V(rsOther_, "updateSQLXML", "C_DOUBLE", sqlxml_); + rsOther_.updateRow(); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } - - - - /** - updateSQLXML() - Update a DECIMAL, when the value is too big. - **/ - public void Var036 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rsOther_, key_); - JDReflectionUtil.callMethod_V(rsOther_, "updateSQLXML", "C_DECIMAL_40", sqlxml_); - rsOther_.updateRow (); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + /* + * failed ("Didn't throw SQLException"); } catch (Exception e) { DataTruncation + * dt = (DataTruncation)e; assertCondition ((dt.getIndex() == expectedColumn) && + * (dt.getParameter() == false) && (dt.getRead() == false) && (dt.getDataSize() + * == 19) && (dt.getTransferSize() == 17)); + * + * } } + */ + } + + /** + * updateSQLXML() - Update a DOUBLE, when the string is not a number. + **/ + public void Var034() { + if (checkJdbc40()) { + try { + JDRSTest.position(rsOther_, key_); + JDReflectionUtil.callMethod_V(rsOther_, "updateSQLXML", "C_DOUBLE", sqlxml_); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } - - - /** - updateSQLXML() - Update a DECIMAL, when the string is not a number. - **/ - public void Var037 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rsOther_, key_); - JDReflectionUtil.callMethod_V(rsOther_, "updateSQLXML", "C_DECIMAL_105", sqlxml_); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + } + + /** + * updateSQLXML() - Update a DECIMAL. + **/ + public void Var035() { + if (checkJdbc40()) { + try { + JDRSTest.position(rsOther_, key_); + JDReflectionUtil.callMethod_V(rsOther_, "updateSQLXML", "C_DECIMAL_105", sqlxml_); + rsOther_.updateRow(); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } - - - - /** - updateSQLXML() - Update a NUMERIC. - **/ - public void Var038 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rsOther_, key_); - JDReflectionUtil.callMethod_V(rsOther_, "updateSQLXML", "C_NUMERIC_105", sqlxml_); - rsOther_.updateRow (); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + } + + /** + * updateSQLXML() - Update a DECIMAL, when the value is too big. + **/ + public void Var036() { + if (checkJdbc40()) { + try { + JDRSTest.position(rsOther_, key_); + JDReflectionUtil.callMethod_V(rsOther_, "updateSQLXML", "C_DECIMAL_40", sqlxml_); + rsOther_.updateRow(); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } - - - - /** - updateSQLXML() - Update a NUMERIC, when the value is too big. - **/ - public void Var039 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rsOther_, key_); - JDReflectionUtil.callMethod_V(rsOther_, "updateSQLXML", "C_NUMERIC_40", sqlxml_); - rsOther_.updateRow (); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + } + + /** + * updateSQLXML() - Update a DECIMAL, when the string is not a number. + **/ + public void Var037() { + if (checkJdbc40()) { + try { + JDRSTest.position(rsOther_, key_); + JDReflectionUtil.callMethod_V(rsOther_, "updateSQLXML", "C_DECIMAL_105", sqlxml_); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } - - - - /** - updateSQLXML() - Update a NUMERIC, when the string is not a number. - **/ - public void Var040 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rsOther_, key_); - JDReflectionUtil.callMethod_V(rsOther_, "updateSQLXML", "C_NUMERIC_105", sqlxml_); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + } + + /** + * updateSQLXML() - Update a NUMERIC. + **/ + public void Var038() { + if (checkJdbc40()) { + try { + JDRSTest.position(rsOther_, key_); + JDReflectionUtil.callMethod_V(rsOther_, "updateSQLXML", "C_NUMERIC_105", sqlxml_); + rsOther_.updateRow(); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } - - - - /** - updateSQLXML() - Update a CHAR. - **/ - public void Var041 () - { - - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rsOther_, key_); - JDReflectionUtil.callMethod_V(rsOther_, "updateSQLXML", "C_CHAR_50", sqlxml_); - rsOther_.updateRow (); - if(isToolboxDriver()){ - succeeded(); - return; - } - failed ("Didn't throw SQLException when updating a char field "); - } - catch(Exception e) - { - if(isToolboxDriver()){ - failed("toolbox should be able to update char"); - return; - } - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + } + + /** + * updateSQLXML() - Update a NUMERIC, when the value is too big. + **/ + public void Var039() { + if (checkJdbc40()) { + try { + JDRSTest.position(rsOther_, key_); + JDReflectionUtil.callMethod_V(rsOther_, "updateSQLXML", "C_NUMERIC_40", sqlxml_); + rsOther_.updateRow(); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } - - - - /** - updateSQLXML() - Update a CHAR, when the value is too big. - **/ - public void Var042 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rsOther_, key_); - JDReflectionUtil.callMethod_V(rsOther_, "updateSQLXML", "C_CHAR_1", sqlxml_); - rsOther_.updateRow (); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + } + + /** + * updateSQLXML() - Update a NUMERIC, when the string is not a number. + **/ + public void Var040() { + if (checkJdbc40()) { + try { + JDRSTest.position(rsOther_, key_); + JDReflectionUtil.callMethod_V(rsOther_, "updateSQLXML", "C_NUMERIC_105", sqlxml_); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } - - - - /** - updateSQLXML() - Update a VARCHAR, with the length equal to the - full stream. - **/ - public void Var043 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rsOther_, key_); - JDReflectionUtil.callMethod_V(rsOther_, "updateSQLXML", "C_CLOB0037", sqlxml_); - rsOther_.updateRow (); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + } + + /** + * updateSQLXML() - Update a CHAR. + **/ + public void Var041() { + + if (checkJdbc40()) { + try { + JDRSTest.position(rsOther_, key_); + JDReflectionUtil.callMethod_V(rsOther_, "updateSQLXML", "C_CHAR_50", sqlxml_); + rsOther_.updateRow(); + if (isToolboxDriver()) { + succeeded(); + return; + } + failed("Didn't throw SQLException when updating a char field "); + } catch (Exception e) { + if (isToolboxDriver()) { + failed("toolbox should be able to update char"); + return; + } + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } - - - - /** - updateSQLXML() - Update a VARCHAR, with the length less than the - full stream. - - @D2 - Native driver doesn't throw an exception if stream contains extra characters then there needs to be there. - **/ - public void Var044 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rsOther_, key_); - JDReflectionUtil.callMethod_V(rsOther_, "updateSQLXML", "C_CLOB0037", sqlxml_); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + } + + /** + * updateSQLXML() - Update a CHAR, when the value is too big. + **/ + public void Var042() { + if (checkJdbc40()) { + try { + JDRSTest.position(rsOther_, key_); + JDReflectionUtil.callMethod_V(rsOther_, "updateSQLXML", "C_CHAR_1", sqlxml_); + rsOther_.updateRow(); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } - - - - /** - updateSQLXML() - Update a VARCHAR, with the length greater than the - full stream. - **/ - public void Var045 () - { - notApplicable(); + } + + /** + * updateSQLXML() - Update a VARCHAR, with the length equal to the full stream. + **/ + public void Var043() { + if (checkJdbc40()) { + try { + JDRSTest.position(rsOther_, key_); + JDReflectionUtil.callMethod_V(rsOther_, "updateSQLXML", "C_CLOB0037", sqlxml_); + rsOther_.updateRow(); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } - - - - /** - updateSQLXML() - Update a VARCHAR, with the length set to 1. - - @D2 - Native driver doesn't throw an exception if stream contains extra characters then there needs to be there. - **/ - public void Var046 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rsOther_, key_); - JDReflectionUtil.callMethod_V(rsOther_, "updateSQLXML", "C_CLOB0037", sqlxml_); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + } + + /** + * updateSQLXML() - Update a VARCHAR, with the length less than the full stream. + * + * @D2 - Native driver doesn't throw an exception if stream contains extra + * characters then there needs to be there. + **/ + public void Var044() { + if (checkJdbc40()) { + try { + JDRSTest.position(rsOther_, key_); + JDReflectionUtil.callMethod_V(rsOther_, "updateSQLXML", "C_CLOB0037", sqlxml_); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } - - - - /** - updateSQLXML() - Update a VARCHAR, with the length set to 0. - **/ - public void Var047 () - { - notApplicable(); + } + + /** + * updateSQLXML() - Update a VARCHAR, with the length greater than the full + * stream. + **/ + public void Var045() { + notApplicable(); + } + + /** + * updateSQLXML() - Update a VARCHAR, with the length set to 1. + * + * @D2 - Native driver doesn't throw an exception if stream contains extra + * characters then there needs to be there. + **/ + public void Var046() { + if (checkJdbc40()) { + try { + JDRSTest.position(rsOther_, key_); + JDReflectionUtil.callMethod_V(rsOther_, "updateSQLXML", "C_CLOB0037", sqlxml_); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } - - - - /** - updateSQLXML() - Update a VARCHAR, with an empty string. - **/ - public void Var048 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rsOther_, key_); - JDReflectionUtil.callMethod_V(rsOther_, "updateSQLXML", "C_CLOB0037", sqlxml_); - rsOther_.updateRow (); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + } + + /** + * updateSQLXML() - Update a VARCHAR, with the length set to 0. + **/ + public void Var047() { + notApplicable(); + } + + /** + * updateSQLXML() - Update a VARCHAR, with an empty string. + **/ + public void Var048() { + if (checkJdbc40()) { + try { + JDRSTest.position(rsOther_, key_); + JDReflectionUtil.callMethod_V(rsOther_, "updateSQLXML", "C_CLOB0037", sqlxml_); + rsOther_.updateRow(); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } - - - - /** - updateSQLXML() - Update a VARCHAR, when the value is too big. - **/ - public void Var049 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rsOther_, key_); - JDReflectionUtil.callMethod_V(rsOther_, "updateSQLXML", "C_CLOB0037", sqlxml_); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + } + + /** + * updateSQLXML() - Update a VARCHAR, when the value is too big. + **/ + public void Var049() { + if (checkJdbc40()) { + try { + JDRSTest.position(rsOther_, key_); + JDReflectionUtil.callMethod_V(rsOther_, "updateSQLXML", "C_CLOB0037", sqlxml_); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } - - - /** - updateSQLXML() - Update a VARCHAR parameter to a bad reader. - **/ - public void Var050() - { - notApplicable(); + } + + /** + * updateSQLXML() - Update a VARCHAR parameter to a bad reader. + **/ + public void Var050() { + notApplicable(); + } + + /** + * updateSQLXML() - Update a BINARY. + **/ + public void Var051() { + if (checkJdbc40()) { + try { + + JDRSTest.position(rsOther_, key_); + JDReflectionUtil.callMethod_V(rsOther_, "updateSQLXML", "C_BINARY_20", sqlxml_); + rsOther_.updateRow(); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } + } + + /** + * updateSQLXML() - Update a BINARY, when the value is too big. + **/ + public void Var052() { + if (checkJdbc40()) { + try { + JDRSTest.position(rsOther_, key_); + JDReflectionUtil.callMethod_V(rsOther_, "updateSQLXML", "C_BINARY_1", sqlxml_); + rsOther_.updateRow(); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); - - - - - /** - updateSQLXML() - Update a BINARY. - **/ - public void Var051 () - { - if(checkJdbc40 ()) - { - try - { - - JDRSTest.position (rsOther_, key_); - JDReflectionUtil.callMethod_V(rsOther_, "updateSQLXML", "C_BINARY_20", sqlxml_); - rsOther_.updateRow (); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + } } - - - - /** - updateSQLXML() - Update a BINARY, when the value is too big. - **/ - public void Var052 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rsOther_, key_); - JDReflectionUtil.callMethod_V(rsOther_, "updateSQLXML", "C_BINARY_1", sqlxml_); - rsOther_.updateRow (); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - - } - } + } + + /** + * updateSQLXML() - Update a VARBINARY. + **/ + public void Var053() { + if (checkJdbc40()) { + try { + JDRSTest.position(rsOther_, key_); + JDReflectionUtil.callMethod_V(rsOther_, "updateSQLXML", "C_VARBINARY_20", sqlxml_); + rsOther_.updateRow(); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } + } + /** + * updateSQLXML() - Update a VARBINARY, when the value is too big. + **/ + public void Var054() { + if (checkJdbc40()) { + try { + JDRSTest.position(rsOther_, key_); + JDReflectionUtil.callMethod_V(rsOther_, "updateSQLXML", "C_VARBINARY_20", sqlxml_); + rsOther_.updateRow(); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); - /** - updateSQLXML() - Update a VARBINARY. - **/ - public void Var053 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rsOther_, key_); - JDReflectionUtil.callMethod_V(rsOther_, "updateSQLXML", "C_VARBINARY_20", sqlxml_); - rsOther_.updateRow (); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + } } + } + + /** + * updateSQLXML() - Update a CLOB. + * + * SQL400 - the native driver expects this update to work correctly. + **/ + public void Var055() { + if (checkJdbc40()) { + + try { + + String expected = " Var055"; + if (nodecl) { + expected = " Var055"; + } + Object sqlxml = JDReflectionUtil.callMethod_O(connection_, "createSQLXML"); + JDReflectionUtil.callMethod_V(sqlxml, "setString", expected); + JDRSTest.position(rsOther_, key_); - /** - updateSQLXML() - Update a VARBINARY, when the value is too big. - **/ - public void Var054 () - { - if(checkJdbc40 ()) { - try { - - JDRSTest.position (rsOther_, key_); - JDReflectionUtil.callMethod_V(rsOther_, "updateSQLXML", "C_VARBINARY_20", sqlxml_); - rsOther_.updateRow (); - failed ("Didn't throw SQLException"); - } catch(Exception e) { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - - } - } - } - + JDReflectionUtil.callMethod_V(rsOther_, "updateSQLXML", "C_CLOB", sqlxml); + rsOther_.updateRow(); /* serialized */ + ResultSet rs2 = statement2Other_.executeQuery(select_); + JDRSTest.position(rs2, key_); + String v = rs2.getString("C_CLOB"); + rs2.close(); + assertCondition(expected.equals(v), "v=" + v + " sb=" + expected); - /** - updateSQLXML() - Update a CLOB. + } catch (Exception e) { + failed(e, "Unexpected Exception"); - SQL400 - the native driver expects this update to work correctly. - **/ - public void Var055 () - { - if(checkJdbc40 ()) - { - try - { - String expected = " Var055"; - if (nodecl) { - expected = " Var055"; - } - - - Object sqlxml = JDReflectionUtil.callMethod_O(connection_, "createSQLXML"); - JDReflectionUtil.callMethod_V(sqlxml, "setString", expected); - - JDRSTest.position (rsOther_, key_); - - JDReflectionUtil.callMethod_V(rsOther_, "updateSQLXML", "C_CLOB", sqlxml); - rsOther_.updateRow(); - ResultSet rs2 = statement2Other_.executeQuery (select_); - JDRSTest.position (rs2, key_); - String v = rs2.getString ("C_CLOB"); - rs2.close (); - assertCondition (expected.equals(v), "v="+v+" sb="+expected); - - } - catch(Exception e) - { - failed (e, "Unexpected Exception"); - } - } - } - - - - /** - updateSQLXML() - Update a DBCLOB. - - SQL400 - the native driver expects this update to work correctly. - **/ - public void Var056 () - { - if(checkJdbc40 ()) - { - if(checkLobSupport ()) - { - try - { - String expected = " Var056"; - if (nodecl) { - expected = " Var056"; - } - Object sqlxml = JDReflectionUtil.callMethod_O(connection_, "createSQLXML"); - JDReflectionUtil.callMethod_V(sqlxml, "setString", expected); - - JDRSTest.position (rsOther_, key_); - JDReflectionUtil.callMethod_V(rsOther_, "updateSQLXML", "C_DBCLOB", sqlxml); - - rsOther_.updateRow (); - ResultSet rs2 = statement2Other_.executeQuery (select_); - JDRSTest.position (rs2, key_); - String v = rs2.getString ("C_DBCLOB"); - rs2.close (); - assertCondition (v.equals (expected)); - } - catch(Exception e) - { - failed (e, "Unexpected Exception"); - } - } - } + } } + } + + /** + * updateSQLXML() - Update a DBCLOB. + * + * SQL400 - the native driver expects this update to work correctly. + **/ + public void Var056() { + if (checkJdbc40()) { + if (checkLobSupport()) { + try { + String expected = " Var056"; + if (nodecl) { + expected = " Var056"; + } + Object sqlxml = JDReflectionUtil.callMethod_O(connection_, "createSQLXML"); + JDReflectionUtil.callMethod_V(sqlxml, "setString", expected); + JDRSTest.position(rsOther_, key_); + JDReflectionUtil.callMethod_V(rsOther_, "updateSQLXML", "C_DBCLOB", sqlxml); - - /** - updateSQLXML() - Update a BLOB. - **/ - public void Var057 () - { - if(checkJdbc40 ()) - { - if(checkLobSupport ()) - { - try - { - JDRSTest.position (rsOther_, key_); - JDReflectionUtil.callMethod_V(rsOther_, "updateSQLXML", "C_BLOB", sqlxml_); - rsOther_.updateRow (); - ResultSet rs2 = statement2Other_.executeQuery (select_); - JDRSTest.position (rs2, key_); - Object outSqlxml = JDReflectionUtil.callMethod_OS(rs2, "getSQLXML", "C_BLOB"); - String v = JDReflectionUtil.callMethod_S(outSqlxml, "getString"); - rs2.close (); - //trim decl since accessing blob via SQLXML.getString() - assertCondition (v.equals (JDTestUtilities.stripXmlDeclaration(JDRSTest.SAMPLE_XML2)), "Got "+v+" expected "+JDTestUtilities.stripXmlDeclaration(JDRSTest.SAMPLE_XML2)); - } - catch(Exception e) - { - if(isToolboxDriver()){ - assertCondition(e.getMessage().startsWith("Data type mismatch"), "xml from non-char not supported."); - return; - } - failed (e, "Unexpected Exception"); - } - } + rsOther_.updateRow(); + ResultSet rs2 = statement2Other_.executeQuery(select_); + JDRSTest.position(rs2, key_); + String v = rs2.getString("C_DBCLOB"); + rs2.close(); + assertCondition(v.equals(expected)); + } catch (Exception e) { + failed(e, "Unexpected Exception"); } + } } - - - - /** - updateSQLXML() - Update a DATE. - **/ - public void Var058 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rsOther_, key_); - JDReflectionUtil.callMethod_V(rsOther_, "updateSQLXML", "C_DATE", sqlxml_); - rsOther_.updateRow (); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } + } + + /** + * updateSQLXML() - Update a BLOB. + **/ + public void Var057() { + if (checkJdbc40()) { + if (checkLobSupport()) { + try { + JDRSTest.position(rsOther_, key_); + JDReflectionUtil.callMethod_V(rsOther_, "updateSQLXML", "C_BLOB", sqlxml_); + rsOther_.updateRow(); + ResultSet rs2 = statement2Other_.executeQuery(select_); + JDRSTest.position(rs2, key_); + Object outSqlxml = JDReflectionUtil.callMethod_OS(rs2, "getSQLXML", "C_BLOB"); + String v = JDReflectionUtil.callMethod_S(outSqlxml, "getString"); + rs2.close(); + // trim decl since accessing blob via SQLXML.getString() + assertCondition(v.equals(JDTestUtilities.stripXmlDeclaration(JDRSTest.SAMPLE_XML2)), + "Got " + v + " expected " + JDTestUtilities.stripXmlDeclaration(JDRSTest.SAMPLE_XML2)); + } catch (Exception e) { + if (isToolboxDriver()) { + assertCondition(e.getMessage().startsWith("Data type mismatch"), "xml from non-char not supported."); + return; + } + failed(e, "Unexpected Exception"); } + } } - - - - /** - updateSQLXML() - Update a DATE, when the string is not a valid date. - **/ - public void Var059 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rsOther_, key_); - JDReflectionUtil.callMethod_V(rsOther_, "updateSQLXML", "C_DATE", sqlxml_); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + } + + /** + * updateSQLXML() - Update a DATE. + **/ + public void Var058() { + if (checkJdbc40()) { + try { + JDRSTest.position(rsOther_, key_); + JDReflectionUtil.callMethod_V(rsOther_, "updateSQLXML", "C_DATE", sqlxml_); + rsOther_.updateRow(); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } - - - - /** - updateSQLXML() - Update a TIME. - **/ - public void Var060 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rsOther_, key_); - JDReflectionUtil.callMethod_V(rsOther_, "updateSQLXML", "C_TIME", sqlxml_); - rsOther_.updateRow (); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + } + + /** + * updateSQLXML() - Update a DATE, when the string is not a valid date. + **/ + public void Var059() { + if (checkJdbc40()) { + try { + JDRSTest.position(rsOther_, key_); + JDReflectionUtil.callMethod_V(rsOther_, "updateSQLXML", "C_DATE", sqlxml_); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } - - - - /** - updateSQLXML() - Update a TIME, when the string is not a valid time. - **/ - public void Var061 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rsOther_, key_); - JDReflectionUtil.callMethod_V(rsOther_, "updateSQLXML", "C_TIME", sqlxml_); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + } + + /** + * updateSQLXML() - Update a TIME. + **/ + public void Var060() { + if (checkJdbc40()) { + try { + JDRSTest.position(rsOther_, key_); + JDReflectionUtil.callMethod_V(rsOther_, "updateSQLXML", "C_TIME", sqlxml_); + rsOther_.updateRow(); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } - - - - /** - updateSQLXML() - Update a TIMESTAMP. - **/ - public void Var062 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rsOther_, key_); - JDReflectionUtil.callMethod_V(rsOther_, "updateSQLXML", "C_TIMESTAMP", sqlxml_); - rsOther_.updateRow (); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + } + + /** + * updateSQLXML() - Update a TIME, when the string is not a valid time. + **/ + public void Var061() { + if (checkJdbc40()) { + try { + JDRSTest.position(rsOther_, key_); + JDReflectionUtil.callMethod_V(rsOther_, "updateSQLXML", "C_TIME", sqlxml_); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } - - - - /** - updateSQLXML() - Update a TIMESTAMP, when the string is not a valid timestamp. - **/ - public void Var063 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rsOther_, key_); - JDReflectionUtil.callMethod_V(rsOther_, "updateSQLXML", "C_TIMESTAMP", sqlxml_); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + } + + /** + * updateSQLXML() - Update a TIMESTAMP. + **/ + public void Var062() { + if (checkJdbc40()) { + try { + JDRSTest.position(rsOther_, key_); + JDReflectionUtil.callMethod_V(rsOther_, "updateSQLXML", "C_TIMESTAMP", sqlxml_); + rsOther_.updateRow(); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } - - - - /** - updateSQLXML() - Update a DATALINK. - **/ - public void Var064 () - { - // We do not test updating datalinks, since it is not - // possible to open a updatable cursor/result set with - // a datalink column. - notApplicable("DATALINK update not supported."); - } - - - - /** - updateSQLXML() - Update a DISTINCT. - **/ - public void Var065 () - { - if(checkJdbc40 ()) - { - if(checkLobSupport ()) - { - try - { - JDRSTest.position (rsOther_, key_); - JDReflectionUtil.callMethod_V(rsOther_, "updateSQLXML", "C_DISTINCT", sqlxml_); - rsOther_.updateRow (); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } - } + } + + /** + * updateSQLXML() - Update a TIMESTAMP, when the string is not a valid + * timestamp. + **/ + public void Var063() { + if (checkJdbc40()) { + try { + JDRSTest.position(rsOther_, key_); + JDReflectionUtil.callMethod_V(rsOther_, "updateSQLXML", "C_TIMESTAMP", sqlxml_); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } - - - - /** - updateSQLXML() - Update a BIGINT. - **/ - public void Var066() - { - if(checkJdbc40 ()) - { - if(checkBigintSupport()) - { - try - { - JDRSTest.position (rsOther_, key_); - JDReflectionUtil.callMethod_V(rsOther_, "updateSQLXML", "C_BIGINT", sqlxml_); - rsOther_.updateRow (); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + } + + /** + * updateSQLXML() - Update a DATALINK. + **/ + public void Var064() { + // We do not test updating datalinks, since it is not + // possible to open a updatable cursor/result set with + // a datalink column. + notApplicable("DATALINK update not supported."); + } + + /** + * updateSQLXML() - Update a DISTINCT. + **/ + public void Var065() { + if (checkJdbc40()) { + if (checkLobSupport()) { + try { + JDRSTest.position(rsOther_, key_); + JDReflectionUtil.callMethod_V(rsOther_, "updateSQLXML", "C_DISTINCT", sqlxml_); + rsOther_.updateRow(); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); } + } } - - - - /** - updateSQLXML() - Update a BIGINT, when the integer is too big. - **/ - public void Var067() - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rsOther_, key_); - JDReflectionUtil.callMethod_V(rsOther_, "updateSQLXML", "C_BIGINT", sqlxml_); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } + } + + /** + * updateSQLXML() - Update a BIGINT. + **/ + public void Var066() { + if (checkJdbc40()) { + if (checkBigintSupport()) { + try { + JDRSTest.position(rsOther_, key_); + JDReflectionUtil.callMethod_V(rsOther_, "updateSQLXML", "C_BIGINT", sqlxml_); + rsOther_.updateRow(); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); } + } } - - - - /** - updateSQLXML() - Update a BIGINTEGER, when the string is not a number. - **/ - public void Var068() - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position (rsOther_, key_); - JDReflectionUtil.callMethod_V(rsOther_, "updateSQLXML", "C_BIGINT", sqlxml_); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + } + + /** + * updateSQLXML() - Update a BIGINT, when the integer is too big. + **/ + public void Var067() { + if (checkJdbc40()) { + try { + JDRSTest.position(rsOther_, key_); + JDReflectionUtil.callMethod_V(rsOther_, "updateSQLXML", "C_BIGINT", sqlxml_); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } - - - /** - updateSQLXML() - Update a BLOB. - **/ - public void Var069 () - { - if(checkJdbc40 ()) - { - try - { - JDRSTest.position(rsOther_, key_); - JDReflectionUtil.callMethod_V(rsOther_, "updateSQLXML", "C_BLOB", sqlxml_); - succeeded(); - } - catch(Exception e) - { - if(isToolboxDriver()){ - assertCondition(e.getMessage().startsWith("Data type mismatch"), "xml from non-char not supported."); - return; - } - failed(e, "Unexpected Exception"); - } - } + } + + /** + * updateSQLXML() - Update a BIGINTEGER, when the string is not a number. + **/ + public void Var068() { + if (checkJdbc40()) { + try { + JDRSTest.position(rsOther_, key_); + JDReflectionUtil.callMethod_V(rsOther_, "updateSQLXML", "C_BIGINT", sqlxml_); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } - - - - - /** - updateSQLXML() - Update a DFP16. - **/ - public void Var070 () - { - if (checkJdbc40()) { - if(checkDecFloatSupport()) - { - try - { - Statement s = connection_.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, - ResultSet.CONCUR_UPDATABLE); - ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP16+" FOR UPDATE "); - rs.next(); - JDReflectionUtil.callMethod_V(rs, "updateSQLXML", 1, sqlxml_); - rs.updateRow (); - - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + } + + /** + * updateSQLXML() - Update a BLOB. + **/ + public void Var069() { + if (checkJdbc40()) { + try { + JDRSTest.position(rsOther_, key_); + JDReflectionUtil.callMethod_V(rsOther_, "updateSQLXML", "C_BLOB", sqlxml_); + succeeded(); + } catch (Exception e) { + if (isToolboxDriver()) { + assertCondition(e.getMessage().startsWith("Data type mismatch"), "xml from non-char not supported."); + return; + } + failed(e, "Unexpected Exception"); } } + } + /** + * updateSQLXML() - Update a DFP16. + **/ + public void Var070() { + if (checkJdbc40()) { + if (checkDecFloatSupport()) { + try (Statement s = connection_.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); + ResultSet rs = s.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_UPDDFP16 + " FOR UPDATE ")) { + rs.next(); + JDReflectionUtil.callMethod_V(rs, "updateSQLXML", 1, sqlxml_); + rs.updateRow(); /* exception thrown */ - /** - updateSQLXML() - Update a DFP16, when the value is too big. - **/ - public void Var071 () - { - if (checkJdbc40()) { - if(checkDecFloatSupport()) - { - try - { - Statement s = connection_.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, - ResultSet.CONCUR_UPDATABLE); - ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP16+" FOR UPDATE "); - rs.next(); - JDReflectionUtil.callMethod_V(rs, "updateSQLXML", 1, sqlxml_); - rs.updateRow (); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); } } - - /** - updateSQLXML() - Update a DFP16, when the string is not a number. - **/ - public void Var072 () - { - if (checkJdbc40()) { - if(checkDecFloatSupport()) - { - try - { - Statement s = connection_.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, - ResultSet.CONCUR_UPDATABLE); - ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP16+" FOR UPDATE "); - rs.next(); - JDReflectionUtil.callMethod_V(rs, "updateSQLXML", 1, sqlxml_); - rs.updateRow (); - - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } + } + } + + /** + * updateSQLXML() - Update a DFP16, when the value is too big. + **/ + public void Var071() { + if (checkJdbc40()) { + if (checkDecFloatSupport()) { + try { + Statement s = connection_.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); + ResultSet rs = s.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_UPDDFP16 + " FOR UPDATE "); + rs.next(); + JDReflectionUtil.callMethod_V(rs, "updateSQLXML", 1, sqlxml_); + rs.updateRow(); /* exception thrown */ + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); } } } - - /** - updateSQLXML() - Update a DFP34. - **/ - public void Var073 () - { - if (checkJdbc40()) { - if(checkDecFloatSupport()) - { - try - { - Statement s = connection_.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, - ResultSet.CONCUR_UPDATABLE); - ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP34+" FOR UPDATE "); - rs.next(); - JDReflectionUtil.callMethod_V(rs, "updateSQLXML", 1, sqlxml_); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } + } + + /** + * updateSQLXML() - Update a DFP16, when the string is not a number. + **/ + public void Var072() { + if (checkJdbc40()) { + if (checkDecFloatSupport()) { + try { + Statement s = connection_.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); + ResultSet rs = s.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_UPDDFP16 + " FOR UPDATE "); + rs.next(); + JDReflectionUtil.callMethod_V(rs, "updateSQLXML", 1, sqlxml_); + rs.updateRow(); /* exception thrown */ + + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); } + } } + } + + /** + * updateSQLXML() - Update a DFP34. + **/ + public void Var073() { + if (checkJdbc40()) { + if (checkDecFloatSupport()) { + try { + Statement s = connection_.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); + ResultSet rs = s.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_UPDDFP34 + " FOR UPDATE "); + rs.next(); + JDReflectionUtil.callMethod_V(rs, "updateSQLXML", 1, sqlxml_); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } + } } + } + /** + * updateSQLXML() - Update a DFP34, when the value is too big. + **/ + public void Var074() { + if (checkJdbc40()) { + if (checkDecFloatSupport()) { - /** - updateSQLXML() - Update a DFP34, when the value is too big. - **/ - public void Var074 () - { - if (checkJdbc40()) { - if(checkDecFloatSupport()) - { - - try - { - Statement s = connection_.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, - ResultSet.CONCUR_UPDATABLE); - ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP34+" FOR UPDATE "); - rs.next(); - JDReflectionUtil.callMethod_V(rs, "updateSQLXML", 1, sqlxml_); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } + try { + Statement s = connection_.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); + ResultSet rs = s.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_UPDDFP34 + " FOR UPDATE "); + rs.next(); + JDReflectionUtil.callMethod_V(rs, "updateSQLXML", 1, sqlxml_); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } } } - } + } - /** - updateSQLXML() - Update a DFP34, when the string is not a number. - **/ - public void Var075 () - { - if (checkJdbc40()) { - if(checkDecFloatSupport()) - { - try - { - Statement s = connection_.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, - ResultSet.CONCUR_UPDATABLE); - ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP34+" FOR UPDATE "); - rs.next(); - JDReflectionUtil.callMethod_V(rs, "updateSQLXML", 1, sqlxml_); - rs.updateRow (); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } + /** + * updateSQLXML() - Update a DFP34, when the string is not a number. + **/ + public void Var075() { + if (checkJdbc40()) { + if (checkDecFloatSupport()) { + + try { + + Statement s = connection_.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); + ResultSet rs = s.executeQuery("SELECT * FROM " + JDRSTest.RSTEST_UPDDFP34 + " FOR UPDATE "); + rs.next(); + JDReflectionUtil.callMethod_V(rs, "updateSQLXML", 1, sqlxml_); + rs.updateRow(); /* serialized */ + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + + } } } - } - - /** - updateSQLXML() - Update a BOOLEAN. - **/ - public void Var076() - { - if(checkJdbc40 ()) - { - if(checkBooleanSupport()) - { - try - { - JDRSTest.position (rsOther_, key_); - JDReflectionUtil.callMethod_V(rsOther_, "updateSQLXML", "C_BOOLEAN", sqlxml_); - rsOther_.updateRow (); - failed ("Didn't throw SQLException"); - } - catch(Exception e) - { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - } + } + + /** + * updateSQLXML() - Update a BOOLEAN. + **/ + public void Var076() { + if (checkJdbc40()) { + if (checkBooleanSupport()) { + try { + JDRSTest.position(rsOther_, key_); + JDReflectionUtil.callMethod_V(rsOther_, "updateSQLXML", "C_BOOLEAN", sqlxml_); + rsOther_.updateRow(); + failed("Didn't throw SQLException"); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); } + } } - - + } } - - - diff --git a/src/test/JD/RS/JDRSUpdateShort.java b/src/test/JD/RS/JDRSUpdateShort.java index f4d6fc4b..b7aa67e3 100644 --- a/src/test/JD/RS/JDRSUpdateShort.java +++ b/src/test/JD/RS/JDRSUpdateShort.java @@ -17,6 +17,7 @@ import java.math.BigDecimal; import java.sql.DataTruncation; import java.sql.ResultSet; +import java.sql.SQLException; import java.sql.Statement; import java.util.Hashtable; import java.util.Vector; @@ -25,6 +26,7 @@ import test.JDRSTest; import test.JDTestcase; +import test.JD.JDSerializeFile; @@ -59,6 +61,7 @@ public static void main(String args[]) throws Exception { private Statement statement_; private Statement statement2_; private ResultSet rs_; + private JDSerializeFile serializeUpdateFile_; @@ -97,18 +100,20 @@ protected void setup () + ";data truncation=true"; connection_ = testDriver_.getConnection (url,systemObject_.getUserId(), encryptedPassword_); connection_.setAutoCommit(false); // @C1A - statement_ = connection_.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, + serializeUpdateFile_ = new JDSerializeFile(connection_, JDRSTest.RSTEST_UPDATE); + connection_.commit(); + statement_ = connection_.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); statement2_ = connection_.createStatement (ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); - - statement_.executeUpdate ("INSERT INTO " + JDRSTest.RSTEST_UPDATE - + " (C_KEY) VALUES ('DUMMY_ROW')"); - statement_.executeUpdate ("INSERT INTO " + JDRSTest.RSTEST_UPDATE - + " (C_KEY) VALUES ('" + key_ + "')"); - - rs_ = statement_.executeQuery (select_ + " FOR UPDATE"); - } + + + + statement_.executeUpdate("INSERT INTO " + JDRSTest.RSTEST_UPDATE + " (C_KEY) VALUES ('DUMMY_UPDINT')"); + statement_.executeUpdate("INSERT INTO " + JDRSTest.RSTEST_UPDATE + " (C_KEY) VALUES ('" + key_ + "')"); + + rs_ = statement_.executeQuery(select_ + " FOR UPDATE"); + } } @@ -125,7 +130,9 @@ protected void cleanup () rs_.close (); statement_.close (); connection_.commit(); // @C1A - connection_.close (); + serializeUpdateFile_.close(); + connection_.commit(); + connection_.close (); } } @@ -486,7 +493,7 @@ public void Var017() { if (checkJdbc20 ()) { try { - JDRSTest.position (rs_, "DUMMY_ROW"); + JDRSTest.position (rs_, "DUMMY_UPDINT"); rs_.deleteRow (); rs_.updateShort ("C_SMALLINT", (short) 2892); failed ("Didn't throw SQLException"); @@ -1045,7 +1052,9 @@ public void Var040() public void dfpTest(String table, short value, String expected) { if (checkDecFloatSupport()) { + try { + Statement s = connection_.createStatement( ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); ResultSet rs = s @@ -1053,7 +1062,7 @@ public void dfpTest(String table, short value, String expected) { rs.next(); String originalValue = rs.getString(1); rs.updateShort(1, value); - rs.updateRow(); + rs.updateRow(); /* serialized */ rs.close(); ResultSet rs2 = statement2_.executeQuery("SELECT * FROM " + table); @@ -1064,7 +1073,7 @@ public void dfpTest(String table, short value, String expected) { rs = s.executeQuery("SELECT * FROM " + table + " FOR UPDATE "); rs.next(); rs.updateString(1,originalValue); - rs.updateRow(); + rs.updateRow(); /* serialized */ rs.close(); s.close(); try { @@ -1073,6 +1082,7 @@ public void dfpTest(String table, short value, String expected) { assertCondition(v.equals(expected), "Got " + v + " sb " + expected); } catch (Exception e) { failed(e, "Unexpected Exception"); + } } } @@ -1081,12 +1091,12 @@ public void dfpTest(String table, short value, String expected) { /** * updateInt -- set a DFP16 value */ - public void Var041 () { dfpTest(JDRSTest.RSTEST_DFP16, (short) 32767, ""+32767); } + public void Var041 () { dfpTest(JDRSTest.RSTEST_UPDDFP16, (short) 32767, ""+32767); } /** * updateInt -- set a DFP16 value */ - public void Var042 () { dfpTest(JDRSTest.RSTEST_DFP34, (short) -32760, "-32760"); } + public void Var042 () { dfpTest(JDRSTest.RSTEST_UPDDFP34, (short) -32760, "-32760"); } /** diff --git a/src/test/JD/RS/JDRSUpdateString.java b/src/test/JD/RS/JDRSUpdateString.java index 5b294176..ed421fc0 100644 --- a/src/test/JD/RS/JDRSUpdateString.java +++ b/src/test/JD/RS/JDRSUpdateString.java @@ -20,6 +20,7 @@ import test.JDRSTest; import test.JDTestDriver; import test.JDTestcase; +import test.JD.JDSerializeFile; import java.io.FileOutputStream; import java.math.BigDecimal; @@ -27,6 +28,7 @@ import java.sql.DataTruncation; import java.sql.Date; import java.sql.ResultSet; +import java.sql.SQLException; import java.sql.Statement; import java.sql.PreparedStatement; import java.sql.Time; @@ -69,6 +71,7 @@ public static void main(String args[]) throws Exception { private ResultSet rs_; boolean isjdk14_ = false; + private JDSerializeFile serializeUpdateFile_; /** @@ -110,15 +113,17 @@ protected void setup () + ";data truncation=true"; connection_ = testDriver_.getConnection (url,systemObject_.getUserId(), encryptedPassword_); connection_.setAutoCommit(false); // @C1A + serializeUpdateFile_ = new JDSerializeFile(connection_, JDRSTest.RSTEST_UPDATE); + connection_.commit(); statement_ = connection_.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); statement2_ = connection_.createStatement (ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); statement_.executeUpdate ("INSERT INTO " + JDRSTest.RSTEST_UPDATE - + " (C_KEY) VALUES ('DUMMY_ROW')"); + + " (C_KEY) VALUES ('DUMMY_UPDSTR')"); statement_.executeUpdate ("INSERT INTO " + JDRSTest.RSTEST_UPDATE - + " (C_KEY) VALUES ('DUMMY_ROW2')"); + + " (C_KEY) VALUES ('DUMMY_UPDSTR2')"); statement_.executeUpdate ("INSERT INTO " + JDRSTest.RSTEST_UPDATE + " (C_KEY) VALUES ('" + key_ + "')"); @@ -141,7 +146,9 @@ protected void cleanup () rs_.close (); statement_.close (); connection_.commit(); // @C1A - connection_.close (); + serializeUpdateFile_.close(); + connection_.commit(); + connection_.close (); } } @@ -581,7 +588,7 @@ public void Var018() { try { - JDRSTest.position (rs_, "DUMMY_ROW"); + JDRSTest.position (rs_, "DUMMY_UPDSTR"); rs_.deleteRow (); rs_.updateString ("C_VARCHAR_50", "STRSQL"); failed ("Didn't throw SQLException"); @@ -1970,7 +1977,7 @@ public void Var063() ResultSet rs = stmt.executeQuery(sql); rs.first(); rs.updateString("NAME",DAT0); - rs.updateRow(); + rs.updateRow(); /* Update unique table */ rs.close(); // add the commit here so we can debug this.. @@ -2063,14 +2070,16 @@ public void Var064() public void dfpTest(String table, String value, String expected) { if (checkDecFloatSupport()) { + try { + Statement s = connection_.createStatement( ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); ResultSet rs = s.executeQuery("SELECT * FROM " + table + " FOR UPDATE "); rs.next(); String originalValue = rs.getString(1); rs.updateString(1, value); - rs.updateRow(); + rs.updateRow(); /* serialized */ rs.close(); ResultSet rs2 = s.executeQuery("SELECT * FROM " + table); @@ -2082,7 +2091,7 @@ public void dfpTest(String table, String value, String expected) { ResultSet rs3 = s.executeQuery("SELECT * FROM " + table + " FOR UPDATE "); rs3.next(); rs3.updateString(1, originalValue); - rs3.updateRow(); + rs3.updateRow(); /* serialized */ rs3.close(); s.close(); @@ -2095,13 +2104,16 @@ public void dfpTest(String table, String value, String expected) { "Got " + v + " from "+ value +" sb " + expected); } catch (Exception e) { failed(e, "Unexpected Exception for value "+value); + } } } public void dfpRoundTest(String roundingMode, String table, String value, String expected) { if (checkDecFloatSupport()) { - try { + + try { + String roundingModeProp = roundingMode; if(isToolboxDriver()) roundingModeProp = roundingModeProp.substring(6); //without "rounding " string @@ -2120,7 +2132,7 @@ public void dfpRoundTest(String roundingMode, String table, String value, String rs.next(); originalValue = rs.getString(1); rs.updateString(1, value); - rs.updateRow(); + rs.updateRow(); /* serialized */ // Close the cursor so the next job can get at it rs.close(); @@ -2133,7 +2145,7 @@ public void dfpRoundTest(String roundingMode, String table, String value, String ResultSet rs3 = s.executeQuery("SELECT * FROM " + table + " FOR UPDATE "); rs3.next(); rs3.updateString(1, originalValue); - rs3.updateRow(); + rs3.updateRow(); /* serialized */ rs3.close(); s.close(); @@ -2142,215 +2154,215 @@ public void dfpRoundTest(String roundingMode, String table, String value, String assertCondition(v.equals(expected), "Got " + v + " sb " + expected +" from "+value+" for mode "+roundingMode); } catch (Exception e) { failed(e, "Unexpected Exception for value "+ value); - } + } } } /** * updateString -- set DFP16 to different values and retrieve */ - public void Var065 () { dfpTest(JDRSTest.RSTEST_DFP16, "4533.43", "4533.43"); } - public void Var066 () { dfpTest(JDRSTest.RSTEST_DFP16, "NaN", "NaN");} - public void Var067 () { dfpTest(JDRSTest.RSTEST_DFP16, "NAN", "NaN");} - public void Var068 () { dfpTest(JDRSTest.RSTEST_DFP16, "+NaN", "NaN");} - public void Var069 () { dfpTest(JDRSTest.RSTEST_DFP16, "-NaN", "-NaN");} - public void Var070 () { dfpTest(JDRSTest.RSTEST_DFP16, "QNaN", "NaN");} - public void Var071 () { dfpTest(JDRSTest.RSTEST_DFP16, "+QNaN", "NaN");} - public void Var072 () { dfpTest(JDRSTest.RSTEST_DFP16, "-QNaN", "-NaN");} - public void Var073 () { dfpTest(JDRSTest.RSTEST_DFP16, "SNaN", "SNaN");} - public void Var074 () { dfpTest(JDRSTest.RSTEST_DFP16, "+SNaN", "SNaN");} - public void Var075 () { dfpTest(JDRSTest.RSTEST_DFP16, "-SNaN", "-SNaN");} - public void Var076 () { dfpTest(JDRSTest.RSTEST_DFP16, "INF", "Infinity");} - public void Var077 () { dfpTest(JDRSTest.RSTEST_DFP16, "+INF", "Infinity");} - public void Var078 () { dfpTest(JDRSTest.RSTEST_DFP16, "-INF", "-Infinity");} - public void Var079 () { dfpTest(JDRSTest.RSTEST_DFP16, "Infinity", "Infinity");} - public void Var080 () { dfpTest(JDRSTest.RSTEST_DFP16, "+Infinity", "Infinity");} - public void Var081 () { dfpTest(JDRSTest.RSTEST_DFP16, "-Infinity", "-Infinity");} - public void Var082 () { dfpTest(JDRSTest.RSTEST_DFP16, "1234567890123456", "1234567890123456");} - public void Var083 () { dfpTest(JDRSTest.RSTEST_DFP16, "-1234567890123456", "-1234567890123456");} - public void Var084 () { dfpTest(JDRSTest.RSTEST_DFP16, "+1234567890123456","1234567890123456");} + public void Var065 () { dfpTest(JDRSTest.RSTEST_UPDDFP16, "4533.43", "4533.43"); } + public void Var066 () { dfpTest(JDRSTest.RSTEST_UPDDFP16, "NaN", "NaN");} + public void Var067 () { dfpTest(JDRSTest.RSTEST_UPDDFP16, "NAN", "NaN");} + public void Var068 () { dfpTest(JDRSTest.RSTEST_UPDDFP16, "+NaN", "NaN");} + public void Var069 () { dfpTest(JDRSTest.RSTEST_UPDDFP16, "-NaN", "-NaN");} + public void Var070 () { dfpTest(JDRSTest.RSTEST_UPDDFP16, "QNaN", "NaN");} + public void Var071 () { dfpTest(JDRSTest.RSTEST_UPDDFP16, "+QNaN", "NaN");} + public void Var072 () { dfpTest(JDRSTest.RSTEST_UPDDFP16, "-QNaN", "-NaN");} + public void Var073 () { dfpTest(JDRSTest.RSTEST_UPDDFP16, "SNaN", "SNaN");} + public void Var074 () { dfpTest(JDRSTest.RSTEST_UPDDFP16, "+SNaN", "SNaN");} + public void Var075 () { dfpTest(JDRSTest.RSTEST_UPDDFP16, "-SNaN", "-SNaN");} + public void Var076 () { dfpTest(JDRSTest.RSTEST_UPDDFP16, "INF", "Infinity");} + public void Var077 () { dfpTest(JDRSTest.RSTEST_UPDDFP16, "+INF", "Infinity");} + public void Var078 () { dfpTest(JDRSTest.RSTEST_UPDDFP16, "-INF", "-Infinity");} + public void Var079 () { dfpTest(JDRSTest.RSTEST_UPDDFP16, "Infinity", "Infinity");} + public void Var080 () { dfpTest(JDRSTest.RSTEST_UPDDFP16, "+Infinity", "Infinity");} + public void Var081 () { dfpTest(JDRSTest.RSTEST_UPDDFP16, "-Infinity", "-Infinity");} + public void Var082 () { dfpTest(JDRSTest.RSTEST_UPDDFP16, "1234567890123456", "1234567890123456");} + public void Var083 () { dfpTest(JDRSTest.RSTEST_UPDDFP16, "-1234567890123456", "-1234567890123456");} + public void Var084 () { dfpTest(JDRSTest.RSTEST_UPDDFP16, "+1234567890123456","1234567890123456");} public void Var085 () { if ((getDriver() == JDTestDriver.DRIVER_NATIVE || isToolboxDriver()) && isjdk14_) { - dfpTest(JDRSTest.RSTEST_DFP16, "+1234567890123456E28","12345678901234560000000000000000000000000000"); + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+1234567890123456E28","12345678901234560000000000000000000000000000"); } else { - dfpTest(JDRSTest.RSTEST_DFP16, "+1234567890123456E28","1.234567890123456E+43"); + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+1234567890123456E28","1.234567890123456E+43"); } } public void Var086 () { if ((getDriver() == JDTestDriver.DRIVER_NATIVE || isToolboxDriver()) && isjdk14_) { - dfpTest(JDRSTest.RSTEST_DFP16, "+1234567890123456E+28","12345678901234560000000000000000000000000000"); + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+1234567890123456E+28","12345678901234560000000000000000000000000000"); } else { - dfpTest(JDRSTest.RSTEST_DFP16, "+1234567890123456E+28","1.234567890123456E+43"); + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+1234567890123456E+28","1.234567890123456E+43"); } } public void Var087 () { if ((getDriver() == JDTestDriver.DRIVER_NATIVE || isToolboxDriver()) && isjdk14_) { - dfpTest(JDRSTest.RSTEST_DFP16, "+123456789012345.6E+29","12345678901234560000000000000000000000000000"); + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+123456789012345.6E+29","12345678901234560000000000000000000000000000"); } else { - dfpTest(JDRSTest.RSTEST_DFP16, "+123456789012345.6E+29","1.234567890123456E+43"); + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+123456789012345.6E+29","1.234567890123456E+43"); } } public void Var088 () { if ((getDriver() == JDTestDriver.DRIVER_NATIVE || isToolboxDriver()) && isjdk14_) { - dfpTest(JDRSTest.RSTEST_DFP16, "+12345678901234.56E+30","12345678901234560000000000000000000000000000"); + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+12345678901234.56E+30","12345678901234560000000000000000000000000000"); } else { - dfpTest(JDRSTest.RSTEST_DFP16, "+12345678901234.56E+30","1.234567890123456E+43"); + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+12345678901234.56E+30","1.234567890123456E+43"); } } public void Var089 () { if ((getDriver() == JDTestDriver.DRIVER_NATIVE || isToolboxDriver()) && isjdk14_) { - dfpTest(JDRSTest.RSTEST_DFP16, "+1234567890123.456E+31","12345678901234560000000000000000000000000000"); + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+1234567890123.456E+31","12345678901234560000000000000000000000000000"); } else { - dfpTest(JDRSTest.RSTEST_DFP16, "+1234567890123.456E+31","1.234567890123456E+43"); + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+1234567890123.456E+31","1.234567890123456E+43"); } } public void Var090 () { if ((getDriver() == JDTestDriver.DRIVER_NATIVE || isToolboxDriver()) && isjdk14_) { - dfpTest(JDRSTest.RSTEST_DFP16, "+123456789012.3456E+32","12345678901234560000000000000000000000000000"); + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+123456789012.3456E+32","12345678901234560000000000000000000000000000"); } else { - dfpTest(JDRSTest.RSTEST_DFP16, "+123456789012.3456E+32","1.234567890123456E+43"); + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+123456789012.3456E+32","1.234567890123456E+43"); } } public void Var091 () { if ((getDriver() == JDTestDriver.DRIVER_NATIVE || isToolboxDriver()) && isjdk14_) { - dfpTest(JDRSTest.RSTEST_DFP16, "+12345678901.23456E+33","12345678901234560000000000000000000000000000"); + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+12345678901.23456E+33","12345678901234560000000000000000000000000000"); } else { - dfpTest(JDRSTest.RSTEST_DFP16, "+12345678901.23456E+33","1.234567890123456E+43"); + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+12345678901.23456E+33","1.234567890123456E+43"); } } public void Var092 () { if ((getDriver() == JDTestDriver.DRIVER_NATIVE || isToolboxDriver()) && isjdk14_) { - dfpTest(JDRSTest.RSTEST_DFP16, "+1234567890.123456E+34","12345678901234560000000000000000000000000000"); + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+1234567890.123456E+34","12345678901234560000000000000000000000000000"); } else { - dfpTest(JDRSTest.RSTEST_DFP16, "+1234567890.123456E+34","1.234567890123456E+43"); + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+1234567890.123456E+34","1.234567890123456E+43"); } } public void Var093 () { if ((getDriver() == JDTestDriver.DRIVER_NATIVE || isToolboxDriver()) && isjdk14_) { - dfpTest(JDRSTest.RSTEST_DFP16, "+123456789.0123456E+35","12345678901234560000000000000000000000000000"); + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+123456789.0123456E+35","12345678901234560000000000000000000000000000"); } else { - dfpTest(JDRSTest.RSTEST_DFP16, "+123456789.0123456E+35","1.234567890123456E+43"); + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+123456789.0123456E+35","1.234567890123456E+43"); } } public void Var094 () { if ((getDriver() == JDTestDriver.DRIVER_NATIVE || isToolboxDriver()) && isjdk14_) { - dfpTest(JDRSTest.RSTEST_DFP16, "+12345678.90123456E+36","12345678901234560000000000000000000000000000"); + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+12345678.90123456E+36","12345678901234560000000000000000000000000000"); } else { - dfpTest(JDRSTest.RSTEST_DFP16, "+12345678.90123456E+36","1.234567890123456E+43"); + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+12345678.90123456E+36","1.234567890123456E+43"); } } public void Var095 () { if ((getDriver() == JDTestDriver.DRIVER_NATIVE || isToolboxDriver()) && isjdk14_) { - dfpTest(JDRSTest.RSTEST_DFP16, "+1234567.890123456E+37","12345678901234560000000000000000000000000000"); + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+1234567.890123456E+37","12345678901234560000000000000000000000000000"); } else { - dfpTest(JDRSTest.RSTEST_DFP16, "+1234567.890123456E+37","1.234567890123456E+43"); + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+1234567.890123456E+37","1.234567890123456E+43"); } } public void Var096 () { if ((getDriver() == JDTestDriver.DRIVER_NATIVE || isToolboxDriver()) && isjdk14_) { - dfpTest(JDRSTest.RSTEST_DFP16, "+123456.7890123456E+38","12345678901234560000000000000000000000000000"); + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+123456.7890123456E+38","12345678901234560000000000000000000000000000"); } else { - dfpTest(JDRSTest.RSTEST_DFP16, "+123456.7890123456E+38","1.234567890123456E+43"); + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+123456.7890123456E+38","1.234567890123456E+43"); } } public void Var097 () { if ((getDriver() == JDTestDriver.DRIVER_NATIVE || isToolboxDriver()) && isjdk14_) { - dfpTest(JDRSTest.RSTEST_DFP16, "+12345.67890123456E+39","12345678901234560000000000000000000000000000"); + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+12345.67890123456E+39","12345678901234560000000000000000000000000000"); } else { - dfpTest(JDRSTest.RSTEST_DFP16, "+12345.67890123456E+39","1.234567890123456E+43"); + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+12345.67890123456E+39","1.234567890123456E+43"); } } public void Var098 () { if ((getDriver() == JDTestDriver.DRIVER_NATIVE || isToolboxDriver()) && isjdk14_) { - dfpTest(JDRSTest.RSTEST_DFP16, "+1234.567890123456E+40","12345678901234560000000000000000000000000000"); + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+1234.567890123456E+40","12345678901234560000000000000000000000000000"); } else { - dfpTest(JDRSTest.RSTEST_DFP16, "+1234.567890123456E+40","1.234567890123456E+43"); + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+1234.567890123456E+40","1.234567890123456E+43"); } } public void Var099 () { if ((getDriver() == JDTestDriver.DRIVER_NATIVE || isToolboxDriver()) && isjdk14_) { - dfpTest(JDRSTest.RSTEST_DFP16, "+123.4567890123456E+41","12345678901234560000000000000000000000000000"); + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+123.4567890123456E+41","12345678901234560000000000000000000000000000"); } else { - dfpTest(JDRSTest.RSTEST_DFP16, "+123.4567890123456E+41","1.234567890123456E+43"); + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+123.4567890123456E+41","1.234567890123456E+43"); } } public void Var100 () { if ((getDriver() == JDTestDriver.DRIVER_NATIVE || isToolboxDriver()) && isjdk14_) { - dfpTest(JDRSTest.RSTEST_DFP16, "+12.34567890123456E+42","12345678901234560000000000000000000000000000"); + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+12.34567890123456E+42","12345678901234560000000000000000000000000000"); } else { - dfpTest(JDRSTest.RSTEST_DFP16, "+12.34567890123456E+42","1.234567890123456E+43"); + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+12.34567890123456E+42","1.234567890123456E+43"); } } public void Var101 () { if ((getDriver() == JDTestDriver.DRIVER_NATIVE || isToolboxDriver()) && isjdk14_) { - dfpTest(JDRSTest.RSTEST_DFP16, "+1.234567890123456E+43","12345678901234560000000000000000000000000000"); + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+1.234567890123456E+43","12345678901234560000000000000000000000000000"); } else { - dfpTest(JDRSTest.RSTEST_DFP16, "+1.234567890123456E+43","1.234567890123456E+43"); + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+1.234567890123456E+43","1.234567890123456E+43"); } } public void Var102 () { if ((getDriver() == JDTestDriver.DRIVER_NATIVE || isToolboxDriver()) && isjdk14_) { - dfpTest(JDRSTest.RSTEST_DFP16, "+.1234567890123456E+44","12345678901234560000000000000000000000000000"); + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+.1234567890123456E+44","12345678901234560000000000000000000000000000"); } else { - dfpTest(JDRSTest.RSTEST_DFP16, "+.1234567890123456E+44","1.234567890123456E+43"); + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+.1234567890123456E+44","1.234567890123456E+43"); } } public void Var103 () { if ((getDriver() == JDTestDriver.DRIVER_NATIVE || isToolboxDriver()) && isjdk14_) { - dfpTest(JDRSTest.RSTEST_DFP16, "+0.1234567890123456E+44","12345678901234560000000000000000000000000000"); + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+0.1234567890123456E+44","12345678901234560000000000000000000000000000"); } else { - dfpTest(JDRSTest.RSTEST_DFP16, "+0.1234567890123456E+44","1.234567890123456E+43"); + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+0.1234567890123456E+44","1.234567890123456E+43"); } } public void Var104 () { if ((getDriver() == JDTestDriver.DRIVER_NATIVE || isToolboxDriver()) && isjdk14_) { - dfpTest(JDRSTest.RSTEST_DFP16, "+0.01234567890123456E+45","12345678901234560000000000000000000000000000"); + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+0.01234567890123456E+45","12345678901234560000000000000000000000000000"); } else { - dfpTest(JDRSTest.RSTEST_DFP16, "+0.01234567890123456E+45","1.234567890123456E+43"); + dfpTest(JDRSTest.RSTEST_UPDDFP16, "+0.01234567890123456E+45","1.234567890123456E+43"); } } public void Var105 () { if ((getDriver() == JDTestDriver.DRIVER_NATIVE || isToolboxDriver()) && isjdk14_) { - dfpTest(JDRSTest.RSTEST_DFP16, "-1234567890123456E28","-12345678901234560000000000000000000000000000"); + dfpTest(JDRSTest.RSTEST_UPDDFP16, "-1234567890123456E28","-12345678901234560000000000000000000000000000"); } else { - dfpTest(JDRSTest.RSTEST_DFP16, "-1234567890123456E28","-1.234567890123456E+43"); + dfpTest(JDRSTest.RSTEST_UPDDFP16, "-1234567890123456E28","-1.234567890123456E+43"); } } - public void Var106 () { dfpTest(JDRSTest.RSTEST_DFP16, "1E0", "1");} - public void Var107 () { dfpTest(JDRSTest.RSTEST_DFP16, "1.1", "1.1");} - public void Var108 () { dfpTest(JDRSTest.RSTEST_DFP16, "1.1E0", "1.1");} - public void Var109 () { dfpTest(JDRSTest.RSTEST_DFP16, null, null);} + public void Var106 () { dfpTest(JDRSTest.RSTEST_UPDDFP16, "1E0", "1");} + public void Var107 () { dfpTest(JDRSTest.RSTEST_UPDDFP16, "1.1", "1.1");} + public void Var108 () { dfpTest(JDRSTest.RSTEST_UPDDFP16, "1.1E0", "1.1");} + public void Var109 () { dfpTest(JDRSTest.RSTEST_UPDDFP16, null, null);} /* * updateString -- using different rounding modes */ String RHE="round half even"; - public void Var110 () { dfpRoundTest(RHE, JDRSTest.RSTEST_DFP16, "1.2345678901234545", "1.234567890123454"); } - public void Var111 () { dfpRoundTest(RHE, JDRSTest.RSTEST_DFP16, "1.2345678901234555", "1.234567890123456"); } - public void Var112 () { dfpRoundTest(RHE, JDRSTest.RSTEST_DFP16, "-1.2345678901234545", "-1.234567890123454"); } - public void Var113 () { dfpRoundTest(RHE, JDRSTest.RSTEST_DFP16, "-1.2345678901234555", "-1.234567890123456"); } + public void Var110 () { dfpRoundTest(RHE, JDRSTest.RSTEST_UPDDFP16, "1.2345678901234545", "1.234567890123454"); } + public void Var111 () { dfpRoundTest(RHE, JDRSTest.RSTEST_UPDDFP16, "1.2345678901234555", "1.234567890123456"); } + public void Var112 () { dfpRoundTest(RHE, JDRSTest.RSTEST_UPDDFP16, "-1.2345678901234545", "-1.234567890123454"); } + public void Var113 () { dfpRoundTest(RHE, JDRSTest.RSTEST_UPDDFP16, "-1.2345678901234555", "-1.234567890123456"); } /** * updateFloat -- set a DFP16 with rounding mode "round half up" */ String RHU = "round half up"; - public void Var114 () { dfpRoundTest(RHU, JDRSTest.RSTEST_DFP16, "1.2345678901234555", "1.234567890123456"); } - public void Var115 () { dfpRoundTest(RHU, JDRSTest.RSTEST_DFP16, "1.2345678901234545", "1.234567890123455"); } - public void Var116 () { dfpRoundTest(RHU, JDRSTest.RSTEST_DFP16, "1.2345678901234565", "1.234567890123457"); } - public void Var117 () { dfpRoundTest(RHU, JDRSTest.RSTEST_DFP16, "-1.2345678901234555", "-1.234567890123456"); } - public void Var118 () { dfpRoundTest(RHU, JDRSTest.RSTEST_DFP16, "-1.2345678901234545", "-1.234567890123455"); } - public void Var119 () { dfpRoundTest(RHU, JDRSTest.RSTEST_DFP16, "-1.2345678901234565", "-1.234567890123457"); } + public void Var114 () { dfpRoundTest(RHU, JDRSTest.RSTEST_UPDDFP16, "1.2345678901234555", "1.234567890123456"); } + public void Var115 () { dfpRoundTest(RHU, JDRSTest.RSTEST_UPDDFP16, "1.2345678901234545", "1.234567890123455"); } + public void Var116 () { dfpRoundTest(RHU, JDRSTest.RSTEST_UPDDFP16, "1.2345678901234565", "1.234567890123457"); } + public void Var117 () { dfpRoundTest(RHU, JDRSTest.RSTEST_UPDDFP16, "-1.2345678901234555", "-1.234567890123456"); } + public void Var118 () { dfpRoundTest(RHU, JDRSTest.RSTEST_UPDDFP16, "-1.2345678901234545", "-1.234567890123455"); } + public void Var119 () { dfpRoundTest(RHU, JDRSTest.RSTEST_UPDDFP16, "-1.2345678901234565", "-1.234567890123457"); } /** * updateFloat -- set a DFP16 with rounding mode "round down" */ String RD = "round down"; - public void Var120 () { dfpRoundTest(RD, JDRSTest.RSTEST_DFP16, "1.2345678901234555", "1.234567890123455"); } - public void Var121 () { dfpRoundTest(RD, JDRSTest.RSTEST_DFP16, "1.2345678901234559999999", "1.234567890123455"); } - public void Var122 () { dfpRoundTest(RD, JDRSTest.RSTEST_DFP16, "-1.2345678901234555", "-1.234567890123455"); } - public void Var123 () { dfpRoundTest(RD, JDRSTest.RSTEST_DFP16, "-1.2345678901234559999999", "-1.234567890123455"); } + public void Var120 () { dfpRoundTest(RD, JDRSTest.RSTEST_UPDDFP16, "1.2345678901234555", "1.234567890123455"); } + public void Var121 () { dfpRoundTest(RD, JDRSTest.RSTEST_UPDDFP16, "1.2345678901234559999999", "1.234567890123455"); } + public void Var122 () { dfpRoundTest(RD, JDRSTest.RSTEST_UPDDFP16, "-1.2345678901234555", "-1.234567890123455"); } + public void Var123 () { dfpRoundTest(RD, JDRSTest.RSTEST_UPDDFP16, "-1.2345678901234559999999", "-1.234567890123455"); } @@ -2358,32 +2370,32 @@ public void Var105 () { * updateFloat -- set a DFP16 with rounding mode "round ceiling" */ String RC = "round ceiling"; - public void Var124 () { dfpRoundTest(RC, JDRSTest.RSTEST_DFP16, "1.2345678901234555", "1.234567890123456"); } - public void Var125 () { dfpRoundTest(RC, JDRSTest.RSTEST_DFP16, "1.2345678901234559999999", "1.234567890123456"); } - public void Var126 () { dfpRoundTest(RC, JDRSTest.RSTEST_DFP16, "-1.2345678901234555", "-1.234567890123455"); } - public void Var127 () { dfpRoundTest(RC, JDRSTest.RSTEST_DFP16, "-1.2345678901234559999999", "-1.234567890123455"); } + public void Var124 () { dfpRoundTest(RC, JDRSTest.RSTEST_UPDDFP16, "1.2345678901234555", "1.234567890123456"); } + public void Var125 () { dfpRoundTest(RC, JDRSTest.RSTEST_UPDDFP16, "1.2345678901234559999999", "1.234567890123456"); } + public void Var126 () { dfpRoundTest(RC, JDRSTest.RSTEST_UPDDFP16, "-1.2345678901234555", "-1.234567890123455"); } + public void Var127 () { dfpRoundTest(RC, JDRSTest.RSTEST_UPDDFP16, "-1.2345678901234559999999", "-1.234567890123455"); } /** * updateFloat -- set a DFP16 with rounding mode "round floor" */ String RF = "round floor"; - public void Var128 () { dfpRoundTest(RF, JDRSTest.RSTEST_DFP16, "1.2345678901234555", "1.234567890123455"); } - public void Var129 () { dfpRoundTest(RF, JDRSTest.RSTEST_DFP16, "1.2345678901234559999999", "1.234567890123455"); } - public void Var130 () { dfpRoundTest(RF, JDRSTest.RSTEST_DFP16, "-1.2345678901234555", "-1.234567890123456"); } - public void Var131 () { dfpRoundTest(RF, JDRSTest.RSTEST_DFP16, "-1.2345678901234559999999", "-1.234567890123456"); } + public void Var128 () { dfpRoundTest(RF, JDRSTest.RSTEST_UPDDFP16, "1.2345678901234555", "1.234567890123455"); } + public void Var129 () { dfpRoundTest(RF, JDRSTest.RSTEST_UPDDFP16, "1.2345678901234559999999", "1.234567890123455"); } + public void Var130 () { dfpRoundTest(RF, JDRSTest.RSTEST_UPDDFP16, "-1.2345678901234555", "-1.234567890123456"); } + public void Var131 () { dfpRoundTest(RF, JDRSTest.RSTEST_UPDDFP16, "-1.2345678901234559999999", "-1.234567890123456"); } /** * updateFloat -- set a DFP16 with rounding mode "round half down" */ String RHD = "round half down"; - public void Var132 () { dfpRoundTest(RHD, JDRSTest.RSTEST_DFP16, "1.2345678901234555", "1.234567890123455"); } - public void Var133 () { dfpRoundTest(RHD, JDRSTest.RSTEST_DFP16, "1.2345678901234545", "1.234567890123454"); } - public void Var134 () { dfpRoundTest(RHD, JDRSTest.RSTEST_DFP16, "1.2345678901234565", "1.234567890123456"); } - public void Var135 () { dfpRoundTest(RHD, JDRSTest.RSTEST_DFP16, "-1.2345678901234555", "-1.234567890123455"); } - public void Var136 () { dfpRoundTest(RHD, JDRSTest.RSTEST_DFP16, "-1.2345678901234545", "-1.234567890123454"); } - public void Var137 () { dfpRoundTest(RHD, JDRSTest.RSTEST_DFP16, "-1.2345678901234565", "-1.234567890123456"); } + public void Var132 () { dfpRoundTest(RHD, JDRSTest.RSTEST_UPDDFP16, "1.2345678901234555", "1.234567890123455"); } + public void Var133 () { dfpRoundTest(RHD, JDRSTest.RSTEST_UPDDFP16, "1.2345678901234545", "1.234567890123454"); } + public void Var134 () { dfpRoundTest(RHD, JDRSTest.RSTEST_UPDDFP16, "1.2345678901234565", "1.234567890123456"); } + public void Var135 () { dfpRoundTest(RHD, JDRSTest.RSTEST_UPDDFP16, "-1.2345678901234555", "-1.234567890123455"); } + public void Var136 () { dfpRoundTest(RHD, JDRSTest.RSTEST_UPDDFP16, "-1.2345678901234545", "-1.234567890123454"); } + public void Var137 () { dfpRoundTest(RHD, JDRSTest.RSTEST_UPDDFP16, "-1.2345678901234565", "-1.234567890123456"); } @@ -2391,254 +2403,254 @@ public void Var105 () { * updateFloat -- set a DFP16 with rounding mode "round up" */ String RU = "round up"; - public void Var138 () { dfpRoundTest(RU, JDRSTest.RSTEST_DFP16, "1.2345678901234555", "1.234567890123456"); } - public void Var139 () { dfpRoundTest(RU, JDRSTest.RSTEST_DFP16, "1.2345678901234559999999", "1.234567890123456"); } - public void Var140 () { dfpRoundTest(RU, JDRSTest.RSTEST_DFP16, "-1.2345678901234555", "-1.234567890123456"); } - public void Var141 () { dfpRoundTest(RU, JDRSTest.RSTEST_DFP16, "-1.2345678901234559999999", "-1.234567890123456"); } + public void Var138 () { dfpRoundTest(RU, JDRSTest.RSTEST_UPDDFP16, "1.2345678901234555", "1.234567890123456"); } + public void Var139 () { dfpRoundTest(RU, JDRSTest.RSTEST_UPDDFP16, "1.2345678901234559999999", "1.234567890123456"); } + public void Var140 () { dfpRoundTest(RU, JDRSTest.RSTEST_UPDDFP16, "-1.2345678901234555", "-1.234567890123456"); } + public void Var141 () { dfpRoundTest(RU, JDRSTest.RSTEST_UPDDFP16, "-1.2345678901234559999999", "-1.234567890123456"); } /** * updateString -- set DFP34 to different values and retrieve */ - public void Var142 () { dfpTest(JDRSTest.RSTEST_DFP34, "4533.43", "4533.43"); } - public void Var143 () { dfpTest(JDRSTest.RSTEST_DFP34, "NaN", "NaN");} - public void Var144 () { dfpTest(JDRSTest.RSTEST_DFP34, "NAN", "NaN");} - public void Var145 () { dfpTest(JDRSTest.RSTEST_DFP34, "+NaN", "NaN");} - public void Var146 () { dfpTest(JDRSTest.RSTEST_DFP34, "-NaN", "-NaN");} - public void Var147 () { dfpTest(JDRSTest.RSTEST_DFP34, "QNaN", "NaN");} - public void Var148 () { dfpTest(JDRSTest.RSTEST_DFP34, "+QNaN", "NaN");} - public void Var149 () { dfpTest(JDRSTest.RSTEST_DFP34, "-QNaN", "-NaN");} - public void Var150 () { dfpTest(JDRSTest.RSTEST_DFP34, "SNaN", "SNaN");} - public void Var151 () { dfpTest(JDRSTest.RSTEST_DFP34, "+SNaN", "SNaN");} - public void Var152 () { dfpTest(JDRSTest.RSTEST_DFP34, "-SNaN", "-SNaN");} - public void Var153 () { dfpTest(JDRSTest.RSTEST_DFP34, "INF", "Infinity");} - public void Var154 () { dfpTest(JDRSTest.RSTEST_DFP34, "+INF", "Infinity");} - public void Var155 () { dfpTest(JDRSTest.RSTEST_DFP34, "-INF", "-Infinity");} - public void Var156 () { dfpTest(JDRSTest.RSTEST_DFP34, "Infinity", "Infinity");} - public void Var157 () { dfpTest(JDRSTest.RSTEST_DFP34, "+Infinity", "Infinity");} - public void Var158 () { dfpTest(JDRSTest.RSTEST_DFP34, "-Infinity", "-Infinity");} - public void Var159 () { dfpTest(JDRSTest.RSTEST_DFP34, "1234567890123456", "1234567890123456");} - public void Var160 () { dfpTest(JDRSTest.RSTEST_DFP34, "-1234567890123456", "-1234567890123456");} - public void Var161 () { dfpTest(JDRSTest.RSTEST_DFP34, "+1234567890123456","1234567890123456");} + public void Var142 () { dfpTest(JDRSTest.RSTEST_UPDDFP34, "4533.43", "4533.43"); } + public void Var143 () { dfpTest(JDRSTest.RSTEST_UPDDFP34, "NaN", "NaN");} + public void Var144 () { dfpTest(JDRSTest.RSTEST_UPDDFP34, "NAN", "NaN");} + public void Var145 () { dfpTest(JDRSTest.RSTEST_UPDDFP34, "+NaN", "NaN");} + public void Var146 () { dfpTest(JDRSTest.RSTEST_UPDDFP34, "-NaN", "-NaN");} + public void Var147 () { dfpTest(JDRSTest.RSTEST_UPDDFP34, "QNaN", "NaN");} + public void Var148 () { dfpTest(JDRSTest.RSTEST_UPDDFP34, "+QNaN", "NaN");} + public void Var149 () { dfpTest(JDRSTest.RSTEST_UPDDFP34, "-QNaN", "-NaN");} + public void Var150 () { dfpTest(JDRSTest.RSTEST_UPDDFP34, "SNaN", "SNaN");} + public void Var151 () { dfpTest(JDRSTest.RSTEST_UPDDFP34, "+SNaN", "SNaN");} + public void Var152 () { dfpTest(JDRSTest.RSTEST_UPDDFP34, "-SNaN", "-SNaN");} + public void Var153 () { dfpTest(JDRSTest.RSTEST_UPDDFP34, "INF", "Infinity");} + public void Var154 () { dfpTest(JDRSTest.RSTEST_UPDDFP34, "+INF", "Infinity");} + public void Var155 () { dfpTest(JDRSTest.RSTEST_UPDDFP34, "-INF", "-Infinity");} + public void Var156 () { dfpTest(JDRSTest.RSTEST_UPDDFP34, "Infinity", "Infinity");} + public void Var157 () { dfpTest(JDRSTest.RSTEST_UPDDFP34, "+Infinity", "Infinity");} + public void Var158 () { dfpTest(JDRSTest.RSTEST_UPDDFP34, "-Infinity", "-Infinity");} + public void Var159 () { dfpTest(JDRSTest.RSTEST_UPDDFP34, "1234567890123456", "1234567890123456");} + public void Var160 () { dfpTest(JDRSTest.RSTEST_UPDDFP34, "-1234567890123456", "-1234567890123456");} + public void Var161 () { dfpTest(JDRSTest.RSTEST_UPDDFP34, "+1234567890123456","1234567890123456");} public void Var162 () { if ((getDriver() == JDTestDriver.DRIVER_NATIVE || isToolboxDriver()) && isjdk14_) { - dfpTest(JDRSTest.RSTEST_DFP34, "+1234567890123456E28","12345678901234560000000000000000000000000000"); + dfpTest(JDRSTest.RSTEST_UPDDFP34, "+1234567890123456E28","12345678901234560000000000000000000000000000"); } else { - dfpTest(JDRSTest.RSTEST_DFP34, "+1234567890123456E28","1.234567890123456E+43"); + dfpTest(JDRSTest.RSTEST_UPDDFP34, "+1234567890123456E28","1.234567890123456E+43"); } } public void Var163 () { if ((getDriver() == JDTestDriver.DRIVER_NATIVE || isToolboxDriver()) && isjdk14_) { - dfpTest(JDRSTest.RSTEST_DFP34, "+1234567890123456E+28","12345678901234560000000000000000000000000000"); + dfpTest(JDRSTest.RSTEST_UPDDFP34, "+1234567890123456E+28","12345678901234560000000000000000000000000000"); } else { - dfpTest(JDRSTest.RSTEST_DFP34, "+1234567890123456E+28","1.234567890123456E+43"); + dfpTest(JDRSTest.RSTEST_UPDDFP34, "+1234567890123456E+28","1.234567890123456E+43"); } } public void Var164 () { if ((getDriver() == JDTestDriver.DRIVER_NATIVE || isToolboxDriver()) && isjdk14_) { - dfpTest(JDRSTest.RSTEST_DFP34, "+123456789012345.6E+29","12345678901234560000000000000000000000000000"); + dfpTest(JDRSTest.RSTEST_UPDDFP34, "+123456789012345.6E+29","12345678901234560000000000000000000000000000"); } else { - dfpTest(JDRSTest.RSTEST_DFP34, "+123456789012345.6E+29","1.234567890123456E+43"); + dfpTest(JDRSTest.RSTEST_UPDDFP34, "+123456789012345.6E+29","1.234567890123456E+43"); } } public void Var165 () { if ((getDriver() == JDTestDriver.DRIVER_NATIVE || isToolboxDriver()) && isjdk14_) { - dfpTest(JDRSTest.RSTEST_DFP34, "+12345678901234.56E+30","12345678901234560000000000000000000000000000"); + dfpTest(JDRSTest.RSTEST_UPDDFP34, "+12345678901234.56E+30","12345678901234560000000000000000000000000000"); } else { - dfpTest(JDRSTest.RSTEST_DFP34, "+12345678901234.56E+30","1.234567890123456E+43"); + dfpTest(JDRSTest.RSTEST_UPDDFP34, "+12345678901234.56E+30","1.234567890123456E+43"); } } public void Var166 () { if ((getDriver() == JDTestDriver.DRIVER_NATIVE || isToolboxDriver()) && isjdk14_) { - dfpTest(JDRSTest.RSTEST_DFP34, "+1234567890123.456E+31","12345678901234560000000000000000000000000000"); + dfpTest(JDRSTest.RSTEST_UPDDFP34, "+1234567890123.456E+31","12345678901234560000000000000000000000000000"); } else { - dfpTest(JDRSTest.RSTEST_DFP34, "+1234567890123.456E+31","1.234567890123456E+43"); + dfpTest(JDRSTest.RSTEST_UPDDFP34, "+1234567890123.456E+31","1.234567890123456E+43"); } } public void Var167 () { if ((getDriver() == JDTestDriver.DRIVER_NATIVE || isToolboxDriver()) && isjdk14_) { - dfpTest(JDRSTest.RSTEST_DFP34, "+123456789012.3456E+32","12345678901234560000000000000000000000000000"); + dfpTest(JDRSTest.RSTEST_UPDDFP34, "+123456789012.3456E+32","12345678901234560000000000000000000000000000"); } else { - dfpTest(JDRSTest.RSTEST_DFP34, "+123456789012.3456E+32","1.234567890123456E+43"); + dfpTest(JDRSTest.RSTEST_UPDDFP34, "+123456789012.3456E+32","1.234567890123456E+43"); } } public void Var168 () { if ((getDriver() == JDTestDriver.DRIVER_NATIVE || isToolboxDriver()) && isjdk14_) { - dfpTest(JDRSTest.RSTEST_DFP34, "+12345678901.23456E+33","12345678901234560000000000000000000000000000"); + dfpTest(JDRSTest.RSTEST_UPDDFP34, "+12345678901.23456E+33","12345678901234560000000000000000000000000000"); } else { - dfpTest(JDRSTest.RSTEST_DFP34, "+12345678901.23456E+33","1.234567890123456E+43"); + dfpTest(JDRSTest.RSTEST_UPDDFP34, "+12345678901.23456E+33","1.234567890123456E+43"); } } public void Var169 () { if ((getDriver() == JDTestDriver.DRIVER_NATIVE || isToolboxDriver()) && isjdk14_) { - dfpTest(JDRSTest.RSTEST_DFP34, "+1234567890.123456E+34","12345678901234560000000000000000000000000000"); + dfpTest(JDRSTest.RSTEST_UPDDFP34, "+1234567890.123456E+34","12345678901234560000000000000000000000000000"); } else { - dfpTest(JDRSTest.RSTEST_DFP34, "+1234567890.123456E+34","1.234567890123456E+43"); + dfpTest(JDRSTest.RSTEST_UPDDFP34, "+1234567890.123456E+34","1.234567890123456E+43"); } } public void Var170 () { if ((getDriver() == JDTestDriver.DRIVER_NATIVE || isToolboxDriver()) && isjdk14_) { - dfpTest(JDRSTest.RSTEST_DFP34, "+123456789.0123456E+35","12345678901234560000000000000000000000000000"); + dfpTest(JDRSTest.RSTEST_UPDDFP34, "+123456789.0123456E+35","12345678901234560000000000000000000000000000"); } else { - dfpTest(JDRSTest.RSTEST_DFP34, "+123456789.0123456E+35","1.234567890123456E+43"); + dfpTest(JDRSTest.RSTEST_UPDDFP34, "+123456789.0123456E+35","1.234567890123456E+43"); } } public void Var171 () { if ((getDriver() == JDTestDriver.DRIVER_NATIVE || isToolboxDriver()) && isjdk14_) { - dfpTest(JDRSTest.RSTEST_DFP34, "+12345678.90123456E+36","12345678901234560000000000000000000000000000"); + dfpTest(JDRSTest.RSTEST_UPDDFP34, "+12345678.90123456E+36","12345678901234560000000000000000000000000000"); } else { - dfpTest(JDRSTest.RSTEST_DFP34, "+12345678.90123456E+36","1.234567890123456E+43"); + dfpTest(JDRSTest.RSTEST_UPDDFP34, "+12345678.90123456E+36","1.234567890123456E+43"); } } public void Var172 () { if ((getDriver() == JDTestDriver.DRIVER_NATIVE || isToolboxDriver()) && isjdk14_) { - dfpTest(JDRSTest.RSTEST_DFP34, "+1234567.890123456E+37","12345678901234560000000000000000000000000000"); + dfpTest(JDRSTest.RSTEST_UPDDFP34, "+1234567.890123456E+37","12345678901234560000000000000000000000000000"); } else { - dfpTest(JDRSTest.RSTEST_DFP34, "+1234567.890123456E+37","1.234567890123456E+43"); + dfpTest(JDRSTest.RSTEST_UPDDFP34, "+1234567.890123456E+37","1.234567890123456E+43"); } } public void Var173 () { if ((getDriver() == JDTestDriver.DRIVER_NATIVE || isToolboxDriver()) && isjdk14_) { - dfpTest(JDRSTest.RSTEST_DFP34, "+123456.7890123456E+38","12345678901234560000000000000000000000000000"); + dfpTest(JDRSTest.RSTEST_UPDDFP34, "+123456.7890123456E+38","12345678901234560000000000000000000000000000"); } else { - dfpTest(JDRSTest.RSTEST_DFP34, "+123456.7890123456E+38","1.234567890123456E+43"); + dfpTest(JDRSTest.RSTEST_UPDDFP34, "+123456.7890123456E+38","1.234567890123456E+43"); } } public void Var174 () { if ((getDriver() == JDTestDriver.DRIVER_NATIVE || isToolboxDriver()) && isjdk14_) { - dfpTest(JDRSTest.RSTEST_DFP34, "+12345.67890123456E+39","12345678901234560000000000000000000000000000"); + dfpTest(JDRSTest.RSTEST_UPDDFP34, "+12345.67890123456E+39","12345678901234560000000000000000000000000000"); } else { - dfpTest(JDRSTest.RSTEST_DFP34, "+12345.67890123456E+39","1.234567890123456E+43"); + dfpTest(JDRSTest.RSTEST_UPDDFP34, "+12345.67890123456E+39","1.234567890123456E+43"); } } public void Var175 () { if ((getDriver() == JDTestDriver.DRIVER_NATIVE || isToolboxDriver()) && isjdk14_) { - dfpTest(JDRSTest.RSTEST_DFP34, "+1234.567890123456E+40","12345678901234560000000000000000000000000000"); + dfpTest(JDRSTest.RSTEST_UPDDFP34, "+1234.567890123456E+40","12345678901234560000000000000000000000000000"); } else { - dfpTest(JDRSTest.RSTEST_DFP34, "+1234.567890123456E+40","1.234567890123456E+43"); + dfpTest(JDRSTest.RSTEST_UPDDFP34, "+1234.567890123456E+40","1.234567890123456E+43"); } } public void Var176 () { if ((getDriver() == JDTestDriver.DRIVER_NATIVE || isToolboxDriver()) && isjdk14_) { - dfpTest(JDRSTest.RSTEST_DFP34, "+123.4567890123456E+41","12345678901234560000000000000000000000000000"); + dfpTest(JDRSTest.RSTEST_UPDDFP34, "+123.4567890123456E+41","12345678901234560000000000000000000000000000"); } else { - dfpTest(JDRSTest.RSTEST_DFP34, "+123.4567890123456E+41","1.234567890123456E+43"); + dfpTest(JDRSTest.RSTEST_UPDDFP34, "+123.4567890123456E+41","1.234567890123456E+43"); } } public void Var177 () { if ((getDriver() == JDTestDriver.DRIVER_NATIVE || isToolboxDriver()) && isjdk14_) { - dfpTest(JDRSTest.RSTEST_DFP34, "+12.34567890123456E+42","12345678901234560000000000000000000000000000"); + dfpTest(JDRSTest.RSTEST_UPDDFP34, "+12.34567890123456E+42","12345678901234560000000000000000000000000000"); } else { - dfpTest(JDRSTest.RSTEST_DFP34, "+12.34567890123456E+42","1.234567890123456E+43"); + dfpTest(JDRSTest.RSTEST_UPDDFP34, "+12.34567890123456E+42","1.234567890123456E+43"); } } public void Var178 () { if ((getDriver() == JDTestDriver.DRIVER_NATIVE || isToolboxDriver()) && isjdk14_) { - dfpTest(JDRSTest.RSTEST_DFP34, "+1.234567890123456E+43","12345678901234560000000000000000000000000000"); + dfpTest(JDRSTest.RSTEST_UPDDFP34, "+1.234567890123456E+43","12345678901234560000000000000000000000000000"); } else { - dfpTest(JDRSTest.RSTEST_DFP34, "+1.234567890123456E+43","1.234567890123456E+43"); + dfpTest(JDRSTest.RSTEST_UPDDFP34, "+1.234567890123456E+43","1.234567890123456E+43"); } } public void Var179 () { if ((getDriver() == JDTestDriver.DRIVER_NATIVE || isToolboxDriver()) && isjdk14_) { - dfpTest(JDRSTest.RSTEST_DFP34, "+.1234567890123456E+44","12345678901234560000000000000000000000000000"); + dfpTest(JDRSTest.RSTEST_UPDDFP34, "+.1234567890123456E+44","12345678901234560000000000000000000000000000"); } else { - dfpTest(JDRSTest.RSTEST_DFP34, "+.1234567890123456E+44","1.234567890123456E+43"); + dfpTest(JDRSTest.RSTEST_UPDDFP34, "+.1234567890123456E+44","1.234567890123456E+43"); } } public void Var180 () { if ((getDriver() == JDTestDriver.DRIVER_NATIVE || isToolboxDriver()) && isjdk14_) { - dfpTest(JDRSTest.RSTEST_DFP34, "+0.1234567890123456E+44","12345678901234560000000000000000000000000000"); + dfpTest(JDRSTest.RSTEST_UPDDFP34, "+0.1234567890123456E+44","12345678901234560000000000000000000000000000"); } else { - dfpTest(JDRSTest.RSTEST_DFP34, "+0.1234567890123456E+44","1.234567890123456E+43"); + dfpTest(JDRSTest.RSTEST_UPDDFP34, "+0.1234567890123456E+44","1.234567890123456E+43"); } } public void Var181 () { if ((getDriver() == JDTestDriver.DRIVER_NATIVE || isToolboxDriver()) && isjdk14_) { - dfpTest(JDRSTest.RSTEST_DFP34, "+0.01234567890123456E+45","12345678901234560000000000000000000000000000"); + dfpTest(JDRSTest.RSTEST_UPDDFP34, "+0.01234567890123456E+45","12345678901234560000000000000000000000000000"); } else { - dfpTest(JDRSTest.RSTEST_DFP34, "+0.01234567890123456E+45","1.234567890123456E+43"); + dfpTest(JDRSTest.RSTEST_UPDDFP34, "+0.01234567890123456E+45","1.234567890123456E+43"); } } public void Var182 () { if ((getDriver() == JDTestDriver.DRIVER_NATIVE || isToolboxDriver()) && isjdk14_) { - dfpTest(JDRSTest.RSTEST_DFP34, "-1234567890123456E28","-12345678901234560000000000000000000000000000"); + dfpTest(JDRSTest.RSTEST_UPDDFP34, "-1234567890123456E28","-12345678901234560000000000000000000000000000"); } else { - dfpTest(JDRSTest.RSTEST_DFP34, "-1234567890123456E28","-1.234567890123456E+43"); + dfpTest(JDRSTest.RSTEST_UPDDFP34, "-1234567890123456E28","-1.234567890123456E+43"); } } - public void Var183 () { dfpTest(JDRSTest.RSTEST_DFP34, "1E0", "1");} - public void Var184 () { dfpTest(JDRSTest.RSTEST_DFP34, "1.1", "1.1");} - public void Var185 () { dfpTest(JDRSTest.RSTEST_DFP34, "1.1E0", "1.1");} - public void Var186 () { dfpTest(JDRSTest.RSTEST_DFP34, null, null);} + public void Var183 () { dfpTest(JDRSTest.RSTEST_UPDDFP34, "1E0", "1");} + public void Var184 () { dfpTest(JDRSTest.RSTEST_UPDDFP34, "1.1", "1.1");} + public void Var185 () { dfpTest(JDRSTest.RSTEST_UPDDFP34, "1.1E0", "1.1");} + public void Var186 () { dfpTest(JDRSTest.RSTEST_UPDDFP34, null, null);} /* * updateString -- using different rounding modes */ - public void Var187 () { dfpRoundTest(RHE, JDRSTest.RSTEST_DFP34, "1.1818181818181818182345678901234545", "1.181818181818181818234567890123454"); } - public void Var188 () { dfpRoundTest(RHE, JDRSTest.RSTEST_DFP34, "1.1818181818181818182345678901234555", "1.181818181818181818234567890123456"); } - public void Var189 () { dfpRoundTest(RHE, JDRSTest.RSTEST_DFP34, "-1.1818181818181818182345678901234545", "-1.181818181818181818234567890123454"); } - public void Var190 () { dfpRoundTest(RHE, JDRSTest.RSTEST_DFP34, "-1.1818181818181818182345678901234555", "-1.181818181818181818234567890123456"); } + public void Var187 () { dfpRoundTest(RHE, JDRSTest.RSTEST_UPDDFP34, "1.1818181818181818182345678901234545", "1.181818181818181818234567890123454"); } + public void Var188 () { dfpRoundTest(RHE, JDRSTest.RSTEST_UPDDFP34, "1.1818181818181818182345678901234555", "1.181818181818181818234567890123456"); } + public void Var189 () { dfpRoundTest(RHE, JDRSTest.RSTEST_UPDDFP34, "-1.1818181818181818182345678901234545", "-1.181818181818181818234567890123454"); } + public void Var190 () { dfpRoundTest(RHE, JDRSTest.RSTEST_UPDDFP34, "-1.1818181818181818182345678901234555", "-1.181818181818181818234567890123456"); } /** * updateFloat -- set a DFP34 with rounding mode "round half up" */ - public void Var191 () { dfpRoundTest(RHU, JDRSTest.RSTEST_DFP34, "1.1818181818181818182345678901234555", "1.181818181818181818234567890123456"); } - public void Var192 () { dfpRoundTest(RHU, JDRSTest.RSTEST_DFP34, "1.1818181818181818182345678901234545", "1.181818181818181818234567890123455"); } - public void Var193 () { dfpRoundTest(RHU, JDRSTest.RSTEST_DFP34, "1.1818181818181818182345678901234565", "1.181818181818181818234567890123457"); } - public void Var194 () { dfpRoundTest(RHU, JDRSTest.RSTEST_DFP34, "-1.1818181818181818182345678901234555", "-1.181818181818181818234567890123456"); } - public void Var195 () { dfpRoundTest(RHU, JDRSTest.RSTEST_DFP34, "-1.1818181818181818182345678901234545", "-1.181818181818181818234567890123455"); } - public void Var196 () { dfpRoundTest(RHU, JDRSTest.RSTEST_DFP34, "-1.1818181818181818182345678901234565", "-1.181818181818181818234567890123457"); } + public void Var191 () { dfpRoundTest(RHU, JDRSTest.RSTEST_UPDDFP34, "1.1818181818181818182345678901234555", "1.181818181818181818234567890123456"); } + public void Var192 () { dfpRoundTest(RHU, JDRSTest.RSTEST_UPDDFP34, "1.1818181818181818182345678901234545", "1.181818181818181818234567890123455"); } + public void Var193 () { dfpRoundTest(RHU, JDRSTest.RSTEST_UPDDFP34, "1.1818181818181818182345678901234565", "1.181818181818181818234567890123457"); } + public void Var194 () { dfpRoundTest(RHU, JDRSTest.RSTEST_UPDDFP34, "-1.1818181818181818182345678901234555", "-1.181818181818181818234567890123456"); } + public void Var195 () { dfpRoundTest(RHU, JDRSTest.RSTEST_UPDDFP34, "-1.1818181818181818182345678901234545", "-1.181818181818181818234567890123455"); } + public void Var196 () { dfpRoundTest(RHU, JDRSTest.RSTEST_UPDDFP34, "-1.1818181818181818182345678901234565", "-1.181818181818181818234567890123457"); } /** * updateFloat -- set a DFP34 with rounding mode "round down" */ - public void Var197 () { dfpRoundTest(RD, JDRSTest.RSTEST_DFP34, "1.1818181818181818182345678901234555", "1.181818181818181818234567890123455"); } - public void Var198 () { dfpRoundTest(RD, JDRSTest.RSTEST_DFP34, "1.1818181818181818182345678901234559999999", "1.181818181818181818234567890123455"); } - public void Var199 () { dfpRoundTest(RD, JDRSTest.RSTEST_DFP34, "-1.1818181818181818182345678901234555", "-1.181818181818181818234567890123455"); } - public void Var200 () { dfpRoundTest(RD, JDRSTest.RSTEST_DFP34, "-1.1818181818181818182345678901234559999999", "-1.181818181818181818234567890123455"); } + public void Var197 () { dfpRoundTest(RD, JDRSTest.RSTEST_UPDDFP34, "1.1818181818181818182345678901234555", "1.181818181818181818234567890123455"); } + public void Var198 () { dfpRoundTest(RD, JDRSTest.RSTEST_UPDDFP34, "1.1818181818181818182345678901234559999999", "1.181818181818181818234567890123455"); } + public void Var199 () { dfpRoundTest(RD, JDRSTest.RSTEST_UPDDFP34, "-1.1818181818181818182345678901234555", "-1.181818181818181818234567890123455"); } + public void Var200 () { dfpRoundTest(RD, JDRSTest.RSTEST_UPDDFP34, "-1.1818181818181818182345678901234559999999", "-1.181818181818181818234567890123455"); } /** * updateFloat -- set a DFP34 with rounding mode "round ceiling" */ - public void Var201 () { dfpRoundTest(RC, JDRSTest.RSTEST_DFP34, "1.1818181818181818182345678901234555", "1.181818181818181818234567890123456"); } - public void Var202 () { dfpRoundTest(RC, JDRSTest.RSTEST_DFP34, "1.1818181818181818182345678901234559999999", "1.181818181818181818234567890123456"); } - public void Var203 () { dfpRoundTest(RC, JDRSTest.RSTEST_DFP34, "-1.1818181818181818182345678901234555", "-1.181818181818181818234567890123455"); } - public void Var204 () { dfpRoundTest(RC, JDRSTest.RSTEST_DFP34, "-1.1818181818181818182345678901234559999999", "-1.181818181818181818234567890123455"); } + public void Var201 () { dfpRoundTest(RC, JDRSTest.RSTEST_UPDDFP34, "1.1818181818181818182345678901234555", "1.181818181818181818234567890123456"); } + public void Var202 () { dfpRoundTest(RC, JDRSTest.RSTEST_UPDDFP34, "1.1818181818181818182345678901234559999999", "1.181818181818181818234567890123456"); } + public void Var203 () { dfpRoundTest(RC, JDRSTest.RSTEST_UPDDFP34, "-1.1818181818181818182345678901234555", "-1.181818181818181818234567890123455"); } + public void Var204 () { dfpRoundTest(RC, JDRSTest.RSTEST_UPDDFP34, "-1.1818181818181818182345678901234559999999", "-1.181818181818181818234567890123455"); } /** * updateFloat -- set a DFP34 with rounding mode "round floor" */ - public void Var205 () { dfpRoundTest(RF, JDRSTest.RSTEST_DFP34, "1.1818181818181818182345678901234555", "1.181818181818181818234567890123455"); } - public void Var206 () { dfpRoundTest(RF, JDRSTest.RSTEST_DFP34, "1.1818181818181818182345678901234559999999", "1.181818181818181818234567890123455"); } - public void Var207 () { dfpRoundTest(RF, JDRSTest.RSTEST_DFP34, "-1.1818181818181818182345678901234555", "-1.181818181818181818234567890123456"); } - public void Var208 () { dfpRoundTest(RF, JDRSTest.RSTEST_DFP34, "-1.1818181818181818182345678901234559999999", "-1.181818181818181818234567890123456"); } + public void Var205 () { dfpRoundTest(RF, JDRSTest.RSTEST_UPDDFP34, "1.1818181818181818182345678901234555", "1.181818181818181818234567890123455"); } + public void Var206 () { dfpRoundTest(RF, JDRSTest.RSTEST_UPDDFP34, "1.1818181818181818182345678901234559999999", "1.181818181818181818234567890123455"); } + public void Var207 () { dfpRoundTest(RF, JDRSTest.RSTEST_UPDDFP34, "-1.1818181818181818182345678901234555", "-1.181818181818181818234567890123456"); } + public void Var208 () { dfpRoundTest(RF, JDRSTest.RSTEST_UPDDFP34, "-1.1818181818181818182345678901234559999999", "-1.181818181818181818234567890123456"); } /** * updateFloat -- set a DFP34 with rounding mode "round half down" */ - public void Var209 () { dfpRoundTest(RHD, JDRSTest.RSTEST_DFP34, "1.1818181818181818182345678901234555", "1.181818181818181818234567890123455"); } - public void Var210 () { dfpRoundTest(RHD, JDRSTest.RSTEST_DFP34, "1.1818181818181818182345678901234545", "1.181818181818181818234567890123454"); } - public void Var211 () { dfpRoundTest(RHD, JDRSTest.RSTEST_DFP34, "1.1818181818181818182345678901234565", "1.181818181818181818234567890123456"); } - public void Var212 () { dfpRoundTest(RHD, JDRSTest.RSTEST_DFP34, "-1.1818181818181818182345678901234555", "-1.181818181818181818234567890123455"); } - public void Var213 () { dfpRoundTest(RHD, JDRSTest.RSTEST_DFP34, "-1.1818181818181818182345678901234545", "-1.181818181818181818234567890123454"); } - public void Var214 () { dfpRoundTest(RHD, JDRSTest.RSTEST_DFP34, "-1.1818181818181818182345678901234565", "-1.181818181818181818234567890123456"); } + public void Var209 () { dfpRoundTest(RHD, JDRSTest.RSTEST_UPDDFP34, "1.1818181818181818182345678901234555", "1.181818181818181818234567890123455"); } + public void Var210 () { dfpRoundTest(RHD, JDRSTest.RSTEST_UPDDFP34, "1.1818181818181818182345678901234545", "1.181818181818181818234567890123454"); } + public void Var211 () { dfpRoundTest(RHD, JDRSTest.RSTEST_UPDDFP34, "1.1818181818181818182345678901234565", "1.181818181818181818234567890123456"); } + public void Var212 () { dfpRoundTest(RHD, JDRSTest.RSTEST_UPDDFP34, "-1.1818181818181818182345678901234555", "-1.181818181818181818234567890123455"); } + public void Var213 () { dfpRoundTest(RHD, JDRSTest.RSTEST_UPDDFP34, "-1.1818181818181818182345678901234545", "-1.181818181818181818234567890123454"); } + public void Var214 () { dfpRoundTest(RHD, JDRSTest.RSTEST_UPDDFP34, "-1.1818181818181818182345678901234565", "-1.181818181818181818234567890123456"); } /** * updateFloat -- set a DFP34 with rounding mode "round up" */ - public void Var215 () { dfpRoundTest(RU, JDRSTest.RSTEST_DFP34, "1.1818181818181818182345678901234555", "1.181818181818181818234567890123456"); } - public void Var216 () { dfpRoundTest(RU, JDRSTest.RSTEST_DFP34, "1.1818181818181818182345678901234559999999", "1.181818181818181818234567890123456"); } - public void Var217 () { dfpRoundTest(RU, JDRSTest.RSTEST_DFP34, "-1.1818181818181818182345678901234555", "-1.181818181818181818234567890123456"); } - public void Var218 () { dfpRoundTest(RU, JDRSTest.RSTEST_DFP34, "-1.1818181818181818182345678901234559999999", "-1.181818181818181818234567890123456"); } + public void Var215 () { dfpRoundTest(RU, JDRSTest.RSTEST_UPDDFP34, "1.1818181818181818182345678901234555", "1.181818181818181818234567890123456"); } + public void Var216 () { dfpRoundTest(RU, JDRSTest.RSTEST_UPDDFP34, "1.1818181818181818182345678901234559999999", "1.181818181818181818234567890123456"); } + public void Var217 () { dfpRoundTest(RU, JDRSTest.RSTEST_UPDDFP34, "-1.1818181818181818182345678901234555", "-1.181818181818181818234567890123456"); } + public void Var218 () { dfpRoundTest(RU, JDRSTest.RSTEST_UPDDFP34, "-1.1818181818181818182345678901234559999999", "-1.181818181818181818234567890123456"); } @@ -2648,13 +2660,15 @@ public void Var182 () { public void updateBoolean(String inString, String outString) { if (checkJdbc20()) { if (checkBooleanSupport()) { + try { + // A previous commit could have lost lock on position. // We need to make sure that server knows we want to re-obtain the lock JDRSTest.position(rs_,key1_); JDRSTest.position(rs_, key_); rs_.updateString("C_BOOLEAN", inString); - rs_.updateRow(); + rs_.updateRow(); /* serialized */ ResultSet rs2 = statement2_.executeQuery(select_); JDRSTest.position(rs2, key_); String v = rs2.getString("C_BOOLEAN"); @@ -2662,7 +2676,7 @@ public void updateBoolean(String inString, String outString) { assertCondition(outString.equals(v), "Got "+v+" sb "+outString); } catch (Exception e) { failed(e, "Unexpected Exception"); - } + } } } } diff --git a/src/test/JD/RS/JDRSUpdateTime.java b/src/test/JD/RS/JDRSUpdateTime.java index b126aab3..dc11d06f 100644 --- a/src/test/JD/RS/JDRSUpdateTime.java +++ b/src/test/JD/RS/JDRSUpdateTime.java @@ -26,6 +26,7 @@ import test.JDRSTest; import test.JDTestDriver; import test.JDTestcase; +import test.JD.JDSerializeFile; @@ -60,6 +61,7 @@ public static void main(String args[]) throws Exception { private Statement statement_; private Statement statement2_; private ResultSet rs_; + private JDSerializeFile serializeUpdateFile_; @@ -100,13 +102,15 @@ protected void setup () + ";data truncation=true"; connection_ = testDriver_.getConnection (url,systemObject_.getUserId(), encryptedPassword_); connection_.setAutoCommit(false); // @C1A - statement_ = connection_.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, + serializeUpdateFile_ = new JDSerializeFile(connection_, JDRSTest.RSTEST_UPDATE); + connection_.commit(); + statement_ = connection_.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); statement2_ = connection_.createStatement (ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); statement_.executeUpdate ("INSERT INTO " + JDRSTest.RSTEST_UPDATE - + " (C_KEY) VALUES ('DUMMY_ROW')"); + + " (C_KEY) VALUES ('DUMMY_UPDTIME')"); statement_.executeUpdate ("INSERT INTO " + JDRSTest.RSTEST_UPDATE + " (C_KEY) VALUES ('" + key_ + "')"); @@ -128,6 +132,8 @@ protected void cleanup () rs_.close (); statement_.close (); connection_.commit(); // @C1A + serializeUpdateFile_.close(); + connection_.commit(); connection_.close (); } } @@ -193,7 +199,7 @@ public void Var003() try { JDRSTest.position (rs_, null); rs_.updateTime ("C_TIME", Time.valueOf("08:07:23")); - rs_.updateRow(); + rs_.updateRow(); /* exception */ failed ("Didn't throw SQLException"); } catch (Exception e) { @@ -530,7 +536,7 @@ public void Var018() { if (checkJdbc20 ()) { try { - JDRSTest.position (rs_, "DUMMY_ROW"); + JDRSTest.position (rs_, "DUMMY_UPDTIME"); rs_.deleteRow (); rs_.updateTime ("C_TIME", Time.valueOf("14:34:05")); failed ("Didn't throw SQLException"); @@ -1027,7 +1033,7 @@ public void Var040 () Statement s = connection_.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP16+" FOR UPDATE "); + + JDRSTest.RSTEST_UPDDFP16+" FOR UPDATE "); rs.next(); rs.updateTime (1, new Time(1423449495)); failed ("Didn't throw SQLException"); @@ -1048,7 +1054,7 @@ public void Var041 () Statement s = connection_.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP34+" FOR UPDATE "); + + JDRSTest.RSTEST_UPDDFP34+" FOR UPDATE "); rs.next(); rs.updateTime (1, new Time(1423449495)); failed ("Didn't throw SQLException"); diff --git a/src/test/JD/RS/JDRSUpdateTimestamp.java b/src/test/JD/RS/JDRSUpdateTimestamp.java index 8fd5d6d1..abdce8f5 100644 --- a/src/test/JD/RS/JDRSUpdateTimestamp.java +++ b/src/test/JD/RS/JDRSUpdateTimestamp.java @@ -29,6 +29,7 @@ import test.JDRSTest; import test.JDTestDriver; import test.JDTestcase; +import test.JD.JDSerializeFile; @@ -64,6 +65,7 @@ public static void main(String args[]) throws Exception { private Statement statement2_; private Statement statementMisc_; private ResultSet rs_; + private JDSerializeFile serializeUpdateFile_; @@ -104,7 +106,9 @@ protected void setup () + ";data truncation=true"; connection_ = testDriver_.getConnection (url,systemObject_.getUserId(), encryptedPassword_); connection_.setAutoCommit(false); // @C1A - statement_ = connection_.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, + serializeUpdateFile_ = new JDSerializeFile(connection_, JDRSTest.RSTEST_UPDATE); + connection_.commit(); + statement_ = connection_.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); statement2_ = connection_.createStatement (ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); @@ -112,7 +116,7 @@ protected void setup () ResultSet.CONCUR_UPDATABLE); statement_.executeUpdate ("INSERT INTO " + JDRSTest.RSTEST_UPDATE - + " (C_KEY) VALUES ('DUMMY_ROW')"); + + " (C_KEY) VALUES ('DUMMY_UPDTS')"); statement_.executeUpdate ("INSERT INTO " + JDRSTest.RSTEST_UPDATE + " (C_KEY) VALUES ('" + key_ + "')"); @@ -136,6 +140,8 @@ protected void cleanup () rs_.close (); statement_.close (); connection_.commit(); // @C1A + serializeUpdateFile_.close(); + connection_.commit(); connection_.close (); } } @@ -201,7 +207,7 @@ public void Var003() try { JDRSTest.position (rs_, null); rs_.updateTimestamp ("C_TIMESTAMP", new Timestamp (453443723)); - rs_.updateRow(); + rs_.updateRow(); /* exception */ failed ("Didn't throw SQLException"); } catch (Exception e) { @@ -538,7 +544,7 @@ public void Var018() { if (checkJdbc20 ()) { try { - JDRSTest.position (rs_, "DUMMY_ROW"); + JDRSTest.position (rs_, "DUMMY_UPDTS"); rs_.deleteRow (); rs_.updateTimestamp ("C_TIMESTAMP", new Timestamp (14345)); failed ("Didn't throw SQLException"); @@ -1060,7 +1066,7 @@ public void Var040 () Statement s = connection_.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP16+" FOR UPDATE "); + + JDRSTest.RSTEST_UPDDFP16+" FOR UPDATE "); rs.next(); rs.updateTimestamp (1, new Timestamp(1423449495)); failed ("Didn't throw SQLException"); @@ -1081,7 +1087,7 @@ public void Var041 () Statement s = connection_.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); ResultSet rs = s.executeQuery ("SELECT * FROM " - + JDRSTest.RSTEST_DFP34+" FOR UPDATE "); + + JDRSTest.RSTEST_UPDDFP34+" FOR UPDATE "); rs.next(); rs.updateTimestamp (1, new Timestamp(1423449495)); failed ("Didn't throw SQLException"); diff --git a/src/test/JD/RS/JDRSWasNull.java b/src/test/JD/RS/JDRSWasNull.java index b70b160b..db260a49 100644 --- a/src/test/JD/RS/JDRSWasNull.java +++ b/src/test/JD/RS/JDRSWasNull.java @@ -104,7 +104,7 @@ protected void setup () ResultSet.CONCUR_UPDATABLE); } statement_.executeUpdate ("INSERT INTO " + JDRSTest.RSTEST_GET - + " (C_KEY) VALUES ('DUMMY_ROW')"); + + " (C_KEY) VALUES ('DUMMY_WASNULL')"); rs_ = statement_.executeQuery ("SELECT * FROM " + JDRSTest.RSTEST_GET + " FOR UPDATE"); } @@ -487,7 +487,7 @@ public void Var016() { if (checkJdbc20 ()) { try { - JDRSTest.position (rs_, "DUMMY_ROW"); + JDRSTest.position (rs_, "DUMMY_WASNULL"); rs_.deleteRow (); boolean v = rs_.wasNull (); assertCondition (v == false); diff --git a/src/test/JD/RS/JDRowSetRSTestcase.java b/src/test/JD/RS/JDRowSetRSTestcase.java index 3db49d41..cffdc3cf 100644 --- a/src/test/JD/RS/JDRowSetRSTestcase.java +++ b/src/test/JD/RS/JDRowSetRSTestcase.java @@ -11,7 +11,6 @@ // /////////////////////////////////////////////////////////////////////////////// - package test.JD.RS; import com.ibm.as400.access.AS400; @@ -25,6 +24,7 @@ import test.JTOpenTestEnvironment; import test.PasswordVault; import test.Testcase; +import test.JD.JDSerializeFile; import test.JD.DataSource.JDDatabaseOverride; import java.io.ByteArrayInputStream; @@ -43,7325 +43,7056 @@ import javax.naming.InitialContext; import javax.naming.NamingException; - //native classes for Rowsets & DataSources import javax.sql.DataSource; import javax.sql.RowSet; import java.util.Map; - /** -Testcase JDRowSetRSTestcase. -**/ -public class JDRowSetRSTestcase -extends JDTestcase -{ + * Testcase JDRowSetRSTestcase. + **/ +public class JDRowSetRSTestcase extends JDTestcase { public static void main(String args[]) throws Exception { - String[] newArgs = new String[args.length+2]; - newArgs[0] = "-tc"; - newArgs[1] = "JDRowSetRSTestcase"; - for (int i = 0; i < args.length; i++) { - newArgs[2+i]=args[i]; - } - test.JDRSTest.main(newArgs); - } - private String jndiName_ = "jdbc/customer"; - static final String key2_ = "JDRowSetRSTestcase2"; - private static String select_ = "SELECT * FROM " + JDRSTest.RSTEST_UPDATE; - private static final byte[] eleven = { (byte) 'E', (byte) 'l', (byte) 'e', (byte) 'v', (byte) 'e', (byte) 'n', - (byte) ' ', (byte) ' ', (byte) ' ', (byte) ' ', (byte) ' ', (byte) ' ', - (byte) ' ', (byte) ' ', (byte) ' ', (byte) ' ', (byte) ' ', (byte) ' ', - (byte) ' ', (byte) ' ' }; - private static final byte[] twelve = { (byte) 'T', (byte) 'w', (byte) 'e', (byte) 'l', (byte) 'v', (byte) 'e' }; - - AS400JDBCRowSet updateRowset_; - AS400JDBCRowSet urlRowset_; - AS400JDBCDataSource dataSource_; - - private Connection conn_; //@a1 - private Statement stmt_; //used by the native driver for do some of the table setup stuff. - private Connection conn2_; //@pda for creatign Nclobs - StringBuffer sb = new StringBuffer(); - -/** -Constructor. -**/ - public JDRowSetRSTestcase (AS400 systemObject, - Hashtable> namesAndVars, - int runMode, - FileOutputStream fileOutputStream, - - String password, - String pwrUserId, - String pwrPassword) - { - super (systemObject, "JDRowSetRSTestcase", - namesAndVars, runMode, fileOutputStream, - password,pwrUserId,pwrPassword); - } + String[] newArgs = new String[args.length + 2]; + newArgs[0] = "-tc"; + newArgs[1] = "JDRowSetRSTestcase"; + for (int i = 0; i < args.length; i++) { + newArgs[2 + i] = args[i]; + } + test.JDRSTest.main(newArgs); + } + + private String jndiName_ = "jdbc/customer"; + static final String key2_ = "JDRowSetRSTestcase2"; + private static String select_ = "SELECT * FROM " + JDRSTest.RSTEST_UPDATE; + private static final byte[] eleven = { (byte) 'E', (byte) 'l', (byte) 'e', (byte) 'v', (byte) 'e', (byte) 'n', + (byte) ' ', (byte) ' ', (byte) ' ', (byte) ' ', (byte) ' ', (byte) ' ', (byte) ' ', (byte) ' ', (byte) ' ', + (byte) ' ', (byte) ' ', (byte) ' ', (byte) ' ', (byte) ' ' }; + private static final byte[] twelve = { (byte) 'T', (byte) 'w', (byte) 'e', (byte) 'l', (byte) 'v', (byte) 'e' }; + + AS400JDBCRowSet updateRowset_; + AS400JDBCRowSet urlRowset_; + AS400JDBCDataSource dataSource_; + + private Connection conn_; // @a1 + private Statement stmt_; // used by the native driver for do some of the table setup stuff. + private Connection conn2_; // @pda for creatign Nclobs + StringBuffer sb = new StringBuffer(); + + /** + * Constructor. + **/ + public JDRowSetRSTestcase(AS400 systemObject, Hashtable> namesAndVars, int runMode, + FileOutputStream fileOutputStream, + + String password, String pwrUserId, String pwrPassword) { + super(systemObject, "JDRowSetRSTestcase", namesAndVars, runMode, fileOutputStream, password, pwrUserId, + pwrPassword); + } + + /** + * Performs setup needed before running variations. + * + * @exception Exception If an exception occurs. + **/ + protected void setup() throws Exception { + super.setup(); + DataSource ds; // @A1 switched to generic object types instead of driver specific ones. + // Make sure this is set after JDRSTest.RSTEST_UPDATE has been updated + select_ = "SELECT * FROM " + JDRSTest.RSTEST_UPDATE; + if (getDriver() == JDTestDriver.DRIVER_TOOLBOX) { -/** -Performs setup needed before running variations. + char[] passwordChars = PasswordVault.decryptPassword(encryptedPassword_); + ds = new AS400JDBCDataSource(systemObject_.getSystemName(), systemObject_.getUserId(), passwordChars); + PasswordVault.clearPassword(passwordChars); + System.setProperty(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.fscontext.RefFSContextFactory"); // @C1A -@exception Exception If an exception occurs. -**/ - protected void setup () - throws Exception - { - super.setup(); - DataSource ds; //@A1 switched to generic object types instead of driver specific ones. - - // Make sure this is set after JDRSTest.RSTEST_UPDATE has been updated - select_ = "SELECT * FROM " + JDRSTest.RSTEST_UPDATE; - - if (getDriver () == JDTestDriver.DRIVER_TOOLBOX) - { - - - char[] passwordChars = PasswordVault.decryptPassword(encryptedPassword_); - ds = new AS400JDBCDataSource(systemObject_.getSystemName(), systemObject_.getUserId (), passwordChars); - PasswordVault.clearPassword(passwordChars); - System.setProperty(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.fscontext.RefFSContextFactory"); //@C1A - - // Set the root to a writable directory on AIX and Linux - if (JTOpenTestEnvironment.isOS400 || JTOpenTestEnvironment.isWindows || JTOpenTestEnvironment.isLinux || JTOpenTestEnvironment.isAIX) { - - System.setProperty("java.naming.provider.url", "file:///tmp"); - - java.io.File file = new java.io.File("/tmp/jdbc"); - try { - file.mkdir(); - } catch (Exception e) { - e.printStackTrace(); - } - - - } else { - output_.println("Unexpected osVersion="+JTOpenTestEnvironment.osVersion); - } - - Context context = new InitialContext(); - try - { - output_.println("binding "+jndiName_+" with "+ds); - // output_.println("Reference for ds is "+((AS400JDBCDataSource)ds).getReference()); - // Note: If this blows up with a Null Pointer Exception, this refers to the - // following bug as documented (valid 5/2/2007) at - // http://archives.java.sun.com/cgi-bin/wa?A2=ind0003&L=jndi-interest&D=0&P=3248 - // - // To fix this you need the fscontext.jar from fscontext-1_2-beta3 - // - try { - context.bind(jndiName_, ds); - } catch (NullPointerException e) { - e.printStackTrace(); - output_.println(" Note: If this blows up with a Null Pointer Exception, this refers to the"); - output_.println("following bug as documented (valid 5/2/2007) at "); - output_.println("http://archives.java.sun.com/cgi-bin/wa?A2=ind0003&L=jndi-interest&D=0&P=3248 "); - - output_.println("To fix this you need the fscontext.jar from fscontext-1_2-beta3"); - } - - } - catch(NamingException n) - { - context.unbind(jndiName_); - context.bind(jndiName_, ds); - } - - } - else - { - System.setProperty(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.fscontext.RefFSContextFactory"); - jndiName_ = "jdbc"; - ds = (DataSource) JDReflectionUtil.createObject("com.ibm.db2.jdbc.app.UDBDataSource"); - - JDReflectionUtil.callMethod_V(ds, "setDatabaseName",systemObject_.getSystemName()); - JDReflectionUtil.callMethod_V(ds, "setUser",systemObject_.getUserId ()); - JDReflectionUtil.callMethod_V(ds, "setPassword",PasswordVault.decryptPasswordLeak(encryptedPassword_)); - - Context context = new InitialContext(); - try { - context.rebind(jndiName_,ds); - } catch (Exception e) { - cleanupBindings(pwrSysUserID_, pwrSysEncryptedPassword_); - context.rebind(jndiName_,ds); - } - - // - // Must connect to the specified system.. Needed for IASP to - // work - // - conn_ = testDriver_.getConnection(baseURL_, userId_, encryptedPassword_); - stmt_ = conn_.createStatement (); - } - - conn2_ = testDriver_.getConnection (baseURL_, userId_, encryptedPassword_,"JDRowSetRSTestcase"); - - Statement s2 = conn2_.createStatement(); - s2.execute("delete from " + JDRSTest.RSTEST_UPDATE); //make sure table is empty - - } - - RowSet updater() throws Exception - { - RowSet update; - if (getDriver () == JDTestDriver.DRIVER_TOOLBOX) - { - update = new AS400JDBCRowSet(jndiName_); - update.setUsername(systemObject_.getUserId()); - - char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); - ((AS400JDBCRowSet)update).setPassword(charPassword); - PasswordVault.clearPassword(charPassword); - update.setType(ResultSet.TYPE_SCROLL_SENSITIVE); - update.setConcurrency(ResultSet.CONCUR_UPDATABLE); - update.setCommand("INSERT INTO " + JDRSTest.RSTEST_UPDATE + " (C_KEY) VALUES ('DUMMY_ROW')"); - update.execute(); - return update; - } - else - { //@A1 The native driver's rowset can not execute a command that does not return a result set. - //so we use a statement to do the setup stuff. - update = (RowSet) JDReflectionUtil.createObject("com.ibm.db2.jdbc.app.DB2JdbcRowSet"); - update.setDataSourceName(jndiName_); - update.setUsername(systemObject_.getUserId()); - update.setPassword(PasswordVault.decryptPasswordLeak(encryptedPassword_)); - update.setType(ResultSet.TYPE_SCROLL_SENSITIVE); - update.setConcurrency(ResultSet.CONCUR_UPDATABLE); - stmt_.executeUpdate("INSERT INTO " + JDRSTest.RSTEST_UPDATE + " (C_KEY) VALUES ('DUMMY_ROW')"); - return update; - } - } - private RowSet updater(String key) throws Exception - { - RowSet rowset;//@A1 - AS400JDBCRowSet rowset2; - if (getDriver () == JDTestDriver.DRIVER_TOOLBOX) - { - rowset2 = new AS400JDBCRowSet(jndiName_); - rowset = rowset2; - rowset.setUsername(systemObject_.getUserId()); - char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); - rowset2.setPassword(charPassword); - PasswordVault.clearPassword(charPassword); - rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); - rowset.setConcurrency(ResultSet.CONCUR_UPDATABLE); - rowset.setCommand("INSERT INTO " + JDRSTest.RSTEST_UPDATE + " (C_KEY) VALUES ('DUMMY_ROW')"); - rowset.execute(); - rowset.setCommand("INSERT INTO " + JDRSTest.RSTEST_UPDATE + " (C_KEY) VALUES ('" + key + "')"); - rowset.execute(); - } - else//@A1 - { - rowset = (RowSet) JDReflectionUtil.createObject("com.ibm.db2.jdbc.app.DB2JdbcRowSet"); - rowset.setDataSourceName(jndiName_); - rowset.setUsername(systemObject_.getUserId()); - String password = "passwordLeak.JDRowSetRSTestcase"; - char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); - password = new String(charPassword); - rowset.setPassword(password); - PasswordVault.clearPassword(charPassword); - rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); - rowset.setConcurrency(ResultSet.CONCUR_UPDATABLE); - stmt_.executeUpdate("INSERT INTO " + JDRSTest.RSTEST_UPDATE + " (C_KEY) VALUES ('DUMMY_ROW')"); - stmt_.executeUpdate("INSERT INTO " + JDRSTest.RSTEST_UPDATE + " (C_KEY) VALUES ('" + key + "')"); - } - - rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_UPDATE + " FOR UPDATE"); - rowset.execute(); - - return rowset; - - } - private RowSet validater() throws Exception - { - RowSet validater;//@A1 - if (getDriver () == JDTestDriver.DRIVER_TOOLBOX) - { - validater = new AS400JDBCRowSet(jndiName_); - } - else - { - validater = (RowSet) JDReflectionUtil.createObject("com.ibm.db2.jdbc.app.DB2JdbcRowSet"); - - - validater.setDataSourceName(jndiName_); - } - validater.setUsername(systemObject_.getUserId()); - validater.setPassword(PasswordVault.decryptPasswordLeak(encryptedPassword_)); - validater.setType(ResultSet.TYPE_SCROLL_INSENSITIVE); - validater.setConcurrency(ResultSet.CONCUR_READ_ONLY); - validater.setCommand("SELECT * FROM " + JDRSTest.RSTEST_UPDATE); - validater.execute(); - return validater; - } - - //@A1 - private RowSet getRowSet(String s) throws Exception - { - RowSet rowset = null; - if (getDriver () == JDTestDriver.DRIVER_TOOLBOX) - { - rowset = new AS400JDBCRowSet(s); - } - else - { - rowset = (RowSet) JDReflectionUtil.createObject("com.ibm.db2.jdbc.app.DB2JdbcRowSet"); + // Set the root to a writable directory on AIX and Linux + if (JTOpenTestEnvironment.isOS400 || JTOpenTestEnvironment.isWindows || JTOpenTestEnvironment.isLinux + || JTOpenTestEnvironment.isAIX) { - rowset.setDataSourceName(s); - } - return rowset; - } -/** -Performs cleanup needed after running variations. + System.setProperty("java.naming.provider.url", "file:///tmp"); -@exception Exception If an exception occurs. -**/ - protected void cleanup () throws Exception - { - if (getDriver () == JDTestDriver.DRIVER_NATIVE) - { - stmt_.close (); - conn_.close (); + java.io.File file = new java.io.File("/tmp/jdbc"); + try { + file.mkdir(); + } catch (Exception e) { + e.printStackTrace(); } - } + } else { + output_.println("Unexpected osVersion=" + JTOpenTestEnvironment.osVersion); + } -/** -Positions the cursor on a particular row and return the -row set. + Context context = new InitialContext(); + try { + output_.println("binding " + jndiName_ + " with " + ds); + // output_.println("Reference for ds is + // "+((AS400JDBCDataSource)ds).getReference()); + // Note: If this blows up with a Null Pointer Exception, this refers to the + // following bug as documented (valid 5/2/2007) at + // http://archives.java.sun.com/cgi-bin/wa?A2=ind0003&L=jndi-interest&D=0&P=3248 + // + // To fix this you need the fscontext.jar from fscontext-1_2-beta3 + // + try { + context.bind(jndiName_, ds); + } catch (NullPointerException e) { + e.printStackTrace(); + output_.println(" Note: If this blows up with a Null Pointer Exception, this refers to the"); + output_.println("following bug as documented (valid 5/2/2007) at "); + output_.println("http://archives.java.sun.com/cgi-bin/wa?A2=ind0003&L=jndi-interest&D=0&P=3248 "); -@param rs The row set. -@param key The key. If null, positions to before the - first row. + output_.println("To fix this you need the fscontext.jar from fscontext-1_2-beta3"); + } -@exception SQLException If an exception occurs. -**/ - public void position (RowSet rs, String key) throws SQLException - { - rs.beforeFirst (); - position0(rs, key); - } + } catch (NamingException n) { + context.unbind(jndiName_); + context.bind(jndiName_, ds); + } -/** -Positions the cursor on a particular row and return the -row set. + } else { + System.setProperty(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.fscontext.RefFSContextFactory"); + jndiName_ = "jdbc"; + ds = (DataSource) JDReflectionUtil.createObject("com.ibm.db2.jdbc.app.UDBDataSource"); -@param rs The row set. -@param key The key. If null, positions to before the - first row. + JDReflectionUtil.callMethod_V(ds, "setDatabaseName", systemObject_.getSystemName()); + JDReflectionUtil.callMethod_V(ds, "setUser", systemObject_.getUserId()); + JDReflectionUtil.callMethod_V(ds, "setPassword", PasswordVault.decryptPasswordLeak(encryptedPassword_)); -@exception SQLException If an exception occurs. -**/ - public void position0(RowSet rs, String key) throws SQLException - { - if (key != null) - { - while (rs.next ()) - { - String s = rs.getString ("C_KEY"); - if (s != null) - { - if (s.equals (key)) - return; - } - } - output_.println ("Warning: Key " + key + " not found."); - } - } + Context context = new InitialContext(); + try { + context.rebind(jndiName_, ds); + } catch (Exception e) { + cleanupBindings(pwrSysUserID_, pwrSysEncryptedPassword_); + context.rebind(jndiName_, ds); + } -/** -Forces a single warning to be posted to the statement. - -@param rs The RowSet object. - -@exception Exception If an exception occurs. -**/ - @SuppressWarnings("deprecation") - public void forceWarning (RowSet rs) - throws Exception - { //@A1 - if (getDriver () == JDTestDriver.DRIVER_TOOLBOX) - { - position(rs, "NUMBER_POS"); //@C1A - // This should force the warning "data truncation". - ((AS400JDBCRowSet)rs).getBigDecimal ("C_NUMERIC_105",0); //@C1A - //((AS400JDBCRowSet)rs).updateString ("VALUE", "Lots more than 25 characters."); //@C1D - } - else - { - rs.updateString ("VALUE", "Lots more than 25 characters."); + // + // Must connect to the specified system.. Needed for IASP to + // work + // + conn_ = testDriver_.getConnection(baseURL_, userId_, encryptedPassword_); + stmt_ = conn_.createStatement(); + } + + conn2_ = testDriver_.getConnection(baseURL_, userId_, encryptedPassword_, "JDRowSetRSTestcase"); + + Statement s2 = conn2_.createStatement(); + s2.execute("delete from " + JDRSTest.RSTEST_UPDATE); // make sure table is empty + s2.close(); + } + + void cleanUpdateTable() throws Exception { + stmt_.executeUpdate("DELETE FrOM "+JDRSTest.RSTEST_UPDATE ); + } + + RowSet updater() throws Exception { + RowSet update; + cleanUpdateTable(); + if (getDriver() == JDTestDriver.DRIVER_TOOLBOX) { + update = new AS400JDBCRowSet(jndiName_); + update.setUsername(systemObject_.getUserId()); + + char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); + ((AS400JDBCRowSet) update).setPassword(charPassword); + PasswordVault.clearPassword(charPassword); + update.setType(ResultSet.TYPE_SCROLL_SENSITIVE); + update.setConcurrency(ResultSet.CONCUR_UPDATABLE); + update.setCommand("INSERT INTO " + JDRSTest.RSTEST_UPDATE + " (C_KEY) VALUES ('DUMMY_ROW')"); + update.execute(); + return update; + } else { // @A1 The native driver's rowset can not execute a command that does not return + // a result set. + // so we use a statement to do the setup stuff. + update = (RowSet) JDReflectionUtil.createObject("com.ibm.db2.jdbc.app.DB2JdbcRowSet"); + update.setDataSourceName(jndiName_); + update.setUsername(systemObject_.getUserId()); + update.setPassword(PasswordVault.decryptPasswordLeak(encryptedPassword_)); + update.setType(ResultSet.TYPE_SCROLL_SENSITIVE); + update.setConcurrency(ResultSet.CONCUR_UPDATABLE); + stmt_.executeUpdate("INSERT INTO " + JDRSTest.RSTEST_UPDATE + " (C_KEY) VALUES ('DUMMY_ROW')"); + return update; + } + } + + private RowSet updater(String key) throws Exception { + RowSet rowset;// @A1 + AS400JDBCRowSet rowset2; + cleanUpdateTable(); + if (getDriver() == JDTestDriver.DRIVER_TOOLBOX) { + rowset2 = new AS400JDBCRowSet(jndiName_); + rowset = rowset2; + rowset.setUsername(systemObject_.getUserId()); + char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); + rowset2.setPassword(charPassword); + PasswordVault.clearPassword(charPassword); + rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); + rowset.setConcurrency(ResultSet.CONCUR_UPDATABLE); + rowset.setCommand("INSERT INTO " + JDRSTest.RSTEST_UPDATE + " (C_KEY) VALUES ('DUMMY_ROW')"); + rowset.execute(); + rowset.setCommand("INSERT INTO " + JDRSTest.RSTEST_UPDATE + " (C_KEY) VALUES ('" + key + "')"); + rowset.execute(); + } else// @A1 + { + rowset = (RowSet) JDReflectionUtil.createObject("com.ibm.db2.jdbc.app.DB2JdbcRowSet"); + rowset.setDataSourceName(jndiName_); + rowset.setUsername(systemObject_.getUserId()); + String password = "passwordLeak.JDRowSetRSTestcase"; + char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); + password = new String(charPassword); + rowset.setPassword(password); + PasswordVault.clearPassword(charPassword); + rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); + rowset.setConcurrency(ResultSet.CONCUR_UPDATABLE); + stmt_.executeUpdate("INSERT INTO " + JDRSTest.RSTEST_UPDATE + " (C_KEY) VALUES ('DUMMY_ROW')"); + stmt_.executeUpdate("INSERT INTO " + JDRSTest.RSTEST_UPDATE + " (C_KEY) VALUES ('" + key + "')"); + } + + rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_UPDATE + " FOR UPDATE"); + rowset.execute(); + + return rowset; + + } + + private RowSet validater() throws Exception { + RowSet validater;// @A1 + if (getDriver() == JDTestDriver.DRIVER_TOOLBOX) { + validater = new AS400JDBCRowSet(jndiName_); + } else { + validater = (RowSet) JDReflectionUtil.createObject("com.ibm.db2.jdbc.app.DB2JdbcRowSet"); + + validater.setDataSourceName(jndiName_); + } + validater.setUsername(systemObject_.getUserId()); + validater.setPassword(PasswordVault.decryptPasswordLeak(encryptedPassword_)); + validater.setType(ResultSet.TYPE_SCROLL_INSENSITIVE); + validater.setConcurrency(ResultSet.CONCUR_READ_ONLY); + validater.setCommand("SELECT * FROM " + JDRSTest.RSTEST_UPDATE); + validater.execute(); + return validater; + } + + // @A1 + private RowSet getRowSet(String s) throws Exception { + RowSet rowset = null; + if (getDriver() == JDTestDriver.DRIVER_TOOLBOX) { + rowset = new AS400JDBCRowSet(s); + } else { + rowset = (RowSet) JDReflectionUtil.createObject("com.ibm.db2.jdbc.app.DB2JdbcRowSet"); + + rowset.setDataSourceName(s); + } + return rowset; + } + + /** + * Performs cleanup needed after running variations. + * + * @exception Exception If an exception occurs. + **/ + protected void cleanup() throws Exception { + if (getDriver() == JDTestDriver.DRIVER_NATIVE) { + stmt_.close(); + conn_.close(); + } + } + + /** + * Positions the cursor on a particular row and return the row set. + * + * @param rs The row set. + * @param key The key. If null, positions to before the first row. + * + * @exception SQLException If an exception occurs. + **/ + public void position(RowSet rs, String key) throws SQLException { + rs.beforeFirst(); + position0(rs, key); + } + + /** + * Positions the cursor on a particular row and return the row set. + * + * @param rs The row set. + * @param key The key. If null, positions to before the first row. + * + * @exception SQLException If an exception occurs. + **/ + public void position0(RowSet rs, String key) throws SQLException { + if (key != null) { + while (rs.next()) { + String s = rs.getString("C_KEY"); + if (s != null) { + if (s.equals(key)) + return; } + } + output_.println("Warning: Key " + key + " not found."); } + } - -/** -Compares a Blob with a byte[]. -**/ - private boolean compareBlobToByteArray (Blob i, byte[] b) - throws SQLException - { - byte[] iBytes = i.getBytes (1, (int) i.length ()); // @B1C - return areEqual (iBytes, b); - } - - //takes NClob and string as args - private boolean compareNClobToString (Object i, String b) - throws SQLException - { - try{ - //same as compareClobToString, but first checks to be sure it is of type NClob (not just Clob) - if ( i.getClass().getName().indexOf("NClob") == -1) - return false; - - return compareClobToString((Clob)i, b); - }catch(Exception e) - { - return false; - } - } - -/** -Compares a Clob with a String. - -@exception SQLException If an exception occurs. -**/ - private boolean compareClobToString (Clob i, String b) - throws SQLException - { - String s = i.getSubString (1, (int) i.length ()); // @B1C - return s.equals (b); - } - - protected static boolean compareBeginsWithBytes (InputStream i, byte[] b) // @K2 - // this compare doesn't check if inputStream has more bytes or not beyond containing b - // unlike JDTestcase.compare which see thats inputStream should contain only b and nothing - // beyond it. - // this exclusion is esp. needed for native driver from v5r3m0 onwards - { - try - { - byte[] buf = new byte[b.length]; - int num = i.read(buf, 0, buf.length); - if(num == -1) - return b.length == 0; - int total = num; - while(num > -1 && total < buf.length) - { - num = i.read(buf, total, buf.length-total); - total += num; + /** + * Forces a single warning to be posted to the statement. + * + * @param rs The RowSet object. + * + * @exception Exception If an exception occurs. + **/ + @SuppressWarnings("deprecation") + public void forceWarning(RowSet rs) throws Exception { // @A1 + if (getDriver() == JDTestDriver.DRIVER_TOOLBOX) { + position(rs, "NUMBER_POS"); // @C1A + // This should force the warning "data truncation". + ((AS400JDBCRowSet) rs).getBigDecimal("C_NUMERIC_105", 0); // @C1A + // ((AS400JDBCRowSet)rs).updateString ("VALUE", "Lots more than 25 + // characters."); //@C1D + } else { + rs.updateString("VALUE", "Lots more than 25 characters."); + } + } + + /** + * Compares a Blob with a byte[]. + **/ + private boolean compareBlobToByteArray(Blob i, byte[] b) throws SQLException { + byte[] iBytes = i.getBytes(1, (int) i.length()); // @B1C + return areEqual(iBytes, b); + } + + // takes NClob and string as args + private boolean compareNClobToString(Object i, String b) throws SQLException { + try { + // same as compareClobToString, but first checks to be sure it is of type NClob + // (not just Clob) + if (i.getClass().getName().indexOf("NClob") == -1) + return false; + + return compareClobToString((Clob) i, b); + } catch (Exception e) { + return false; + } + } + + /** + * Compares a Clob with a String. + * + * @exception SQLException If an exception occurs. + **/ + private boolean compareClobToString(Clob i, String b) throws SQLException { + String s = i.getSubString(1, (int) i.length()); // @B1C + return s.equals(b); + } + + protected static boolean compareBeginsWithBytes(InputStream i, byte[] b) // @K2 + // this compare doesn't check if inputStream has more bytes or not beyond + // containing b + // unlike JDTestcase.compare which see thats inputStream should contain only b + // and nothing + // beyond it. + // this exclusion is esp. needed for native driver from v5r3m0 onwards + { + try { + byte[] buf = new byte[b.length]; + int num = i.read(buf, 0, buf.length); + if (num == -1) + return b.length == 0; + int total = num; + while (num > -1 && total < buf.length) { + num = i.read(buf, total, buf.length - total); + total += num; + } + if (num == -1) + --total; + return total == b.length && Testcase.areEqual(b, buf); + } catch (java.io.IOException e) { + return false; + } + } + + public boolean compareColumns(int i, Object[] before, Object[] after, boolean[] beforeNulls, boolean[] afterNulls, + StringBuffer message) { + boolean success = true; + if (before[i] == null) { + if (after[i] != null) { + message.append("For column " + i + " before = " + before[i] + " after = " + after[i] + "\n"); + success = false; + } + } else { + if (!before[i].equals(after[i])) { + if (before[i] instanceof byte[]) { + byte[] beforeBytes = (byte[]) before[i]; + byte[] afterBytes = (byte[]) after[i]; + if (afterBytes != null) { + if (afterBytes.length == beforeBytes.length) { + boolean ok = true; + for (int j = 0; ok && j < beforeBytes.length; j++) { + if (beforeBytes[j] != afterBytes[j]) { + ok = false; + ; + } + } + if (!ok) { + message.append("\n"); + message.append("beforeBytes: "); + for (int j = 0; j < beforeBytes.length; j++) { + message.append(Integer.toHexString(0xFF & (int) beforeBytes[j])); + } + message.append("\n"); + message.append("afterBytes: "); + for (int j = 0; j < afterBytes.length; j++) { + message.append(Integer.toHexString(0xFF & (int) afterBytes[j])); + } + message.append("\n"); + + message.append("For column " + i + " before = " + before[i] + " after = " + after[i] + "\n"); + success = false; + } + } else { + message.append("For column " + i + " before = " + before[i] + " l=" + beforeBytes.length + " after = " + + after[i] + " l= " + afterBytes.length + "\n"); + success = false; } - if(num == -1) - --total; - return total == b.length && Testcase.areEqual(b, buf); - } - catch(java.io.IOException e) - { - return false; + } else { + message.append("For byte array column " + i + " before = " + before[i] + " after = " + after[i] + "\n"); + success = false; + } + } else { + message.append("For column " + i + " before = " + before[i] + " class(" + before[i].getClass().getName() + + ") after = " + after[i] + "\n"); + success = false; } + } } + if (beforeNulls[i] != afterNulls[i]) { + message.append("For column " + i + " beforeNulls = " + beforeNulls[i] + " afterNulls = " + afterNulls[i] + "\n"); + success = false; + } - public boolean compareColumns(int i, Object[] before, Object[] after, - boolean[] beforeNulls, boolean[] afterNulls, StringBuffer message) { - boolean success = true; - if (before[i] == null) { - if (after[i] != null) { - message.append("For column "+i+" before = "+before[i]+" after = "+after[i] +"\n"); - success = false; - } - } - else { - if (! before[i].equals (after[i])) { - if ( before[i] instanceof byte[]) { - byte[] beforeBytes = (byte[]) before[i]; - byte[] afterBytes = (byte[]) after[i]; - if (afterBytes != null) { - if (afterBytes.length == beforeBytes.length) { - boolean ok = true; - for (int j = 0; ok && j < beforeBytes.length; j++) { - if (beforeBytes[j] != afterBytes[j]) { - ok = false; ; - } - } - if (!ok) { - message.append("\n"); - message.append("beforeBytes: "); - for (int j = 0; j < beforeBytes.length; j++) { - message.append(Integer.toHexString(0xFF & (int) beforeBytes[j])) ; - } - message.append("\n"); - message.append("afterBytes: "); - for (int j = 0; j < afterBytes.length; j++) { - message.append(Integer.toHexString(0xFF & (int) afterBytes[j])) ; - } - message.append("\n"); - - message.append("For column "+i+" before = "+before[i]+" after = "+after[i] +"\n"); - success = false; - } - } else { - message.append("For column "+i+" before = "+before[i]+" l="+beforeBytes.length+" after = "+after[i] +" l= "+afterBytes.length+"\n"); - success = false; - } - } else { - message.append("For byte array column "+i+" before = "+before[i]+" after = "+after[i] +"\n"); - success = false; - } - } else { - message.append("For column "+i+" before = "+before[i]+" class("+before[i].getClass().getName()+") after = "+after[i] +"\n"); - success = false; - } - } - } - - if (beforeNulls[i] != afterNulls[i]) { - message.append("For column "+i+" beforeNulls = "+beforeNulls[i]+" afterNulls = "+afterNulls[i]+"\n"); - success = false; - } - - return success; - } + return success; + } -/** -updateRow() - Should update exactly 1 column when updates are -pending. -**/ - public void Var001() - { - StringBuffer message = new StringBuffer(); - String key = "JDRowSetRSTestcase"; - if (checkJdbc20 ()) - { - try { - RowSet rowset = updater(key); - rowset.setCommand(select_ + " FOR UPDATE"); - rowset.execute(); - position (rowset, key); - - int columnCount = rowset.getMetaData ().getColumnCount (); - Object[] before = new Object[columnCount]; - boolean[] beforeNulls = new boolean[columnCount]; - for (int i = 0; i < columnCount; ++i) { - before[i] = rowset.getObject (i+1); - beforeNulls[i] = rowset.wasNull (); - } - - rowset.updateString ("C_VARCHAR_50", "Hi Mom!"); - rowset.updateRow (); - rowset.close(); - - RowSet validate = validater(); - position (validate, key); - Object[] after = new Object[columnCount]; - boolean[] afterNulls = new boolean[columnCount]; - for (int i = 0; i < columnCount; ++i) { - after[i] = validate.getObject (i+1); - afterNulls[i] = validate.wasNull (); - } - int updatedColumn = validate.findColumn ("C_VARCHAR_50") - 1; - - validate.close (); - - boolean success = true; - for (int i = 0; i < columnCount; ++i) { - if (i == updatedColumn) { - if ((! after[i].equals ("Hi Mom!")) - || (afterNulls[i] != false)) - success = false; - } - else { - success = compareColumns(i, before, after, beforeNulls, afterNulls, message) && success; - } - } - - assertCondition (success, message.toString()); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } + /** + * updateRow() - Should update exactly 1 column when updates are pending. + **/ + public void Var001() { + StringBuffer message = new StringBuffer(); + String key = "JDRowSetRSTestcase"; + if (checkJdbc20()) { + + try { + + RowSet rowset = updater(key); + rowset.setCommand(select_ + " FOR UPDATE"); + rowset.execute(); + position(rowset, key); + + int columnCount = rowset.getMetaData().getColumnCount(); + Object[] before = new Object[columnCount]; + boolean[] beforeNulls = new boolean[columnCount]; + for (int i = 0; i < columnCount; ++i) { + before[i] = rowset.getObject(i + 1); + beforeNulls[i] = rowset.wasNull(); + } + + rowset.updateString("C_VARCHAR_50", "Hi Mom!"); + rowset.updateRow(); + rowset.close(); + + RowSet validate = validater(); + position(validate, key); + Object[] after = new Object[columnCount]; + boolean[] afterNulls = new boolean[columnCount]; + for (int i = 0; i < columnCount; ++i) { + after[i] = validate.getObject(i + 1); + afterNulls[i] = validate.wasNull(); + } + int updatedColumn = validate.findColumn("C_VARCHAR_50") - 1; + + validate.close(); + + boolean success = true; + for (int i = 0; i < columnCount; ++i) { + if (i == updatedColumn) { + if ((!after[i].equals("Hi Mom!")) || (afterNulls[i] != false)) + success = false; + } else { + success = compareColumns(i, before, after, beforeNulls, afterNulls, message) && success; + } } - } - -/** -cancelRowUpdates() - Should have no effect when no updates are pending. -**/ - public void Var002() - { - StringBuffer message = new StringBuffer(); - String key = "JDRowSetRSTestcase"; - if (checkJdbc20 ()) { - try { - RowSet rowset = updater(key); - position (rowset, key); - - int columnCount = rowset.getMetaData ().getColumnCount (); - Object[] before = new Object[columnCount]; - boolean[] beforeNulls = new boolean[columnCount]; - for (int i = 0; i < columnCount; ++i) { - before[i] = rowset.getObject (i+1); - beforeNulls[i] = rowset.wasNull (); - } + assertCondition(success, message.toString()); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } finally { + + } + } + } - rowset.cancelRowUpdates (); - rowset.close(); + /** + * cancelRowUpdates() - Should have no effect when no updates are pending. + **/ + public void Var002() { + StringBuffer message = new StringBuffer(); + String key = "JDRowSetRSTestcase"; + if (checkJdbc20()) { + + try { + + RowSet rowset = updater(key); + position(rowset, key); - RowSet validate = validater(); - position (validate, key); + int columnCount = rowset.getMetaData().getColumnCount(); + Object[] before = new Object[columnCount]; + boolean[] beforeNulls = new boolean[columnCount]; + for (int i = 0; i < columnCount; ++i) { + before[i] = rowset.getObject(i + 1); + beforeNulls[i] = rowset.wasNull(); + } - Object[] after = new Object[columnCount]; - boolean[] afterNulls = new boolean[columnCount]; - for (int i = 0; i < columnCount; ++i) { - after[i] = validate.getObject (i+1); - afterNulls[i] = validate.wasNull (); - } - validate.close (); + rowset.cancelRowUpdates(); + rowset.close(); - boolean success = true; - for (int i = 0; i < columnCount; ++i) - { - success = compareColumns(i, before, after, beforeNulls, afterNulls, message) && success; - } + RowSet validate = validater(); + position(validate, key); - assertCondition (success, message.toString()); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); + Object[] after = new Object[columnCount]; + boolean[] afterNulls = new boolean[columnCount]; + for (int i = 0; i < columnCount; ++i) { + after[i] = validate.getObject(i + 1); + afterNulls[i] = validate.wasNull(); } + validate.close(); + + boolean success = true; + for (int i = 0; i < columnCount; ++i) { + success = compareColumns(i, before, after, beforeNulls, afterNulls, message) && success; } + + assertCondition(success, message.toString()); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } finally { + + } } + } + /** + * cancelRowUpdates() - Should clear any pending updates. + **/ + public void Var003() { + StringBuffer message = new StringBuffer(); + String key = "JDRowSetRSTestcase"; + if (checkJdbc20()) { + + try { + + RowSet rowset = updater(key); + position(rowset, key); + + int columnCount = rowset.getMetaData().getColumnCount(); + Object[] before = new Object[columnCount]; + boolean[] beforeNulls = new boolean[columnCount]; + for (int i = 0; i < columnCount; ++i) { + before[i] = rowset.getObject(i + 1); + beforeNulls[i] = rowset.wasNull(); + } + + rowset.updateInt("C_INTEGER", 9836); + rowset.updateNull("C_SMALLINT"); + rowset.updateFloat("C_FLOAT", -9.25f); + rowset.cancelRowUpdates(); + rowset.updateRow(); + rowset.close(); + + // Validate. + RowSet validate = validater(); + position(validate, key); + Object[] after = new Object[columnCount]; + boolean[] afterNulls = new boolean[columnCount]; + for (int i = 0; i < columnCount; ++i) { + after[i] = validate.getObject(i + 1); + afterNulls[i] = validate.wasNull(); + } + validate.close(); + + boolean success = true; + for (int i = 0; i < columnCount; ++i) { + success = compareColumns(i, before, after, beforeNulls, afterNulls, message) && success; + } + + assertCondition(success, message.toString()); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } finally { + + } + } + } + /** + * clearWarnings() - Clears warnings after 1 has been posted. + **/ + public void Var004() { + String name = "jdbc/var004"; + RowSet rowset = null; + if (getDriver() == JDTestDriver.DRIVER_NATIVE) { + notApplicable("Native directory not set up correctly for this test"); + return; + } -/** -cancelRowUpdates() - Should clear any pending updates. -**/ - public void Var003() - { - StringBuffer message = new StringBuffer(); - String key = "JDRowSetRSTestcase"; - if (checkJdbc20 ()) { + if (checkJdbc20()) { + String systemName = systemObject_.getSystemName().trim(); + String databaseName = "UNSET"; + try { + databaseName = JDDatabaseOverride.getDatabaseNameFromSystemName(systemName, output_); + DataSource ds; + if (getDriver() == JDTestDriver.DRIVER_TOOLBOX) { + + ds = new AS400JDBCDataSource(systemName, systemObject_.getUserId(), encryptedPassword_); + ((AS400JDBCDataSource) ds).setDatabaseName(databaseName); + ((AS400JDBCDataSource) ds).setDataTruncation(true); + } else { + name = "jdbc"; + ds = (DataSource) JDReflectionUtil.createObject("com.ibm.db2.jdbc.app.UDBDataSource"); + + JDReflectionUtil.callMethod_V(ds, "setDatabaseName", name); + JDReflectionUtil.callMethod_V(ds, "setUser", systemObject_.getUserId()); + JDReflectionUtil.callMethod_V(ds, "setPassword", PasswordVault.decryptPasswordLeak(encryptedPassword_)); + JDReflectionUtil.callMethod_V(ds, "setDataTruncation", true); + } + Context context = new InitialContext(); try { - RowSet rowset = updater(key); - position (rowset, key); - - int columnCount = rowset.getMetaData ().getColumnCount (); - Object[] before = new Object[columnCount]; - boolean[] beforeNulls = new boolean[columnCount]; - for (int i = 0; i < columnCount; ++i) { - before[i] = rowset.getObject (i+1); - beforeNulls[i] = rowset.wasNull (); - } + context.bind(name, ds); + } catch (NamingException n) { + context.unbind(name); + context.bind(name, ds); + } + + rowset = getRowSet(name); + rowset.setUsername(systemObject_.getUserId()); + char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); + JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); + PasswordVault.clearPassword(charPassword); + rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); + rowset.setConcurrency(ResultSet.CONCUR_UPDATABLE); + if (getDriver() == JDTestDriver.DRIVER_TOOLBOX) + rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); + else + rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_POS + " FOR UPDATE"); + + rowset.execute(); + if (rowset.next()) { + // force a warning... + forceWarning(rowset); // @C1A + // rowset.updateString ("VALUE", "Here is a lot more than 25 characters."); + // //@C1D + + SQLWarning w1 = rowset.getWarnings(); + rowset.clearWarnings(); + + SQLWarning w2 = rowset.getWarnings(); + assertCondition((w1 != null) && (w2 == null), "systemName=" + systemName + " databaseName=" + databaseName); + } else + failed("Unexpected Results.systemName=" + systemName + " databaseName=" + databaseName); + } catch (Exception e) { + failed(e, "Unexpected Exception systemName=" + systemName + " databaseName=" + databaseName); + } finally { + + } + } + } - rowset.updateInt ("C_INTEGER", 9836); - rowset.updateNull ("C_SMALLINT"); - rowset.updateFloat ("C_FLOAT", -9.25f); - rowset.cancelRowUpdates (); - rowset.updateRow (); - rowset.close(); + /** + * getWarning() - Returns the first warning when 1 warning has been reported. + **/ + public void Var005() { + String name = "jdbc/var005"; + if (getDriver() == JDTestDriver.DRIVER_NATIVE) { + notApplicable("Native directory not set up correctly for this test"); + return; + } + if (checkJdbc20()) { + try { + DataSource dataSource; + if (getDriver() == JDTestDriver.DRIVER_TOOLBOX) { - // Validate. - RowSet validate = validater(); - position (validate, key); - Object[] after = new Object[columnCount]; - boolean[] afterNulls = new boolean[columnCount]; - for (int i = 0; i < columnCount; ++i) { - after[i] = validate.getObject (i+1); - afterNulls[i] = validate.wasNull (); - } - validate.close (); + String systemName = systemObject_.getSystemName(); + String databaseName = JDDatabaseOverride.getDatabaseNameFromSystemName(systemName, output_); + dataSource = new AS400JDBCDataSource(systemName, systemObject_.getUserId(), encryptedPassword_); + ((AS400JDBCDataSource) dataSource).setDatabaseName(databaseName); + ((AS400JDBCDataSource) dataSource).setDataTruncation(true); + } else { + name = "jdbc"; - boolean success = true; - for (int i = 0; i < columnCount; ++i) { - success = compareColumns(i, before, after, beforeNulls, afterNulls, message) && success; - } + dataSource = (DataSource) JDReflectionUtil.createObject("com.ibm.db2.jdbc.app.UDBDataSource"); - assertCondition (success, message.toString()); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } + JDReflectionUtil.callMethod_V(dataSource, "setDatabaseName", name); + JDReflectionUtil.callMethod_V(dataSource, "setUser", systemObject_.getUserId()); + JDReflectionUtil.callMethod_V(dataSource, "setPassword", + PasswordVault.decryptPasswordLeak(encryptedPassword_)); + JDReflectionUtil.callMethod_V(dataSource, "setDataTruncation", true); + } -/** -clearWarnings() - Clears warnings after 1 has been posted. -**/ - public void Var004() - { - String name = "jdbc/var004"; - RowSet rowset = null; - if (getDriver () == JDTestDriver.DRIVER_NATIVE) - { - notApplicable("Native directory not set up correctly for this test"); - return; - } - - if (checkJdbc20 ()) { - String systemName = systemObject_.getSystemName().trim(); - String databaseName = "UNSET"; - try { - databaseName = JDDatabaseOverride.getDatabaseNameFromSystemName(systemName, output_); - DataSource ds; - if (getDriver () == JDTestDriver.DRIVER_TOOLBOX) - { - - - ds = new AS400JDBCDataSource(systemName, systemObject_.getUserId(), encryptedPassword_); - ((AS400JDBCDataSource)ds).setDatabaseName(databaseName); - ((AS400JDBCDataSource)ds).setDataTruncation(true); - } - else - { - name = "jdbc"; - ds = (DataSource) JDReflectionUtil.createObject("com.ibm.db2.jdbc.app.UDBDataSource"); - - JDReflectionUtil.callMethod_V(ds,"setDatabaseName",name); - JDReflectionUtil.callMethod_V(ds,"setUser",systemObject_.getUserId ()); - JDReflectionUtil.callMethod_V(ds,"setPassword",PasswordVault.decryptPasswordLeak(encryptedPassword_)); - JDReflectionUtil.callMethod_V(ds,"setDataTruncation",true); - } - Context context = new InitialContext(); - try - { - context.bind(name, ds); - } - catch(NamingException n) - { - context.unbind(name); - context.bind(name, ds); - } - - rowset = getRowSet(name); - rowset.setUsername(systemObject_.getUserId()); - char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); - JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); - PasswordVault.clearPassword(charPassword); - rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); - rowset.setConcurrency(ResultSet.CONCUR_UPDATABLE); - if( getDriver() == JDTestDriver.DRIVER_TOOLBOX ) - rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); - else - rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_POS + " FOR UPDATE"); - - rowset.execute(); - if (rowset.next ()) - { - // force a warning... - forceWarning(rowset); //@C1A - //rowset.updateString ("VALUE", "Here is a lot more than 25 characters."); //@C1D - - SQLWarning w1 = rowset.getWarnings (); - rowset.clearWarnings (); - - SQLWarning w2 = rowset.getWarnings (); - assertCondition ((w1 != null) && (w2 == null), "systemName="+systemName+" databaseName="+databaseName); - } - else - failed("Unexpected Results.systemName="+systemName+" databaseName="+databaseName); - } - catch (Exception e) - { - failed(e, "Unexpected Exception systemName="+systemName+" databaseName="+databaseName); - } - finally - { - try - { - rowset.close (); - } - catch (SQLException sq) { sq.printStackTrace(); } - } + Context context = new InitialContext(); + try { + context.bind(name, dataSource); + } catch (NamingException n) { + context.unbind(name); + context.bind(name, dataSource); + } + + RowSet rowset = getRowSet(name); + rowset.setUsername(systemObject_.getUserId()); + char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); + JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); + PasswordVault.clearPassword(charPassword); + rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); + rowset.setConcurrency(ResultSet.CONCUR_UPDATABLE); + if (getDriver() == JDTestDriver.DRIVER_TOOLBOX) // @C1A + rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); // @C1A + else // @C1A + rowset.setCommand("SELECT ID, VALUE FROM " + JDRSTest.RSTEST_POS + " FOR UPDATE"); + rowset.setMaxFieldSize(25); + + rowset.execute(); + rowset.next(); + rowset.clearWarnings(); + + forceWarning(rowset); + SQLWarning w1 = rowset.getWarnings(); + + if (w1 == null) { + rowset.close(); + failed("Testcase setup failed."); + } else { + SQLWarning w2 = w1.getNextWarning(); + rowset.close(); + assertCondition((w1 != null) && (w2 == null)); } + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } } + } -/** -getWarning() - Returns the first warning when 1 warning has been -reported. -**/ - public void Var005() - { - String name = "jdbc/var005"; - if (getDriver () == JDTestDriver.DRIVER_NATIVE) { - notApplicable("Native directory not set up correctly for this test"); - return; - } - if (checkJdbc20 ()) { - try - { - DataSource dataSource; - if (getDriver () == JDTestDriver.DRIVER_TOOLBOX) - { - - String systemName = systemObject_.getSystemName(); - String databaseName = JDDatabaseOverride.getDatabaseNameFromSystemName(systemName, output_); - dataSource = new AS400JDBCDataSource(systemName, systemObject_.getUserId(), encryptedPassword_); - ((AS400JDBCDataSource)dataSource).setDatabaseName(databaseName); - ((AS400JDBCDataSource)dataSource).setDataTruncation(true); - } - else - { - name = "jdbc"; - - - dataSource = (DataSource) JDReflectionUtil.createObject("com.ibm.db2.jdbc.app.UDBDataSource"); - - JDReflectionUtil.callMethod_V(dataSource,"setDatabaseName",name); - JDReflectionUtil.callMethod_V(dataSource,"setUser",systemObject_.getUserId ()); - JDReflectionUtil.callMethod_V(dataSource,"setPassword",PasswordVault.decryptPasswordLeak(encryptedPassword_)); - JDReflectionUtil.callMethod_V(dataSource,"setDataTruncation",true); - - } - - Context context = new InitialContext(); - try - { - context.bind(name, dataSource); - } - catch(NamingException n) - { - context.unbind(name); - context.bind(name, dataSource); - } - - RowSet rowset = getRowSet(name); - rowset.setUsername(systemObject_.getUserId()); - char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); - JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); - PasswordVault.clearPassword(charPassword); - rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); - rowset.setConcurrency(ResultSet.CONCUR_UPDATABLE); - if( getDriver() == JDTestDriver.DRIVER_TOOLBOX ) //@C1A - rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); //@C1A - else //@C1A - rowset.setCommand("SELECT ID, VALUE FROM " + JDRSTest.RSTEST_POS + " FOR UPDATE"); - rowset.setMaxFieldSize (25); - - rowset.execute(); - rowset.next (); - rowset.clearWarnings (); - - forceWarning (rowset); - SQLWarning w1 = rowset.getWarnings (); - - if (w1 == null) - failed("Testcase setup failed."); - else - { - SQLWarning w2 = w1.getNextWarning (); - rowset.close (); - assertCondition ((w1 != null) && (w2 == null)); - } - } - catch (Exception e) { - failed(e, "Unexpected Exception"); - } - } + /** + * Validates that close() works as expected. + **/ + public void Var006() { + try { + RowSet rowset = getRowSet(jndiName_); + rowset.setUsername(systemObject_.getUserId()); + char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); + JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); + PasswordVault.clearPassword(charPassword); + rowset.setCommand("SELECT * FROM QIWS.QCUSTCDT"); + rowset.execute(); + + if (rowset.next()) { + rowset.close(); + + rowset.next(); + } + failed("Unexpected Results."); + rowset.close(); + } catch (SQLException sq) { + succeeded(); + } catch (Exception e) { + failed(e, "Unexpected Exception."); } + } - /** - * Validates that close() works as expected. - **/ - public void Var006() - { - try - { - RowSet rowset = getRowSet(jndiName_); - rowset.setUsername(systemObject_.getUserId()); - char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); - JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); - PasswordVault.clearPassword(charPassword); - rowset.setCommand("SELECT * FROM QIWS.QCUSTCDT"); + /** + * Validates that deleteRow works as expected. + **/ + public void Var007() { + if (getDriver() == JDTestDriver.DRIVER_TOOLBOX) { + // notApplicable("This testcase fails for some and not for others. Get back to + // it when we have free time."); + // return; + // Note: Paul can never get this to fail...not sure why others see it fail... + } + sb.setLength(0); + String key = "AA.JDRowSet"; + + try { + + stmt_.executeUpdate("DELETE FROM " + JDRSTest.RSTEST_UPDATE + " WHERE C_KEY LIKE '" + key + "%'"); + RowSet rowset = updater(key); + for (int i = 1; i < 198; ++i) { // @A1 + if (getDriver() == JDTestDriver.DRIVER_TOOLBOX) { + rowset.setCommand("INSERT INTO " + JDRSTest.RSTEST_UPDATE + " (C_KEY) VALUES ('" + key + i + "')"); rowset.execute(); - - if (rowset.next()) - { - rowset.close(); - - rowset.next(); - } - else - failed("Unexpected Results."); - } - catch (SQLException sq) - { - succeeded(); - } - catch (Exception e) - { - failed(e, "Unexpected Exception."); - } - } - - /** - * Validates that deleteRow works as expected. - **/ - public void Var007() - { - if (getDriver () == JDTestDriver.DRIVER_TOOLBOX) - { - // notApplicable("This testcase fails for some and not for others. Get back to it when we have free time."); - //return; - //Note: Paul can never get this to fail...not sure why others see it fail... + } else { + stmt_.executeUpdate("INSERT INTO " + JDRSTest.RSTEST_UPDATE + " (C_KEY) VALUES ('" + key + i + "')"); } - sb.setLength(0); - String key = "JDRSDeleteRow"; - try - { - RowSet rowset = updater(key); - for (int i = 1; i < 198; ++i) - { //@A1 - if (getDriver () == JDTestDriver.DRIVER_TOOLBOX) - { - rowset.setCommand("INSERT INTO " + JDRSTest.RSTEST_UPDATE + " (C_KEY) VALUES ('" + key + i + "')"); - rowset.execute(); - } - else - { - stmt_.executeUpdate("INSERT INTO " + JDRSTest.RSTEST_UPDATE + " (C_KEY) VALUES ('" + key + i + "')"); - } - } - - rowset.setCommand(select_ + " FOR UPDATE"); - rowset.execute(); + } - rowset.beforeFirst (); - int rowCountBefore = 0; - Vector keysBefore = new Vector (); - while (rowset.next ()) - { - ++rowCountBefore; - keysBefore.addElement (rowset.getString ("C_KEY")); - } + rowset.setCommand(select_ + " ORDER BY C_KEY FOR UPDATE"); + rowset.execute(); - rowset.first (); - rowset.deleteRow (); - rowset.close(); + rowset.beforeFirst(); + int rowCountBefore = 0; + Vector keysBefore = new Vector(); + while (rowset.next()) { + ++rowCountBefore; + keysBefore.addElement(rowset.getString("C_KEY")); + } - // Verify results. - RowSet rowset2 = getRowSet(jndiName_); - rowset2.setUsername(systemObject_.getUserId()); - rowset2.setPassword(PasswordVault.decryptPasswordLeak(encryptedPassword_)); - rowset2.setCommand(select_); - rowset2.setType(ResultSet.TYPE_SCROLL_INSENSITIVE); - rowset2.setConcurrency(ResultSet.CONCUR_READ_ONLY); - rowset2.execute(); - - int rowCountAfter = 0; - Vector keysAfter = new Vector (); - while (rowset2.next ()) { - ++rowCountAfter; - keysAfter.addElement (rowset2.getString ("C_KEY")); - } - rowset2.close (); - - boolean success = true; - for (int i = 0; i < rowCountAfter; ++i) { //@K1C changed from rowCountBefore to rowCountAfter - //if (i < deletedRow) //Should never be here, i starts as 0 @K1D - // if (! keysBefore.elementAt (i).equals (keysAfter.elementAt (i))) //@K1D - // success = false; //@K1D - //} //@K1D - //else if (i > deletedRow) { //Should always be here //@K1D - try //put the try catch in to count for entries with that are null, this occurs if you run //@K1A - { //the entire ResultSet testcases. //@K1A - if (! keysBefore.elementAt (i+1).equals (keysAfter.elementAt (i))) { - success = false; - sb.append("for i="+i+" keysBefore.elementAt (i+1)='"+ - keysBefore.elementAt (i+1)+"' keysAfter.elementAt(i)=' "+ - keysAfter.elementAt (i)+"'"); - } - } //@K1A - catch(Exception e) //@K1A - { //@K1A - if(e instanceof NullPointerException) //@K1A - { //@K1A - if(!((keysBefore.elementAt(i+1) == null) && - (keysAfter.elementAt(i)==null))) { //@K1A - success = false; //@K1A - sb.append("\nfor i="+i+" keysBefore.elementAt (i+1)='"+ - keysBefore.elementAt (i+1)+"' keysAfter.elementAt(i)=' "+ - keysAfter.elementAt (i)+"'"); - - } - } //@K1A - } //@K1A - //} @K1D + rowset.first(); + rowset.deleteRow(); + rowset.close(); + + // Verify results. + RowSet rowset2 = getRowSet(jndiName_); + rowset2.setUsername(systemObject_.getUserId()); + rowset2.setPassword(PasswordVault.decryptPasswordLeak(encryptedPassword_)); + rowset2.setCommand(select_ + " ORDER BY C_KEY"); + rowset2.setType(ResultSet.TYPE_SCROLL_INSENSITIVE); + rowset2.setConcurrency(ResultSet.CONCUR_READ_ONLY); + rowset2.execute(); + + int rowCountAfter = 0; + Vector keysAfter = new Vector(); + while (rowset2.next()) { + ++rowCountAfter; + keysAfter.addElement(rowset2.getString("C_KEY")); + } + rowset2.close(); + + boolean success = true; + for (int i = 0; i < rowCountAfter; ++i) { // @K1C changed from rowCountBefore to rowCountAfter + // if (i < deletedRow) //Should never be here, i starts as 0 @K1D + // if (! keysBefore.elementAt (i).equals (keysAfter.elementAt (i))) //@K1D + // success = false; //@K1D + // } //@K1D + // else if (i > deletedRow) { //Should always be here //@K1D + try // put the try catch in to count for entries with that are null, this occurs if + // you run //@K1A + { // the entire ResultSet testcases. //@K1A + if (!keysBefore.elementAt(i + 1).equals(keysAfter.elementAt(i))) { + success = false; + sb.append("\nfor i=" + i + " keysBefore.elementAt (i+1)='" + keysBefore.elementAt(i + 1) + + "' keysAfter.elementAt(i)=' " + keysAfter.elementAt(i) + "'"); } + } // @K1A + catch (Exception e) // @K1A + { // @K1A + if (e instanceof NullPointerException) // @K1A + { // @K1A + if (!((keysBefore.elementAt(i + 1) == null) && (keysAfter.elementAt(i) == null))) { // @K1A + success = false; // @K1A + sb.append("\nfor i=" + i + " keysBefore.elementAt (i+1)='" + keysBefore.elementAt(i + 1) + + "' keysAfter.elementAt(i)=' " + keysAfter.elementAt(i) + "'"); - assertCondition (success && (rowCountAfter == (rowCountBefore - 1)), - sb.toString() + "\nsuccess = "+success+" rowCountAfter="+rowCountAfter+" sb "+(rowCountBefore-1)); - } - catch (Exception e) - { - failed (e, "Unexpected Exception"); - } - } - - /** - * Validates that findColumn(String) works as expected. - **/ - public void Var008() - { - try - { - RowSet rowset = getRowSet(jndiName_); - rowset.setUsername(systemObject_.getUserId()); - char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); - JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); - PasswordVault.clearPassword(charPassword); - rowset.setCommand("SELECT CUSNUM,LSTNAM,INIT FROM QIWS.QCUSTCDT"); - rowset.execute(); + } + } // @K1A + } // @K1A + // } @K1D + } - int i = rowset.findColumn ("INIT"); - rowset.close (); - assertCondition (i == 3); - } - catch (Exception e) - { - failed(e, "Unexpected Exception"); - } + assertCondition(success && (rowCountAfter == (rowCountBefore - 1)), + sb.toString() + "\nsuccess = " + success + " rowCountAfter=" + rowCountAfter + " sb " + (rowCountBefore - 1)); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } finally { + } + } - /** - * Validates first() works as expected. - **/ - public void Var009() - { - try - { - RowSet rowset = getRowSet(jndiName_); - rowset.setUsername(systemObject_.getUserId()); - char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); - JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); - PasswordVault.clearPassword(charPassword); - rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); - rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_POS); - rowset.execute(); + /** + * Validates that findColumn(String) works as expected. + **/ + public void Var008() { + try { + RowSet rowset = getRowSet(jndiName_); + rowset.setUsername(systemObject_.getUserId()); + char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); + JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); + PasswordVault.clearPassword(charPassword); + rowset.setCommand("SELECT CUSNUM,LSTNAM,INIT FROM QIWS.QCUSTCDT"); + rowset.execute(); + + int i = rowset.findColumn("INIT"); + rowset.close(); + assertCondition(i == 3); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + + /** + * Validates first() works as expected. + **/ + public void Var009() { + try { + RowSet rowset = getRowSet(jndiName_); + rowset.setUsername(systemObject_.getUserId()); + char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); + JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); + PasswordVault.clearPassword(charPassword); + rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); + rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_POS); + rowset.execute(); + + boolean success = rowset.first(); + int id1 = rowset.getInt(1); + rowset.close(); + assertCondition((success == true) && (id1 == 1)); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + + /** + * getArray() - Get from a INTEGER. + **/ + public void Var010() { + RowSet rowset = null; - boolean success = rowset.first (); - int id1 = rowset.getInt (1); - rowset.close (); - assertCondition ((success == true) && (id1 == 1)); - } - catch (Exception e) - { - failed(e, "Unexpected Exception"); - } + if (checkJdbc20()) { + try { + rowset = getRowSet(jndiName_); + rowset.setUsername(systemObject_.getUserId()); + char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); + JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); + PasswordVault.clearPassword(charPassword); + rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); + rowset.execute(); + + position(rowset, "NUMBER_POS"); + Array v = rowset.getArray("C_INTEGER"); + failed("Didn't throw SQLException but got " + v); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } finally { + + } } + } - -/** -getArray() - Get from a INTEGER. -**/ - public void Var010 () - { - RowSet rowset = null; - - if (checkJdbc20 ()) { - try { - rowset = getRowSet(jndiName_); - rowset.setUsername(systemObject_.getUserId()); - char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); - JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); - PasswordVault.clearPassword(charPassword); - rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); - rowset.execute(); - - position (rowset, "NUMBER_POS"); - Array v = rowset.getArray ("C_INTEGER"); - failed ("Didn't throw SQLException but got "+v); - } - catch (Exception e) { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - finally - { - try - { - rowset.close(); - } - catch (SQLException sq) { /* ignore */ } - } - } + /** + * getAsciiStream() - Should work when the column index is valid. + **/ + public void Var011() { + try { + RowSet rowset = getRowSet(jndiName_); + rowset.setUsername(systemObject_.getUserId()); + char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); + JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); + PasswordVault.clearPassword(charPassword); + rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); + rowset.execute(); + + position0(rowset, "CHAR_FULL"); + InputStream v = rowset.getAsciiStream(12); + sb.setLength(0); + if (getDriver() == JDTestDriver.DRIVER_NATIVE && // @K2 + true) // @K2 + assertCondition( + compareBeginsWithBytes(v, "Toolbox for Java ".getBytes("8859_1"), sb), sb); // @K2 + else // @K2 + assertCondition(compare(v, "Toolbox for Java ", "8859_1", sb), sb); + v.close(); + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + + /** + * getAsciiStream() - Should work when the column name is valid. + **/ + public void Var012() { + try { + RowSet rowset = getRowSet(jndiName_); + rowset.setUsername(systemObject_.getUserId()); + char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); + JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); + PasswordVault.clearPassword(charPassword); + rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); + rowset.execute(); + + position0(rowset, "CHAR_FULL"); + InputStream v = rowset.getAsciiStream("C_CHAR_50"); + sb.setLength(0); + if (getDriver() == JDTestDriver.DRIVER_NATIVE && // @K2 + true) // @K2 + assertCondition( + compareBeginsWithBytes(v, "Toolbox for Java ".getBytes("8859_1"), sb), sb); // @K2 + else // @K2 + assertCondition(compare(v, "Toolbox for Java ", "8859_1", sb), sb); + v.close(); + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + + /** + * getBinaryStream() - Should work when the column index is valid. + **/ + public void Var013() { + sb.setLength(0); + try { + RowSet rowset = getRowSet(jndiName_); + rowset.setUsername(systemObject_.getUserId()); + char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); + JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); + PasswordVault.clearPassword(charPassword); + rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); + rowset.execute(); + + position0(rowset, "BINARY_NOTRANS"); + InputStream v = rowset.getBinaryStream(18); + if (getDriver() == JDTestDriver.DRIVER_NATIVE && // @K2 + true) // @K2 + assertCondition(compareBeginsWithBytes(v, twelve)); // @K2 + else // @K2 + assertCondition(compare(v, twelve, sb), sb); + v.close(); + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + + /** + * getBinaryStream() - Should work when the column name is valid. + **/ + public void Var014() { + sb.setLength(0); + + try { + RowSet rowset = getRowSet(jndiName_); + rowset.setUsername(systemObject_.getUserId()); + char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); + JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); + PasswordVault.clearPassword(charPassword); + rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); + rowset.execute(); + + position0(rowset, "BINARY_NOTRANS"); + InputStream v = rowset.getBinaryStream("C_BINARY_20"); + if (getDriver() == JDTestDriver.DRIVER_NATIVE && // @K2 + true) // @K2 + assertCondition(compareBeginsWithBytes(v, eleven)); // @K2 + else // @K2 + assertCondition(compare(v, eleven, sb), sb); + v.close(); + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + + /** + * getBigDecimal() - Should work when the column index is valid. + **/ + public void Var015() { + if (checkJdbc20()) { + try { + RowSet rowset = getRowSet(jndiName_); + rowset.setUsername(systemObject_.getUserId()); + char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); + JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); + PasswordVault.clearPassword(charPassword); + rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); + rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); + rowset.execute(); + + position(rowset, "NUMBER_POS"); + BigDecimal v = rowset.getBigDecimal(8); + assertCondition(v.doubleValue() == 8.8888); + + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } } + } -/** -getAsciiStream() - Should work when the column index is valid. -**/ - public void Var011() - { - try { - RowSet rowset = getRowSet(jndiName_); - rowset.setUsername(systemObject_.getUserId()); - char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); - JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); - PasswordVault.clearPassword(charPassword); - rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); - rowset.execute(); - - position0 (rowset, "CHAR_FULL"); - InputStream v = rowset.getAsciiStream (12); - sb.setLength(0); - if(getDriver() == JDTestDriver.DRIVER_NATIVE && // @K2 - true ) // @K2 - assertCondition( compareBeginsWithBytes( v, "Toolbox for Java ".getBytes("8859_1"),sb),sb); // @K2 - else // @K2 - assertCondition (compare (v, "Toolbox for Java ", "8859_1",sb),sb); - - rowset.close(); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } + /** + * getBigDecimal() - Should work when the column name is valid. + **/ + public void Var016() { + if (checkJdbc20()) { + try { + RowSet rowset = getRowSet(jndiName_); + rowset.setUsername(systemObject_.getUserId()); + char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); + JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); + PasswordVault.clearPassword(charPassword); + rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); + rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); + rowset.execute(); + + position(rowset, "NUMBER_POS"); + BigDecimal v = rowset.getBigDecimal("C_NUMERIC_105"); + assertCondition(v.doubleValue() == 10.10105); + + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } } + } -/** -getAsciiStream() - Should work when the column name is valid. -**/ - public void Var012() - { - try { - RowSet rowset = getRowSet(jndiName_); - rowset.setUsername(systemObject_.getUserId()); - char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); - JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); - PasswordVault.clearPassword(charPassword); - rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); - rowset.execute(); - - position0 (rowset, "CHAR_FULL"); - InputStream v = rowset.getAsciiStream ("C_CHAR_50"); - sb.setLength(0); - if(getDriver() == JDTestDriver.DRIVER_NATIVE && // @K2 - true ) // @K2 - assertCondition( compareBeginsWithBytes( v, "Toolbox for Java ".getBytes("8859_1"),sb),sb); // @K2 - else // @K2 - assertCondition (compare (v, "Toolbox for Java ", "8859_1",sb),sb); - - rowset.close(); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } + /** + * getBigDecimal() with 2 parameters - Should work when the column index is + * valid. + **/ + @SuppressWarnings("deprecation") + public void Var017() { + try { + RowSet rowset = getRowSet(jndiName_); + rowset.setUsername(systemObject_.getUserId()); + char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); + JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); + PasswordVault.clearPassword(charPassword); + rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); + rowset.execute(); + + position0(rowset, "NUMBER_POS"); + BigDecimal v = rowset.getBigDecimal(8, 3); + assertCondition(v.doubleValue() == 8.889); + + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + + /** + * getBoolean() - Should work when the column index is valid. + **/ + public void Var018() { + try { + RowSet rowset = getRowSet(jndiName_); + rowset.setUsername(systemObject_.getUserId()); + char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); + JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); + PasswordVault.clearPassword(charPassword); + rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); + rowset.execute(); + + position0(rowset, "NUMBER_POS"); + boolean v = rowset.getBoolean(2); + assertCondition(v == true); + + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + + /** + * getBoolean() - Should work when the column name is valid. + **/ + public void Var019() { + try { + RowSet rowset = getRowSet(jndiName_); + rowset.setUsername(systemObject_.getUserId()); + char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); + JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); + PasswordVault.clearPassword(charPassword); + rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); + rowset.execute(); + + position0(rowset, "NUMBER_POS"); + boolean v = rowset.getBoolean("C_INTEGER"); + assertCondition(v == true); + + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + + /** + * getBytes() - Should work when the column index is valid. + **/ + public void Var020() { + try { + RowSet rowset = getRowSet(jndiName_); + rowset.setUsername(systemObject_.getUserId()); + char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); + JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); + PasswordVault.clearPassword(charPassword); + rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); + rowset.execute(); + + position0(rowset, "BINARY_NOTRANS"); + byte[] v = rowset.getBytes(18); + assertCondition(areEqual(v, twelve)); + + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + + /** + * getBytes() - Should work when the column name is valid. + **/ + public void Var021() { + try { + RowSet rowset = getRowSet(jndiName_); + rowset.setUsername(systemObject_.getUserId()); + char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); + JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); + PasswordVault.clearPassword(charPassword); + rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); + rowset.execute(); + + position0(rowset, "BINARY_NOTRANS"); + byte[] v = rowset.getBytes("C_BINARY_20"); + assertCondition(areEqual(v, eleven)); + + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + + /** + * getByte() - Should work when the column index is valid. + **/ + public void Var022() { + try { + RowSet rowset = getRowSet(jndiName_); + rowset.setUsername(systemObject_.getUserId()); + char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); + JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); + PasswordVault.clearPassword(charPassword); + rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); + rowset.execute(); + + // Changed 3/6/2007 -- a value of 198 doesn't fit in a + // signed byte, so we retrieve from different row. + // position0 (rowset, "NUMBER_POS"); + // byte v = rowset.getByte (2); + // assertCondition (v == (byte) 198); + + position0(rowset, "NUMBER_0"); + byte v = rowset.getByte(2); + assertCondition(v == (byte) 0, "got " + (int) v + " sb 0"); + + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + + /** + * getByte() - Should work when the column name is valid. + **/ + public void Var023() { + try { + RowSet rowset = getRowSet(jndiName_); + rowset.setUsername(systemObject_.getUserId()); + char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); + JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); + PasswordVault.clearPassword(charPassword); + rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); + rowset.execute(); + + position0(rowset, "NUMBER_0"); + byte v = rowset.getByte("C_SMALLINT"); + assertCondition(v == (byte) 0); + + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + + /** + * getBlob() - Should work when the column index is valid. + **/ + public void Var024() { + if (checkJdbc20()) { + try { + RowSet rowset = getRowSet(jndiName_); + rowset.setUsername(systemObject_.getUserId()); + char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); + JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); + PasswordVault.clearPassword(charPassword); + rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); + rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); + rowset.execute(); + + position(rowset, "BINARY_NOTRANS"); + Blob v = rowset.getBlob(18); + assertCondition(compareBlobToByteArray(v, twelve)); + + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } } + } -/** -getBinaryStream() - Should work when the column index is valid. -**/ - public void Var013() - { - sb.setLength(0); - try - { - RowSet rowset = getRowSet(jndiName_); - rowset.setUsername(systemObject_.getUserId()); - char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); - JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); - PasswordVault.clearPassword(charPassword); - rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); - rowset.execute(); - - position0 (rowset, "BINARY_NOTRANS"); - InputStream v = rowset.getBinaryStream (18); - if(getDriver() == JDTestDriver.DRIVER_NATIVE && // @K2 - true ) // @K2 - assertCondition( compareBeginsWithBytes( v, twelve)); // @K2 - else // @K2 - assertCondition (compare (v, twelve, sb), sb); + /** + * getBlob() - Should work when the column name is valid. + **/ + public void Var025() { + if (checkJdbc20()) { + try { + RowSet rowset = getRowSet(jndiName_); + rowset.setUsername(systemObject_.getUserId()); + char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); + JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); + PasswordVault.clearPassword(charPassword); + rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); + rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); + rowset.execute(); + + position(rowset, "BINARY_NOTRANS"); + Blob v = rowset.getBlob("C_BINARY_20"); + assertCondition(compareBlobToByteArray(v, eleven)); + + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } - rowset.close(); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } + /** + * getCharacterStream() - Should work when the column index is valid. + **/ + public void Var026() { + if (checkJdbc20()) { + try { + RowSet rowset = getRowSet(jndiName_); + rowset.setUsername(systemObject_.getUserId()); + char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); + JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); + PasswordVault.clearPassword(charPassword); + rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); + rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); + rowset.execute(); + + position(rowset, "CHAR_FULL"); + Reader v = rowset.getCharacterStream(12); + sb.setLength(0); + assertCondition(compare(v, "Toolbox for Java ", sb), sb); + v.close(); + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } } + } -/** -getBinaryStream() - Should work when the column name is valid. -**/ - public void Var014() - { - sb.setLength(0); + /** + * getCharacterStream() - Should work when the column name is valid. + **/ + public void Var027() { + if (checkJdbc20()) { + try { + RowSet rowset = getRowSet(jndiName_); + rowset.setUsername(systemObject_.getUserId()); + char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); + JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); + PasswordVault.clearPassword(charPassword); + rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); + rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); + rowset.execute(); + + position(rowset, "CHAR_FULL"); + Reader v = rowset.getCharacterStream("C_CHAR_50"); + sb.setLength(0); + assertCondition(compare(v, "Toolbox for Java ", sb), sb); + v.close(); + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } - try { - RowSet rowset = getRowSet(jndiName_); - rowset.setUsername(systemObject_.getUserId()); - char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); - JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); - PasswordVault.clearPassword(charPassword); - rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); - rowset.execute(); - - position0 (rowset, "BINARY_NOTRANS"); - InputStream v = rowset.getBinaryStream ("C_BINARY_20"); - if(getDriver() == JDTestDriver.DRIVER_NATIVE && // @K2 - true ) // @K2 - assertCondition( compareBeginsWithBytes( v, eleven)); // @K2 - else // @K2 - assertCondition (compare (v, eleven,sb),sb); - - rowset.close(); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } + /** + * getClob() - Should work when the column index is valid. + **/ + public void Var028() { + if (checkJdbc20()) { + try { + RowSet rowset = getRowSet(jndiName_); + rowset.setUsername(systemObject_.getUserId()); + char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); + JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); + PasswordVault.clearPassword(charPassword); + rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); + rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); + rowset.execute(); + + position(rowset, "CHAR_FULL"); + Clob v = rowset.getClob(14); + assertCondition(compareClobToString(v, "Java Toolbox")); + + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } } + } -/** -getBigDecimal() - Should work when the column index is valid. -**/ - public void Var015() - { - if (checkJdbc20 ()) { - try { - RowSet rowset = getRowSet(jndiName_); - rowset.setUsername(systemObject_.getUserId()); - char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); - JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); - PasswordVault.clearPassword(charPassword); - rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); - rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); - rowset.execute(); - - position (rowset, "NUMBER_POS"); - BigDecimal v = rowset.getBigDecimal (8); - assertCondition (v.doubleValue () == 8.8888); - - rowset.close(); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } + /** + * getClob() - Should work when the column name is valid. + **/ + public void Var029() { + if (checkJdbc20()) { + try { + RowSet rowset = getRowSet(jndiName_); + rowset.setUsername(systemObject_.getUserId()); + char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); + JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); + PasswordVault.clearPassword(charPassword); + rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); + rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); + rowset.execute(); + + position(rowset, "CHAR_FULL"); + Clob v = rowset.getClob("C_VARCHAR_50"); + assertCondition(compareClobToString(v, "Java Toolbox")); + + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } } + } -/** -getBigDecimal() - Should work when the column name is valid. -**/ - public void Var016() - { - if (checkJdbc20 ()) { - try { - RowSet rowset = getRowSet(jndiName_); - rowset.setUsername(systemObject_.getUserId()); - char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); - JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); - PasswordVault.clearPassword(charPassword); - rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); - rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); - rowset.execute(); - - position (rowset, "NUMBER_POS"); - BigDecimal v = rowset.getBigDecimal ("C_NUMERIC_105"); - assertCondition (v.doubleValue () == 10.10105); - - rowset.close(); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } + /** + * getDate() - Should work when the column index is valid. + **/ + public void Var030() { + try { + RowSet rowset = getRowSet(jndiName_); + rowset.setUsername(systemObject_.getUserId()); + char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); + JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); + PasswordVault.clearPassword(charPassword); + rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); + rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); + rowset.execute(); + + position0(rowset, "DATE_2000"); + Date v = rowset.getDate(19); + assertCondition(v.toString().equals("2000-02-21")); + + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + + /** + * getDate() - Should work when the column name is valid. + **/ + public void Var031() { + try { + RowSet rowset = getRowSet(jndiName_); + rowset.setUsername(systemObject_.getUserId()); + char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); + JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); + PasswordVault.clearPassword(charPassword); + rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); + rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); + rowset.execute(); + + position0(rowset, "DATE_1998"); + Date v = rowset.getDate("C_DATE"); + assertCondition(v.toString().equals("1998-04-08")); + + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + + /** + * getDouble() - Should work when the column index is valid. + **/ + public void Var032() { + try { + RowSet rowset = getRowSet(jndiName_); + rowset.setUsername(systemObject_.getUserId()); + char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); + JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); + PasswordVault.clearPassword(charPassword); + rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); + rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); + rowset.execute(); + + position0(rowset, "NUMBER_POS"); + double v = rowset.getDouble(6); + assertCondition(v == 6.666); + + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + + /** + * getDouble() - Should work when the column name is valid. + **/ + public void Var033() { + try { + RowSet rowset = getRowSet(jndiName_); + rowset.setUsername(systemObject_.getUserId()); + char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); + JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); + PasswordVault.clearPassword(charPassword); + rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); + rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); + rowset.execute(); + + JDRSTest.position0(rowset, "NUMBER_POS"); + double v = rowset.getDouble("C_INTEGER"); + assertCondition(v == 98765); + + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + + /** + * getFloat() - Should work when the column index is valid. + **/ + public void Var034() { + try { + RowSet rowset = getRowSet(jndiName_); + rowset.setUsername(systemObject_.getUserId()); + char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); + JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); + PasswordVault.clearPassword(charPassword); + rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); + rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); + rowset.execute(); + + JDRSTest.position0(rowset, "NUMBER_POS"); + float v = rowset.getFloat(5); + assertCondition(v == 5.55f); + + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + + /** + * getFloat() - Should work when the column name is valid. + **/ + public void Var035() { + try { + RowSet rowset = getRowSet(jndiName_); + rowset.setUsername(systemObject_.getUserId()); + char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); + JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); + PasswordVault.clearPassword(charPassword); + rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); + rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); + rowset.execute(); + + position0(rowset, "NUMBER_POS"); + float v = rowset.getFloat("C_INTEGER"); + assertCondition(v == 98765); + + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + + /** + * getInt() - Should work when the column index is valid. + **/ + public void Var036() { + try { + RowSet rowset = getRowSet(jndiName_); + rowset.setUsername(systemObject_.getUserId()); + char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); + JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); + PasswordVault.clearPassword(charPassword); + rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); + rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); + rowset.execute(); + + position0(rowset, "NUMBER_POS"); + int v = rowset.getInt(3); + assertCondition(v == 98765); + + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + + /** + * getInt() - Should work when the column name is valid. + **/ + public void Var037() { + try { + RowSet rowset = getRowSet(jndiName_); + rowset.setUsername(systemObject_.getUserId()); + char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); + JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); + PasswordVault.clearPassword(charPassword); + rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); + rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); + rowset.execute(); + + position0(rowset, "NUMBER_POS"); + int v = rowset.getInt("C_INTEGER"); + assertCondition(v == 98765); + + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + + /** + * getLong() - Should work when the column index is valid. + **/ + public void Var038() { + try { + RowSet rowset = getRowSet(jndiName_); + rowset.setUsername(systemObject_.getUserId()); + char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); + JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); + PasswordVault.clearPassword(charPassword); + rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); + rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); + rowset.execute(); + + position0(rowset, "NUMBER_POS"); + long v = rowset.getLong(3); + assertCondition(v == 98765); + + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + + /** + * getLong() - Should work when the column name is valid. + **/ + public void Var039() { + try { + RowSet rowset = getRowSet(jndiName_); + rowset.setUsername(systemObject_.getUserId()); + char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); + JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); + PasswordVault.clearPassword(charPassword); + rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); + rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); + rowset.execute(); + + position0(rowset, "NUMBER_POS"); + long v = rowset.getLong("C_INTEGER"); + assertCondition(v == 98765); + + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + + /** + * getObject() - Should work when the column index is valid. + **/ + public void Var040() { + try { + RowSet rowset = getRowSet(jndiName_); + rowset.setUsername(systemObject_.getUserId()); + char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); + JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); + PasswordVault.clearPassword(charPassword); + rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); + rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); + rowset.execute(); + + position0(rowset, "DATE_1998"); + Object s = rowset.getObject(1); + assertCondition(s.equals("DATE_1998")); + + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + + /** + * getObject() - Should work when the column name is valid. + **/ + public void Var041() { + try { + RowSet rowset = getRowSet(jndiName_); + rowset.setUsername(systemObject_.getUserId()); + char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); + JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); + PasswordVault.clearPassword(charPassword); + rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); + rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); + rowset.execute(); + + position0(rowset, "DATE_1998"); + Object s = rowset.getObject("C_KEY"); + assertCondition(s.equals("DATE_1998")); + + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + + /** + * getRef() - Should throw an exception when the column index is valid. + **/ + public void Var042() { + RowSet rowset = null; + if (checkJdbc20()) { + try { + rowset = getRowSet(jndiName_); + rowset.setUsername(systemObject_.getUserId()); + char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); + JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); + PasswordVault.clearPassword(charPassword); + rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); + rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); + rowset.execute(); + + position(rowset, "NUMBER_POS"); + Ref v = rowset.getRef(3); + failed("Didn't throw SQLException but got " + v); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } finally { + + } } + } - -/** -getBigDecimal() with 2 parameters - Should work when the column index is valid. -**/ - @SuppressWarnings("deprecation") - public void Var017() - { - try { - RowSet rowset = getRowSet(jndiName_); - rowset.setUsername(systemObject_.getUserId()); - char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); - JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); - PasswordVault.clearPassword(charPassword); - rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); - rowset.execute(); - - position0 (rowset, "NUMBER_POS"); - BigDecimal v = rowset.getBigDecimal (8, 3); - assertCondition (v.doubleValue () == 8.889); - - rowset.close(); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } + /** + * getRef() - Should throw an exception when the column name is valid. + **/ + public void Var043() { + RowSet rowset = null; + if (checkJdbc20()) { + try { + rowset = getRowSet(jndiName_); + rowset.setUsername(systemObject_.getUserId()); + char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); + JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); + PasswordVault.clearPassword(charPassword); + rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); + rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); + rowset.execute(); + + position(rowset, "NUMBER_POS"); + Ref v = rowset.getRef("C_INTEGER"); + failed("Didn't throw SQLException but got " + v); + } catch (Exception e) { + assertExceptionIsInstanceOf(e, "java.sql.SQLException"); + } + try { + rowset.close(); + } catch (SQLException sq) { + /* ignore */ } } + } - -/** -getBoolean() - Should work when the column index is valid. -**/ - public void Var018() - { - try { - RowSet rowset = getRowSet(jndiName_); - rowset.setUsername(systemObject_.getUserId()); - char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); - JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); - PasswordVault.clearPassword(charPassword); - rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); - rowset.execute(); - - position0 (rowset, "NUMBER_POS"); - boolean v = rowset.getBoolean (2); - assertCondition (v == true); - - rowset.close(); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } + /** + * getRow() - Should return 0 on an empty result set. + **/ + public void Var044() { + if (checkJdbc20()) { + try { + RowSet rowset = getRowSet(jndiName_); + rowset.setUsername(systemObject_.getUserId()); + char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); + JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); + PasswordVault.clearPassword(charPassword); + rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); + rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); + rowset.execute(); + + int row = rowset.getRow(); + rowset.close(); + assertCondition(row == 0); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } } + } -/** -getBoolean() - Should work when the column name is valid. -**/ - public void Var019() - { - try { - RowSet rowset = getRowSet(jndiName_); - rowset.setUsername(systemObject_.getUserId()); - char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); - JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); - PasswordVault.clearPassword(charPassword); - rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); - rowset.execute(); - - position0 (rowset, "NUMBER_POS"); - boolean v = rowset.getBoolean ("C_INTEGER"); - assertCondition (v == true); - - rowset.close(); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } + /** + * getRow() - Should work on a 1 row result set. + **/ + public void Var045() { + if (checkJdbc20()) { + try { + RowSet rowset = getRowSet(jndiName_); + rowset.setUsername(systemObject_.getUserId()); + char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); + JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); + PasswordVault.clearPassword(charPassword); + rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); + rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_POS + " WHERE ID = 1"); + rowset.execute(); + + boolean success = rowset.first(); + int row = rowset.getRow(); + rowset.close(); + assertCondition(row == 1, "row=" + row + " sb success=" + success); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } } + } -/** -getBytes() - Should work when the column index is valid. -**/ - public void Var020() - { + /** + * getShort() - Should work when the column index is valid. + **/ + public void Var046() { + try { + RowSet rowset = getRowSet(jndiName_); + rowset.setUsername(systemObject_.getUserId()); + char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); + JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); + PasswordVault.clearPassword(charPassword); + rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); + rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); + rowset.execute(); + + position0(rowset, "NUMBER_POS"); + short v = rowset.getShort(2); + assertCondition(v == 198); + + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + + /** + * getShort() - Should work when the column name is valid. + **/ + public void Var047() { + try { + RowSet rowset = getRowSet(jndiName_); + rowset.setUsername(systemObject_.getUserId()); + char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); + JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); + PasswordVault.clearPassword(charPassword); + rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); + rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); + rowset.execute(); + + position0(rowset, "NUMBER_POS"); + short v = rowset.getShort("C_SMALLINT"); + assertCondition(v == 198); + + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + + /** + * last() - Should return false on an empty result set. + **/ + public void Var048() { + if (checkJdbc20()) { try { - RowSet rowset = getRowSet(jndiName_); - rowset.setUsername(systemObject_.getUserId()); - char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); - JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); - PasswordVault.clearPassword(charPassword); - rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); - rowset.execute(); - - position0 (rowset, "BINARY_NOTRANS"); - byte[] v = rowset.getBytes (18); - assertCondition (areEqual (v, twelve)); - - rowset.close(); + RowSet rowset = getRowSet(jndiName_); + rowset.setUsername(systemObject_.getUserId()); + char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); + JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); + PasswordVault.clearPassword(charPassword); + rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); + rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_POS + " WHERE ID = -1"); + rowset.execute(); + + boolean success = rowset.last(); + rowset.close(); + assertCondition(success == false); } catch (Exception e) { - failed (e, "Unexpected Exception"); + failed(e, "Unexpected Exception"); } - } + } + } -/** -getBytes() - Should work when the column name is valid. -**/ - public void Var021() - { + /** + * last() - Should work on a large result set. + **/ + public void Var049() { + if (checkJdbc20()) { try { - RowSet rowset = getRowSet(jndiName_); - rowset.setUsername(systemObject_.getUserId()); - char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); - JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); - PasswordVault.clearPassword(charPassword); - rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); - rowset.execute(); - - position0 (rowset, "BINARY_NOTRANS"); - byte[] v = rowset.getBytes ("C_BINARY_20"); - assertCondition (areEqual (v, eleven)); - - rowset.close(); + RowSet rowset = getRowSet(jndiName_); + rowset.setUsername(systemObject_.getUserId()); + char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); + JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); + PasswordVault.clearPassword(charPassword); + rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); + rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_POS); + rowset.execute(); + + boolean success = rowset.last(); + int id1 = rowset.getInt(1); + rowset.close(); + assertCondition((success == true) && (id1 == 99)); } catch (Exception e) { - failed (e, "Unexpected Exception"); + failed(e, "Unexpected Exception"); } - } + } + } -/** -getByte() - Should work when the column index is valid. -**/ - public void Var022() - { - try { - RowSet rowset = getRowSet(jndiName_); - rowset.setUsername(systemObject_.getUserId()); - char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); - JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); - PasswordVault.clearPassword(charPassword); - rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); - rowset.execute(); - - // Changed 3/6/2007 -- a value of 198 doesn't fit in a - // signed byte, so we retrieve from different row. - // position0 (rowset, "NUMBER_POS"); - // byte v = rowset.getByte (2); - // assertCondition (v == (byte) 198); - - position0 (rowset, "NUMBER_0"); - byte v = rowset.getByte (2); - assertCondition (v == (byte) 0); - - rowset.close(); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } + /** + * insertRow() - Inserted row should be reflected in the result set being + * updated when not repositioned. + **/ + public void Var050() { + if (checkJdbc20()) { + + try { + + RowSet rowset = getRowSet(jndiName_); + rowset.setUsername(systemObject_.getUserId()); + char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); + JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); + PasswordVault.clearPassword(charPassword); + rowset.setConcurrency(ResultSet.CONCUR_UPDATABLE); + rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); + rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_UPDATE + " FOR UPDATE"); + rowset.execute(); + + JDRSTest.position(rowset, "JDRowSetInsertRow"); + int columnCount = rowset.getMetaData().getColumnCount(); + + rowset.moveToInsertRow(); + rowset.updateString("C_VARCHAR_50", "Space people"); + rowset.insertRow(); + + assertCondition(rowset.getString("C_VARCHAR_50").equals("Space people"), + "Did not get expected string column count=" + columnCount); + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } finally { + + } } + } -/** -getByte() - Should work when the column name is valid. -**/ - public void Var023() - { + /** + * getUnicodeStream() - Should work when the column index is valid. + **/ + public void Var051() { + try { + RowSet rowset = getRowSet(jndiName_); + rowset.setUsername(systemObject_.getUserId()); + char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); + JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); + PasswordVault.clearPassword(charPassword); + rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); + rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); + rowset.execute(); + + position0(rowset, "CHAR_FULL"); + Reader v = rowset.getCharacterStream(12); + sb.setLength(0); + if (getDriver() == JDTestDriver.DRIVER_NATIVE && // @K2 + true) // @K2 + assertCondition(compare(v, "Toolbox for Java ", sb), sb); // @K2 + else // @K2 + assertCondition(compare(v, "Toolbox for Java ", sb), sb); // @B0C + v.close(); + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + + /** + * getUnicodeStream() - Should work when the column name is valid. + **/ + public void Var052() { + try { + RowSet rowset = getRowSet(jndiName_); + rowset.setUsername(systemObject_.getUserId()); + char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); + JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); + PasswordVault.clearPassword(charPassword); + rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); + rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); + rowset.execute(); + + position0(rowset, "CHAR_FULL"); + Reader v = rowset.getCharacterStream("C_CHAR_50"); + sb.setLength(0); + if (getDriver() == JDTestDriver.DRIVER_NATIVE && // @K2 + true) // @K2 + assertCondition(compare(v, "Toolbox for Java ", sb), sb); // @K2 + else // @K2 + assertCondition(compare(v, "Toolbox for Java ", sb), sb); // @B0C + v.close(); + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + + /** + * getTimestamp() - Should work when the column index is valid. + **/ + public void Var053() { + try { + RowSet rowset = getRowSet(jndiName_); + rowset.setUsername(systemObject_.getUserId()); + char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); + JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); + PasswordVault.clearPassword(charPassword); + rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); + rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); + rowset.execute(); + + position0(rowset, "DATE_2000"); + Timestamp v = rowset.getTimestamp(21); + assertCondition(v.toString().equals("2000-06-25 10:30:12.345676")); + + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + + /** + * getTimestamp() - Should work when the column name is valid. + **/ + public void Var054() { + try { + RowSet rowset = getRowSet(jndiName_); + rowset.setUsername(systemObject_.getUserId()); + char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); + JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); + PasswordVault.clearPassword(charPassword); + rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); + rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); + rowset.execute(); + + position0(rowset, "DATE_1998"); + Timestamp v = rowset.getTimestamp("C_TIMESTAMP"); + assertCondition(v.toString().equals("1998-11-18 03:13:42.987654")); + + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + + /** + * getTime() - Should work when the column index is valid. + **/ + public void Var055() { + try { + RowSet rowset = getRowSet(jndiName_); + rowset.setUsername(systemObject_.getUserId()); + char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); + JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); + PasswordVault.clearPassword(charPassword); + rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); + rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); + rowset.execute(); + + position0(rowset, "DATE_2000"); + Time v = rowset.getTime(20); + assertCondition(v.toString().equals("14:04:55")); + + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + + /** + * getTime() - Should work when the column name is valid. + **/ + public void Var056() { + try { + RowSet rowset = getRowSet(jndiName_); + rowset.setUsername(systemObject_.getUserId()); + char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); + JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); + PasswordVault.clearPassword(charPassword); + rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); + rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); + rowset.execute(); + + position0(rowset, "DATE_1998"); + Time v = rowset.getTime("C_TIME"); + assertCondition(v.toString().equals("08:14:03")); + + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + + /** + * getString() - Should work when the column index is valid. + **/ + public void Var057() { + try { + RowSet rowset = getRowSet(jndiName_); + rowset.setUsername(systemObject_.getUserId()); + char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); + JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); + PasswordVault.clearPassword(charPassword); + rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); + rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); + rowset.execute(); + + position0(rowset, "DATE_1998"); + String s = rowset.getString(1); + assertCondition(s.equals("DATE_1998")); + + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + + /** + * getString() - Should work when the column name is valid. + **/ + public void Var058() { + try { + RowSet rowset = getRowSet(jndiName_); + rowset.setUsername(systemObject_.getUserId()); + char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); + JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); + PasswordVault.clearPassword(charPassword); + rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); + rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); + rowset.execute(); + + position0(rowset, "DATE_1998"); + String s = rowset.getString("C_KEY"); + assertCondition(s.equals("DATE_1998")); + + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + + /** + * Validates that getCommand returns as expected. + **/ + public void Var059() { + String command = "SELECT * FROM QIWS.QCUSTCDT"; + try { + RowSet rowset = getRowSet(jndiName_); + rowset.setUsername(systemObject_.getUserId()); + char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); + JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); + PasswordVault.clearPassword(charPassword); + rowset.setCommand(command); + String command2 = rowset.getCommand(); + rowset.close(); + assertCondition(command2.equals(command)); + + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + + /** + * Validates that getConcurrency returns as expected before a result set is + * created. + **/ + public void Var060() { + int concurrency = ResultSet.CONCUR_UPDATABLE; + try { + RowSet rowset = getRowSet(jndiName_); + rowset.setUsername(systemObject_.getUserId()); + char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); + JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); + PasswordVault.clearPassword(charPassword); + rowset.setConcurrency(concurrency); + int resultConcurrency = rowset.getConcurrency(); + rowset.close(); + assertCondition(resultConcurrency == concurrency); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + + /** + * Validates that getConcurrency returns as expected. + **/ + public void Var061() { + int concurrency = ResultSet.CONCUR_UPDATABLE; + try { + RowSet rowset = getRowSet(jndiName_); + rowset.setUsername(systemObject_.getUserId()); + char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); + JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); + PasswordVault.clearPassword(charPassword); + rowset.setConcurrency(concurrency); + int resultCurrency = rowset.getConcurrency(); + rowset.close(); + assertCondition(resultCurrency == concurrency); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + + /** + * Validates that getCursorName returns as expected. + **/ + public void Var062() { + try { + RowSet rowset = getRowSet(jndiName_); + rowset.setUsername(systemObject_.getUserId()); + char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); + JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); + PasswordVault.clearPassword(charPassword); + rowset.setCommand("SELECT * FROM QIWS.QCUSTCDT"); + rowset.execute(); + + assertCondition(rowset.getCursorName() != null); + + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + + /** + * Validates that getDataSourceName returns as expected. + **/ + public void Var063() { + try { + RowSet rowset; // @C1A + if (getDriver() == JDTestDriver.DRIVER_TOOLBOX) // @C1A + rowset = new AS400JDBCRowSet(); // @C1A + else // @C1A + rowset = getRowSet(null); // @C1M + rowset.setDataSourceName(jndiName_); + String datasourceName = rowset.getDataSourceName(); + rowset.close(); + assertCondition(datasourceName.equals(jndiName_)); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + + /** + * Validates that getEscapeProcessing returns false as expected. + **/ + public void Var064() { + try { + RowSet rowset = getRowSet(jndiName_); + rowset.setUsername(systemObject_.getUserId()); + char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); + JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); + PasswordVault.clearPassword(charPassword); + rowset.setCommand("SELECT * FROM QIWS.QCUSTCDT"); + rowset.setEscapeProcessing(false); + boolean resultEscapeProcessing = rowset.getEscapeProcessing(); + rowset.close(); + assertCondition(resultEscapeProcessing == false); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + + /** + * Validates that getFetchDirection returns as expected. + **/ + public void Var065() { + try { + RowSet rowset = getRowSet(jndiName_); + rowset.setUsername(systemObject_.getUserId()); + char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); + JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); + PasswordVault.clearPassword(charPassword); + rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); + rowset.setCommand("SELECT * FROM QIWS.QCUSTCDT"); + rowset.execute(); + + rowset.setFetchDirection(ResultSet.FETCH_REVERSE); + assertCondition(rowset.getFetchDirection() == ResultSet.FETCH_REVERSE); + + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + + /** + * Validates that getFetchDirection returns as expected. + **/ + public void Var066() { + try { + RowSet rowset = getRowSet(jndiName_); + rowset.setCommand("SELECT * FROM QIWS.QCUSTCDT"); + int fetchDirection = rowset.getFetchDirection(); + rowset.close(); + assertCondition(fetchDirection == ResultSet.FETCH_FORWARD); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + + /** + * Validates that getFetchDirection returns as expected. + **/ + public void Var067() { + RowSet rowset = null; + try { + rowset = getRowSet(jndiName_); + int fetchDirection = rowset.getFetchDirection(); + rowset.close(); + assertCondition(fetchDirection == ResultSet.FETCH_FORWARD); + } catch (Exception e) { + if (rowset != null) try { - RowSet rowset = getRowSet(jndiName_); - rowset.setUsername(systemObject_.getUserId()); - char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); - JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); - PasswordVault.clearPassword(charPassword); - rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); - rowset.execute(); - - position0 (rowset, "NUMBER_0"); - byte v = rowset.getByte ("C_SMALLINT"); - assertCondition (v == (byte) 0); - - rowset.close(); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); + rowset.close(); + } catch (SQLException e1) { } + failed(e, "Unexpected Exception"); } + } -/** -getBlob() - Should work when the column index is valid. -**/ - public void Var024() - { - if (checkJdbc20 ()) { - try { - RowSet rowset = getRowSet(jndiName_); - rowset.setUsername(systemObject_.getUserId()); - char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); - JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); - PasswordVault.clearPassword(charPassword); - rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); - rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); - rowset.execute(); - - position (rowset, "BINARY_NOTRANS"); - Blob v = rowset.getBlob (18); - assertCondition (compareBlobToByteArray (v, twelve)); - - rowset.close(); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } + /** + * Validates that getFetchSize returns as expected. + **/ + public void Var068() { + try { + RowSet rowset = getRowSet(jndiName_); + rowset.setUsername(systemObject_.getUserId()); + char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); + JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); + PasswordVault.clearPassword(charPassword); + rowset.setCommand("SELECT * FROM QIWS.QCUSTCDT"); + rowset.execute(); -/** -getBlob() - Should work when the column name is valid. -**/ - public void Var025() - { - if (checkJdbc20 ()) { - try { - RowSet rowset = getRowSet(jndiName_); - rowset.setUsername(systemObject_.getUserId()); - char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); - JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); - PasswordVault.clearPassword(charPassword); - rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); - rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); - rowset.execute(); - - position (rowset, "BINARY_NOTRANS"); - Blob v = rowset.getBlob ("C_BINARY_20"); - assertCondition (compareBlobToByteArray (v, eleven)); - - rowset.close(); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } + int size = 64; + rowset.setFetchSize(size); -/** -getCharacterStream() - Should work when the column index is valid. -**/ - public void Var026() - { - if (checkJdbc20 ()) { - try { - RowSet rowset = getRowSet(jndiName_); - rowset.setUsername(systemObject_.getUserId()); - char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); - JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); - PasswordVault.clearPassword(charPassword); - rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); - rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); - rowset.execute(); - - position (rowset, "CHAR_FULL"); - Reader v = rowset.getCharacterStream (12); - sb.setLength(0); - assertCondition (compare (v, "Toolbox for Java ",sb),sb); - rowset.close(); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } + assertCondition(rowset.getFetchSize() == size); -/** -getCharacterStream() - Should work when the column name is valid. -**/ - public void Var027() - { - if (checkJdbc20 ()) { - try { - RowSet rowset = getRowSet(jndiName_); - rowset.setUsername(systemObject_.getUserId()); - char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); - JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); - PasswordVault.clearPassword(charPassword); - rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); - rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); - rowset.execute(); - - position (rowset, "CHAR_FULL"); - Reader v = rowset.getCharacterStream ("C_CHAR_50"); - sb.setLength(0); - assertCondition (compare (v, "Toolbox for Java ",sb),sb); - rowset.close(); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception"); } + } -/** -getClob() - Should work when the column index is valid. -**/ - public void Var028() - { - if (checkJdbc20 ()) { - try { - RowSet rowset = getRowSet(jndiName_); - rowset.setUsername(systemObject_.getUserId()); - char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); - JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); - PasswordVault.clearPassword(charPassword); - rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); - rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); - rowset.execute(); - - position (rowset, "CHAR_FULL"); - Clob v = rowset.getClob (14); - assertCondition (compareClobToString (v, "Java Toolbox")); + /** + * Validates that getFetchSize returns as expected. + **/ + public void Var069() { + try { + RowSet rowset = getRowSet(jndiName_); + rowset.setCommand("SELECT * FROM QIWS.QCUSTCDT"); + int fetchSize = rowset.getFetchSize(); + rowset.close(); + assertCondition(fetchSize == 0); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + + /** + * Validates that getFetchSize returns as expected if a statement has been + * created. + **/ + public void Var070() { + RowSet rowset = null; + try { + rowset = getRowSet(jndiName_); + rowset.setUsername(systemObject_.getUserId()); + char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); + JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); + PasswordVault.clearPassword(charPassword); + // @A1 + if (getDriver() == JDTestDriver.DRIVER_TOOLBOX) { + rowset.setCommand("CREATE TABLE QGPL.TESTTBLE (I INTEGER)"); + rowset.execute(); + } else { + stmt_.executeUpdate("CREATE TABLE QGPL.TESTTBLE (I INTEGER)"); + } - rowset.close(); - } catch (Exception e) { - failed (e, "Unexpected Exception"); - } + assertCondition(rowset.getFetchSize() == 0); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } finally { + try { + // @A1 + if (getDriver() == JDTestDriver.DRIVER_TOOLBOX) { + rowset.setCommand("DROP TABLE QGPL.TESTTBLE"); + rowset.execute(); + } else { + stmt_.executeUpdate("DROP TABLE QGPL.TESTTBLE"); + } + } catch (Exception e) { + /* ignore errors. */ + } + try { + rowset.close(); + } catch (Exception f) { } - } + } + } -/** -getClob() - Should work when the column name is valid. -**/ - public void Var029() - { - if (checkJdbc20 ()) { - try { - RowSet rowset = getRowSet(jndiName_); - rowset.setUsername(systemObject_.getUserId()); - char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); - JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); - PasswordVault.clearPassword(charPassword); - rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); - rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); - rowset.execute(); - - position (rowset, "CHAR_FULL"); - Clob v = rowset.getClob ("C_VARCHAR_50"); - assertCondition (compareClobToString (v, "Java Toolbox")); + /** + * Validates that getMaxFieldSize returns as expected. + **/ + public void Var071() { + try { + RowSet rowset = getRowSet(jndiName_); + rowset.setCommand("SELECT * FROM QIWS.QCUSTCDT"); + int size = rowset.getMaxFieldSize(); + rowset.close(); + assertCondition(size == 0); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + + /** + * Validates that getMaxFieldSize() returns as expected. + **/ + public void Var072() { + RowSet rowset = null; + try { + rowset = getRowSet(jndiName_); + rowset.setUsername(systemObject_.getUserId()); + char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); + JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); + PasswordVault.clearPassword(charPassword); + rowset.setCommand("SELECT * FROM QIWS.QCUSTCDT"); + + int size = 25; + rowset.setMaxFieldSize(size); + + assertCondition(rowset.getMaxFieldSize() == size); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } finally { + + } + } + + /** + * Validates that getMaxRows() returns as expected. + **/ + public void Var073() { + try { + RowSet rowset = getRowSet(jndiName_); + rowset.setCommand("SELECT * FROM QIWS.QCUSTCDT"); + int maxrows = rowset.getMaxRows(); + rowset.close(); + assertCondition(maxrows == 0); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + + /** + * Validates that getMaxRows() returns as expected. + **/ + public void Var074() { + RowSet rowset = null; + try { + rowset = getRowSet(jndiName_); + rowset.setUsername(systemObject_.getUserId()); + char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); + JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); + PasswordVault.clearPassword(charPassword); + rowset.setCommand("SELECT * FROM QIWS.QCUSTCDT"); + + int size = 25; + rowset.setMaxRows(size); + + assertCondition(rowset.getMaxRows() == size); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } finally { + + } + } + + /** + * Validates that getMetaData() returns as expected. + **/ + public void Var075() { + try { + RowSet rowset = getRowSet(jndiName_); + rowset.setUsername(systemObject_.getUserId()); + char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); + JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); + PasswordVault.clearPassword(charPassword); + rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); + rowset.execute(); + + assertCondition(rowset.getMetaData() != null); + + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception."); + } + } + + /** + * Validates that getPassword() returns an empty string. + **/ + public void Var076() { + try { + RowSet rowset = getRowSet(jndiName_); + rowset.setPassword("MYPWD"); + String password = rowset.getPassword(); + rowset.close(); + if (getDriver() == JDTestDriver.DRIVER_TOOLBOX) { + assertCondition(password.equals("")); + } else { + assertCondition(password.equals("MYPWD")); + } + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } - rowset.close(); - } catch (Exception e) { - failed (e, "Unexpected Exception"); - } + /** + * Validates that getQueryTimeout() returns as expected. + **/ + public void Var077() { + int expected = 1000; + RowSet rowset = null; + try { + rowset = getRowSet(jndiName_); + rowset.setUsername(systemObject_.getUserId()); + char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); + JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); + PasswordVault.clearPassword(charPassword); + rowset.setCommand("SELECT * FROM QIWS.QCUSTCDT"); + rowset.setQueryTimeout(expected); + + assertCondition(rowset.getQueryTimeout() == expected); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } finally { + + } + } + + /** + * Validates that getStatement() returns as expected. + **/ + public void Var078() { + RowSet rowset = null; + try { + rowset = getRowSet(jndiName_); + rowset.setUsername(systemObject_.getUserId()); + char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); + JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); + PasswordVault.clearPassword(charPassword); + rowset.setCommand("SELECT * FROM QIWS.QCUSTCDT"); + rowset.execute(); + Statement statement = rowset.getStatement(); + statement.close(); + assertCondition(statement != null); + } catch (Exception e) { + if (getDriver() == JDTestDriver.DRIVER_NATIVE) { + assertCondition(e.getMessage().indexOf("NOT SUPPORTED") >= 0); + } else + failed(e, "Unexpected Exception."); + } finally { + + } + } + + /** + * Validates that getTransactionIsolation() returns as expected. + **/ + public void Var079() { + try { + int isolation = Connection.TRANSACTION_READ_COMMITTED; + RowSet rowset = getRowSet(jndiName_); + rowset.setTransactionIsolation(isolation); + int outIsolation = rowset.getTransactionIsolation(); + rowset.close(); + assertCondition(outIsolation == isolation); + } catch (Exception e) { + failed(e, "Unexpected Exception."); + } + } + + /** + * Validates that getTransactionIsolation() returns as expected. + **/ + public void Var080() { + + try (RowSet rowset = getRowSet(jndiName_);){ + + + rowset.setUsername(systemObject_.getUserId()); + char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); + JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); + PasswordVault.clearPassword(charPassword); + // @A1 + if (getDriver() == JDTestDriver.DRIVER_TOOLBOX) { + rowset.setCommand("INSERT INTO " + JDRSTest.RSTEST_UPDATE + " (C_KEY) VALUES ('test')"); + rowset.execute(); + } else { + stmt_.executeUpdate("INSERT INTO " + JDRSTest.RSTEST_UPDATE + " (C_KEY) VALUES ('test')"); } - } + int isolation = Connection.TRANSACTION_REPEATABLE_READ; + rowset.setTransactionIsolation(isolation); -/** -getDate() - Should work when the column index is valid. -**/ - public void Var030() - { - try { - RowSet rowset = getRowSet(jndiName_); - rowset.setUsername(systemObject_.getUserId()); - char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); - JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); - PasswordVault.clearPassword(charPassword); - rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); - rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); - rowset.execute(); - - position0 (rowset, "DATE_2000"); - Date v = rowset.getDate (19); - assertCondition (v.toString ().equals ("2000-02-21")); - - rowset.close(); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } + assertCondition(rowset.getTransactionIsolation() == isolation); + } catch (Exception e) { + failed(e, "Unexpected Exception."); + } finally { + } + } -/** -getDate() - Should work when the column name is valid. -**/ - public void Var031() - { + /** + * Validates that getType() returns as expected. + **/ + public void Var081() { + try { + RowSet rowset = getRowSet(jndiName_); + rowset.setUsername(systemObject_.getUserId()); + char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); + JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); + PasswordVault.clearPassword(charPassword); + rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); + + int type = ResultSet.TYPE_SCROLL_INSENSITIVE; + rowset.setType(type); + + rowset.execute(); + int outType = rowset.getType(); + rowset.close(); + assertCondition(outType == type); + } catch (Exception e) { + failed(e, "Unexpected Exception."); + } + } + + /** + * Validates that getType() returns as expected. + **/ + public void Var082() { + try { + RowSet rowset = getRowSet(jndiName_); + int type = ResultSet.TYPE_SCROLL_SENSITIVE; + rowset.setType(type); + int outType = rowset.getType(); + rowset.close(); + assertCondition(outType == type); + } catch (Exception e) { + failed(e, "Unexpected Exception."); + } + } + + /** + * Validates that getTypeMap() returns the expected value. + **/ + public void Var083() { + RowSet rowset = null; + try { + rowset = getRowSet(jndiName_); + rowset.setUsername(systemObject_.getUserId()); + char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); + JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); + PasswordVault.clearPassword(charPassword); + rowset.setCommand("SELECT * FROM QIWS.QCUSTCDT"); + rowset.setMaxRows(25); + + Map> m = rowset.getTypeMap(); + if (getDriver() == JDTestDriver.DRIVER_NATIVE) { + assertCondition(m == null); + return; + } + failed("No SQLException thrown"); + } catch (SQLException sq) { + succeeded(); + } catch (Exception e) { + failed(e, "Unexpected Exception."); + } finally { + if (rowset != null) { try { - RowSet rowset = getRowSet(jndiName_); - rowset.setUsername(systemObject_.getUserId()); - char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); - JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); - PasswordVault.clearPassword(charPassword); - rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); - rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); - rowset.execute(); - - position0 (rowset, "DATE_1998"); - Date v = rowset.getDate ("C_DATE"); - assertCondition (v.toString ().equals ("1998-04-08")); - - rowset.close(); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); + rowset.close(); + } catch (SQLException e) { } + } } + } + /** + * Validates that getUrl() returns the expected value. + **/ + public void Var084() { + String url = "jdbc:as400:"; + try { + RowSet rowset = getRowSet(jndiName_); + rowset.setUrl(url); + String outUrl = rowset.getUrl(); + rowset.close(); + assertCondition(outUrl.equals(url)); + } catch (Exception e) { + failed(e, "Unexpected Exception."); + } + } + + /** + * Validates that getUsername() returns the expected value. + **/ + public void Var085() { + String name = "MYUSER"; + try { + RowSet rowset = getRowSet(jndiName_); + rowset.setUsername(name); + String outUsername = rowset.getUsername(); + rowset.close(); + assertCondition(outUsername.equals(name)); + } catch (Exception e) { + failed(e, "Unexpected Exception."); + } + } + + /** + * Validates that rowDeleted() - Should return true on the deleted row when + * called immediately without repositioning. + **/ + public void Var086() { + String key = "JDRowSetRowDeleted"; + + try { + + RowSet rowset = updater(key); + rowset.next(); + rowset.deleteRow(); -/** -getDouble() - Should work when the column index is valid. -**/ - public void Var032() - { - try { - RowSet rowset = getRowSet(jndiName_); - rowset.setUsername(systemObject_.getUserId()); - char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); - JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); - PasswordVault.clearPassword(charPassword); - rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); - rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); - rowset.execute(); - - position0 (rowset, "NUMBER_POS"); - double v = rowset.getDouble (6); - assertCondition (v == 6.666); - - rowset.close(); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } + assertCondition(rowset.rowDeleted() == true); -/** -getDouble() - Should work when the column name is valid. -**/ - public void Var033() - { - try { - RowSet rowset = getRowSet(jndiName_); - rowset.setUsername(systemObject_.getUserId()); - char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); - JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); - PasswordVault.clearPassword(charPassword); - rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); - rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); - rowset.execute(); - - JDRSTest.position0 (rowset, "NUMBER_POS"); - double v = rowset.getDouble ("C_INTEGER"); - assertCondition (v == 98765); - - rowset.close(); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } finally { + } -/** -getFloat() - Should work when the column index is valid. -**/ - public void Var034() - { - try { - RowSet rowset = getRowSet(jndiName_); - rowset.setUsername(systemObject_.getUserId()); - char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); - JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); - PasswordVault.clearPassword(charPassword); - rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); - rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); - rowset.execute(); - - JDRSTest.position0 (rowset, "NUMBER_POS"); - float v = rowset.getFloat (5); - assertCondition (v == 5.55f); - - rowset.close(); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } + } -/** -getFloat() - Should work when the column name is valid. -**/ - public void Var035() - { - try { - RowSet rowset = getRowSet(jndiName_); - rowset.setUsername(systemObject_.getUserId()); - char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); - JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); - PasswordVault.clearPassword(charPassword); - rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); - rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); - rowset.execute(); - - position0 (rowset, "NUMBER_POS"); - float v = rowset.getFloat ("C_INTEGER"); - assertCondition (v == 98765); - - rowset.close(); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } + /** + * Validates that rowInserted() - Should return false on all rows in the updated + * result set after repositioning. + **/ + public void Var087() { + String key = "JDRowSetRowInserted"; + + try { + + RowSet rowset = updater(key); + rowset.moveToInsertRow(); + rowset.updateInt("C_INTEGER", 68290); + rowset.updateNull("C_SMALLINT"); + rowset.updateString("C_CHAR_1", ")"); + rowset.insertRow(); + + rowset.beforeFirst(); + boolean success = true; + while (rowset.next()) { + if (rowset.rowInserted() != false) + success = false; + } + assertCondition(success); + + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } finally { + } + } + /** + * Validates that rowUpdated() - Should return false on all rows in the updated + * result set after repositioning. + **/ + public void Var088() { + String key = "JDRowSetRowUpdated"; + + try { + + RowSet rowset = updater(key); + rowset.next(); + rowset.updateInt("C_INTEGER", 98276); + rowset.updateNull("C_SMALLINT"); + rowset.updateFloat("C_FLOAT", -4.225f); + rowset.updateRow(); + + rowset.beforeFirst(); + boolean success = true; + while (rowset.next()) { + if (rowset.rowUpdated() != false) + success = false; + } + assertCondition(success); -/** -getInt() - Should work when the column index is valid. -**/ - public void Var036() - { - try { - RowSet rowset = getRowSet(jndiName_); - rowset.setUsername(systemObject_.getUserId()); - char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); - JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); - PasswordVault.clearPassword(charPassword); - rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); - rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); - rowset.execute(); - - position0 (rowset, "NUMBER_POS"); - int v = rowset.getInt (3); - assertCondition (v == 98765); - - rowset.close(); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } finally { + } + } -/** -getInt() - Should work when the column name is valid. -**/ - public void Var037() - { - try { - RowSet rowset = getRowSet(jndiName_); - rowset.setUsername(systemObject_.getUserId()); - char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); - JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); - PasswordVault.clearPassword(charPassword); - rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); - rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); - rowset.execute(); - - position0 (rowset, "NUMBER_POS"); - int v = rowset.getInt ("C_INTEGER"); - assertCondition (v == 98765); - - rowset.close(); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } + /** + * Validates that refreshRow() - Should work on a 1 row result set. + **/ + public void Var089() { + RowSet rowset = null; + try { + rowset = getRowSet(jndiName_); + rowset.setUsername(systemObject_.getUserId()); + char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); + JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); + PasswordVault.clearPassword(charPassword); + rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); + rowset.setConcurrency(ResultSet.CONCUR_UPDATABLE); + rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_POS + " WHERE ID = 1"); + rowset.execute(); + + rowset.next(); + rowset.refreshRow(); + int id = rowset.getInt("ID"); + boolean success = rowset.next(); + + assertCondition((success == false) && (id == 1)); + + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } finally { + + } + + } + + /** + * Validates that moveToCurrentRow() - Should return to the current row after a + * moveToInsertRow(), when the current row is positioned using first(). + **/ + public void Var090() { + String key = "JDRowSetMoveToCurrentRow"; + + try { + + RowSet rowset = getRowSet(jndiName_); + rowset.setUsername(systemObject_.getUserId()); + char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); + JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); + PasswordVault.clearPassword(charPassword); + rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); + rowset.setConcurrency(ResultSet.CONCUR_UPDATABLE); + rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_POS + " FOR UPDATE"); + rowset.execute(); + + rowset.first(); + rowset.moveToInsertRow(); + rowset.moveToCurrentRow(); + + int id = rowset.getInt(1); + rowset.close(); + + assertCondition(id == 1); + } catch (Exception e) { + failed(e, "Unexpected Exception for key=" + key); + } finally { + + } + } + + /** + * Returns an input stream containing the ASCII bytes for a string. + **/ + private InputStream stringToAsciiStream(String s) throws UnsupportedEncodingException { + return new ByteArrayInputStream(s.getBytes("ISO8859_1")); + } -/** -getLong() - Should work when the column index is valid. -**/ - public void Var038() - { - try { - RowSet rowset = getRowSet(jndiName_); - rowset.setUsername(systemObject_.getUserId()); - char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); - JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); - PasswordVault.clearPassword(charPassword); - rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); - rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); - rowset.execute(); - - position0 (rowset, "NUMBER_POS"); - long v = rowset.getLong (3); - assertCondition (v == 98765); - - rowset.close(); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } + /** + * Validate that updateAsciiStream() - Should work when the column index is + * valid. + **/ + public void Var091() { + String key_ = "JDRowSUpdAsciiStream"; -/** -getLong() - Should work when the column name is valid. -**/ - public void Var039() - { - try { - RowSet rowset = getRowSet(jndiName_); - rowset.setUsername(systemObject_.getUserId()); - char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); - JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); - PasswordVault.clearPassword(charPassword); - rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); - rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); - rowset.execute(); - - position0 (rowset, "NUMBER_POS"); - long v = rowset.getLong ("C_INTEGER"); - assertCondition (v == 98765); - - rowset.close(); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } + if (checkJdbc20()) { + + try { + + RowSet rowset = updater(key_); + position(rowset, key_); + InputStream asciiStream = stringToAsciiStream("Dublin"); + rowset.updateAsciiStream(14, asciiStream, 6); + asciiStream.close(); + rowset.updateRow(); + rowset.close(); + + // Validate. + RowSet validater = validater(); + position(validater, key_); + String v = validater.getString("C_VARCHAR_50"); + validater.close(); + + assertCondition(v.equals("Dublin")); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } finally { + + } } + } -/** -getObject() - Should work when the column index is valid. -**/ - public void Var040() - { - try { - RowSet rowset = getRowSet(jndiName_); - rowset.setUsername(systemObject_.getUserId()); - char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); - JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); - PasswordVault.clearPassword(charPassword); - rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); - rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); - rowset.execute(); - - position0 (rowset, "DATE_1998"); - Object s = rowset.getObject (1); - assertCondition (s.equals ("DATE_1998")); - - rowset.close(); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } + /** + * Validates that updateAsciiStream() - Should work when the column name is + * valid. + **/ + public void Var092() { + String key_ = "JDRowSUpdAsciiStream"; -/** -getObject() - Should work when the column name is valid. -**/ - public void Var041() - { - try { - RowSet rowset = getRowSet(jndiName_); - rowset.setUsername(systemObject_.getUserId()); - char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); - JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); - PasswordVault.clearPassword(charPassword); - rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); - rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); - rowset.execute(); - - position0 (rowset, "DATE_1998"); - Object s = rowset.getObject ("C_KEY"); - assertCondition (s.equals ("DATE_1998")); - - rowset.close(); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } -/** -getRef() - Should throw an exception when the column index is valid. -**/ - public void Var042() - { - RowSet rowset = null; - if (checkJdbc20 ()) { - try { - rowset = getRowSet(jndiName_); - rowset.setUsername(systemObject_.getUserId()); - char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); - JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); - PasswordVault.clearPassword(charPassword); - rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); - rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); - rowset.execute(); - - position (rowset, "NUMBER_POS"); - Ref v = rowset.getRef (3); - failed ("Didn't throw SQLException but got "+v); - } - catch (Exception e) { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - finally - { - try - { - rowset.close(); - } - catch (SQLException sq) { /* ignore */ } - } - } - } -/** -getRef() - Should throw an exception when the column name is valid. -**/ - public void Var043() - { - RowSet rowset = null; - if (checkJdbc20 ()) { - try { - rowset = getRowSet(jndiName_); - rowset.setUsername(systemObject_.getUserId()); - char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); - JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); - PasswordVault.clearPassword(charPassword); - rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); - rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); - rowset.execute(); - - position (rowset, "NUMBER_POS"); - Ref v = rowset.getRef ("C_INTEGER"); - failed ("Didn't throw SQLException but got "+v); - } - catch (Exception e) { - assertExceptionIsInstanceOf (e, "java.sql.SQLException"); - } - try - { - rowset.close(); - } - catch (SQLException sq) { /* ignore */ } - } + if (checkJdbc20()) { + + try { + + RowSet rowset = updater(key_); + // Update + position(rowset, key_); + InputStream asciiStream = stringToAsciiStream("Ibiza92"); + rowset.updateAsciiStream("C_VARCHAR_50", asciiStream, 7); + rowset.updateRow(); + asciiStream.close(); + rowset.close(); + + // Validate. + RowSet validater = validater(); + position(validater, key_); + String v = validater.getString("C_VARCHAR_50"); + validater.close(); + assertCondition(v.equals("Ibiza92"), "Got " + v + " sb Ibiza92"); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } finally { + + } } + } -/** -getRow() - Should return 0 on an empty result set. -**/ - public void Var044 () - { - if (checkJdbc20 ()) { - try { - RowSet rowset = getRowSet(jndiName_); - rowset.setUsername(systemObject_.getUserId()); - char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); - JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); - PasswordVault.clearPassword(charPassword); - rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); - rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); - rowset.execute(); - - int row = rowset.getRow (); - rowset.close (); - assertCondition (row == 0); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } + /** + * Compares a BigDecimal with a double, and allows a little rounding error. + **/ + private boolean compareBigDecimal(BigDecimal bd, double d) { + return (Math.abs(bd.doubleValue() - d) < 0.001); + } -/** -getRow() - Should work on a 1 row result set. -**/ - public void Var045 () - { - if (checkJdbc20 ()) { - try { - RowSet rowset = getRowSet(jndiName_); - rowset.setUsername(systemObject_.getUserId()); - char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); - JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); - PasswordVault.clearPassword(charPassword); - rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); - rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_POS + " WHERE ID = 1"); - rowset.execute(); - - boolean success = rowset.first (); - int row = rowset.getRow (); - rowset.close (); - assertCondition (row == 1, "row="+row+" sb success="+success); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } + /** + * updateBigDecimal() - Should work when the column index is valid. + **/ + public void Var093() { + String key_ = "JDRowSUpdBigDecimal"; -/** -getShort() - Should work when the column index is valid. -**/ - public void Var046() - { - try { - RowSet rowset = getRowSet(jndiName_); - rowset.setUsername(systemObject_.getUserId()); - char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); - JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); - PasswordVault.clearPassword(charPassword); - rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); - rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); - rowset.execute(); - - position0 (rowset, "NUMBER_POS"); - short v = rowset.getShort (2); - assertCondition (v == 198); - - rowset.close(); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } + if (checkJdbc20()) { + + try { + + RowSet rowset = updater(key_); -/** -getShort() - Should work when the column name is valid. -**/ - public void Var047() - { - try { - RowSet rowset = getRowSet(jndiName_); - rowset.setUsername(systemObject_.getUserId()); - char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); - JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); - PasswordVault.clearPassword(charPassword); - rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); - rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); - rowset.execute(); - - position0 (rowset, "NUMBER_POS"); - short v = rowset.getShort ("C_SMALLINT"); - assertCondition (v == 198); - - rowset.close(); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } + // Update. + position(rowset, key_); + rowset.updateBigDecimal(8, new BigDecimal("1.22")); + rowset.updateRow(); -/** -last() - Should return false on an empty result set. -**/ - public void Var048 () - { - if (checkJdbc20 ()) { - try { - RowSet rowset = getRowSet(jndiName_); - rowset.setUsername(systemObject_.getUserId()); - char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); - JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); - PasswordVault.clearPassword(charPassword); - rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); - rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_POS + " WHERE ID = -1"); - rowset.execute(); - - boolean success = rowset.last (); - rowset.close (); - assertCondition (success == false); - } catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } + rowset.close(); -/** -last() - Should work on a large result set. -**/ - public void Var049 () - { - if (checkJdbc20 ()) { - try { - RowSet rowset = getRowSet(jndiName_); - rowset.setUsername(systemObject_.getUserId()); - char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); - JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); - PasswordVault.clearPassword(charPassword); - rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); - rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_POS); - rowset.execute(); - - boolean success = rowset.last (); - int id1 = rowset.getInt (1); - rowset.close (); - assertCondition ((success == true) && (id1 == 99)); - } catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } + // Validate. + RowSet validater = validater(); + position(validater, key_); + BigDecimal v = validater.getBigDecimal("C_DECIMAL_105"); + validater.close(); -/** -insertRow() - Inserted row should be reflected in the result set -being updated when not repositioned. -**/ - public void Var050() - { - if (checkJdbc20 ()) { - try { - RowSet rowset = getRowSet(jndiName_); - rowset.setUsername(systemObject_.getUserId()); - char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); - JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); - PasswordVault.clearPassword(charPassword); - rowset.setConcurrency(ResultSet.CONCUR_UPDATABLE); - rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); - rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_UPDATE + " FOR UPDATE"); - rowset.execute(); - - JDRSTest.position (rowset, "JDRSInsertRow"); - int columnCount = rowset.getMetaData ().getColumnCount (); - - rowset.moveToInsertRow (); - rowset.updateString ("C_VARCHAR_50", "Space people"); - rowset.insertRow (); - - assertCondition (rowset.getString ("C_VARCHAR_50").equals ("Space people"), "Did not get expected string column count="+columnCount); - rowset.close(); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } + assertCondition(compareBigDecimal(v, 1.22)); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } finally { + + } } + } -/** -getUnicodeStream() - Should work when the column index is valid. -**/ - public void Var051() - { - try { - RowSet rowset = getRowSet(jndiName_); - rowset.setUsername(systemObject_.getUserId()); - char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); - JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); - PasswordVault.clearPassword(charPassword); - rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); - rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); - rowset.execute(); - - position0 (rowset, "CHAR_FULL"); - Reader v = rowset.getCharacterStream (12); - sb.setLength(0); - if(getDriver() == JDTestDriver.DRIVER_NATIVE && // @K2 - true ) // @K2 - assertCondition( compare( v, "Toolbox for Java ",sb),sb); // @K2 - else // @K2 - assertCondition (compare (v, "Toolbox for Java ",sb),sb); // @B0C - - rowset.close(); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } + /** + * updateBigDecimal() - Should work when the column name is valid. + **/ + public void Var094() { + String key_ = "JDRowSUpdBigDecimal"; -/** -getUnicodeStream() - Should work when the column name is valid. -**/ - public void Var052() - { - try { - RowSet rowset = getRowSet(jndiName_); - rowset.setUsername(systemObject_.getUserId()); - char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); - JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); - PasswordVault.clearPassword(charPassword); - rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); - rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); - rowset.execute(); - - position0 (rowset, "CHAR_FULL"); - Reader v = rowset.getCharacterStream ("C_CHAR_50"); - sb.setLength(0); - if(getDriver() == JDTestDriver.DRIVER_NATIVE && // @K2 - true ) // @K2 - assertCondition( compare( v, "Toolbox for Java ",sb),sb); // @K2 - else // @K2 - assertCondition (compare (v, "Toolbox for Java ",sb),sb); // @B0C - - rowset.close(); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } + if (checkJdbc20()) { + + try { + + RowSet rowset = updater(key_); -/** -getTimestamp() - Should work when the column index is valid. -**/ - public void Var053() - { - try { - RowSet rowset = getRowSet(jndiName_); - rowset.setUsername(systemObject_.getUserId()); - char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); - JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); - PasswordVault.clearPassword(charPassword); - rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); - rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); - rowset.execute(); - - position0 (rowset, "DATE_2000"); - Timestamp v = rowset.getTimestamp (21); - assertCondition (v.toString ().equals ("2000-06-25 10:30:12.345676")); - - rowset.close(); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } + // Update. + position(rowset, "JDRowSUpdBigDecimal"); + rowset.updateBigDecimal("C_NUMERIC_105", new BigDecimal("-5.3322")); + rowset.updateRow(); -/** -getTimestamp() - Should work when the column name is valid. -**/ - public void Var054() - { - try { - RowSet rowset = getRowSet(jndiName_); - rowset.setUsername(systemObject_.getUserId()); - char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); - JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); - PasswordVault.clearPassword(charPassword); - rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); - rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); - rowset.execute(); - - position0 (rowset, "DATE_1998"); - Timestamp v = rowset.getTimestamp ("C_TIMESTAMP"); - assertCondition (v.toString ().equals ("1998-11-18 03:13:42.987654")); - - rowset.close(); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } + rowset.close(); -/** -getTime() - Should work when the column index is valid. -**/ - public void Var055() - { - try { - RowSet rowset = getRowSet(jndiName_); - rowset.setUsername(systemObject_.getUserId()); - char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); - JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); - PasswordVault.clearPassword(charPassword); - rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); - rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); - rowset.execute(); - - position0 (rowset, "DATE_2000"); - Time v = rowset.getTime (20); - assertCondition (v.toString ().equals ("14:04:55")); - - rowset.close(); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } + // Validate. + RowSet validater = validater(); + position(validater, "JDRowSUpdBigDecimal"); + BigDecimal v = validater.getBigDecimal("C_NUMERIC_105"); + validater.close(); -/** -getTime() - Should work when the column name is valid. -**/ - public void Var056() - { - try { - RowSet rowset = getRowSet(jndiName_); - rowset.setUsername(systemObject_.getUserId()); - char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); - JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); - PasswordVault.clearPassword(charPassword); - rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); - rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); - rowset.execute(); - - position0 (rowset, "DATE_1998"); - Time v = rowset.getTime ("C_TIME"); - assertCondition (v.toString ().equals ("08:14:03")); - - rowset.close(); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } + assertCondition(v.doubleValue() == -5.3322); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } finally { + + } } + } -/** -getString() - Should work when the column index is valid. -**/ - public void Var057() - { + /** + * Validates that updateBinaryStream() - Should work when the column index is + * valid. + **/ + public void Var095() { + String key_ = "JDRowSUpdBinaryStream"; + + if (checkJdbc20()) { + try { - RowSet rowset = getRowSet(jndiName_); - rowset.setUsername(systemObject_.getUserId()); - char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); - JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); - PasswordVault.clearPassword(charPassword); - rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); - rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); - rowset.execute(); - - position0 (rowset, "DATE_1998"); - String s = rowset.getString (1); - assertCondition (s.equals ("DATE_1998")); - - rowset.close(); + + RowSet rowset = updater(key_); + + // Update. + position(rowset, key_); + byte[] ba = new byte[] { (byte) 22, (byte) 4, (byte) 98, (byte) -2 }; + rowset.updateBinaryStream(18, new ByteArrayInputStream(ba), ba.length); + rowset.updateRow(); + rowset.close(); + + // Validate + RowSet validater = validater(); + position(validater, key_); + byte[] v = validater.getBytes("C_VARBINARY_20"); + validater.close(); + + assertCondition(areEqual(v, ba)); } catch (Exception e) { - failed (e, "Unexpected Exception"); + failed(e, "Unexpected Exception"); + } finally { + } - } + } + } -/** -getString() - Should work when the column name is valid. -**/ - public void Var058() - { + /** + * Validates that updateBinaryStream() - Should work when the column name is + * valid. + **/ + public void Var096() { + String key_ = "JDRowSUpdBinaryStream"; + + if (checkJdbc20()) { + try { - RowSet rowset = getRowSet(jndiName_); - rowset.setUsername(systemObject_.getUserId()); - char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); - JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); - PasswordVault.clearPassword(charPassword); - rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); - rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); - rowset.execute(); - - position0 (rowset, "DATE_1998"); - String s = rowset.getString ("C_KEY"); - assertCondition (s.equals ("DATE_1998")); - - rowset.close(); - } catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - - /** - * Validates that getCommand returns as expected. - **/ - public void Var059() - { - String command = "SELECT * FROM QIWS.QCUSTCDT"; - try - { - RowSet rowset = getRowSet(jndiName_); - rowset.setUsername(systemObject_.getUserId()); - char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); - JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); - PasswordVault.clearPassword(charPassword); - rowset.setCommand(command); - - assertCondition(rowset.getCommand().equals(command)); - } - catch (Exception e) - { - failed(e, "Unexpected Exception"); - } - } - - /** - * Validates that getConcurrency returns as expected before a result set is created. - **/ - public void Var060() - { - int concurrency = ResultSet.CONCUR_UPDATABLE; - try - { - RowSet rowset = getRowSet(jndiName_); - rowset.setUsername(systemObject_.getUserId()); - char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); - JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); - PasswordVault.clearPassword(charPassword); - rowset.setConcurrency(concurrency); - - assertCondition(rowset.getConcurrency() == concurrency); - } - catch (Exception e) - { - failed(e, "Unexpected Exception"); - } - } - - /** - * Validates that getConcurrency returns as expected. - **/ - public void Var061() - { - int concurrency = ResultSet.CONCUR_UPDATABLE; - try - { - RowSet rowset = getRowSet(jndiName_); - rowset.setUsername(systemObject_.getUserId()); - char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); - JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); - PasswordVault.clearPassword(charPassword); - rowset.setConcurrency(concurrency); - - assertCondition(rowset.getConcurrency() == concurrency); - } - catch (Exception e) - { - failed(e, "Unexpected Exception"); - } - } - - /** - * Validates that getCursorName returns as expected. - **/ - public void Var062() - { - try - { - RowSet rowset = getRowSet(jndiName_); - rowset.setUsername(systemObject_.getUserId()); - char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); - JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); - PasswordVault.clearPassword(charPassword); - rowset.setCommand("SELECT * FROM QIWS.QCUSTCDT"); - rowset.execute(); - - assertCondition(rowset.getCursorName() != null); - - rowset.close(); - } - catch (Exception e) - { - failed(e, "Unexpected Exception"); - } - } - - /** - * Validates that getDataSourceName returns as expected. - **/ - public void Var063() - { - try - { - RowSet rowset; //@C1A - if(getDriver () == JDTestDriver.DRIVER_TOOLBOX) //@C1A - rowset = new AS400JDBCRowSet(); //@C1A - else //@C1A - rowset = getRowSet(null); //@C1M - rowset.setDataSourceName(jndiName_); - - assertCondition(rowset.getDataSourceName().equals(jndiName_)); - } - catch (Exception e) - { - failed(e, "Unexpected Exception"); - } - } - - /** - * Validates that getEscapeProcessing returns false as expected. - **/ - public void Var064() - { - try - { - RowSet rowset = getRowSet(jndiName_); - rowset.setUsername(systemObject_.getUserId()); - char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); - JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); - PasswordVault.clearPassword(charPassword); - rowset.setCommand("SELECT * FROM QIWS.QCUSTCDT"); - rowset.setEscapeProcessing(false); - - assertCondition(rowset.getEscapeProcessing() == false); - } - catch (Exception e) - { - failed(e, "Unexpected Exception"); - } - } - - - /** - * Validates that getFetchDirection returns as expected. - **/ - public void Var065() - { - try - { - RowSet rowset = getRowSet(jndiName_); - rowset.setUsername(systemObject_.getUserId()); - char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); - JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); - PasswordVault.clearPassword(charPassword); - rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); - rowset.setCommand("SELECT * FROM QIWS.QCUSTCDT"); - rowset.execute(); - - rowset.setFetchDirection(ResultSet.FETCH_REVERSE); - assertCondition(rowset.getFetchDirection() == ResultSet.FETCH_REVERSE); + + RowSet rowset = updater(key_); - rowset.close(); - } - catch (Exception e) - { - failed(e, "Unexpected Exception"); - } - } + // Update. + position(rowset, key_); + byte[] ba = new byte[] { (byte) -4, (byte) 98, (byte) 99 }; + rowset.updateBinaryStream("C_VARBINARY_20", new ByteArrayInputStream(ba), 3); + rowset.updateRow(); - /** - * Validates that getFetchDirection returns as expected. - **/ - public void Var066() - { - try - { - RowSet rowset = getRowSet(jndiName_); - rowset.setCommand("SELECT * FROM QIWS.QCUSTCDT"); - assertCondition(rowset.getFetchDirection() == ResultSet.FETCH_FORWARD); - } - catch (Exception e) - { - failed(e, "Unexpected Exception"); - } - } + rowset.close(); - /** - * Validates that getFetchDirection returns as expected. - **/ - public void Var067() - { - RowSet rowset = null; - try - { - rowset = getRowSet(jndiName_); - assertCondition(rowset.getFetchDirection() == ResultSet.FETCH_FORWARD); - } - catch (Exception e) - { - failed(e, "Unexpected Exception"); + // Validate. + RowSet validater = validater(); + position(validater, key_); + byte[] v = validater.getBytes("C_VARBINARY_20"); + validater.close(); + + assertCondition(areEqual(v, ba)); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } finally { + } - } + } + } - /** - * Validates that getFetchSize returns as expected. + /** + * updateBoolean() - Should work when the column index is valid. **/ - public void Var068() - { - try - { - RowSet rowset = getRowSet(jndiName_); - rowset.setUsername(systemObject_.getUserId()); - char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); - JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); - PasswordVault.clearPassword(charPassword); - rowset.setCommand("SELECT * FROM QIWS.QCUSTCDT"); - rowset.execute(); - - int size = 64; - rowset.setFetchSize(size); + public void Var097() { + String key_ = "JDRowSUpdBoolean"; + if (checkJdbc20()) { + + try { + + RowSet rowset = updater(key_); - assertCondition(rowset.getFetchSize() == size); + position(rowset, key_); + rowset.updateBoolean(2, true); + rowset.updateRow(); - rowset.close(); - } - catch (Exception e) - { - failed(e, "Unexpected Exception"); - } - } + rowset.close(); - /** - * Validates that getFetchSize returns as expected. - **/ - public void Var069() - { - try - { - RowSet rowset = getRowSet(jndiName_); - rowset.setCommand("SELECT * FROM QIWS.QCUSTCDT"); + // Validate. + RowSet validater = validater(); + position(validater, key_); + boolean v = validater.getBoolean("C_SMALLINT"); + validater.close(); - assertCondition(rowset.getFetchSize() == 0); - } - catch (Exception e) - { - failed(e, "Unexpected Exception"); + assertCondition(v == true); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } finally { + } - } + } + } - /** - * Validates that getFetchSize returns as expected if a statement has been created. + /** + * updateBoolean() - Should work when the column name is valid. **/ - public void Var070() - { - RowSet rowset = null; - try - { - rowset = getRowSet(jndiName_); - rowset.setUsername(systemObject_.getUserId()); - char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); - JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); - PasswordVault.clearPassword(charPassword); - //@A1 - if (getDriver () == JDTestDriver.DRIVER_TOOLBOX) - { - rowset.setCommand("CREATE TABLE QGPL.TESTTBLE (I INTEGER)"); - rowset.execute(); - } - else - { - stmt_.executeUpdate("CREATE TABLE QGPL.TESTTBLE (I INTEGER)"); - } - - assertCondition(rowset.getFetchSize() == 0); - } - catch (Exception e) - { - failed(e, "Unexpected Exception"); - } - finally - { - try - { - //@A1 - if (getDriver () == JDTestDriver.DRIVER_TOOLBOX) - { - rowset.setCommand("DROP TABLE QGPL.TESTTBLE"); - rowset.execute(); - } - else - { - stmt_.executeUpdate("DROP TABLE QGPL.TESTTBLE"); - } - } - catch (Exception e) - { - /* ignore errors. */ - } - try - { - rowset.close(); - } - catch (Exception f) {} - } - } + public void Var098() { + String key_ = "JDRowSUpdBoolean"; + if (checkJdbc20()) { + + try { + + RowSet rowset = updater(key_); + position(rowset, key_); + rowset.updateBoolean("C_SMALLINT", false); + rowset.updateRow(); - /** - * Validates that getMaxFieldSize returns as expected. - **/ - public void Var071() - { - try - { - RowSet rowset = getRowSet(jndiName_); - rowset.setCommand("SELECT * FROM QIWS.QCUSTCDT"); + rowset.close(); - assertCondition(rowset.getMaxFieldSize() == 0); - } - catch (Exception e) - { - failed(e, "Unexpected Exception"); + // Validate. + RowSet validater = validater(); + position(validater, key_); + boolean v = validater.getBoolean("C_SMALLINT"); + validater.close(); + assertCondition(v == false); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } finally { + } - } + } + } - /** - * Validates that getMaxFieldSize() returns as expected. + /** + * updateByte() - Should work when the column index is valid. **/ - public void Var072() - { - RowSet rowset = null; - try - { - rowset = getRowSet(jndiName_); - rowset.setUsername(systemObject_.getUserId()); - char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); - JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); - PasswordVault.clearPassword(charPassword); - rowset.setCommand("SELECT * FROM QIWS.QCUSTCDT"); - - int size = 25; - rowset.setMaxFieldSize(size); - - assertCondition(rowset.getMaxFieldSize() == size); - } - catch (Exception e) - { - failed(e, "Unexpected Exception"); - } - finally - { - try - { - rowset.close(); - } - catch (Exception f) {} - } - } + public void Var099() { + String key_ = "JDRowSUpdByte"; - /** - * Validates that getMaxRows() returns as expected. - **/ - public void Var073() - { - try - { - RowSet rowset = getRowSet(jndiName_); - rowset.setCommand("SELECT * FROM QIWS.QCUSTCDT"); + if (checkJdbc20()) { + + try { + + RowSet rowset = updater(key_); - assertCondition(rowset.getMaxRows() == 0); - } - catch (Exception e) - { - failed(e, "Unexpected Exception"); - } - } + position(rowset, key_); + rowset.updateByte(2, (byte) 45); + rowset.updateRow(); - /** - * Validates that getMaxRows() returns as expected. - **/ - public void Var074() - { - RowSet rowset = null; - try - { - rowset = getRowSet(jndiName_); - rowset.setUsername(systemObject_.getUserId()); - char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); - JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); - PasswordVault.clearPassword(charPassword); - rowset.setCommand("SELECT * FROM QIWS.QCUSTCDT"); - - int size = 25; - rowset.setMaxRows(size); - - assertCondition(rowset.getMaxRows() == size); - } - catch (Exception e) - { - failed(e, "Unexpected Exception"); - } - finally - { - try - { - rowset.close(); - } - catch (Exception f) {} - } - } - - /** - * Validates that getMetaData() returns as expected. - **/ - public void Var075() - { - try - { - RowSet rowset = getRowSet(jndiName_); - rowset.setUsername(systemObject_.getUserId()); - char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); - JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); - PasswordVault.clearPassword(charPassword); - rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); - rowset.execute(); - - assertCondition(rowset.getMetaData() != null); - - rowset.close(); - } - catch (Exception e) - { - failed(e, "Unexpected Exception."); - } - } - - /** - * Validates that getPassword() returns an empty string. - **/ - public void Var076() - { - try - { - RowSet rowset = getRowSet(jndiName_); - rowset.setPassword("MYPWD"); - - if (getDriver () == JDTestDriver.DRIVER_TOOLBOX) - { - assertCondition(rowset.getPassword().equals("")); - } - else - { - assertCondition(rowset.getPassword().equals("MYPWD")); - } - } - catch (Exception e) - { - failed(e, "Unexpected Exception"); - } - } - - /** - * Validates that getQueryTimeout() returns as expected. - **/ - public void Var077() - { - int expected = 1000; - RowSet rowset = null; - try - { - rowset = getRowSet(jndiName_); - rowset.setUsername(systemObject_.getUserId()); - char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); - JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); - PasswordVault.clearPassword(charPassword); - rowset.setCommand("SELECT * FROM QIWS.QCUSTCDT"); - rowset.setQueryTimeout(expected); - - assertCondition(rowset.getQueryTimeout() == expected); - } - catch (Exception e) - { - failed(e, "Unexpected Exception"); - } - finally - { - try - { - rowset.close(); - } - catch (Exception f) {} + rowset.close(); + + // Validate. + RowSet validater = validater(); + position(validater, key_); + byte v = validater.getByte("C_SMALLINT"); + validater.close(); + + assertCondition(v == 45); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } finally { + } - } + } + } - /** - * Validates that getStatement() returns as expected. + /** + * updateByte() - Should work when the column name is valid. **/ - public void Var078() - { - RowSet rowset = null; - try - { - rowset = getRowSet(jndiName_); - rowset.setUsername(systemObject_.getUserId()); - char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); - JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); - PasswordVault.clearPassword(charPassword); - rowset.setCommand("SELECT * FROM QIWS.QCUSTCDT" ); - rowset.execute(); - - assertCondition(rowset.getStatement() != null); - } - catch (Exception e) - { - if (getDriver () == JDTestDriver.DRIVER_NATIVE) - { - assertCondition(e.getMessage().indexOf("NOT SUPPORTED") >= 0); - } - else - failed(e, "Unexpected Exception."); - } - finally - { - try - { - rowset.close(); - } - catch (Exception f) {} - } - } + public void Var100() { + String key_ = "JDRowSUpdByte"; + + if (checkJdbc20()) { + + try { + + RowSet rowset = updater(key_); - /** - * Validates that getTransactionIsolation() returns as expected. - **/ - public void Var079() - { - try - { - int isolation = Connection.TRANSACTION_READ_COMMITTED; - RowSet rowset = getRowSet(jndiName_); - rowset.setTransactionIsolation(isolation); + position(rowset, key_); + rowset.updateByte("C_SMALLINT", (byte) -59); + rowset.updateRow(); + rowset.close(); - assertCondition(rowset.getTransactionIsolation() == isolation); - } - catch (Exception e) - { - failed(e, "Unexpected Exception."); + // Validate. + RowSet validater = validater(); + position(validater, key_); + + byte v = validater.getByte("C_SMALLINT"); + validater.close(); + assertCondition(v == -59); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } finally { + } - } + } + } - /** - * Validates that getTransactionIsolation() returns as expected. + /** + * updateBytes() - Should work when the column index is valid. **/ - public void Var080() - { - RowSet rowset = null; - try - { - rowset = getRowSet(jndiName_); - rowset.setUsername(systemObject_.getUserId()); - char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); - JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); - PasswordVault.clearPassword(charPassword); - //@A1 - if (getDriver () == JDTestDriver.DRIVER_TOOLBOX) - { - rowset.setCommand("INSERT INTO " + JDRSTest.RSTEST_UPDATE + " (C_KEY) VALUES ('test')" ); - rowset.execute(); - } - else - { - stmt_.executeUpdate("INSERT INTO " + JDRSTest.RSTEST_UPDATE + " (C_KEY) VALUES ('test')" ); - } - int isolation = Connection.TRANSACTION_REPEATABLE_READ; - rowset.setTransactionIsolation(isolation); - - assertCondition(rowset.getTransactionIsolation() == isolation); - } - catch (Exception e) - { - failed(e, "Unexpected Exception."); - } - finally - { - try - { - rowset.close(); - } - catch (Exception f) {} - } - } - - /** - * Validates that getType() returns as expected. - **/ - public void Var081() - { - try - { - RowSet rowset = getRowSet(jndiName_); - rowset.setUsername(systemObject_.getUserId()); - char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); - JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); - PasswordVault.clearPassword(charPassword); - rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); - - int type = ResultSet.TYPE_SCROLL_INSENSITIVE; - rowset.setType(type); + public void Var101() { + String key_ = "JDRowSUpdBytes"; - rowset.execute(); - - assertCondition(rowset.getType() == type); - } - catch (Exception e) - { - failed(e, "Unexpected Exception."); - } - } - - /** - * Validates that getType() returns as expected. - **/ - public void Var082() - { - try - { - RowSet rowset = getRowSet(jndiName_); - int type = ResultSet.TYPE_SCROLL_SENSITIVE; - rowset.setType(type); - - assertCondition(rowset.getType() == type); - } - catch (Exception e) - { - failed(e, "Unexpected Exception."); - } - } - - /** - * Validates that getTypeMap() returns the expected value. - **/ - public void Var083() - { - try - { - RowSet rowset = getRowSet(jndiName_); - rowset.setUsername(systemObject_.getUserId()); - char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); - JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); - PasswordVault.clearPassword(charPassword); - rowset.setCommand("SELECT * FROM QIWS.QCUSTCDT"); - rowset.setMaxRows(25); - - Map> m = rowset.getTypeMap(); - if (getDriver () == JDTestDriver.DRIVER_NATIVE) - { - assertCondition(m == null); - return; - } - failed("No SQLException thrown"); - } - catch (SQLException sq) - { - succeeded(); - } - catch (Exception e) - { - failed(e, "Unexpected Exception."); - } - } - - /** - * Validates that getUrl() returns the expected value. - **/ - public void Var084() - { - String url = "jdbc:as400:"; - try - { - RowSet rowset = getRowSet(jndiName_); - rowset.setUrl(url); - - assertCondition(rowset.getUrl().equals(url)); - } - catch (Exception e) - { - failed(e, "Unexpected Exception."); - } - } - - /** - * Validates that getUsername() returns the expected value. - **/ - public void Var085() - { - String name = "MYUSER"; - try - { - RowSet rowset = getRowSet(jndiName_); - rowset.setUsername(name); - - assertCondition(rowset.getUsername().equals(name)); - } - catch (Exception e) - { - failed(e, "Unexpected Exception."); - } - } + if (checkJdbc20()) { + + try { + + RowSet rowset = updater(key_); - /** - * Validates that rowDeleted() - Should return true on the deleted row when called immediately without repositioning. - **/ - public void Var086() - { - String key = "JDRSRowDeleted"; - try - { - RowSet rowset = updater(key); - rowset.next(); - rowset.deleteRow(); + position(rowset, key_); + byte[] ba = new byte[] { (byte) 22, (byte) 4, (byte) 98, (byte) -2 }; + rowset.updateBytes(18, ba); + rowset.updateRow(); - assertCondition (rowset.rowDeleted () == true); + rowset.close(); - rowset.close(); - } - catch (Exception e) - { - failed (e, "Unexpected Exception"); - } + // Validate. + RowSet validater = validater(); + position(validater, key_); + byte[] v = validater.getBytes("C_VARBINARY_20"); + validater.close(); + assertCondition(areEqual(v, ba)); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } finally { + + } } + } - /** - * Validates that rowInserted() - Should return false on all rows in the updated result set after repositioning. + /** + * updateBytes() - Should work when the column name is valid. **/ - public void Var087() - { - String key = "JDRSRowInserted"; - try - { - RowSet rowset = updater(key); - rowset.moveToInsertRow (); - rowset.updateInt ("C_INTEGER", 68290); - rowset.updateNull ("C_SMALLINT"); - rowset.updateString ("C_CHAR_1", ")"); - rowset.insertRow (); + public void Var102() { + String key_ = "JDRowSUpdBytes"; - rowset.beforeFirst (); - boolean success = true; - while (rowset.next ()) - { - if (rowset.rowInserted () != false) - success = false; - } - assertCondition (success); + if (checkJdbc20()) { + + try { + + RowSet rowset = updater(key_); - rowset.close(); - } - catch (Exception e) - { - failed (e, "Unexpected Exception"); - } - } - - /** - * Validates that rowUpdated() - Should return false on all rows in the updated result set after repositioning. - **/ - public void Var088() - { - String key = "JDRSRowUpdated"; - try - { - RowSet rowset = updater(key); - rowset.next(); - rowset.updateInt ("C_INTEGER", 98276); - rowset.updateNull ("C_SMALLINT"); - rowset.updateFloat ("C_FLOAT", -4.225f); - rowset.updateRow (); - - rowset.beforeFirst (); - boolean success = true; - while (rowset.next ()) - { - if (rowset.rowUpdated () != false) - success = false; - } - assertCondition (success); + position(rowset, key_); + byte[] ba = new byte[] { (byte) -4, (byte) 98, (byte) 99 }; + rowset.updateBytes("C_VARBINARY_20", ba); + rowset.updateRow(); - rowset.close(); - } - catch (Exception e) - { - failed (e, "Unexpected Exception"); - } - } + rowset.close(); + // Validate. + RowSet validater = validater(); + position(validater, key_); - /** - * Validates that refreshRow() - Should work on a 1 row result set. - **/ - public void Var089 () - { - RowSet rowset = null; - try - { - rowset = getRowSet(jndiName_); - rowset.setUsername(systemObject_.getUserId()); - char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); - JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); - PasswordVault.clearPassword(charPassword); - rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); - rowset.setConcurrency(ResultSet.CONCUR_UPDATABLE); - rowset.setCommand ("SELECT * FROM " + JDRSTest.RSTEST_POS + " WHERE ID = 1"); - rowset.execute(); - - rowset.next (); - rowset.refreshRow (); - int id = rowset.getInt ("ID"); - boolean success = rowset.next (); - - assertCondition ((success == false) && (id == 1)); - - rowset.close(); - } - catch (Exception e) - { - failed(e, "Unexpected Exception"); - } - finally - { - try - { - rowset.close(); - } - catch (SQLException sq) { /* ignore */ } + byte[] v = validater.getBytes("C_VARBINARY_20"); + validater.close(); + assertCondition(areEqual(v, ba)); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } finally { + } + } + } - } - - /** - * Validates that moveToCurrentRow() - Should return to the current row after a moveToInsertRow(), - * when the current row is positioned using first(). + /** + * updateCharacterStream() - Should work when the column index is valid. **/ - public void Var090 () - { - String key = "JDRSMoveToCurrentRow"; - try - { - RowSet rowset = getRowSet(jndiName_); - rowset.setUsername(systemObject_.getUserId()); - char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); - JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); - PasswordVault.clearPassword(charPassword); - rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); - rowset.setConcurrency(ResultSet.CONCUR_UPDATABLE); - rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_POS + " FOR UPDATE"); - rowset.execute(); + public void Var103() { + String key_ = "JDRowSUpdCharacterStream"; - rowset.first(); - rowset.moveToInsertRow(); - rowset.moveToCurrentRow(); + if (checkJdbc20()) { + + try { + + RowSet rowset = updater(key_); - int id = rowset.getInt (1); - rowset.close (); + position(rowset, key_); + rowset.updateCharacterStream(14, new StringReader("Fargo"), 5); + rowset.updateRow(); - assertCondition (id == 1); - } - catch (Exception e) - { - failed(e, "Unexpected Exception for key="+key); - } - } + rowset.close(); + // Validate. + RowSet validater = validater(); + position(validater, key_); -/** -Returns an input stream containing the ASCII bytes for a string. -**/ - private InputStream stringToAsciiStream (String s) - throws UnsupportedEncodingException - { - return new ByteArrayInputStream (s.getBytes ("ISO8859_1")); + String v = validater.getString("C_VARCHAR_50"); + validater.close(); + assertCondition(v.equals("Fargo")); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } finally { + + } } + } - /** - * Validate that updateAsciiStream() - Should work when the column index is valid. + /** + * updateCharacterStream() - Should work when the column name is valid. **/ - public void Var091() - { - String key_ = "JDRSUpdateAsciiStream"; + public void Var104() { + String key_ = "JDRowSUpdCharacterStream"; - if (checkJdbc20 ()) { - try { - RowSet rowset = updater(key_); - position (rowset, key_); - rowset.updateAsciiStream (14, stringToAsciiStream ("Dublin"), 6); - rowset.updateRow (); - rowset.close(); - - // Validate. - RowSet validater = validater(); - position (validater, key_); - String v = validater.getString ("C_VARCHAR_50"); - validater.close (); - assertCondition (v.equals ("Dublin")); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } + if (checkJdbc20()) { + + try { + + RowSet rowset = updater(key_); - /** - * Validates that updateAsciiStream() - Should work when the column name is valid. - **/ - public void Var092() - { - String key_ = "JDRSUpdateAsciiStream"; + position(rowset, key_); + rowset.updateCharacterStream("C_VARCHAR_50", new StringReader("Gillette"), 8); + rowset.updateRow(); - if (checkJdbc20 ()) { - try { - RowSet rowset = updater(key_); - // Update - position (rowset, key_); - rowset.updateAsciiStream ("C_VARCHAR_50", stringToAsciiStream ("Ibiza"), 5); - rowset.updateRow (); - rowset.close(); - - // Validate. - RowSet validater = validater(); - position (validater, key_); - String v = validater.getString ("C_VARCHAR_50"); - validater.close (); - assertCondition (v.equals ("Ibiza")); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } + rowset.close(); + // Validate. + RowSet validater = validater(); + position(validater, key_); -/** -Compares a BigDecimal with a double, and allows a little rounding error. -**/ - private boolean compareBigDecimal (BigDecimal bd, double d) - { - return (Math.abs (bd.doubleValue () - d) < 0.001); + String v = validater.getString("C_VARCHAR_50"); + validater.close(); + assertCondition(v.equals("Gillette")); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } finally { + + } } + } -/** -updateBigDecimal() - Should work when the column index is valid. -**/ - public void Var093() - { - String key_ = "JDRSUpdateBigDecimal"; + /** + * updateDouble() - Should work when the column index is valid. + **/ + public void Var105() { + String key_ = "JDRowSUpdDouble"; - if (checkJdbc20 ()) { - try { - RowSet rowset = updater(key_); + if (checkJdbc20()) { + + try { + + RowSet rowset = updater(key_); - // Update. - position (rowset, key_); - rowset.updateBigDecimal (8, new BigDecimal ("1.22")); - rowset.updateRow (); + position(rowset, key_); + rowset.updateDouble(6, 545); + rowset.updateRow(); - rowset.close(); + rowset.close(); - // Validate. - RowSet validater = validater(); - position (validater, key_); - BigDecimal v = validater.getBigDecimal ("C_DECIMAL_105"); - validater.close (); + // Validate. + RowSet validater = validater(); + position(validater, key_); - assertCondition (compareBigDecimal(v, 1.22)); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } + double v = validater.getDouble("C_DOUBLE"); + validater.close(); + assertCondition(v == 545); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } finally { + + } } + } -/** -updateBigDecimal() - Should work when the column name is valid. -**/ - public void Var094() - { - String key_ = "JDRSUpdateBigDecimal"; + /** + * updateDouble() - Should work when the column name is valid. + **/ + public void Var106() { + String key_ = "JDRowSUpdDouble"; - if (checkJdbc20 ()) { - try { - RowSet rowset = updater(key_); + if (checkJdbc20()) { + + try { + + RowSet rowset = updater(key_); - // Update. - position (rowset, "JDRSUpdateBigDecimal"); - rowset.updateBigDecimal ("C_NUMERIC_105", new BigDecimal ("-5.3322")); - rowset.updateRow (); + position(rowset, key_); + rowset.updateDouble("C_DOUBLE", -599); + rowset.updateRow(); + rowset.close(); - rowset.close(); + // Validate. + RowSet validater = validater(); + position(validater, key_); - // Validate. - RowSet validater = validater(); - position (validater, "JDRSUpdateBigDecimal"); - BigDecimal v = validater.getBigDecimal ("C_NUMERIC_105"); - validater.close (); + double v = validater.getDouble("C_DOUBLE"); + validater.close(); + assertCondition(v == -599); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } finally { + + } + } + } - assertCondition (v.doubleValue () == -5.3322); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } + /** + * updateDate() - Should work when the column index is valid. + **/ + public void Var107() { + String key_ = "JDRowSUpdDate"; + + if (checkJdbc20()) { + + try { + + RowSet rowset = updater(key_); + + position(rowset, key_); + Date d = new Date(1922400000); + rowset.updateDate(19, d); + rowset.updateRow(); + rowset.close(); + + // Validate. + RowSet validater = validater(); + position(validater, key_); + + Date v = validater.getDate("C_DATE"); + validater.close(); + // SQL400 - changed to compare only the date. + assertCondition(v.toString().equals(d.toString())); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } finally { + + } } + } + + /** + * updateDate() - Should work when the column name is valid. + **/ + public void Var108() { + String key_ = "JDRowSUpdDate"; + if (checkJdbc20()) { + + try { + + RowSet rowset = updater(key_); + + position(rowset, key_); + Date d = new Date(108000000); + rowset.updateDate("C_DATE", d); + rowset.updateRow(); + rowset.close(); + + // Validate. + RowSet validater = validater(); + position(validater, key_); + + Date v = validater.getDate("C_DATE"); + validater.close(); + // SQL400 - changed to compare only the dates. + assertCondition(v.toString().equals(d.toString())); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } finally { + + } + } + } - /** - * Validates that updateBinaryStream() - Should work when the column index is valid. + /** + * updateInt() - Should work when the column index is valid. **/ - public void Var095() - { - String key_ = "JDRSUpdateBinaryStream"; + public void Var109() { + String key_ = "JDRowSUpdInt"; - if (checkJdbc20 ()) { - try { - RowSet rowset = updater(key_); + if (checkJdbc20()) { + + try { + + RowSet rowset = updater(key_); - // Update. - position (rowset, key_); - byte[] ba = new byte[] { (byte) 22, (byte) 4, (byte) 98, (byte) -2 }; - rowset.updateBinaryStream (18, new ByteArrayInputStream (ba), ba.length); - rowset.updateRow (); - rowset.close(); + position(rowset, key_); + rowset.updateInt(3, 545); + rowset.updateRow(); + rowset.close(); - // Validate - RowSet validater = validater(); - position (validater, key_); - byte[] v = validater.getBytes ("C_VARBINARY_20"); - validater.close (); + // Validate. + RowSet validater = validater(); + position(validater, key_); - assertCondition (areEqual (v, ba)); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } + int v = validater.getInt("C_INTEGER"); + validater.close(); + assertCondition(v == 545); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } finally { + + } } + } - /** - * Validates that updateBinaryStream() - Should work when the column name is valid. + /** + * updateInt() - Should work when the column name is valid. **/ - public void Var096() - { - String key_ = "JDRSUpdateBinaryStream"; - - if (checkJdbc20 ()) { - try { - RowSet rowset = updater(key_); + public void Var110() { + String key_ = "JDRowSUpdInt"; - // Update. - position (rowset, key_); - byte[] ba = new byte[] { (byte) -4, (byte) 98, (byte) 99 }; - rowset.updateBinaryStream ("C_VARBINARY_20", new ByteArrayInputStream (ba), 3); - rowset.updateRow (); + if (checkJdbc20()) { + + try { + + RowSet rowset = updater(key_); - rowset.close(); + position(rowset, key_); + rowset.updateInt("C_INTEGER", -599); + rowset.updateRow(); + rowset.close(); - // Validate. - RowSet validater = validater(); - position (validater, key_); - byte[] v = validater.getBytes ("C_VARBINARY_20"); - validater.close (); + // Validate. + RowSet validater = validater(); + position(validater, key_); - assertCondition (areEqual (v, ba)); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } + int v = validater.getInt("C_INTEGER"); + validater.close(); + assertCondition(v == -599); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } finally { + + } } + } -/** -updateBoolean() - Should work when the column index is valid. -**/ - public void Var097() - { - String key_ = "JDRSUpdateBoolean"; - if (checkJdbc20 ()) { - try { - RowSet rowset = updater(key_); + /** + * updateFloat() - Should work when the column index is valid. + **/ + public void Var111() { + String key_ = "JDRowSUpdFloat"; - position (rowset, key_); - rowset.updateBoolean (2, true); - rowset.updateRow (); + if (checkJdbc20()) { + + try { + + RowSet rowset = updater(key_); - rowset.close(); + position(rowset, key_); + rowset.updateFloat(5, 545); + rowset.updateRow(); + rowset.close(); - // Validate. - RowSet validater = validater(); - position (validater, key_); - boolean v = validater.getBoolean ("C_SMALLINT"); - validater.close (); + // Validate. + RowSet validater = validater(); + position(validater, key_); - assertCondition (v == true); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } + float v = validater.getFloat("C_FLOAT"); + validater.close(); + assertCondition(v == 545); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } finally { + + } } + } + /** + * updateFloat() - Should work when the column name is valid. + **/ + public void Var112() { + String key_ = "JDRowSUpdFloat"; -/** -updateBoolean() - Should work when the column name is valid. -**/ - public void Var098() - { - String key_ = "JDRSUpdateBoolean"; - if (checkJdbc20 ()) { - try { - RowSet rowset = updater(key_); - - position (rowset, key_); - rowset.updateBoolean ("C_SMALLINT", false); - rowset.updateRow (); + if (checkJdbc20()) { + + try { + + RowSet rowset = updater(key_); + + position(rowset, key_); + rowset.updateFloat("C_FLOAT", -599); + rowset.updateRow(); + rowset.close(); + + // Validate. + RowSet validater = validater(); + position(validater, key_); + float v = validater.getFloat("C_FLOAT"); + validater.close(); + assertCondition(v == -599); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } finally { + + } + } + } - rowset.close(); + /** + * updateLong() - Should work when the column index is valid. + **/ + public void Var113() { + String key_ = "JDRowSUpdLong"; - // Validate. - RowSet validater = validater(); - position (validater, key_); - boolean v = validater.getBoolean ("C_SMALLINT"); - validater.close (); - assertCondition (v == false); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } + if (checkJdbc20()) { + + try { + + RowSet rowset = updater(key_); + + position(rowset, key_); + rowset.updateLong(3, 545); + rowset.updateRow(); + rowset.close(); + + // Validate. + RowSet validater = validater(); + position(validater, key_); + long v = validater.getLong("C_INTEGER"); + validater.close(); + assertCondition(v == 545); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } finally { + + } } + } -/** -updateByte() - Should work when the column index is valid. -**/ - public void Var099() - { - String key_ = "JDRSUpdateByte"; + /** + * updateLong() - Should work when the column name is valid. + **/ + public void Var114() { + String key_ = "JDRowSUpdLong"; - if (checkJdbc20 ()) { - try { - RowSet rowset = updater(key_); + if (checkJdbc20()) { + + try { + + RowSet rowset = updater(key_); + + position(rowset, key_); + rowset.updateLong("C_INTEGER", -599); + rowset.updateRow(); + rowset.close(); + + // Validate. + RowSet validater = validater(); + position(validater, key_); + long v = validater.getLong("C_INTEGER"); + validater.close(); + assertCondition(v == -599); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } finally { + + } + } + } - position (rowset, key_); - rowset.updateByte (2, (byte) 45); - rowset.updateRow (); + /** + * updateNull() - Should work when the column index is valid. + **/ + public void Var115() { + String key_ = "JDRowSUpdNull"; - rowset.close(); + if (checkJdbc20()) { + + try { + + RowSet rowset = updater(key_); + + position(rowset, key_); + rowset.updateNull(14); + rowset.updateRow(); + rowset.close(); + + // Validate. + RowSet validater = validater(); + position(validater, key_); + String v = validater.getString("C_VARCHAR_50"); + boolean wn = validater.wasNull(); + validater.close(); + assertCondition(wn == true, "wn is not true v=" + v); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } finally { + + } + } + } - // Validate. - RowSet validater = validater(); - position (validater, key_); - byte v = validater.getByte ("C_SMALLINT"); - validater.close (); + /** + * updateNull() - Should work when the column name is valid. + **/ + public void Var116() { + String key_ = "JDRowSUpdNull"; - assertCondition (v == 45); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } + if (checkJdbc20()) { + + try { + + RowSet rowset = updater(key_); + + position(rowset, key_); + rowset.updateNull("C_VARCHAR_50"); + rowset.updateRow(); + rowset.close(); + + // Validate. + RowSet validater = validater(); + position(validater, key_); + String v = validater.getString("C_VARCHAR_50"); + boolean wn = validater.wasNull(); + validater.close(); + assertCondition(wn == true, "wn is not true string =" + v); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } finally { + + } } + } -/** -updateByte() - Should work when the column name is valid. -**/ - public void Var100() - { - String key_ = "JDRSUpdateByte"; + /** + * updateObject() - Should work when the column index is valid. + **/ + public void Var117() { + String key_ = "JDRowSUpdObject"; - if (checkJdbc20 ()) { - try { - RowSet rowset = updater(key_); + if (checkJdbc20()) { + + try { + + RowSet rowset = updater(key_); + + position(rowset, key_); + rowset.updateObject(14, "Rhode Island"); + rowset.updateRow(); + rowset.close(); + + // Validate. + RowSet validater = validater(); + position(validater, key_); + String v = validater.getString("C_VARCHAR_50"); + validater.close(); + assertCondition(v.equals("Rhode Island")); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } finally { + + } + } + } - position(rowset,key_); - rowset.updateByte ("C_SMALLINT", (byte) -59); - rowset.updateRow (); - rowset.close(); + /** + * updateObject() - Should work when the column name is valid. + **/ + public void Var118() { + String key_ = "JDRowSUpdObject"; + + if (checkJdbc20()) { + + try { + + RowSet rowset = updater(key_); + + position(rowset, key_); + rowset.updateObject("C_VARCHAR_50", "District of Columbia"); + rowset.updateRow(); + rowset.close(); + + // Validate. + RowSet validater = validater(); + position(validater, key_); + String v = validater.getString("C_VARCHAR_50"); + validater.close(); + assertCondition(v.equals("District of Columbia")); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } finally { + + } + } + } - // Validate. - RowSet validater = validater(); - position (validater, key_); + /** + * updateShort() - Should work when the column index is valid. + **/ + public void Var119() { + String key_ = "JDRowSUpdShort"; - byte v = validater.getByte ("C_SMALLINT"); - validater.close (); - assertCondition (v == -59); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } + if (checkJdbc20()) { + + try { + + RowSet rowset = updater(key_); + + position(rowset, key_); + rowset.updateShort(2, (short) 45); + rowset.updateRow(); + rowset.close(); + + // Validate. + RowSet validater = validater(); + position(validater, key_); + int v = validater.getInt("C_SMALLINT"); + validater.close(); + assertCondition(v == 45); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } finally { + + } } + } + /** + * updateShort() - Should work when the column name is valid. + **/ + public void Var120() { + String key_ = "JDRowSUpdShort"; -/** -updateBytes() - Should work when the column index is valid. -**/ - public void Var101() - { - String key_ = "JDRSUpdateBytes"; + if (checkJdbc20()) { + + try { + + RowSet rowset = updater(key_); + + position(rowset, key_); + rowset.updateShort("C_SMALLINT", (short) -59); + rowset.updateRow(); + rowset.close(); + + // Validate. + RowSet validater = validater(); + position(validater, key_); + short v = validater.getShort("C_SMALLINT"); + validater.close(); + assertCondition(v == -59); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } finally { + + } + } + } - if (checkJdbc20 ()) { - try { - RowSet rowset = updater(key_); + /** + * updateString() - Should work when the column index is valid. + **/ + public void Var121() { + String key_ = "JDRowSUpdString"; - position (rowset, key_); - byte[] ba = new byte[] { (byte) 22, (byte) 4, (byte) 98, (byte) -2 }; - rowset.updateBytes (18, ba); - rowset.updateRow (); + if (checkJdbc20()) { + + try { + + RowSet rowset = updater(key_); + + position(rowset, key_); + rowset.updateString(14, "Queries"); + rowset.updateRow(); + rowset.close(); + + // Validate. + RowSet validater = validater(); + position(validater, key_); + String v = validater.getString("C_VARCHAR_50"); + validater.close(); + assertCondition(v.equals("Queries")); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } finally { + + } + } + } - rowset.close(); + /** + * updateString() - Should work when the column name is valid. + **/ + public void Var122() { + String key_ = "JDRowSUpdString"; - // Validate. - RowSet validater = validater(); - position (validater, key_); + if (checkJdbc20()) { + + try { + + RowSet rowset = updater(key_); + + position(rowset, key_); + rowset.updateString("C_VARCHAR_50", "Inner joins"); + rowset.updateRow(); + rowset.close(); + + // Validate. + RowSet validater = validater(); + position(validater, key_); + String v = validater.getString("C_VARCHAR_50"); + validater.close(); + assertCondition(v.equals("Inner joins")); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } finally { + + } + } + } - byte[] v = validater.getBytes ("C_VARBINARY_20"); - validater.close (); - assertCondition (areEqual (v, ba)); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } + /** + * updateTime() - Should work when the column index is valid. + **/ + public void Var123() { + String key_ = "JDRowSUpdTime"; + if (checkJdbc20()) { + + try { + + RowSet rowset = updater(key_); + + position(rowset, key_); + Time d = Time.valueOf("19:22:40"); + rowset.updateTime(20, d); + rowset.updateRow(); + rowset.close(); + + // Validate. + RowSet validater = validater(); + position(validater, key_); + Time v = validater.getTime("C_TIME"); + validater.close(); + assertCondition(v.toString().equals(d.toString())); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } finally { + + } } + } -/** -updateBytes() - Should work when the column name is valid. -**/ - public void Var102() - { - String key_ = "JDRSUpdateBytes"; + /** + * updateTime() - Should work when the column name is valid. + **/ + public void Var124() { + String key_ = "JDRowSUpdTime"; + if (checkJdbc20()) { + + try { + + RowSet rowset = updater(key_); + + position(rowset, key_); + Time d = Time.valueOf("10:08:00"); + rowset.updateTime("C_TIME", d); + rowset.updateRow(); + rowset.close(); + + // Validate. + RowSet validater = validater(); + position(validater, key_); + Time v = validater.getTime("C_TIME"); + validater.close(); + assertCondition(v.toString().equals(d.toString())); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } finally { + + } + } + } - if (checkJdbc20 ()) { - try { - RowSet rowset = updater(key_); + /** + * updateTimestamp() - Should work when the column index is valid. + **/ + public void Var125() { + String key_ = "JDRowSUpdTimestamp"; + + if (checkJdbc20()) { + + try { + + RowSet rowset = updater(key_); - position (rowset, key_); - byte[] ba = new byte[] { (byte) -4, (byte) 98, (byte) 99 }; - rowset.updateBytes ("C_VARBINARY_20", ba); - rowset.updateRow (); + position(rowset, key_); - rowset.close(); + Timestamp d = new Timestamp(19342240); + rowset.updateTimestamp(21, d); + rowset.updateRow(); - // Validate. - RowSet validater = validater(); - position (validater, key_); + rowset.close(); - byte[] v = validater.getBytes ("C_VARBINARY_20"); - validater.close(); - assertCondition (areEqual (v, ba)); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } + // Validate. + RowSet validater = validater(); + position(validater, key_); + Timestamp v = validater.getTimestamp("C_TIMESTAMP"); + validater.close(); + assertCondition(v.equals(d)); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } finally { + + } } + } -/** -updateCharacterStream() - Should work when the column index is valid. -**/ - public void Var103() - { - String key_ = "JDRSUpdateCharacterStream"; + /** + * updateTimestamp() - Should work when the column name is valid. + **/ + public void Var126() { + String key_ = "JDRowSUpdTimestamp"; - if (checkJdbc20 ()) { - try { - RowSet rowset = updater(key_); + if (checkJdbc20()) { + + try { + + RowSet rowset = updater(key_); - position (rowset, key_); - rowset.updateCharacterStream (14, new StringReader ("Fargo"), 5); - rowset.updateRow (); + position(rowset, key_); + Timestamp d = new Timestamp(1084440); + rowset.updateTimestamp("C_TIMESTAMP", d); + rowset.updateRow(); - rowset.close(); + rowset.close(); - // Validate. - RowSet validater = validater(); - position (validater, key_); + // Validate. + RowSet validater = validater(); + position(validater, key_); + Timestamp v = validater.getTimestamp("C_TIMESTAMP"); + validater.close(); - String v = validater.getString ("C_VARCHAR_50"); - validater.close (); - assertCondition (v.equals ("Fargo")); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } + assertCondition(v.equals(d)); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } finally { + + } } + } -/** -updateCharacterStream() - Should work when the column name is valid. -**/ - public void Var104() - { - String key_ = "JDRSUpdateCharacterStream"; + /** + * Validates that close() works as expected after and execute without a result + * set. + **/ + public void Var127() { + try { + RowSet rowset = getRowSet(jndiName_); + rowset.setUsername(systemObject_.getUserId()); + char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); + JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); + PasswordVault.clearPassword(charPassword); + // @A1 + if (getDriver() == JDTestDriver.DRIVER_TOOLBOX) { + rowset.setCommand("CREATE TABLE QGPL.TESTTBLE (G INTEGER)"); + rowset.execute(); + } else { + stmt_.executeUpdate("CREATE TABLE QGPL.TESTTBLE (G INTEGER)"); + } - if (checkJdbc20 ()) { - try { - RowSet rowset = updater(key_); + rowset.close(); + succeeded(); + } catch (Exception e) { + failed(e, "Unexpected Exception."); + } finally { + try { + RowSet rowset = getRowSet(jndiName_); + // @A1 + if (getDriver() == JDTestDriver.DRIVER_TOOLBOX) { + rowset.setUsername(systemObject_.getUserId()); // @K1A + char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); + JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); // @K1A //@K1A + PasswordVault.clearPassword(charPassword); + rowset.setCommand("DROP TABLE QGPL.TESTTBLE"); // @K1A + rowset.execute(); + } else { + stmt_.executeUpdate("DROP TABLE QGPL.TESTTBLE"); + } + rowset.close(); + } catch (Exception all) { + /* ignore */ } + } + } + + /** + * Validates that addRowSetListener(RowSetListener) notifies listeners when the + * row is changed - updateAsciiStream(int,AsciiStream). + **/ + public void Var128() { + String key_ = "RowSetListener"; + + try { + + MyRowListener listener = new MyRowListener(); + + RowSet rowset = updater(key_); + rowset.addRowSetListener(listener); + position(rowset, key_); + InputStream asciiStream = stringToAsciiStream("Dublin"); + rowset.updateAsciiStream(14, asciiStream, 6); + boolean changed = listener.isRowChanged(); + asciiStream.close(); + rowset.close(); + assertCondition(changed); + + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception."); + } finally { + + } + } + + /** + * Validates that addRowSetListener(RowSetListener) notifies listeners when the + * row is changed - updateAsciiStream(String,AsciiStream). + **/ + public void Var129() { + String key_ = "RowSetListener"; + + try { + + MyRowListener listener = new MyRowListener(); + + RowSet rowset = updater(key_); + rowset.addRowSetListener(listener); + position(rowset, key_); + InputStream asciiStream = stringToAsciiStream("Ibiza129"); + rowset.updateAsciiStream("C_VARCHAR_50", asciiStream, 8); + asciiStream.close(); + assertCondition(listener.isRowChanged()); + + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception."); + } finally { + + } + } + + /** + * Validates that addRowSetListener(RowSetListener) notifies listeners when the + * row is changed - updateBigDecimal(int,BigDecimal). + **/ + public void Var130() { + String key_ = "RowSetListener"; + + try { + + MyRowListener listener = new MyRowListener(); - position (rowset, key_); - rowset.updateCharacterStream ("C_VARCHAR_50", new StringReader ("Gillette"), 8); - rowset.updateRow (); + RowSet rowset = updater(key_); + rowset.addRowSetListener(listener); + position(rowset, key_); - rowset.close(); + rowset.updateBigDecimal(8, new BigDecimal("1.22")); - // Validate. - RowSet validater = validater(); - position (validater, key_); + assertCondition(listener.isRowChanged()); - String v = validater.getString ("C_VARCHAR_50"); - validater.close (); - assertCondition (v.equals ("Gillette")); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception."); + } finally { + } + } -/** -updateDouble() - Should work when the column index is valid. -**/ - public void Var105() - { - String key_ = "JDRSUpdateDouble"; + /** + * Validates that addRowSetListener(RowSetListener) notifies listeners when the + * row is changed - updateBigDecimal(String,BigDecimal). + **/ + public void Var131() { + String key_ = "RowSetListener"; + + try { + + MyRowListener listener = new MyRowListener(); - if (checkJdbc20 ()) { - try { - RowSet rowset = updater(key_); + RowSet rowset = updater(key_); + rowset.addRowSetListener(listener); + position(rowset, key_); - position (rowset, key_); - rowset.updateDouble (6, 545); - rowset.updateRow (); + rowset.updateBigDecimal("C_NUMERIC_105", new BigDecimal("-5.3322")); - rowset.close(); + assertCondition(listener.isRowChanged()); - // Validate. - RowSet validater = validater(); - position (validater, key_); + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception."); + } finally { + + } + } - double v = validater.getDouble ("C_DOUBLE"); - validater.close (); - assertCondition (v == 545); - } catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } + /** + * Validates that addRowSetListener(RowSetListener) notifies listeners when the + * row is changed - updateBinaryStream(int,BinaryStream). + **/ + public void Var132() { + String key_ = "RowSetListener"; + + try { + + MyRowListener listener = new MyRowListener(); -/** -updateDouble() - Should work when the column name is valid. -**/ - public void Var106() - { - String key_ = "JDRSUpdateDouble"; - - if (checkJdbc20 ()) { - try { - RowSet rowset = updater(key_); - - position (rowset, key_); - rowset.updateDouble ("C_DOUBLE", -599); - rowset.updateRow (); - rowset.close(); + RowSet rowset = updater(key_); + rowset.addRowSetListener(listener); + position(rowset, key_); + + byte[] ba = new byte[] { (byte) 22, (byte) 4, (byte) 98, (byte) -2 }; + rowset.updateBinaryStream(18, new ByteArrayInputStream(ba), ba.length); + + assertCondition(listener.isRowChanged()); + + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception."); + } finally { + + } + } + + /** + * Validates that addRowSetListener(RowSetListener) notifies listeners when the + * row is changed - updateBinaryStream(String,BinaryStream). + **/ + public void Var133() { + String key_ = "RowSetListener"; + + try { + + MyRowListener listener = new MyRowListener(); - // Validate. - RowSet validater = validater(); - position (validater, key_); + RowSet rowset = updater(key_); + rowset.addRowSetListener(listener); + position(rowset, key_); - double v = validater.getDouble ("C_DOUBLE"); - validater.close (); - assertCondition (v == -599); - } catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } + byte[] ba = new byte[] { (byte) -4, (byte) 98, (byte) 99 }; + rowset.updateBinaryStream("C_VARBINARY_20", new ByteArrayInputStream(ba), 3); -/** -updateDate() - Should work when the column index is valid. -**/ - public void Var107() - { - String key_ = "JDRSUpdateDate"; + assertCondition(listener.isRowChanged()); - if (checkJdbc20 ()) { - try { - RowSet rowset = updater(key_); - - position (rowset, key_); - Date d = new Date (1922400000); - rowset.updateDate (19, d); - rowset.updateRow (); - rowset.close(); - - // Validate. - RowSet validater = validater(); - position (validater, key_); - - Date v = validater.getDate ("C_DATE"); - validater.close (); - // SQL400 - changed to compare only the date. - assertCondition (v.toString().equals(d.toString())); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception."); + } finally { + } + } -/** -updateDate() - Should work when the column name is valid. -**/ - public void Var108() - { - String key_ = "JDRSUpdateDate"; + /** + * Validates that addRowSetListener(RowSetListener) notifies listeners when the + * row is changed - updateBoolean(int,boolean). + **/ + public void Var134() { + String key_ = "RowSetListener"; + + try { + + MyRowListener listener = new MyRowListener(); - if (checkJdbc20 ()) { - try { - RowSet rowset = updater(key_); - - position (rowset, key_); - Date d = new Date (108000000); - rowset.updateDate ("C_DATE", d); - rowset.updateRow (); - rowset.close(); - - // Validate. - RowSet validater = validater(); - position (validater, key_); - - Date v = validater.getDate ("C_DATE"); - validater.close (); - // SQL400 - changed to compare only the dates. - assertCondition (v.toString().equals(d.toString())); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } + RowSet rowset = updater(key_); + rowset.addRowSetListener(listener); + position(rowset, key_); + rowset.updateBoolean(2, true); -/** -updateInt() - Should work when the column index is valid. -**/ - public void Var109() - { - String key_ = "JDRSUpdateInt"; + assertCondition(listener.isRowChanged()); - if (checkJdbc20 ()) { - try { - RowSet rowset = updater(key_); + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception."); + } finally { + + } + } - position (rowset, key_); - rowset.updateInt (3, 545); - rowset.updateRow (); - rowset.close(); + /** + * Validates that addRowSetListener(RowSetListener) notifies listeners when the + * row is changed - updateBoolean(int,boolean). + **/ + public void Var135() { + String key_ = "RowSetListener"; + + try { + + MyRowListener listener = new MyRowListener(); - // Validate. - RowSet validater = validater(); - position (validater, key_); + RowSet rowset = updater(key_); + rowset.addRowSetListener(listener); + position(rowset, key_); - int v = validater.getInt ("C_INTEGER"); - validater.close (); - assertCondition (v == 545); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } + rowset.updateBoolean(2, true); + + assertCondition(listener.isRowChanged()); + + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception."); + } finally { + } + } -/** -updateInt() - Should work when the column name is valid. -**/ - public void Var110() - { - String key_ = "JDRSUpdateInt"; + /** + * Validates that addRowSetListener(RowSetListener) notifies listeners when the + * row is changed - updateBoolean(String,boolean). + **/ + public void Var136() { + String key_ = "RowSetListener"; + + try { + + MyRowListener listener = new MyRowListener(); - if (checkJdbc20 ()) { - try { - RowSet rowset = updater(key_); + RowSet rowset = updater(key_); + rowset.addRowSetListener(listener); + position(rowset, key_); - position (rowset, key_); - rowset.updateInt ("C_INTEGER", -599); - rowset.updateRow (); - rowset.close(); + rowset.updateBoolean("C_SMALLINT", false); - // Validate. - RowSet validater = validater(); - position (validater, key_); + assertCondition(listener.isRowChanged()); - int v = validater.getInt ("C_INTEGER"); - validater.close (); - assertCondition (v == -599); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception."); + } finally { + } + } -/** -updateFloat() - Should work when the column index is valid. -**/ - public void Var111() - { - String key_ = "JDRSUpdateFloat"; + /** + * Validates that addRowSetListener(RowSetListener) notifies listeners when the + * row is changed - updateByte(int,byte). + **/ + public void Var137() { + String key_ = "RowSetListener"; + + try { + + MyRowListener listener = new MyRowListener(); - if (checkJdbc20 ()) { - try { - RowSet rowset = updater(key_); + RowSet rowset = updater(key_); + rowset.addRowSetListener(listener); + position(rowset, key_); - position (rowset, key_); - rowset.updateFloat (5, 545); - rowset.updateRow (); - rowset.close(); + rowset.updateByte(2, (byte) 45); - // Validate. - RowSet validater = validater(); - position (validater, key_); + assertCondition(listener.isRowChanged()); - float v = validater.getFloat ("C_FLOAT"); - validater.close (); - assertCondition (v == 545); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception."); + } finally { + } + } -/** -updateFloat() - Should work when the column name is valid. -**/ - public void Var112() - { - String key_ = "JDRSUpdateFloat"; + /** + * Validates that addRowSetListener(RowSetListener) notifies listeners when the + * row is changed - updateByte(String,byte). + **/ + public void Var138() { + String key_ = "RowSetListener"; + + try { + + MyRowListener listener = new MyRowListener(); - if (checkJdbc20 ()) { - try { - RowSet rowset = updater(key_); + RowSet rowset = updater(key_); + rowset.addRowSetListener(listener); + position(rowset, key_); - position (rowset, key_); - rowset.updateFloat ("C_FLOAT", -599); - rowset.updateRow (); - rowset.close(); + rowset.updateByte("C_SMALLINT", (byte) -59); - // Validate. - RowSet validater = validater(); - position (validater, key_); - float v = validater.getFloat ("C_FLOAT"); - validater.close (); - assertCondition (v == -599); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } + assertCondition(listener.isRowChanged()); + + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception."); + } finally { + } + } -/** -updateLong() - Should work when the column index is valid. -**/ - public void Var113() - { - String key_ = "JDRSUpdateLong"; + /** + * Validates that addRowSetListener(RowSetListener) notifies listeners when the + * row is changed - updateBytes(int,byte[]). + **/ + public void Var139() { + String key_ = "RowSetListener"; + + try { + + MyRowListener listener = new MyRowListener(); - if (checkJdbc20 ()) { - try { - RowSet rowset = updater(key_); + RowSet rowset = updater(key_); + rowset.addRowSetListener(listener); + position(rowset, key_); - position (rowset, key_); - rowset.updateLong (3, 545); - rowset.updateRow (); - rowset.close(); + byte[] ba = new byte[] { (byte) 22, (byte) 4, (byte) 98, (byte) -2 }; + rowset.updateBytes(18, ba); - // Validate. - RowSet validater = validater(); - position (validater, key_); - long v = validater.getLong ("C_INTEGER"); - validater.close (); - assertCondition (v == 545); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } + assertCondition(listener.isRowChanged()); + + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception."); + } finally { + } + } + /** + * Validates that addRowSetListener(RowSetListener) notifies listeners when the + * row is changed - updateBytes(String,bytes[]). + **/ + public void Var140() { + String key_ = "RowSetListener"; + + try { + + MyRowListener listener = new MyRowListener(); -/** -updateLong() - Should work when the column name is valid. -**/ - public void Var114() - { - String key_ = "JDRSUpdateLong"; + RowSet rowset = updater(key_); + rowset.addRowSetListener(listener); + position(rowset, key_); - if (checkJdbc20 ()) { - try { - RowSet rowset = updater(key_); + byte[] ba = new byte[] { (byte) -4, (byte) 98, (byte) 99 }; + rowset.updateBytes("C_VARBINARY_20", ba); - position (rowset, key_); - rowset.updateLong ("C_INTEGER", -599); - rowset.updateRow (); - rowset.close(); + assertCondition(listener.isRowChanged()); - // Validate. - RowSet validater = validater(); - position (validater, key_); - long v = validater.getLong ("C_INTEGER"); - validater.close (); - assertCondition (v == -599); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception."); + } finally { + } + } -/** -updateNull() - Should work when the column index is valid. -**/ - public void Var115() - { - String key_ = "JDRSUpdateNull"; + /** + * Validates that addRowSetListener(RowSetListener) notifies listeners when the + * row is changed - updateCharacterStream(int,CharacterStream). + **/ + public void Var141() { + String key_ = "RowSetListener"; + + try { + + MyRowListener listener = new MyRowListener(); - if (checkJdbc20 ()) { - try { - RowSet rowset = updater(key_); + RowSet rowset = updater(key_); + rowset.addRowSetListener(listener); + position(rowset, key_); - position (rowset, key_); - rowset.updateNull (14); - rowset.updateRow (); - rowset.close(); + rowset.updateCharacterStream(14, new StringReader("Fargo"), 5); - // Validate. - RowSet validater = validater(); - position (validater, key_); - String v = validater.getString ("C_VARCHAR_50"); - boolean wn = validater.wasNull (); - validater.close (); - assertCondition (wn == true, "wn is not true v="+v); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } + assertCondition(listener.isRowChanged()); + + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception."); + } finally { + } + } -/** -updateNull() - Should work when the column name is valid. -**/ - public void Var116() - { - String key_ = "JDRSUpdateNull"; + /** + * Validates that addRowSetListener(RowSetListener) notifies listeners when the + * row is changed - updateCharacterStream(String,CharacterStream). + **/ + public void Var142() { + String key_ = "RowSetListener"; + + try { + + MyRowListener listener = new MyRowListener(); - if (checkJdbc20 ()) { - try { - RowSet rowset = updater(key_); + RowSet rowset = updater(key_); + rowset.addRowSetListener(listener); + position(rowset, key_); - position (rowset, key_); - rowset.updateNull ("C_VARCHAR_50"); - rowset.updateRow (); - rowset.close(); + rowset.updateCharacterStream("C_VARCHAR_50", new StringReader("Gillette"), 8); - // Validate. - RowSet validater = validater(); - position (validater, key_); - String v = validater.getString ("C_VARCHAR_50"); - boolean wn = validater.wasNull (); - validater.close (); - assertCondition (wn == true, "wn is not true string ="+v); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } + assertCondition(listener.isRowChanged()); -/** -updateObject() - Should work when the column index is valid. -**/ - public void Var117() - { - String key_ = "JDRSUpdateObject"; - - if (checkJdbc20 ()) { - try { - RowSet rowset = updater(key_); - - position (rowset, key_); - rowset.updateObject (14, "Rhode Island"); - rowset.updateRow (); - rowset.close(); - - // Validate. - RowSet validater = validater(); - position (validater, key_); - String v = validater.getString ("C_VARCHAR_50"); - validater.close (); - assertCondition (v.equals ("Rhode Island")); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception."); + } finally { + } + } -/** -updateObject() - Should work when the column name is valid. -**/ - public void Var118() - { - String key_ = "JDRSUpdateObject"; - - if (checkJdbc20 ()) { - try { - RowSet rowset = updater(key_); - - position (rowset, key_); - rowset.updateObject ("C_VARCHAR_50", "District of Columbia"); - rowset.updateRow (); - rowset.close(); - - // Validate. - RowSet validater = validater(); - position (validater, key_); - String v = validater.getString ("C_VARCHAR_50"); - validater.close (); - assertCondition (v.equals ("District of Columbia")); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } -/** -updateShort() - Should work when the column index is valid. -**/ - public void Var119() - { - String key_ = "JDRSUpdateShort"; + /** + * Validates that addRowSetListener(RowSetListener) notifies listeners when the + * row is changed - updateDouble(int,double). + **/ + public void Var143() { + String key_ = "RowSetListener"; + + try { + + MyRowListener listener = new MyRowListener(); - if (checkJdbc20 ()) { - try { - RowSet rowset = updater(key_); + RowSet rowset = updater(key_); + rowset.addRowSetListener(listener); + position(rowset, key_); - position (rowset, key_); - rowset.updateShort (2, (short) 45); - rowset.updateRow (); - rowset.close(); + rowset.updateDouble(6, 545); - // Validate. - RowSet validater = validater(); - position (validater, key_); - int v = validater.getInt ("C_SMALLINT"); - validater.close (); - assertCondition (v == 45); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } + assertCondition(listener.isRowChanged()); + + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception."); + } finally { + } + } -/** -updateShort() - Should work when the column name is valid. -**/ - public void Var120() - { - String key_ = "JDRSUpdateShort"; + /** + * Validates that addRowSetListener(RowSetListener) notifies listeners when the + * row is changed - updateDouble(String,double). + **/ + public void Var144() { + String key_ = "RowSetListener"; + + try { + + MyRowListener listener = new MyRowListener(); - if (checkJdbc20 ()) { - try { - RowSet rowset = updater(key_); + RowSet rowset = updater(key_); + rowset.addRowSetListener(listener); + position(rowset, key_); - position (rowset, key_); - rowset.updateShort ("C_SMALLINT", (short) -59); - rowset.updateRow (); - rowset.close(); + rowset.updateDouble("C_DOUBLE", -599); - // Validate. - RowSet validater = validater(); - position (validater, key_); - short v = validater.getShort ("C_SMALLINT"); - validater.close (); - assertCondition (v == -59); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } + assertCondition(listener.isRowChanged()); + + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception."); + } finally { + } + } + /** + * Validates that addRowSetListener(RowSetListener) notifies listeners when the + * row is changed - updateDate(int,Date). + **/ + public void Var145() { + String key_ = "RowSetListener"; + + try { + + MyRowListener listener = new MyRowListener(); -/** -updateString() - Should work when the column index is valid. -**/ - public void Var121() - { - String key_ = "JDRSUpdateString"; + RowSet rowset = updater(key_); + rowset.addRowSetListener(listener); + position(rowset, key_); - if (checkJdbc20 ()) { - try { - RowSet rowset = updater(key_); + Date d = new Date(1922400000); + rowset.updateDate(19, d); - position (rowset, key_); - rowset.updateString (14, "Queries"); - rowset.updateRow (); - rowset.close(); + assertCondition(listener.isRowChanged()); - // Validate. - RowSet validater = validater(); - position (validater, key_); - String v = validater.getString ("C_VARCHAR_50"); - validater.close (); - assertCondition (v.equals ("Queries")); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception."); + } finally { + } + } -/** -updateString() - Should work when the column name is valid. -**/ - public void Var122() - { - String key_ = "JDRSUpdateString"; + /** + * Validates that addRowSetListener(RowSetListener) notifies listeners when the + * row is changed - updateDate(String,Date). + **/ + public void Var146() { + String key_ = "RowSetListener"; + + try { + + MyRowListener listener = new MyRowListener(); - if (checkJdbc20 ()) { - try { - RowSet rowset = updater(key_); + RowSet rowset = updater(key_); + rowset.addRowSetListener(listener); + position(rowset, key_); - position (rowset, key_); - rowset.updateString ("C_VARCHAR_50", "Inner joins"); - rowset.updateRow (); - rowset.close(); + Date d = new Date(108000000); + rowset.updateDate("C_DATE", d); - // Validate. - RowSet validater = validater(); - position (validater, key_); - String v = validater.getString ("C_VARCHAR_50"); - validater.close (); - assertCondition (v.equals ("Inner joins")); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } + assertCondition(listener.isRowChanged()); -/** -updateTime() - Should work when the column index is valid. -**/ - public void Var123() - { - String key_ = "JDRSUpdateTime"; - if (checkJdbc20 ()) { - try { - RowSet rowset = updater(key_); + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception."); + } finally { + + } + } - position (rowset, key_); - Time d = Time.valueOf("19:22:40"); - rowset.updateTime (20, d); - rowset.updateRow (); - rowset.close(); + /** + * Validates that addRowSetListener(RowSetListener) notifies listeners when the + * row is changed - updateInt(int,int). + **/ + public void Var147() { + String key_ = "RowSetListener"; + + try { + + MyRowListener listener = new MyRowListener(); - // Validate. - RowSet validater = validater(); - position (validater, key_); - Time v = validater.getTime ("C_TIME"); - validater.close (); - assertCondition (v.toString ().equals (d.toString ())); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } - } + RowSet rowset = updater(key_); + rowset.addRowSetListener(listener); + position(rowset, key_); -/** -updateTime() - Should work when the column name is valid. -**/ - public void Var124() - { - String key_ = "JDRSUpdateTime"; - if (checkJdbc20 ()) { - try { - RowSet rowset = updater(key_); + rowset.updateInt(3, 545); - position (rowset, key_); - Time d = Time.valueOf("10:08:00"); - rowset.updateTime ("C_TIME", d); - rowset.updateRow (); - rowset.close(); + assertCondition(listener.isRowChanged()); - // Validate. - RowSet validater = validater(); - position (validater, key_); - Time v = validater.getTime ("C_TIME"); - validater.close (); - assertCondition (v.toString ().equals (d.toString ())); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception."); + } finally { + } + } -/** -updateTimestamp() - Should work when the column index is valid. -**/ - public void Var125() - { - String key_ = "JDRSUpdateTimestamp"; - - if (checkJdbc20 ()) { - try { - RowSet rowset = updater(key_); + /** + * Validates that addRowSetListener(RowSetListener) notifies listeners when the + * row is changed - updateInt(String,int). + **/ + public void Var148() { + String key_ = "RowSetListener"; + + try { + + MyRowListener listener = new MyRowListener(); - position (rowset, key_); + RowSet rowset = updater(key_); + rowset.addRowSetListener(listener); + position(rowset, key_); - Timestamp d = new Timestamp (19342240); - rowset.updateTimestamp (21, d); - rowset.updateRow (); + rowset.updateInt("C_INTEGER", -599); - rowset.close(); + assertCondition(listener.isRowChanged()); - // Validate. - RowSet validater = validater(); - position (validater, key_); - Timestamp v = validater.getTimestamp ("C_TIMESTAMP"); - validater.close (); - assertCondition (v.equals (d)); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception."); + } finally { + } + } -/** -updateTimestamp() - Should work when the column name is valid. -**/ - public void Var126() - { - String key_ = "JDRSUpdateTimestamp"; - - if (checkJdbc20 ()) { - try { - RowSet rowset = updater(key_); + /** + * Validates that addRowSetListener(RowSetListener) notifies listeners when the + * row is changed - updateFloat(int,float). + **/ + public void Var149() { + String key_ = "RowSetListener"; + + try { + + MyRowListener listener = new MyRowListener(); - position (rowset, key_); - Timestamp d = new Timestamp (1084440); - rowset.updateTimestamp ("C_TIMESTAMP", d); - rowset.updateRow (); + RowSet rowset = updater(key_); + rowset.addRowSetListener(listener); + position(rowset, key_); - rowset.close(); + rowset.updateFloat(5, 545); - // Validate. - RowSet validater = validater(); - position (validater, key_); - Timestamp v = validater.getTimestamp ("C_TIMESTAMP"); - validater.close (); + assertCondition(listener.isRowChanged()); - assertCondition (v.equals (d)); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception."); + } finally { + } + } + /** + * Validates that addRowSetListener(RowSetListener) notifies listeners when the + * row is changed - updateFloat(String,float). + **/ + public void Var150() { + String key_ = "RowSetListener"; + + try { + + MyRowListener listener = new MyRowListener(); - /** - * Validates that close() works as expected after and execute without a result set. - **/ - public void Var127() - { - try - { - RowSet rowset = getRowSet(jndiName_); - rowset.setUsername(systemObject_.getUserId()); - char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); - JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); - PasswordVault.clearPassword(charPassword); - //@A1 - if (getDriver () == JDTestDriver.DRIVER_TOOLBOX) - { - rowset.setCommand("CREATE TABLE QGPL.TESTTBLE (G INTEGER)"); - rowset.execute(); - } - else - { - stmt_.executeUpdate("CREATE TABLE QGPL.TESTTBLE (G INTEGER)"); - } + RowSet rowset = updater(key_); + rowset.addRowSetListener(listener); + position(rowset, key_); - rowset.close(); - succeeded(); - } - catch (Exception e) - { - failed(e, "Unexpected Exception."); - } - finally - { - try - { - RowSet rowset = getRowSet(jndiName_); - //@A1 - if (getDriver () == JDTestDriver.DRIVER_TOOLBOX) - { - rowset.setUsername(systemObject_.getUserId()); //@K1A - char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); - JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); //@K1A //@K1A - PasswordVault.clearPassword(charPassword); - rowset.setCommand("DROP TABLE QGPL.TESTTBLE"); //@K1A - rowset.execute(); - } - else - { - stmt_.executeUpdate("DROP TABLE QGPL.TESTTBLE"); - } - } - catch (Exception all) { /* ignore */ } - } - } + rowset.updateFloat("C_FLOAT", -599); + assertCondition(listener.isRowChanged()); - /** - * Validates that addRowSetListener(RowSetListener) notifies listeners when the row is changed - updateAsciiStream(int,AsciiStream). - **/ - public void Var128() - { - String key_ = "RowSetListener"; - try - { - MyRowListener listener = new MyRowListener(); + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception."); + } finally { + + } + } + + /** + * Validates that addRowSetListener(RowSetListener) notifies listeners when the + * row is changed - updateLong(int,long). + **/ + public void Var151() { + String key_ = "RowSetListener"; + + try { + + MyRowListener listener = new MyRowListener(); - RowSet rowset = updater(key_); - rowset.addRowSetListener(listener); - position (rowset, key_); + RowSet rowset = updater(key_); + rowset.addRowSetListener(listener); + position(rowset, key_); - rowset.updateAsciiStream (14, stringToAsciiStream ("Dublin"), 6); + rowset.updateLong(3, 545); - assertCondition(listener.isRowChanged()); + assertCondition(listener.isRowChanged()); - rowset.close(); - } - catch (Exception e) - { - failed(e, "Unexpected Exception."); - } + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception."); + } finally { + } + } - /** - * Validates that addRowSetListener(RowSetListener) notifies listeners when the row is changed - updateAsciiStream(String,AsciiStream). - **/ - public void Var129() - { - String key_ = "RowSetListener"; - try - { - MyRowListener listener = new MyRowListener(); + /** + * Validates that addRowSetListener(RowSetListener) notifies listeners when the + * row is changed - updateLong(String,long). + **/ + public void Var152() { + String key_ = "RowSetListener"; + + try { + + MyRowListener listener = new MyRowListener(); - RowSet rowset = updater(key_); - rowset.addRowSetListener(listener); - position (rowset, key_); + RowSet rowset = updater(key_); + rowset.addRowSetListener(listener); + position(rowset, key_); - rowset.updateAsciiStream ("C_VARCHAR_50", stringToAsciiStream ("Ibiza"), 5); + rowset.updateLong("C_INTEGER", -599); - assertCondition(listener.isRowChanged()); + assertCondition(listener.isRowChanged()); - rowset.close(); - } - catch (Exception e) - { - failed(e, "Unexpected Exception."); - } + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception."); + } finally { + } + } - /** - * Validates that addRowSetListener(RowSetListener) notifies listeners when the row is changed - updateBigDecimal(int,BigDecimal). - **/ - public void Var130() - { - String key_ = "RowSetListener"; - try - { - MyRowListener listener = new MyRowListener(); + /** + * Validates that addRowSetListener(RowSetListener) notifies listeners when the + * row is changed - updateNull(int). + **/ + public void Var153() { + String key_ = "RowSetListener"; + + try { + + MyRowListener listener = new MyRowListener(); - RowSet rowset = updater(key_); - rowset.addRowSetListener(listener); - position (rowset, key_); + RowSet rowset = updater(key_); + rowset.addRowSetListener(listener); + position(rowset, key_); - rowset.updateBigDecimal (8, new BigDecimal ("1.22")); + rowset.updateNull(14); - assertCondition(listener.isRowChanged()); + assertCondition(listener.isRowChanged()); - rowset.close(); - } - catch (Exception e) - { - failed(e, "Unexpected Exception."); - } + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception."); + } finally { + } + } - /** - * Validates that addRowSetListener(RowSetListener) notifies listeners when the row is changed - updateBigDecimal(String,BigDecimal). - **/ - public void Var131() - { - String key_ = "RowSetListener"; - try - { - MyRowListener listener = new MyRowListener(); + /** + * Validates that addRowSetListener(RowSetListener) notifies listeners when the + * row is changed - updateNull(String). + **/ + public void Var154() { + String key_ = "RowSetListener"; + + try { + + MyRowListener listener = new MyRowListener(); - RowSet rowset = updater(key_); - rowset.addRowSetListener(listener); - position (rowset, key_); + RowSet rowset = updater(key_); + rowset.addRowSetListener(listener); + position(rowset, key_); - rowset.updateBigDecimal ("C_NUMERIC_105", new BigDecimal ("-5.3322")); + rowset.updateNull("C_VARCHAR_50"); - assertCondition(listener.isRowChanged()); + assertCondition(listener.isRowChanged()); - rowset.close(); - } - catch (Exception e) - { - failed(e, "Unexpected Exception."); - } + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception."); + } finally { + } + } - /** - * Validates that addRowSetListener(RowSetListener) notifies listeners when the row is changed - updateBinaryStream(int,BinaryStream). - **/ - public void Var132() - { - String key_ = "RowSetListener"; - try - { - MyRowListener listener = new MyRowListener(); + /** + * Validates that addRowSetListener(RowSetListener) notifies listeners when the + * row is changed - updateObject(int,Object). + **/ + public void Var155() { + String key_ = "RowSetListener"; + + try { + + MyRowListener listener = new MyRowListener(); - RowSet rowset = updater(key_); - rowset.addRowSetListener(listener); - position (rowset, key_); + RowSet rowset = updater(key_); + rowset.addRowSetListener(listener); + position(rowset, key_); - byte[] ba = new byte[] { (byte) 22, (byte) 4, (byte) 98, (byte) -2 }; - rowset.updateBinaryStream (18, new ByteArrayInputStream (ba), ba.length); + rowset.updateObject(14, "Rhode Island"); - assertCondition(listener.isRowChanged()); + assertCondition(listener.isRowChanged()); - rowset.close(); - } - catch (Exception e) - { - failed(e, "Unexpected Exception."); - } + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception."); + } finally { + } + } - /** - * Validates that addRowSetListener(RowSetListener) notifies listeners when the row is changed - updateBinaryStream(String,BinaryStream). - **/ - public void Var133() - { - String key_ = "RowSetListener"; - try - { - MyRowListener listener = new MyRowListener(); + /** + * Validates that addRowSetListener(RowSetListener) notifies listeners when the + * row is changed - updateObject(String,Object). + **/ + public void Var156() { + String key_ = "RowSetListener"; + + try { + + MyRowListener listener = new MyRowListener(); - RowSet rowset = updater(key_); - rowset.addRowSetListener(listener); - position (rowset, key_); + RowSet rowset = updater(key_); + rowset.addRowSetListener(listener); + position(rowset, key_); - byte[] ba = new byte[] { (byte) -4, (byte) 98, (byte) 99 }; - rowset.updateBinaryStream ("C_VARBINARY_20", new ByteArrayInputStream (ba), 3); + rowset.updateObject("C_VARCHAR_50", "District of Columbia"); - assertCondition(listener.isRowChanged()); + assertCondition(listener.isRowChanged()); - rowset.close(); - } - catch (Exception e) - { - failed(e, "Unexpected Exception."); - } + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception."); + } finally { + } + } - /** - * Validates that addRowSetListener(RowSetListener) notifies listeners when the row is changed - updateBoolean(int,boolean). - **/ - public void Var134() - { - String key_ = "RowSetListener"; - try - { - MyRowListener listener = new MyRowListener(); + /** + * Validates that addRowSetListener(RowSetListener) notifies listeners when the + * row is changed - updateShort(int,short). + **/ + public void Var157() { + String key_ = "RowSetListener"; + + try { + + MyRowListener listener = new MyRowListener(); - RowSet rowset = updater(key_); - rowset.addRowSetListener(listener); - position (rowset, key_); + RowSet rowset = updater(key_); + rowset.addRowSetListener(listener); + position(rowset, key_); - rowset.updateBoolean (2, true); + rowset.updateShort(2, (short) 45); - assertCondition(listener.isRowChanged()); + assertCondition(listener.isRowChanged()); - rowset.close(); - } - catch (Exception e) - { - failed(e, "Unexpected Exception."); - } + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception."); + } finally { + } + } - /** - * Validates that addRowSetListener(RowSetListener) notifies listeners when the row is changed - updateBoolean(int,boolean). - **/ - public void Var135() - { - String key_ = "RowSetListener"; - try - { - MyRowListener listener = new MyRowListener(); + /** + * Validates that addRowSetListener(RowSetListener) notifies listeners when the + * row is changed - updateShort(int,short). + **/ + public void Var158() { + String key_ = "RowSetListener"; + + try { + + MyRowListener listener = new MyRowListener(); - RowSet rowset = updater(key_); - rowset.addRowSetListener(listener); - position (rowset, key_); + RowSet rowset = updater(key_); + rowset.addRowSetListener(listener); + position(rowset, key_); - rowset.updateBoolean (2, true); + rowset.updateShort(2, (short) 45); - assertCondition(listener.isRowChanged()); + assertCondition(listener.isRowChanged()); - rowset.close(); - } - catch (Exception e) - { - failed(e, "Unexpected Exception."); - } + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception."); + } finally { + } + } - /** - * Validates that addRowSetListener(RowSetListener) notifies listeners when the row is changed - updateBoolean(String,boolean). - **/ - public void Var136() - { - String key_ = "RowSetListener"; - try - { - MyRowListener listener = new MyRowListener(); + /** + * Validates that addRowSetListener(RowSetListener) notifies listeners when the + * row is changed - updateShort(String,short). + **/ + public void Var159() { + String key_ = "RowSetListener"; + + try { + + MyRowListener listener = new MyRowListener(); - RowSet rowset = updater(key_); - rowset.addRowSetListener(listener); - position (rowset, key_); + RowSet rowset = updater(key_); + rowset.addRowSetListener(listener); + position(rowset, key_); - rowset.updateBoolean ("C_SMALLINT", false); + rowset.updateShort("C_SMALLINT", (short) -59); - assertCondition(listener.isRowChanged()); + assertCondition(listener.isRowChanged()); - rowset.close(); - } - catch (Exception e) - { - failed(e, "Unexpected Exception."); - } + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception."); + } finally { + } + } - /** - * Validates that addRowSetListener(RowSetListener) notifies listeners when the row is changed - updateByte(int,byte). - **/ - public void Var137() - { - String key_ = "RowSetListener"; - try - { - MyRowListener listener = new MyRowListener(); + /** + * Validates that addRowSetListener(RowSetListener) notifies listeners when the + * row is changed - updateString(int,String). + **/ + public void Var160() { + String key_ = "RowSetListener"; + + try { + + MyRowListener listener = new MyRowListener(); - RowSet rowset = updater(key_); - rowset.addRowSetListener(listener); - position (rowset, key_); + RowSet rowset = updater(key_); + rowset.addRowSetListener(listener); + position(rowset, key_); - rowset.updateByte (2, (byte) 45); + rowset.updateString(14, "Queries"); - assertCondition(listener.isRowChanged()); + assertCondition(listener.isRowChanged()); - rowset.close(); - } - catch (Exception e) - { - failed(e, "Unexpected Exception."); - } + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception."); + } finally { + } + } - /** - * Validates that addRowSetListener(RowSetListener) notifies listeners when the row is changed - updateByte(String,byte). - **/ - public void Var138() - { - String key_ = "RowSetListener"; - try - { - MyRowListener listener = new MyRowListener(); + /** + * Validates that addRowSetListener(RowSetListener) notifies listeners when the + * row is changed - updateString(String,String). + **/ + public void Var161() { + String key_ = "RowSetListener"; + + try { + + MyRowListener listener = new MyRowListener(); - RowSet rowset = updater(key_); - rowset.addRowSetListener(listener); - position (rowset, key_); + RowSet rowset = updater(key_); + rowset.addRowSetListener(listener); + position(rowset, key_); - rowset.updateByte ("C_SMALLINT", (byte) -59); + rowset.updateString("C_VARCHAR_50", "Inner joins"); - assertCondition(listener.isRowChanged()); + assertCondition(listener.isRowChanged()); - rowset.close(); - } - catch (Exception e) - { - failed(e, "Unexpected Exception."); - } + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception."); + } finally { + } + } - /** - * Validates that addRowSetListener(RowSetListener) notifies listeners when the row is changed - updateBytes(int,byte[]). - **/ - public void Var139() - { - String key_ = "RowSetListener"; - try - { - MyRowListener listener = new MyRowListener(); + /** + * Validates that addRowSetListener(RowSetListener) notifies listeners when the + * row is changed - updateTime(int,Time). + **/ + public void Var162() { + String key_ = "RowSetListener"; + + try { + + MyRowListener listener = new MyRowListener(); - RowSet rowset = updater(key_); - rowset.addRowSetListener(listener); - position (rowset, key_); + RowSet rowset = updater(key_); + rowset.addRowSetListener(listener); + position(rowset, key_); - byte[] ba = new byte[] { (byte) 22, (byte) 4, (byte) 98, (byte) -2 }; - rowset.updateBytes (18, ba); + Time d = Time.valueOf("19:22:40"); + rowset.updateTime(20, d); - assertCondition(listener.isRowChanged()); + assertCondition(listener.isRowChanged()); - rowset.close(); - } - catch (Exception e) - { - failed(e, "Unexpected Exception."); - } + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception."); + } finally { + } + } - /** - * Validates that addRowSetListener(RowSetListener) notifies listeners when the row is changed - updateBytes(String,bytes[]). - **/ - public void Var140() - { - String key_ = "RowSetListener"; - try - { - MyRowListener listener = new MyRowListener(); + /** + * Validates that addRowSetListener(RowSetListener) notifies listeners when the + * row is changed - updateTime(String,Time). + **/ + public void Var163() { + String key_ = "RowSetListener"; + + try { + + MyRowListener listener = new MyRowListener(); - RowSet rowset = updater(key_); - rowset.addRowSetListener(listener); - position (rowset, key_); + RowSet rowset = updater(key_); + rowset.addRowSetListener(listener); + position(rowset, key_); - byte[] ba = new byte[] { (byte) -4, (byte) 98, (byte) 99 }; - rowset.updateBytes ("C_VARBINARY_20", ba); + Time d = Time.valueOf("10:08:00"); + rowset.updateTime("C_TIME", d); - assertCondition(listener.isRowChanged()); + assertCondition(listener.isRowChanged()); - rowset.close(); - } - catch (Exception e) - { - failed(e, "Unexpected Exception."); - } + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception."); + } finally { + } + } - /** - * Validates that addRowSetListener(RowSetListener) notifies listeners when the row is changed - updateCharacterStream(int,CharacterStream). - **/ - public void Var141() - { - String key_ = "RowSetListener"; - try - { - MyRowListener listener = new MyRowListener(); + /** + * Validates that addRowSetListener(RowSetListener) notifies listeners when the + * row is changed - updateTimestamp(int,Timestamp). + **/ + public void Var164() { + String key_ = "RowSetListener"; + + try { + + MyRowListener listener = new MyRowListener(); - RowSet rowset = updater(key_); - rowset.addRowSetListener(listener); - position (rowset, key_); + RowSet rowset = updater(key_); + rowset.addRowSetListener(listener); + position(rowset, key_); - rowset.updateCharacterStream (14, new StringReader ("Fargo"), 5); + Timestamp d = new Timestamp(19342240); + rowset.updateTimestamp(21, d); - assertCondition(listener.isRowChanged()); + assertCondition(listener.isRowChanged()); - rowset.close(); - } - catch (Exception e) - { - failed(e, "Unexpected Exception."); - } + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception."); + } finally { + } + } - /** - * Validates that addRowSetListener(RowSetListener) notifies listeners when the row is changed - updateCharacterStream(String,CharacterStream). - **/ - public void Var142() - { - String key_ = "RowSetListener"; - try - { - MyRowListener listener = new MyRowListener(); + /** + * Validates that addRowSetListener(RowSetListener) notifies listeners when the + * row is changed - updateTimestamp(String,Timestamp). + **/ + public void Var165() { + String key_ = "RowSetListener"; + + try { + + MyRowListener listener = new MyRowListener(); - RowSet rowset = updater(key_); - rowset.addRowSetListener(listener); - position (rowset, key_); + RowSet rowset = updater(key_); + rowset.addRowSetListener(listener); + position(rowset, key_); - rowset.updateCharacterStream ("C_VARCHAR_50", new StringReader ("Gillette"), 8); + Timestamp d = new Timestamp(1084440); + rowset.updateTimestamp("C_TIMESTAMP", d); - assertCondition(listener.isRowChanged()); + assertCondition(listener.isRowChanged()); - rowset.close(); - } - catch (Exception e) - { - failed(e, "Unexpected Exception."); - } + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception."); + } finally { + + } + } + + /** + * RowSetListener. + **/ + class MyRowListener implements RowSetListener { + private boolean cursorMoved_; + private boolean rowChanged_; + private boolean rowSetChanged_; + + public MyRowListener() { + reset(); + } + + public boolean isCursorMoved() { + return cursorMoved_; } - /** - * Validates that addRowSetListener(RowSetListener) notifies listeners when the row is changed - updateDouble(int,double). - **/ - public void Var143() - { - String key_ = "RowSetListener"; - try - { - MyRowListener listener = new MyRowListener(); + public boolean isRowChanged() { + return rowChanged_; + } - RowSet rowset = updater(key_); - rowset.addRowSetListener(listener); - position (rowset, key_); + public boolean isRowSetChanged() { + return rowSetChanged_; + } - rowset.updateDouble (6, 545); + public void reset() { + cursorMoved_ = false; + rowChanged_ = false; + rowSetChanged_ = false; + } - assertCondition(listener.isRowChanged()); + public void cursorMoved(RowSetEvent event) { + reset(); + cursorMoved_ = true; + } - rowset.close(); - } - catch (Exception e) - { - failed(e, "Unexpected Exception."); - } + public void rowChanged(RowSetEvent event) { + reset(); + rowChanged_ = true; } - /** - * Validates that addRowSetListener(RowSetListener) notifies listeners when the row is changed - updateDouble(String,double). - **/ - public void Var144() - { - String key_ = "RowSetListener"; - try - { - MyRowListener listener = new MyRowListener(); + public void rowSetChanged(RowSetEvent event) { + reset(); + rowSetChanged_ = true; + } + } - RowSet rowset = updater(key_); - rowset.addRowSetListener(listener); - position (rowset, key_); + /** + * getNCharacterStream() - Should work when the column index is valid. + **/ + public void Var166() { + if (checkJdbc40()) { + RowSet rowset = null; + try { + rowset = getRowSet(jndiName_); + rowset.setUsername(systemObject_.getUserId()); + char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); + JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); + PasswordVault.clearPassword(charPassword); + rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); + rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); + rowset.execute(); + + position(rowset, "CHAR_FULL"); + // Reader v = rowset.getNCharacterStream (12); + Reader v = (Reader) JDReflectionUtil.callMethod_O(rowset, "getNCharacterStream", 12); + sb.setLength(0); + assertCondition((v != null) && compare(v, "Toolbox for Java ", sb), sb); + rowset.close(); + } catch (Exception e) { + String rowsetClass = "NOT SET"; + if (rowset != null) { + rowsetClass = rowset.getClass().toString(); + try { + rowset.close(); + } catch (SQLException e1) { + } + } - rowset.updateDouble ("C_DOUBLE", -599); + failed(e, "Unexpected Exception rowSetClass=" + rowsetClass); + } + } + } - assertCondition(listener.isRowChanged()); + /** + * getNCharacterStream() - Should work when the column name is valid. + **/ + public void Var167() { + if (checkJdbc40()) { + try { + RowSet rowset = getRowSet(jndiName_); + rowset.setUsername(systemObject_.getUserId()); + char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); + JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); + PasswordVault.clearPassword(charPassword); + rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); + rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); + rowset.execute(); + + position(rowset, "CHAR_FULL"); + // Reader v = rowset.getCharacterStream ("C_CHAR_50"); + Reader v = (Reader) JDReflectionUtil.callMethod_OS(rowset, "getNCharacterStream", "C_CHAR_50"); + sb.setLength(0); + assertCondition(compare(v, "Toolbox for Java ", sb), sb); + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } - rowset.close(); - } - catch (Exception e) - { - failed(e, "Unexpected Exception."); - } + /** + * getNClob() - Should work when the column index is valid. + **/ + public void Var168() { + if (checkJdbc40()) { + try { + RowSet rowset = getRowSet(jndiName_); + rowset.setUsername(systemObject_.getUserId()); + char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); + JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); + PasswordVault.clearPassword(charPassword); + rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); + rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); + rowset.execute(); + + position(rowset, "CHAR_FULL"); + Object v = JDReflectionUtil.callMethod_O(rowset, "getNClob", 14); + assertCondition(compareNClobToString(v, "Java Toolbox")); + + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } } + } - /** - * Validates that addRowSetListener(RowSetListener) notifies listeners when the row is changed - updateDate(int,Date). - **/ - public void Var145() - { - String key_ = "RowSetListener"; - try - { - MyRowListener listener = new MyRowListener(); + /** + * getNClob() - Should work when the column name is valid. + **/ + public void Var169() { + if (checkJdbc40()) { + try { + RowSet rowset = getRowSet(jndiName_); + rowset.setUsername(systemObject_.getUserId()); + char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); + JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); + PasswordVault.clearPassword(charPassword); + rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); + rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); + rowset.execute(); + + position(rowset, "CHAR_FULL"); + // Clob v = rowset.getClob ("C_VARCHAR_50"); + Object v = JDReflectionUtil.callMethod_OS(rowset, "getNClob", "C_VARCHAR_50"); + assertCondition(compareNClobToString(v, "Java Toolbox")); + + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } - RowSet rowset = updater(key_); - rowset.addRowSetListener(listener); - position (rowset, key_); + /** + * getNString() - Should work when the column index is valid. + **/ + public void Var170() { + if (checkJdbc40()) { + try { + RowSet rowset = getRowSet(jndiName_); + rowset.setUsername(systemObject_.getUserId()); + char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); + JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); + PasswordVault.clearPassword(charPassword); + rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); + rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); + rowset.execute(); + + position0(rowset, "DATE_1998"); + // String s = rowset.getString (1); + String s = (String) JDReflectionUtil.callMethod_O(rowset, "getNString", 1); + assertCondition(s.equals("DATE_1998")); + + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } - Date d = new Date (1922400000); - rowset.updateDate (19, d); + /** + * getNString() - Should work when the column name is valid. + **/ + public void Var171() { + if (checkJdbc40()) { + try { + RowSet rowset = getRowSet(jndiName_); + rowset.setUsername(systemObject_.getUserId()); + char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); + JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); + PasswordVault.clearPassword(charPassword); + rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); + rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); + rowset.execute(); + + position0(rowset, "DATE_1998"); + // String s = rowset.getString ("C_KEY"); + String s = (String) JDReflectionUtil.callMethod_OS(rowset, "getNString", "C_KEY"); + assertCondition(s.equals("DATE_1998")); + + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } - assertCondition(listener.isRowChanged()); + /** + * getRowId() - Should work when the column index is valid. + **/ + public void Var172() { + if (checkJdbc40()) { + try { + RowSet rowset = getRowSet(jndiName_); + rowset.setUsername(systemObject_.getUserId()); + char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); + JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); + PasswordVault.clearPassword(charPassword); + rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); + rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); + rowset.execute(); + + position(rowset, "BINARY_NOTRANS"); // any row + // RowId v = rowset.getRowId(28); + Object v = JDReflectionUtil.callMethod_O(rowset, "getRowId", 28); + + // for now, just verify we got a rowid back + if (v != null) + assertCondition(true); + else + assertCondition(false); - rowset.close(); - } - catch (Exception e) - { - failed(e, "Unexpected Exception."); - } + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } } + } - /** - * Validates that addRowSetListener(RowSetListener) notifies listeners when the row is changed - updateDate(String,Date). - **/ - public void Var146() - { - String key_ = "RowSetListener"; - try - { - MyRowListener listener = new MyRowListener(); - - RowSet rowset = updater(key_); - rowset.addRowSetListener(listener); - position (rowset, key_); + /** + * getRowId() - Should work when the column name is valid. + **/ + public void Var173() { + if (checkJdbc40()) { + try { + RowSet rowset = getRowSet(jndiName_); + rowset.setUsername(systemObject_.getUserId()); + char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); + JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); + PasswordVault.clearPassword(charPassword); + rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); + rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); + rowset.execute(); + + position(rowset, "BINARY_NOTRANS"); // any row + // RowId v = rowset.getRowId(CRowod); + Object v = JDReflectionUtil.callMethod_OS(rowset, "getRowId", "C_ROWID"); + // for now, just verify we got a rowid back + if (v != null) + assertCondition(true); + else + assertCondition(false); - Date d = new Date (108000000); - rowset.updateDate ("C_DATE", d); + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } - assertCondition(listener.isRowChanged()); + /** + * getSQLXML() - Should work when the column index is valid. + **/ + public void Var174() { + if (checkJdbc40()) { + try { + RowSet rowset = getRowSet(jndiName_); + rowset.setUsername(systemObject_.getUserId()); + char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); + JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); + PasswordVault.clearPassword(charPassword); + rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); + rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GETX); + rowset.execute(); + + position(rowset, "CHAR_FULL"); + Object v = JDReflectionUtil.callMethod_O(rowset, "getSQLXML", 14); + String xmlString = (String) JDReflectionUtil.callMethod_O(v, "getString"); + String expected = "Java Toolbox"; + assertCondition(xmlString.equals(expected), "got " + xmlString + " sb " + expected); + + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } - rowset.close(); - } - catch (Exception e) - { - failed(e, "Unexpected Exception."); - } + /** + * getSQLXML() - Should work when the column name is valid. + **/ + public void Var175() { + if (checkJdbc40()) { + try { + RowSet rowset = getRowSet(jndiName_); + rowset.setUsername(systemObject_.getUserId()); + char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); + JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); + PasswordVault.clearPassword(charPassword); + rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); + rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GETX); + rowset.execute(); + + position(rowset, "CHAR_FULL"); + + Object v = JDReflectionUtil.callMethod_OS(rowset, "getSQLXML", "C_VARCHAR_50"); + String xmlString = (String) JDReflectionUtil.callMethod_O(v, "getString"); + String expected = "Java Toolbox"; + assertCondition(xmlString.equals(expected), "got " + xmlString + " sb " + expected); + + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } } + } - /** - * Validates that addRowSetListener(RowSetListener) notifies listeners when the row is changed - updateInt(int,int). - **/ - public void Var147() - { - String key_ = "RowSetListener"; - try - { - MyRowListener listener = new MyRowListener(); + /** + * isClosed() + **/ + public void Var176() { + if (checkJdbc40()) { + try { + RowSet rowset = getRowSet(jndiName_); + rowset.setUsername(systemObject_.getUserId()); + char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); + JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); + PasswordVault.clearPassword(charPassword); + rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); + rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); + rowset.execute(); + + boolean isClosed1 = JDReflectionUtil.callMethod_B(rowset, "isClosed"); + rowset.close(); + boolean isClosed2 = JDReflectionUtil.callMethod_B(rowset, "isClosed"); + + assertCondition((isClosed1 == false) && (isClosed2 == true), + "isClosed1=" + isClosed1 + " isClosed2=" + isClosed2 + " object is " + rowset.getClass().getName()); + + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } + } + } - RowSet rowset = updater(key_); - rowset.addRowSetListener(listener); - position (rowset, key_); + /** + * Validates that addRowSetListener(RowSetListener) notifies listeners when the + * row is changed - + * + * updateAsciiStream(int,AsciiStream). + **/ + public void Var177() { + if (checkJdbc40()) { + String key_ = "RowSetListener"; + + try { + + MyRowListener listener = new MyRowListener(); - rowset.updateInt (3, 545); + RowSet rowset = updater(key_); + rowset.addRowSetListener(listener); + position(rowset, key_); - assertCondition(listener.isRowChanged()); + // rowset.updateAsciiStream (14, stringToAsciiStream ("Dublin"), 6L); + InputStream is = stringToAsciiStream("Dublin"); + JDReflectionUtil.callMethod_V(rowset, "updateAsciiStream", 14, is, 6L); + is.close(); + assertCondition(listener.isRowChanged()); - rowset.close(); - } - catch (Exception e) - { - failed(e, "Unexpected Exception."); - } + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception."); + } finally { + + } } + } - /** - * Validates that addRowSetListener(RowSetListener) notifies listeners when the row is changed - updateInt(String,int). - **/ - public void Var148() - { - String key_ = "RowSetListener"; - try - { - MyRowListener listener = new MyRowListener(); + /** + * Validates that addRowSetListener(RowSetListener) notifies listeners when the + * row is changed - + * + * updateAsciiStream(String,AsciiStream). + **/ + public void Var178() { + if (checkJdbc40()) { + String key_ = "RowSetListener"; + + try { + + MyRowListener listener = new MyRowListener(); - RowSet rowset = updater(key_); - rowset.addRowSetListener(listener); - position (rowset, key_); + RowSet rowset = updater(key_); + rowset.addRowSetListener(listener); + position(rowset, key_); - rowset.updateInt ("C_INTEGER", -599); + // rowset.updateAsciiStream ("C_VARCHAR_50", stringToAsciiStream ("Ibiza"), 5L); + InputStream is = stringToAsciiStream("Ibiza178"); + JDReflectionUtil.callMethod_V_IS(rowset, "updateAsciiStream", "C_VARCHAR_50", is, 8L); + is.close(); - assertCondition(listener.isRowChanged()); + assertCondition(listener.isRowChanged()); - rowset.close(); - } - catch (Exception e) - { - failed(e, "Unexpected Exception."); - } + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception."); + } finally { + + } } + } - /** - * Validates that addRowSetListener(RowSetListener) notifies listeners when the row is changed - updateFloat(int,float). - **/ - public void Var149() - { - String key_ = "RowSetListener"; - try - { - MyRowListener listener = new MyRowListener(); + /** + * Validates that addRowSetListener(RowSetListener) notifies listeners when the + * row is changed - + * + * updateBinaryStream(int,BinaryStream). + **/ + public void Var179() { + if (checkJdbc40()) { + String key_ = "RowSetListener"; + + try { + + MyRowListener listener = new MyRowListener(); - RowSet rowset = updater(key_); - rowset.addRowSetListener(listener); - position (rowset, key_); + RowSet rowset = updater(key_); + rowset.addRowSetListener(listener); + position(rowset, key_); - rowset.updateFloat (5, 545); + byte[] ba = new byte[] { (byte) 22, (byte) 4, (byte) 98, (byte) -2 }; + // rowset.updateBinaryStream (16, new ByteArrayInputStream (ba), ba.length); + JDReflectionUtil.callMethod_V(rowset, "updateBinaryStream", 18, new ByteArrayInputStream(ba), + (Integer.valueOf(ba.length)).longValue()); - assertCondition(listener.isRowChanged()); + assertCondition(listener.isRowChanged()); - rowset.close(); - } - catch (Exception e) - { - failed(e, "Unexpected Exception."); - } + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception."); + } finally { + + } } + } - /** - * Validates that addRowSetListener(RowSetListener) notifies listeners when the row is changed - updateFloat(String,float). - **/ - public void Var150() - { - String key_ = "RowSetListener"; - try - { - MyRowListener listener = new MyRowListener(); + /** + * Validates that addRowSetListener(RowSetListener) notifies listeners when the + * row is changed - + * + * updateBinaryStream(String,BinaryStream). + **/ + public void Var180() { + if (checkJdbc40()) { + String key_ = "RowSetListener"; + + try { + + MyRowListener listener = new MyRowListener(); - RowSet rowset = updater(key_); - rowset.addRowSetListener(listener); - position (rowset, key_); + RowSet rowset = updater(key_); + rowset.addRowSetListener(listener); + position(rowset, key_); - rowset.updateFloat ("C_FLOAT", -599); + byte[] ba = new byte[] { (byte) -4, (byte) 98, (byte) 99 }; + // rowset.updateBinaryStream ("C_VARBINARY_20", new ByteArrayInputStream (ba), + // 3); + JDReflectionUtil.callMethod_V_IS(rowset, "updateBinaryStream", "C_VARBINARY_20", new ByteArrayInputStream(ba), + 3L); - assertCondition(listener.isRowChanged()); + assertCondition(listener.isRowChanged()); - rowset.close(); - } - catch (Exception e) - { - failed(e, "Unexpected Exception."); - } - } - /** - * Validates that addRowSetListener(RowSetListener) notifies listeners when the row is changed - updateLong(int,long). - **/ - public void Var151() - { - String key_ = "RowSetListener"; - try - { - MyRowListener listener = new MyRowListener(); + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception."); + } finally { + + } + } + } + + /** + * Validates that addRowSetListener(RowSetListener) notifies listeners when the + * row is changed - updateBlob(). + */ + public void Var181() { + if (checkJdbc40()) { + String key_ = "RowSetListener"; + + try { + + MyRowListener listener = new MyRowListener(); - RowSet rowset = updater(key_); - rowset.addRowSetListener(listener); - position (rowset, key_); + RowSet rowset = updater(key_); + rowset.addRowSetListener(listener); + position(rowset, key_); - rowset.updateLong (3, 545); + byte[] ba = new byte[] { (byte) 22, (byte) 4, (byte) 98, (byte) -2 }; + // rowset.updateBlob (16, new ByteArrayInputStream (ba), + // ba.length); + JDReflectionUtil.callMethod_V(rowset, "updateBlob", 18, new ByteArrayInputStream(ba), + (Integer.valueOf(ba.length)).longValue()); - assertCondition(listener.isRowChanged()); + assertCondition(listener.isRowChanged()); - rowset.close(); - } - catch (Exception e) - { - failed(e, "Unexpected Exception."); - } + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception."); + } finally { + + } } + } - /** - * Validates that addRowSetListener(RowSetListener) notifies listeners when the row is changed - updateLong(String,long). - **/ - public void Var152() - { - String key_ = "RowSetListener"; - try - { - MyRowListener listener = new MyRowListener(); + /** + * Validates that addRowSetListener(RowSetListener) notifies listeners when the + * row is changed - updateBlob(). + */ + public void Var182() { + if (checkJdbc40()) { + String key_ = "RowSetListener"; + + try { + + MyRowListener listener = new MyRowListener(); - RowSet rowset = updater(key_); - rowset.addRowSetListener(listener); - position (rowset, key_); + RowSet rowset = updater(key_); + rowset.addRowSetListener(listener); + position(rowset, key_); - rowset.updateLong ("C_INTEGER", -599); + byte[] ba = new byte[] { (byte) -4, (byte) 98, (byte) 99 }; + // rowset.updateBlob ("C_VARBINARY_20", new ByteArrayInputStream (ba), 3); + JDReflectionUtil.callMethod_V_IS(rowset, "updateBlob", "C_VARBINARY_20", new ByteArrayInputStream(ba), 3L); - assertCondition(listener.isRowChanged()); + assertCondition(listener.isRowChanged()); - rowset.close(); - } - catch (Exception e) - { - failed(e, "Unexpected Exception."); - } + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception."); + } finally { + + } } + } - /** - * Validates that addRowSetListener(RowSetListener) notifies listeners when the row is changed - updateNull(int). - **/ - public void Var153() - { - String key_ = "RowSetListener"; - try - { - MyRowListener listener = new MyRowListener(); + /** + * Validates that addRowSetListener(RowSetListener) notifies listeners when the + * row is changed - + * + * updateCharacterStream(). + **/ + public void Var183() { + if (checkJdbc40()) { + String key_ = "RowSetListener"; + + try { + + MyRowListener listener = new MyRowListener(); - RowSet rowset = updater(key_); - rowset.addRowSetListener(listener); - position (rowset, key_); + RowSet rowset = updater(key_); + rowset.addRowSetListener(listener); + position(rowset, key_); - rowset.updateNull (14); + // rowset.updateCharacterStream (14, new StringReader ("Fargo"), 5L); + JDReflectionUtil.callMethod_V(rowset, "updateCharacterStream", 14, new StringReader("Fargo"), 5L); - assertCondition(listener.isRowChanged()); + assertCondition(listener.isRowChanged()); - rowset.close(); - } - catch (Exception e) - { - failed(e, "Unexpected Exception."); - } + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception."); + } finally { + + } } + } - /** - * Validates that addRowSetListener(RowSetListener) notifies listeners when the row is changed - updateNull(String). - **/ - public void Var154() - { - String key_ = "RowSetListener"; - try - { - MyRowListener listener = new MyRowListener(); + /** + * Validates that addRowSetListener(RowSetListener) notifies listeners when the + * row is changed - updateCharacterStream(). + */ + public void Var184() { + if (checkJdbc40()) { + String key_ = "RowSetListener"; + + try { + + MyRowListener listener = new MyRowListener(); - RowSet rowset = updater(key_); - rowset.addRowSetListener(listener); - position (rowset, key_); + RowSet rowset = updater(key_); + rowset.addRowSetListener(listener); + position(rowset, key_); - rowset.updateNull ("C_VARCHAR_50"); + // rowset.updateCharacterStream ("C_VARCHAR_50", new StringReader ("Gillette"), + // 8); + JDReflectionUtil.callMethod_V(rowset, "updateCharacterStream", "C_VARCHAR_50", new StringReader("Gillette"), + 8L); - assertCondition(listener.isRowChanged()); + assertCondition(listener.isRowChanged()); - rowset.close(); - } - catch (Exception e) - { - failed(e, "Unexpected Exception."); - } + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception."); + } finally { + + } } + } - /** - * Validates that addRowSetListener(RowSetListener) notifies listeners when the row is changed - updateObject(int,Object). - **/ - public void Var155() - { - String key_ = "RowSetListener"; - try - { - MyRowListener listener = new MyRowListener(); + /** + * Validates that addRowSetListener(RowSetListener) notifies listeners when the + * row is changed - updateClob(). + **/ + public void Var185() { + if (checkJdbc40()) { + String key_ = "RowSetListener"; + + try { + + MyRowListener listener = new MyRowListener(); - RowSet rowset = updater(key_); - rowset.addRowSetListener(listener); - position (rowset, key_); + RowSet rowset = updater(key_); + rowset.addRowSetListener(listener); + position(rowset, key_); - rowset.updateObject (14, "Rhode Island"); + // rowset.updateClob (14, new StringReader ("Fargo"), 5L); + JDReflectionUtil.callMethod_V(rowset, "updateClob", 14, new StringReader("Fargo"), 5L); - assertCondition(listener.isRowChanged()); + assertCondition(listener.isRowChanged()); - rowset.close(); - } - catch (Exception e) - { - failed(e, "Unexpected Exception."); - } - } - /** - * Validates that addRowSetListener(RowSetListener) notifies listeners when the row is changed - updateObject(String,Object). - **/ - public void Var156() - { - String key_ = "RowSetListener"; - try - { - MyRowListener listener = new MyRowListener(); + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception."); + } finally { + + } + } + } - RowSet rowset = updater(key_); - rowset.addRowSetListener(listener); - position (rowset, key_); + /** + * Validates that addRowSetListener(RowSetListener) notifies listeners when the + * row is changed - updateClob(). + **/ + public void Var186() { + if (checkJdbc40()) { + String key_ = "RowSetListener"; + + try { + + MyRowListener listener = new MyRowListener(); - rowset.updateObject ("C_VARCHAR_50", "District of Columbia"); + RowSet rowset = updater(key_); + rowset.addRowSetListener(listener); + position(rowset, key_); - assertCondition(listener.isRowChanged()); + // rowset.updateClob ("C_VARCHAR_50", new StringReader ("Gillette"), 8); + JDReflectionUtil.callMethod_V(rowset, "updateClob", "C_VARCHAR_50", new StringReader("Gillette"), 8L); - rowset.close(); - } - catch (Exception e) - { - failed(e, "Unexpected Exception."); - } + assertCondition(listener.isRowChanged()); + + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception."); + } finally { + + } } + } - /** - * Validates that addRowSetListener(RowSetListener) notifies listeners when the row is changed - updateShort(int,short). - **/ - public void Var157() - { - String key_ = "RowSetListener"; - try - { - MyRowListener listener = new MyRowListener(); + /** + * Validates that addRowSetListener(RowSetListener) notifies listeners when the + * row is changed - + * + * updateNCharacterStream(). + **/ + public void Var187() { + if (checkJdbc40()) { + String key_ = "RowSetListener"; + + try { + + MyRowListener listener = new MyRowListener(); - RowSet rowset = updater(key_); - rowset.addRowSetListener(listener); - position (rowset, key_); + RowSet rowset = updater(key_); + rowset.addRowSetListener(listener); + position(rowset, key_); - rowset.updateShort (2, (short) 45); + // rowset.updateNCharacterStream (14, new StringReader ("Fargo"), 5L); + JDReflectionUtil.callMethod_V(rowset, "updateNCharacterStream", 14, new StringReader("Fargo"), 5L); - assertCondition(listener.isRowChanged()); + assertCondition(listener.isRowChanged()); - rowset.close(); - } - catch (Exception e) - { - failed(e, "Unexpected Exception."); - } + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception."); + } finally { + + } } + } - /** - * Validates that addRowSetListener(RowSetListener) notifies listeners when the row is changed - updateShort(int,short). - **/ - public void Var158() - { - String key_ = "RowSetListener"; - try - { - MyRowListener listener = new MyRowListener(); + /** + * Validates that addRowSetListener(RowSetListener) notifies listeners when the + * row is changed - updateNCharacterStream(). + */ + public void Var188() { + if (checkJdbc40()) { + String key_ = "RowSetListener"; + + try { + + MyRowListener listener = new MyRowListener(); - RowSet rowset = updater(key_); - rowset.addRowSetListener(listener); - position (rowset, key_); + RowSet rowset = updater(key_); + rowset.addRowSetListener(listener); + position(rowset, key_); - rowset.updateShort (2, (short) 45); + // rowset.updateNCharacterStream ("C_VARCHAR_50", new StringReader ("Gillette"), + // 8); + JDReflectionUtil.callMethod_V(rowset, "updateNCharacterStream", "C_VARCHAR_50", new StringReader("Gillette"), + 8L); - assertCondition(listener.isRowChanged()); + assertCondition(listener.isRowChanged()); - rowset.close(); - } - catch (Exception e) - { - failed(e, "Unexpected Exception."); - } + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception."); + } finally { + + } } + } - /** - * Validates that addRowSetListener(RowSetListener) notifies listeners when the row is changed - updateShort(String,short). - **/ - public void Var159() - { - String key_ = "RowSetListener"; - try - { - MyRowListener listener = new MyRowListener(); + /** + * Validates that addRowSetListener(RowSetListener) notifies listeners when the + * row is changed - updateNClob(). + **/ + public void Var189() { + if (checkJdbc40()) { + String key_ = "RowSetListener"; + + try { + + MyRowListener listener = new MyRowListener(); - RowSet rowset = updater(key_); - rowset.addRowSetListener(listener); - position (rowset, key_); + RowSet rowset = updater(key_); + rowset.addRowSetListener(listener); + position(rowset, key_); - rowset.updateShort ("C_SMALLINT", (short) -59); + // rowset.updateNClob (14, new StringReader ("Fargo"), 5L); - assertCondition(listener.isRowChanged()); + Object nClob = JDReflectionUtil.callMethod_O(conn2_, "createNClob"); - rowset.close(); - } - catch (Exception e) - { - failed(e, "Unexpected Exception."); - } + JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "FargoNclob"); + JDReflectionUtil.callMethod_V(rowset, "updateNClob", 14, nClob); + + assertCondition(listener.isRowChanged()); + + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception."); + } finally { + + } } + } - /** - * Validates that addRowSetListener(RowSetListener) notifies listeners when the row is changed - updateString(int,String). - **/ - public void Var160() - { - String key_ = "RowSetListener"; - try - { - MyRowListener listener = new MyRowListener(); + /** + * Validates that addRowSetListener(RowSetListener) notifies listeners when the + * row is changed - updateNClob(). + **/ + public void Var190() { + if (checkJdbc40()) { + String key_ = "RowSetListener"; + + try { + + MyRowListener listener = new MyRowListener(); - RowSet rowset = updater(key_); - rowset.addRowSetListener(listener); - position (rowset, key_); + RowSet rowset = updater(key_); + rowset.addRowSetListener(listener); + position(rowset, key_); - rowset.updateString (14, "Queries"); + // rowset.updateNClob ("C_VARCHAR_50", new StringReader ("Gillette"), 8); - assertCondition(listener.isRowChanged()); + Object nClob = JDReflectionUtil.callMethod_O(conn2_, "createNClob"); + JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "GilletteNclob"); + JDReflectionUtil.callMethod_V(rowset, "updateNClob", "C_VARCHAR_50", nClob); - rowset.close(); - } - catch (Exception e) - { - failed(e, "Unexpected Exception."); - } + assertCondition(listener.isRowChanged()); + + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception."); + } finally { + + } } + } - /** - * Validates that addRowSetListener(RowSetListener) notifies listeners when the row is changed - updateString(String,String). - **/ - public void Var161() - { - String key_ = "RowSetListener"; - try - { - MyRowListener listener = new MyRowListener(); + /** + * Validates that addRowSetListener(RowSetListener) notifies listeners when the + * row is changed - updateNClob2(). + **/ + public void Var191() { + if (checkJdbc40()) { + String key_ = "RowSetListener"; + + try { + + MyRowListener listener = new MyRowListener(); - RowSet rowset = updater(key_); - rowset.addRowSetListener(listener); - position (rowset, key_); + RowSet rowset = updater(key_); + rowset.addRowSetListener(listener); + position(rowset, key_); - rowset.updateString ("C_VARCHAR_50", "Inner joins"); + // rowset.updateNClob (14, new StringReader ("Fargo"), 5L); + JDReflectionUtil.callMethod_V(rowset, "updateNClob", 14, new StringReader("Fargo"), 5L); - assertCondition(listener.isRowChanged()); + assertCondition(listener.isRowChanged()); - rowset.close(); - } - catch (Exception e) - { - failed(e, "Unexpected Exception."); - } + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception."); + } finally { + + } } + } - /** - * Validates that addRowSetListener(RowSetListener) notifies listeners when the row is changed - updateTime(int,Time). - **/ - public void Var162() - { - String key_ = "RowSetListener"; - try - { - MyRowListener listener = new MyRowListener(); + /** + * Validates that addRowSetListener(RowSetListener) notifies listeners when the + * row is changed - updateNClob2(). + **/ + public void Var192() { + if (checkJdbc40()) { + String key_ = "RowSetListener"; + + try { + + MyRowListener listener = new MyRowListener(); - RowSet rowset = updater(key_); - rowset.addRowSetListener(listener); - position (rowset, key_); + RowSet rowset = updater(key_); + rowset.addRowSetListener(listener); + position(rowset, key_); - Time d = Time.valueOf ("19:22:40"); - rowset.updateTime (20, d); + // rowset.updateNClob ("C_VARCHAR_50", new StringReader ("Gillette"), 8); + JDReflectionUtil.callMethod_V(rowset, "updateNClob", "C_VARCHAR_50", new StringReader("Gillette"), 8L); - assertCondition(listener.isRowChanged()); + assertCondition(listener.isRowChanged()); - rowset.close(); - } - catch (Exception e) - { - failed(e, "Unexpected Exception."); - } + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception."); + } finally { + + } } + } - /** - * Validates that addRowSetListener(RowSetListener) notifies listeners when the row is changed - updateTime(String,Time). - **/ - public void Var163() - { - String key_ = "RowSetListener"; - try - { - MyRowListener listener = new MyRowListener(); - - RowSet rowset = updater(key_); - rowset.addRowSetListener(listener); - position (rowset, key_); + /** + * Validates that addRowSetListener(RowSetListener) notifies listeners when the + * row is changed - + * + * updateNString(int,String). + **/ + public void Var193() { + if (checkJdbc40()) { + String key_ = "RowSetListener"; + + try { + + MyRowListener listener = new MyRowListener(); - Time d = Time.valueOf("10:08:00"); - rowset.updateTime ("C_TIME", d); + RowSet rowset = updater(key_); + rowset.addRowSetListener(listener); + position(rowset, key_); - assertCondition(listener.isRowChanged()); + // rowset.updateNString (14, "Queries"); + JDReflectionUtil.callMethod_V(rowset, "updateNString", 14, "Queries"); + assertCondition(listener.isRowChanged()); - rowset.close(); - } - catch (Exception e) - { - failed(e, "Unexpected Exception."); - } + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception."); + } finally { + + } } + } - /** - * Validates that addRowSetListener(RowSetListener) notifies listeners when the row is changed - updateTimestamp(int,Timestamp). - **/ - public void Var164() - { - String key_ = "RowSetListener"; - try - { - MyRowListener listener = new MyRowListener(); + /** + * Validates that addRowSetListener(RowSetListener) notifies listeners when the + * row is changed - + * + * updateNString(String,String). + **/ + public void Var194() { + if (checkJdbc40()) { - RowSet rowset = updater(key_); - rowset.addRowSetListener(listener); - position (rowset, key_); + String key_ = "RowSetListener"; + + try { + + MyRowListener listener = new MyRowListener(); - Timestamp d = new Timestamp (19342240); - rowset.updateTimestamp (21, d); + RowSet rowset = updater(key_); + rowset.addRowSetListener(listener); + position(rowset, key_); - assertCondition(listener.isRowChanged()); + // rowset.updateNString ("C_VARCHAR_50", "Inner joins"); + JDReflectionUtil.callMethod_V(rowset, "updateNString", "C_VARCHAR_50", "Inner joins"); + assertCondition(listener.isRowChanged()); - rowset.close(); - } - catch (Exception e) - { - failed(e, "Unexpected Exception."); - } + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception."); + } finally { + + } } + } - /** - * Validates that addRowSetListener(RowSetListener) notifies listeners when the row is changed - updateTimestamp(String,Timestamp). - **/ - public void Var165() - { - String key_ = "RowSetListener"; - try - { - MyRowListener listener = new MyRowListener(); - - RowSet rowset = updater(key_); - rowset.addRowSetListener(listener); - position (rowset, key_); - - Timestamp d = new Timestamp (1084440); - rowset.updateTimestamp ("C_TIMESTAMP", d); + /** + * Validates that addRowSetListener(RowSetListener) notifies listeners when the + * row is changed - updateRowId(). + **/ + public void Var195() { + if (checkJdbc40()) { + String key_ = "RowSetListener"; + RowSet rowset = null; + + try { + + MyRowListener listener = new MyRowListener(); - assertCondition(listener.isRowChanged()); + rowset = updater(key_); + rowset.addRowSetListener(listener); + position(rowset, key_); - rowset.close(); - } - catch (Exception e) - { - failed(e, "Unexpected Exception."); - } - } + // RowId ri = rowset.getRowId(28); + Object ri = JDReflectionUtil.callMethod_O(rowset, "getRowId", 28); - /** - * RowSetListener. - **/ - class MyRowListener implements RowSetListener - { - private boolean cursorMoved_; - private boolean rowChanged_; - private boolean rowSetChanged_; - - public MyRowListener() - { - reset(); - } - public boolean isCursorMoved() - { - return cursorMoved_; - } - public boolean isRowChanged() - { - return rowChanged_; - } - public boolean isRowSetChanged() - { - return rowSetChanged_; - } - public void reset() - { - cursorMoved_ = false; - rowChanged_ = false; - rowSetChanged_ = false; - } - public void cursorMoved(RowSetEvent event) - { - reset(); - cursorMoved_ = true; - } - public void rowChanged(RowSetEvent event) - { - reset(); - rowChanged_ = true; - } - public void rowSetChanged(RowSetEvent event) - { - reset(); - rowSetChanged_ = true; - } - } - + JDReflectionUtil.callMethod_V(rowset, "updateRowId", 29, ri); - /** - getNCharacterStream() - Should work when the column index is valid. - **/ - public void Var166() - { - if (checkJdbc40()) - { - RowSet rowset = null; - try - { - rowset = getRowSet(jndiName_); - rowset.setUsername(systemObject_.getUserId()); - char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); - JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); - PasswordVault.clearPassword(charPassword); - rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); - rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); - rowset.execute(); - - position(rowset, "CHAR_FULL"); - //Reader v = rowset.getNCharacterStream (12); - Reader v = (Reader) JDReflectionUtil.callMethod_O(rowset, "getNCharacterStream", 12); - sb.setLength(0); - assertCondition((v != null) && compare(v, "Toolbox for Java ",sb),sb); - rowset.close(); - } catch (Exception e) - { - String rowsetClass = "NOT SET"; - if (rowset != null) { - rowsetClass = rowset.getClass().toString(); - } - failed(e, "Unexpected Exception rowSetClass="+rowsetClass); - } - } - } + assertCondition(listener.isRowChanged()); - /** - getNCharacterStream() - Should work when the column name is valid. - **/ - public void Var167() - { - if (checkJdbc40()) - { - try - { - RowSet rowset = getRowSet(jndiName_); - rowset.setUsername(systemObject_.getUserId()); - char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); - JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); - PasswordVault.clearPassword(charPassword); - rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); - rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); - rowset.execute(); - - position(rowset, "CHAR_FULL"); - //Reader v = rowset.getCharacterStream ("C_CHAR_50"); - Reader v = (Reader) JDReflectionUtil.callMethod_OS(rowset, "getNCharacterStream", "C_CHAR_50"); - sb.setLength(0); - assertCondition(compare(v, "Toolbox for Java ",sb),sb); - rowset.close(); - } catch (Exception e) - { - failed(e, "Unexpected Exception"); - } + rowset.close(); + } catch (Exception e) { + if (getDriver() == JDTestDriver.DRIVER_TOOLBOX) { + assertCondition(e.getMessage().indexOf("mismatch") != -1); + try { + rowset.close(); + } catch (Exception e1) { + } + return; } - } - - /** - getNClob() - Should work when the column index is valid. - **/ - public void Var168() - { - if (checkJdbc40()) - { - try - { - RowSet rowset = getRowSet(jndiName_); - rowset.setUsername(systemObject_.getUserId()); - char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); - JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); - PasswordVault.clearPassword(charPassword); - rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); - rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); - rowset.execute(); - - position(rowset, "CHAR_FULL"); - Object v = JDReflectionUtil.callMethod_O(rowset, "getNClob", 14); - assertCondition(compareNClobToString(v, "Java Toolbox")); - - rowset.close(); - } catch (Exception e) - { - failed(e, "Unexpected Exception"); - } + failed(e, "Unexpected Exception."); + if (rowset != null) { + try { + rowset.close(); + } catch (Exception ex) { + ex.printStackTrace(); + } } + } finally { + + } } + } - /** - getNClob() - Should work when the column name is valid. - **/ - public void Var169() - { - if (checkJdbc40()) - { - try - { - RowSet rowset = getRowSet(jndiName_); - rowset.setUsername(systemObject_.getUserId()); - char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); - JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); - PasswordVault.clearPassword(charPassword); - rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); - rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); - rowset.execute(); - - position(rowset, "CHAR_FULL"); - //Clob v = rowset.getClob ("C_VARCHAR_50"); - Object v = JDReflectionUtil.callMethod_OS(rowset, "getNClob", "C_VARCHAR_50"); - assertCondition(compareNClobToString(v, "Java Toolbox")); - - rowset.close(); - } catch (Exception e) - { - failed(e, "Unexpected Exception"); - } - } - } + /** + * Validates that addRowSetListener(RowSetListener) notifies listeners when the + * row is changed - updateRowId(). + **/ + public void Var196() { + if (checkJdbc40()) { + String key_ = "RowSetListener"; + MyRowListener listener = new MyRowListener(); + + try (RowSet rowset = updater(key_)) { + - /** - getNString() - Should work when the column index is valid. - **/ - public void Var170() - { - if (checkJdbc40()) - { - try - { - RowSet rowset = getRowSet(jndiName_); - rowset.setUsername(systemObject_.getUserId()); - char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); - JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); - PasswordVault.clearPassword(charPassword); - rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); - rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); - rowset.execute(); - - position0(rowset, "DATE_1998"); - //String s = rowset.getString (1); - String s = (String) JDReflectionUtil.callMethod_O(rowset, "getNString", 1); - assertCondition(s.equals("DATE_1998")); - - rowset.close(); - } catch (Exception e) - { - failed(e, "Unexpected Exception"); - } - } - } + rowset.addRowSetListener(listener); + position(rowset, key_); - /** - getNString() - Should work when the column name is valid. - **/ - public void Var171() - { - if (checkJdbc40()) - { - try - { - RowSet rowset = getRowSet(jndiName_); - rowset.setUsername(systemObject_.getUserId()); - char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); - JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); - PasswordVault.clearPassword(charPassword); - rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); - rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); - rowset.execute(); - - position0(rowset, "DATE_1998"); - //String s = rowset.getString ("C_KEY"); - String s = (String) JDReflectionUtil.callMethod_OS(rowset, "getNString", "C_KEY"); - assertCondition(s.equals("DATE_1998")); - - rowset.close(); - } catch (Exception e) - { - failed(e, "Unexpected Exception"); - } - } - } + Object ri = JDReflectionUtil.callMethod_O(rowset, "getRowId", 28); - /** - getRowId() - Should work when the column index is valid. - **/ - public void Var172() - { - if (checkJdbc40()) - { - try - { - RowSet rowset = getRowSet(jndiName_); - rowset.setUsername(systemObject_.getUserId()); - char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); - JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); - PasswordVault.clearPassword(charPassword); - rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); - rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); - rowset.execute(); - - position(rowset, "BINARY_NOTRANS"); //any row - // RowId v = rowset.getRowId(28); - Object v = JDReflectionUtil.callMethod_O(rowset, "getRowId", 28); - - //for now, just verify we got a rowid back - if (v != null) - assertCondition(true); - else - assertCondition(false); - - rowset.close(); - } catch (Exception e) - { - failed(e, "Unexpected Exception"); - } - } - } + JDReflectionUtil.callMethod_V(rowset, "updateRowId", "C_VARBINARY_40", ri); - /** - getRowId() - Should work when the column name is valid. - **/ - public void Var173() - { - if (checkJdbc40()) - { - try - { - RowSet rowset = getRowSet(jndiName_); - rowset.setUsername(systemObject_.getUserId()); - char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); - JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); - PasswordVault.clearPassword(charPassword); - rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); - rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); - rowset.execute(); - - position(rowset, "BINARY_NOTRANS"); //any row - // RowId v = rowset.getRowId(CRowod); - Object v = JDReflectionUtil.callMethod_OS(rowset, "getRowId", "C_ROWID"); - //for now, just verify we got a rowid back - if (v != null) - assertCondition(true); - else - assertCondition(false); - - rowset.close(); - } catch (Exception e) - { - failed(e, "Unexpected Exception"); - } - } - } + assertCondition(listener.isRowChanged()); - /** - getSQLXML() - Should work when the column index is valid. - **/ - public void Var174() - { - if (checkJdbc40()) - { - try - { - RowSet rowset = getRowSet(jndiName_); - rowset.setUsername(systemObject_.getUserId()); - char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); - JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); - PasswordVault.clearPassword(charPassword); - rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); - rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GETX); - rowset.execute(); - - position(rowset, "CHAR_FULL"); - Object v = JDReflectionUtil.callMethod_O(rowset, "getSQLXML", 14); - String xmlString = (String) JDReflectionUtil.callMethod_O(v, "getString"); - String expected = "Java Toolbox"; - assertCondition(xmlString.equals(expected), "got "+xmlString+" sb "+expected); - - rowset.close(); - } catch (Exception e) - { - failed(e, "Unexpected Exception"); - } + } catch (Exception e) { + if (getDriver() == JDTestDriver.DRIVER_TOOLBOX) { + assertCondition(e.getMessage().indexOf("mismatch") != -1); + return; } - } + failed(e, "Unexpected Exception."); - /** - getSQLXML() - Should work when the column name is valid. - **/ - public void Var175() - { - if (checkJdbc40()) - { - try - { - RowSet rowset = getRowSet(jndiName_); - rowset.setUsername(systemObject_.getUserId()); - char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); - JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); - PasswordVault.clearPassword(charPassword); - rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); - rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GETX); - rowset.execute(); - - position(rowset, "CHAR_FULL"); - - Object v = JDReflectionUtil.callMethod_OS(rowset, "getSQLXML", "C_VARCHAR_50"); - String xmlString = (String) JDReflectionUtil.callMethod_O(v, "getString"); - String expected = "Java Toolbox"; - assertCondition(xmlString.equals(expected), "got "+xmlString+" sb "+expected); - - rowset.close(); - } catch (Exception e) - { - failed(e, "Unexpected Exception"); - } - } + } finally { + + } } + } - /** - isClosed() - **/ - public void Var176() - { - if (checkJdbc40()) - { - try - { - RowSet rowset = getRowSet(jndiName_); - rowset.setUsername(systemObject_.getUserId()); - char[] charPassword = PasswordVault.decryptPassword(encryptedPassword_); - JDReflectionUtil.callMethod_V(rowset, "setPassword", charPassword); - PasswordVault.clearPassword(charPassword); - rowset.setType(ResultSet.TYPE_SCROLL_SENSITIVE); - rowset.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); - rowset.execute(); - - boolean isClosed1 = JDReflectionUtil.callMethod_B(rowset, "isClosed"); - rowset.close(); - boolean isClosed2 = JDReflectionUtil.callMethod_B(rowset, "isClosed"); - - assertCondition((isClosed1 == false) && (isClosed2 == true), "isClosed1="+isClosed1+" isClosed2="+isClosed2+" object is "+rowset.getClass().getName() ); - - } catch (Exception e) - { - failed(e, "Unexpected Exception"); - } - } - } + /** + * Validates that addRowSetListener(RowSetListener) notifies listeners when the + * row is changed - updateSQLXML(). + **/ + public void Var197() { + if (checkJdbc40()) { + String key_ = "RowSetListener"; + + try { + + MyRowListener listener = new MyRowListener(); - /** - * Validates that addRowSetListener(RowSetListener) notifies listeners when the row is changed - + RowSet rowset = updater(key_); + rowset.addRowSetListener(listener); + position(rowset, key_); - updateAsciiStream(int,AsciiStream). - **/ - public void Var177() - { - if (checkJdbc40()) - { - String key_ = "RowSetListener"; - try - { - MyRowListener listener = new MyRowListener(); - - RowSet rowset = updater(key_); - rowset.addRowSetListener(listener); - position(rowset, key_); - - //rowset.updateAsciiStream (14, stringToAsciiStream ("Dublin"), 6L); - JDReflectionUtil.callMethod_V(rowset, "updateAsciiStream", 14, stringToAsciiStream("Dublin"), 6L); - - assertCondition(listener.isRowChanged()); - - rowset.close(); - } catch (Exception e) - { - failed(e, "Unexpected Exception."); - } - } - } + Object sqlXML = JDReflectionUtil.callMethod_O(conn2_, "createSQLXML"); + JDReflectionUtil.callMethod_V(sqlXML, "setString", "FargoXML"); + JDReflectionUtil.callMethod_V(rowset, "updateSQLXML", 23, sqlXML); - /** - * Validates that addRowSetListener(RowSetListener) notifies listeners when the row is changed - + assertCondition(listener.isRowChanged()); - updateAsciiStream(String,AsciiStream). - **/ - public void Var178() - { - if (checkJdbc40()) - { - String key_ = "RowSetListener"; - try - { - MyRowListener listener = new MyRowListener(); - - RowSet rowset = updater(key_); - rowset.addRowSetListener(listener); - position(rowset, key_); - - // rowset.updateAsciiStream ("C_VARCHAR_50", stringToAsciiStream ("Ibiza"), 5L); - JDReflectionUtil.callMethod_V_IS(rowset, "updateAsciiStream", "C_VARCHAR_50", stringToAsciiStream("Ibiza"), 5L); - - assertCondition(listener.isRowChanged()); - - rowset.close(); - } catch (Exception e) - { - failed(e, "Unexpected Exception."); - } - } + rowset.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception."); + } finally { + + } } + } - /** - * Validates that addRowSetListener(RowSetListener) notifies listeners when the row is changed - + /** + * Validates that addRowSetListener(RowSetListener) notifies listeners when the + * row is changed - updateSQLXML(). + **/ + public void Var198() { + if (checkJdbc40()) { + String key_ = "RowSetListener"; + + try (RowSet rowset = updater(key_);) { + + MyRowListener listener = new MyRowListener(); - updateBinaryStream(int,BinaryStream). - **/ - public void Var179() - { - if (checkJdbc40()) - { - String key_ = "RowSetListener"; - try - { - MyRowListener listener = new MyRowListener(); - - RowSet rowset = updater(key_); - rowset.addRowSetListener(listener); - position(rowset, key_); - - byte[] ba = new byte[] { (byte) 22, (byte) 4, (byte) 98, (byte) -2 }; - //rowset.updateBinaryStream (16, new ByteArrayInputStream (ba), ba.length); - JDReflectionUtil.callMethod_V(rowset, "updateBinaryStream", 18, new ByteArrayInputStream(ba), (Integer.valueOf(ba.length)).longValue()); - - assertCondition(listener.isRowChanged()); - - rowset.close(); - } catch (Exception e) - { - failed(e, "Unexpected Exception."); - } - } - } + rowset.addRowSetListener(listener); + position(rowset, key_); - /** - * Validates that addRowSetListener(RowSetListener) notifies listeners when the row is changed - + Object sqlXML = JDReflectionUtil.callMethod_O(conn2_, "createSQLXML"); + JDReflectionUtil.callMethod_V(sqlXML, "setString", "FargoXML"); + JDReflectionUtil.callMethod_V(rowset, "updateSQLXML", "C_CLOB", sqlXML); - updateBinaryStream(String,BinaryStream). - **/ - public void Var180() - { - if (checkJdbc40()) - { - String key_ = "RowSetListener"; - try - { - MyRowListener listener = new MyRowListener(); - - RowSet rowset = updater(key_); - rowset.addRowSetListener(listener); - position(rowset, key_); - - byte[] ba = new byte[] { (byte) -4, (byte) 98, (byte) 99 }; - //rowset.updateBinaryStream ("C_VARBINARY_20", new ByteArrayInputStream (ba), 3); - JDReflectionUtil.callMethod_V_IS(rowset, "updateBinaryStream", "C_VARBINARY_20", new ByteArrayInputStream(ba), 3L); - - assertCondition(listener.isRowChanged()); - - rowset.close(); - } catch (Exception e) - { - failed(e, "Unexpected Exception."); - } - } - } + assertCondition(listener.isRowChanged()); - /** - * Validates that addRowSetListener(RowSetListener) notifies - * listeners when the row is changed - updateBlob(). - */ - public void Var181() - { - if (checkJdbc40()) - { - String key_ = "RowSetListener"; - try - { - MyRowListener listener = new MyRowListener(); - - RowSet rowset = updater(key_); - rowset.addRowSetListener(listener); - position(rowset, key_); - - byte[] ba = new byte[] { (byte) 22, (byte) 4, (byte) 98, (byte) -2 }; - // rowset.updateBlob (16, new ByteArrayInputStream (ba), - // ba.length); - JDReflectionUtil.callMethod_V(rowset, "updateBlob", 18, new ByteArrayInputStream(ba), (Integer.valueOf(ba.length)).longValue()); - - assertCondition(listener.isRowChanged()); - - rowset.close(); - } catch (Exception e) - { - failed(e, "Unexpected Exception."); - } - } - } + rowset.close(); + } catch (Exception e) { - /** - * Validates that addRowSetListener(RowSetListener) notifies - * listeners when the row is changed - updateBlob(). - */ - public void Var182() - { - if (checkJdbc40()) - { - String key_ = "RowSetListener"; - try - { - MyRowListener listener = new MyRowListener(); - - RowSet rowset = updater(key_); - rowset.addRowSetListener(listener); - position(rowset, key_); - - byte[] ba = new byte[] { (byte) -4, (byte) 98, (byte) 99 }; - //rowset.updateBlob ("C_VARBINARY_20", new ByteArrayInputStream (ba), 3); - JDReflectionUtil.callMethod_V_IS(rowset, "updateBlob", "C_VARBINARY_20", new ByteArrayInputStream(ba), 3L); - - assertCondition(listener.isRowChanged()); - - rowset.close(); - } catch (Exception e) - { - failed(e, "Unexpected Exception."); - } - } + failed(e, "Unexpected Exception."); + } finally { + + } } + } - /** - * Validates that addRowSetListener(RowSetListener) notifies listeners when the row is changed - + /** + * updateAsciiStream(int,AsciiStream). + **/ + public void Var199() { + if (checkJdbc40()) { + String key_ = "JDRowSUpdAsciiStream"; + + try { + - updateCharacterStream(). - **/ - public void Var183() - { - if (checkJdbc40()) - { - String key_ = "RowSetListener"; - try - { - MyRowListener listener = new MyRowListener(); - - RowSet rowset = updater(key_); - rowset.addRowSetListener(listener); - position(rowset, key_); - - // rowset.updateCharacterStream (14, new StringReader ("Fargo"), 5L); - JDReflectionUtil.callMethod_V(rowset, "updateCharacterStream", 14, new StringReader("Fargo"), 5L); - - assertCondition(listener.isRowChanged()); - - rowset.close(); - } catch (Exception e) - { - failed(e, "Unexpected Exception."); - } - } - } + RowSet rowset = updater(key_); + position(rowset, key_); - /** - * Validates that addRowSetListener(RowSetListener) notifies - * listeners when the row is changed - updateCharacterStream(). - */ - public void Var184() - { - if (checkJdbc40()) - { - String key_ = "RowSetListener"; - try - { - MyRowListener listener = new MyRowListener(); - - RowSet rowset = updater(key_); - rowset.addRowSetListener(listener); - position(rowset, key_); - - //rowset.updateCharacterStream ("C_VARCHAR_50", new StringReader ("Gillette"), 8); - JDReflectionUtil.callMethod_V(rowset, "updateCharacterStream", "C_VARCHAR_50", new StringReader("Gillette"), 8L); - - assertCondition(listener.isRowChanged()); - - rowset.close(); - } catch (Exception e) - { - failed(e, "Unexpected Exception."); - } - } + // rowset.updateAsciiStream (14, stringToAsciiStream ("Dublin"), 6L); + InputStream is = stringToAsciiStream("Dublin2"); + JDReflectionUtil.callMethod_V(rowset, "updateAsciiStream", 14, is, 7L); + is.close(); + rowset.updateRow(); + rowset.close(); + + // Validate. + RowSet validater = validater(); + position(validater, key_); + String v = validater.getString(14); + validater.close(); + assertCondition(v.equals("Dublin2"), "Expected Dublin2 got " + v); + + } catch (Exception e) { + failed(e, "Unexpected Exception."); + } finally { + + } } + } - /** - * Validates that addRowSetListener(RowSetListener) notifies listeners when the row is changed - updateClob(). - **/ - public void Var185() - { - if (checkJdbc40()) - { - String key_ = "RowSetListener"; - try - { - MyRowListener listener = new MyRowListener(); - - RowSet rowset = updater(key_); - rowset.addRowSetListener(listener); - position(rowset, key_); - - // rowset.updateClob (14, new StringReader ("Fargo"), 5L); - JDReflectionUtil.callMethod_V(rowset, "updateClob", 14, new StringReader("Fargo"), 5L); - - assertCondition(listener.isRowChanged()); - - rowset.close(); - } catch (Exception e) - { - failed(e, "Unexpected Exception."); - } - } + /** + * updateAsciiStream(int,AsciiStream). + **/ + public void Var200() { + if (checkJdbc40()) { + String key_ = "JDRowSUpdAsciiStream"; + + try { + + + RowSet rowset = updater(key_); + position(rowset, key_); + + // rowset.updateAsciiStream (14, stringToAsciiStream ("Dublin"), 6L); + InputStream is = stringToAsciiStream("Dublin3"); + JDReflectionUtil.callMethod_V_IS(rowset, "updateAsciiStream", "C_VARCHAR_50", is, 7L); + rowset.updateRow(); + is.close(); + rowset.close(); + + // Validate. + RowSet validater = validater(); + position(validater, key_); + String v = validater.getString("C_VARCHAR_50"); + validater.close(); + assertCondition(v.equals("Dublin3")); + } catch (Exception e) { + failed(e, "Unexpected Exception."); + } finally { + + } } + } - /** - * Validates that addRowSetListener(RowSetListener) notifies listeners when the row is changed - updateClob(). - **/ - public void Var186() - { - if (checkJdbc40()) - { - String key_ = "RowSetListener"; - try - { - MyRowListener listener = new MyRowListener(); - - RowSet rowset = updater(key_); - rowset.addRowSetListener(listener); - position(rowset, key_); - - //rowset.updateClob ("C_VARCHAR_50", new StringReader ("Gillette"), 8); - JDReflectionUtil.callMethod_V(rowset, "updateClob", "C_VARCHAR_50", new StringReader("Gillette"), 8L); - - assertCondition(listener.isRowChanged()); - - rowset.close(); - } catch (Exception e) - { - failed(e, "Unexpected Exception."); - } - } + /** + * updateBinaryStream(). + **/ + public void Var201() { + if (checkJdbc40()) { + String key_ = "JDRowSUpdBinaryStream"; + + try { + + sb.setLength(0); + + RowSet rowset = updater(key_); + position(rowset, key_); + + byte[] ba = new byte[] { (byte) 11, (byte) 4, (byte) 98, (byte) -22 }; + // rowset.updateBinaryStream (16, new ByteArrayInputStream (ba), ba.length); + JDReflectionUtil.callMethod_V(rowset, "updateBinaryStream", 18, new ByteArrayInputStream(ba), + (Integer.valueOf(ba.length)).longValue()); + + rowset.updateRow(); + rowset.close(); + + // Validate. + RowSet validater = validater(); + position(validater, key_); + InputStream v = validater.getBinaryStream(18); + validater.close(); + assertCondition(JDTestcase.compare(v, ba, sb), sb); + v.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception."); + } finally { + + } } + } - /** - * Validates that addRowSetListener(RowSetListener) notifies listeners when the row is changed - + /** + * updateBinaryStream(). + **/ + public void Var202() { + if (checkJdbc40()) { + String key_ = "JDRowSUpdBinaryStream"; + + try { + - updateNCharacterStream(). - **/ - public void Var187() - { - if (checkJdbc40()) - { - String key_ = "RowSetListener"; - try - { - MyRowListener listener = new MyRowListener(); - - RowSet rowset = updater(key_); - rowset.addRowSetListener(listener); - position(rowset, key_); - - // rowset.updateNCharacterStream (14, new StringReader ("Fargo"), 5L); - JDReflectionUtil.callMethod_V(rowset, "updateNCharacterStream", 14, new StringReader("Fargo"), 5L); - - assertCondition(listener.isRowChanged()); - - rowset.close(); - } catch (Exception e) - { - failed(e, "Unexpected Exception."); - } - } - } + RowSet rowset = updater(key_); + position(rowset, key_); - /** - * Validates that addRowSetListener(RowSetListener) notifies - * listeners when the row is changed - updateNCharacterStream(). - */ - public void Var188() - { - if (checkJdbc40()) - { - String key_ = "RowSetListener"; - try - { - MyRowListener listener = new MyRowListener(); - - RowSet rowset = updater(key_); - rowset.addRowSetListener(listener); - position(rowset, key_); - - //rowset.updateNCharacterStream ("C_VARCHAR_50", new StringReader ("Gillette"), 8); - JDReflectionUtil.callMethod_V(rowset, "updateNCharacterStream", "C_VARCHAR_50", new StringReader("Gillette"), 8L); - - assertCondition(listener.isRowChanged()); - - rowset.close(); - } catch (Exception e) - { - failed(e, "Unexpected Exception."); - } - } + byte[] ba = new byte[] { (byte) 12, (byte) 44, (byte) 98, (byte) -2 }; + // rowset.updateBinaryStream (18, new ByteArrayInputStream (ba), ba.length); + JDReflectionUtil.callMethod_V_IS(rowset, "updateBinaryStream", "C_VARBINARY_20", new ByteArrayInputStream(ba), + (Integer.valueOf(ba.length)).longValue()); + + rowset.updateRow(); + rowset.close(); + + // Validate. + RowSet validater = validater(); + position(validater, key_); + InputStream v = validater.getBinaryStream("C_VARBINARY_20"); + validater.close(); + sb.setLength(0); + + assertCondition(JDTestcase.compare(v, ba, sb), sb); + v.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception."); + } finally { + + } } + } - /** - * Validates that addRowSetListener(RowSetListener) notifies listeners when the row is changed - updateNClob(). - **/ - public void Var189() - { - if (checkJdbc40()) - { - String key_ = "RowSetListener"; - try - { - MyRowListener listener = new MyRowListener(); - - RowSet rowset = updater(key_); - rowset.addRowSetListener(listener); - position(rowset, key_); - - // rowset.updateNClob (14, new StringReader ("Fargo"), 5L); - - Object nClob = JDReflectionUtil.callMethod_O(conn2_, "createNClob"); - - JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "FargoNclob"); - JDReflectionUtil.callMethod_V(rowset, "updateNClob", 14, nClob); - - assertCondition(listener.isRowChanged()); - - rowset.close(); - } catch (Exception e) - { - failed(e, "Unexpected Exception."); - } - } + /** + * updateBlob(). + **/ + public void Var203() { + if (checkJdbc40()) { + String key_ = "JDRowSUpdBlob"; + + try { + + + RowSet rowset = updater(key_); + position(rowset, key_); + + byte[] ba = new byte[] { (byte) 1, (byte) 2, (byte) 3, (byte) 4 }; + // rowset.updateBinaryStream (18, new ByteArrayInputStream (ba), ba.length); + JDReflectionUtil.callMethod_V_IS(rowset, "updateBlob", "C_VARBINARY_20", new ByteArrayInputStream(ba), + (Integer.valueOf(ba.length)).longValue()); + + rowset.updateRow(); + rowset.close(); + + // Validate. + RowSet validater = validater(); + position(validater, key_); + InputStream v = validater.getBinaryStream("C_VARBINARY_20"); + validater.close(); + sb.setLength(0); + assertCondition(JDTestcase.compare(v, ba, sb), sb); + v.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception."); + } finally { + + } } + } - /** - * Validates that addRowSetListener(RowSetListener) notifies listeners when the row is changed - updateNClob(). - **/ - public void Var190() - { - if (checkJdbc40()) - { - String key_ = "RowSetListener"; - try - { - MyRowListener listener = new MyRowListener(); + /** + * updateBlob(). + **/ + public void Var204() { + if (checkJdbc40()) { + String key_ = "JDRowSUpdBlob"; + + try { + - RowSet rowset = updater(key_); - rowset.addRowSetListener(listener); - position(rowset, key_); + RowSet rowset = updater(key_); + position(rowset, key_); - //rowset.updateNClob ("C_VARCHAR_50", new StringReader ("Gillette"), 8); + byte[] ba = new byte[] { (byte) 1, (byte) 2, (byte) 3, (byte) 4 }; + // rowset.updateBinaryStream (18, new ByteArrayInputStream (ba), ba.length); + JDReflectionUtil.callMethod_V(rowset, "updateBlob", 18, new ByteArrayInputStream(ba), + (Integer.valueOf(ba.length)).longValue()); - Object nClob = JDReflectionUtil.callMethod_O(conn2_, "createNClob"); - JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "GilletteNclob"); - JDReflectionUtil.callMethod_V(rowset, "updateNClob", "C_VARCHAR_50", nClob); + rowset.updateRow(); + rowset.close(); - assertCondition(listener.isRowChanged()); + // Validate. + RowSet validater = validater(); + position(validater, key_); + InputStream v = validater.getBinaryStream(18); + validater.close(); + sb.setLength(0); - rowset.close(); - } catch (Exception e) - { - failed(e, "Unexpected Exception."); - } - } + assertCondition(JDTestcase.compare(v, ba, sb), sb); + v.close(); + } catch (Exception e) { + failed(e, "Unexpected Exception."); + } finally { + + } } + } - /** - * Validates that addRowSetListener(RowSetListener) notifies listeners when the row is changed - updateNClob2(). - **/ - public void Var191() - { - if (checkJdbc40()) - { - String key_ = "RowSetListener"; - try - { - MyRowListener listener = new MyRowListener(); - - RowSet rowset = updater(key_); - rowset.addRowSetListener(listener); - position(rowset, key_); - - // rowset.updateNClob (14, new StringReader ("Fargo"), 5L); - JDReflectionUtil.callMethod_V(rowset, "updateNClob", 14, new StringReader("Fargo"), 5L); - - assertCondition(listener.isRowChanged()); - - rowset.close(); - } catch (Exception e) - { - failed(e, "Unexpected Exception."); - } - } + /** + * updateCharacterStream(). + **/ + public void Var205() { + if (checkJdbc40()) { + String key_ = "JDRowSUpdCharacterStream"; + + try { + + + RowSet rowset = updater(key_); + position(rowset, key_); + + // rowset.updateAsciiStream (14, stringToAsciiStream ("Dublin"), 6L); + JDReflectionUtil.callMethod_V(rowset, "updateCharacterStream", 14, new StringReader("Dublin4"), 7L); + rowset.updateRow(); + rowset.close(); + + // Validate. + RowSet validater = validater(); + position(validater, key_); + String v = validater.getString(14); + validater.close(); + assertCondition(v.equals("Dublin4")); + } catch (Exception e) { + failed(e, "Unexpected Exception."); + } finally { + + } } + } - /** - * Validates that addRowSetListener(RowSetListener) notifies listeners when the row is changed - updateNClob2(). - **/ - public void Var192() - { - if (checkJdbc40()) - { - String key_ = "RowSetListener"; - try - { - MyRowListener listener = new MyRowListener(); - - RowSet rowset = updater(key_); - rowset.addRowSetListener(listener); - position(rowset, key_); - - //rowset.updateNClob ("C_VARCHAR_50", new StringReader ("Gillette"), 8); - JDReflectionUtil.callMethod_V(rowset, "updateNClob", "C_VARCHAR_50", new StringReader("Gillette"), 8L); - - assertCondition(listener.isRowChanged()); - - rowset.close(); - } catch (Exception e) - { - failed(e, "Unexpected Exception."); - } - } + /** + * updateCharacterStream(). + **/ + public void Var206() { + if (checkJdbc40()) { + String key_ = "JDRowSUpdCharacterStream"; + + try { + + + RowSet rowset = updater(key_); + position(rowset, key_); + + // rowset.updateAsciiStream (14, stringToAsciiStream ("Dublin"), 6L); + JDReflectionUtil.callMethod_V(rowset, "updateCharacterStream", "C_VARCHAR_50", new StringReader("Dublin5"), 7L); + rowset.updateRow(); + rowset.close(); + + // Validate. + RowSet validater = validater(); + position(validater, key_); + String v = validater.getString("C_VARCHAR_50"); + validater.close(); + assertCondition(v.equals("Dublin5")); + } catch (Exception e) { + failed(e, "Unexpected Exception."); + } finally { + + } } + } - /** - * Validates that addRowSetListener(RowSetListener) notifies listeners when the row is changed - - - updateNString(int,String). - **/ - public void Var193() - { - if (checkJdbc40()) - { - String key_ = "RowSetListener"; - try - { - MyRowListener listener = new MyRowListener(); - - RowSet rowset = updater(key_); - rowset.addRowSetListener(listener); - position(rowset, key_); - - // rowset.updateNString (14, "Queries"); - JDReflectionUtil.callMethod_V(rowset, "updateNString", 14, "Queries"); - assertCondition(listener.isRowChanged()); - - rowset.close(); - } catch (Exception e) - { - failed(e, "Unexpected Exception."); - } - } - } - /** - * Validates that addRowSetListener(RowSetListener) notifies listeners when the row is changed - - - updateNString(String,String). - **/ - public void Var194() - { - if (checkJdbc40()) - { - - String key_ = "RowSetListener"; - try - { - MyRowListener listener = new MyRowListener(); - - RowSet rowset = updater(key_); - rowset.addRowSetListener(listener); - position(rowset, key_); - - //rowset.updateNString ("C_VARCHAR_50", "Inner joins"); - JDReflectionUtil.callMethod_V(rowset, "updateNString", "C_VARCHAR_50", "Inner joins"); - assertCondition(listener.isRowChanged()); - - rowset.close(); - } catch (Exception e) - { - failed(e, "Unexpected Exception."); - } - } - } - - /** - * Validates that addRowSetListener(RowSetListener) notifies listeners when the row is changed - updateRowId(). - **/ - public void Var195() - { - if (checkJdbc40()) - { - String key_ = "RowSetListener"; - RowSet rowset = null; - try - { - MyRowListener listener = new MyRowListener(); - - rowset = updater(key_); - rowset.addRowSetListener(listener); - position(rowset, key_); - - //RowId ri = rowset.getRowId(28); - Object ri = JDReflectionUtil.callMethod_O(rowset, "getRowId", 28); - - JDReflectionUtil.callMethod_V(rowset, "updateRowId", 29, ri); - - assertCondition(listener.isRowChanged()); - - rowset.close(); - } catch (Exception e) - { - if (getDriver () == JDTestDriver.DRIVER_TOOLBOX) - { - assertCondition(e.getMessage().indexOf("mismatch") != -1); - try{ - rowset.close(); - }catch(Exception e1){} - return; - } - failed(e, "Unexpected Exception."); - if (rowset != null) { - try { - rowset.close(); - } catch(Exception ex) { - ex.printStackTrace(); - } - } - } - } + /** + * updateClob(). + **/ + public void Var207() { + if (checkJdbc40()) { + String key_ = "JDRowSUpdClob"; + + try { + + + RowSet rowset = updater(key_); + position(rowset, key_); + + // rowset.updateAsciiStream (14, stringToAsciiStream ("Dublin"), 6L); + JDReflectionUtil.callMethod_V(rowset, "updateClob", 14, new StringReader("Dublin6"), 7L); + rowset.updateRow(); + rowset.close(); + + // Validate. + RowSet validater = validater(); + position(validater, key_); + String v = validater.getString(14); + validater.close(); + assertCondition(v.equals("Dublin6")); + } catch (Exception e) { + failed(e, "Unexpected Exception."); + } finally { + + } } + } - /** - * Validates that addRowSetListener(RowSetListener) notifies listeners when the row is changed - updateRowId(). - **/ - public void Var196() - { - if (checkJdbc40()) - { - String key_ = "RowSetListener"; - RowSet rowset=null; - try - { - MyRowListener listener = new MyRowListener(); - - rowset = updater(key_); - rowset.addRowSetListener(listener); - position(rowset, key_); - - Object ri = JDReflectionUtil.callMethod_O(rowset, "getRowId", 28); - - JDReflectionUtil.callMethod_V(rowset, "updateRowId", "C_VARBINARY_40", ri); - - assertCondition(listener.isRowChanged()); - - rowset.close(); - } catch (Exception e) - { - if (getDriver () == JDTestDriver.DRIVER_TOOLBOX) - { - assertCondition(e.getMessage().indexOf("mismatch") != -1); - try{ - rowset.close(); - }catch(Exception e1){} - return; - } - failed(e, "Unexpected Exception."); - } - } + /** + * updateClob(). + **/ + public void Var208() { + if (checkJdbc40()) { + String key_ = "JDRowSUpdClob"; + + try { + + + RowSet rowset = updater(key_); + position(rowset, key_); + + // rowset.updateAsciiStream (14, stringToAsciiStream ("Dublin"), 6L); + JDReflectionUtil.callMethod_V(rowset, "updateClob", "C_VARCHAR_50", new StringReader("Dublin7"), 7L); + rowset.updateRow(); + rowset.close(); + + // Validate. + RowSet validater = validater(); + position(validater, key_); + String v = validater.getString("C_VARCHAR_50"); + validater.close(); + assertCondition(v.equals("Dublin7")); + } catch (Exception e) { + failed(e, "Unexpected Exception."); + } finally { + + } } + } - /** - * Validates that addRowSetListener(RowSetListener) notifies listeners when the row is changed - updateSQLXML(). - **/ - public void Var197() - { - if (checkJdbc40()) - { - String key_ = "RowSetListener"; - RowSet rowset = null; - try - { - MyRowListener listener = new MyRowListener(); - - rowset = updater(key_); - rowset.addRowSetListener(listener); - position(rowset, key_); - - Object sqlXML = JDReflectionUtil.callMethod_O(conn2_, "createSQLXML"); - JDReflectionUtil.callMethod_V(sqlXML, "setString", "FargoXML"); - JDReflectionUtil.callMethod_V(rowset, "updateSQLXML", 23, sqlXML); - - assertCondition(listener.isRowChanged()); - - rowset.close(); - } catch (Exception e) - { - try { - if (rowset!= null) rowset.close(); - } catch (Exception e2) { - e2.printStackTrace(); - } - failed(e, "Unexpected Exception."); - } - } + /** + * updateNCharacterStream(). + **/ + public void Var209() { + if (checkJdbc40()) { + String key_ = "JDRowSUpdCharacterStream"; + + try { + + + RowSet rowset = updater(key_); + position(rowset, key_); + + // rowset.updateAsciiStream (14, stringToAsciiStream ("Dublin"), 6L); + JDReflectionUtil.callMethod_V(rowset, "updateNCharacterStream", 14, new StringReader("Dublin8"), 7L); + rowset.updateRow(); + rowset.close(); + + // Validate. + RowSet validater = validater(); + position(validater, key_); + String v = validater.getString(14); + validater.close(); + assertCondition(v.equals("Dublin8")); + } catch (Exception e) { + failed(e, "Unexpected Exception."); + } finally { + + } } + } - /** - * Validates that addRowSetListener(RowSetListener) notifies listeners when the row is changed - updateSQLXML(). - **/ - public void Var198() - { - if (checkJdbc40()) - { - String key_ = "RowSetListener"; - RowSet rowset = null; - try - { - MyRowListener listener = new MyRowListener(); - - rowset = updater(key_); - rowset.addRowSetListener(listener); - position(rowset, key_); - - Object sqlXML = JDReflectionUtil.callMethod_O(conn2_, "createSQLXML"); - JDReflectionUtil.callMethod_V(sqlXML, "setString", "FargoXML"); - JDReflectionUtil.callMethod_V(rowset, "updateSQLXML", "C_CLOB", sqlXML); - - assertCondition(listener.isRowChanged()); - - rowset.close(); - } catch (Exception e) - { - try { - if (rowset != null) rowset.close(); - } catch (Exception e2) { - e2.printStackTrace(); - } - - failed(e, "Unexpected Exception."); - } - } + /** + * updateNCharacterStream(). + **/ + public void Var210() { + if (checkJdbc40()) { + String key_ = "JDRowSUpdCharacterStream"; + + try { + + + RowSet rowset = updater(key_); + position(rowset, key_); + + // rowset.updateAsciiStream (14, stringToAsciiStream ("Dublin"), 6L); + JDReflectionUtil.callMethod_V(rowset, "updateNCharacterStream", "C_VARCHAR_50", new StringReader("Dublin9"), + 7L); + rowset.updateRow(); + rowset.close(); + + // Validate. + RowSet validater = validater(); + position(validater, key_); + String v = validater.getString("C_VARCHAR_50"); + validater.close(); + assertCondition(v.equals("Dublin9")); + } catch (Exception e) { + failed(e, "Unexpected Exception."); + } finally { + + } } + } - /** - * updateAsciiStream(int,AsciiStream). - **/ - public void Var199() - { - if (checkJdbc40()) - { - String key_ = "JDRSUpdateAsciiStream"; - try - { - - RowSet rowset = updater(key_); - position(rowset, key_); - - //rowset.updateAsciiStream (14, stringToAsciiStream ("Dublin"), 6L); - JDReflectionUtil.callMethod_V(rowset, "updateAsciiStream", 14, stringToAsciiStream("Dublin2"), 7L); - rowset.updateRow(); - rowset.close(); - - // Validate. - RowSet validater = validater(); - position(validater, key_); - String v = validater.getString(14); - validater.close(); - assertCondition(v.equals("Dublin2")); - rowset.close(); - } catch (Exception e) - { - failed(e, "Unexpected Exception."); - } - } - } + /** + * updateNClob(). + **/ + public void Var211() { + if (checkJdbc40()) { + String key_ = "JDRowSUpdClob"; + + try { + - /** - * updateAsciiStream(int,AsciiStream). - **/ - public void Var200() - { - if (checkJdbc40()) - { - String key_ = "JDRSUpdateAsciiStream"; - try - { - - RowSet rowset = updater(key_); - position(rowset, key_); - - //rowset.updateAsciiStream (14, stringToAsciiStream ("Dublin"), 6L); - JDReflectionUtil.callMethod_V_IS(rowset, "updateAsciiStream", "C_VARCHAR_50", stringToAsciiStream("Dublin3"), 7L); - rowset.updateRow(); - rowset.close(); - - // Validate. - RowSet validater = validater(); - position(validater, key_); - String v = validater.getString("C_VARCHAR_50"); - validater.close(); - assertCondition(v.equals("Dublin3")); - } catch (Exception e) - { - failed(e, "Unexpected Exception."); - } - } - } + RowSet rowset = updater(key_); + position(rowset, key_); - /** - * updateBinaryStream(). - **/ - public void Var201() - { - if (checkJdbc40()) - { - String key_ = "JDRSupdateBinaryStream"; - try - { - sb.setLength(0); - - RowSet rowset = updater(key_); - position(rowset, key_); - - byte[] ba = new byte[] { (byte) 11, (byte) 4, (byte) 98, (byte) -22 }; - //rowset.updateBinaryStream (16, new ByteArrayInputStream (ba), ba.length); - JDReflectionUtil.callMethod_V(rowset, "updateBinaryStream", 18, new ByteArrayInputStream(ba), (Integer.valueOf(ba.length)).longValue()); - - rowset.updateRow(); - rowset.close(); - - // Validate. - RowSet validater = validater(); - position(validater, key_); - InputStream v = validater.getBinaryStream(18); - validater.close(); - assertCondition(JDTestcase.compare(v, ba,sb),sb); - } catch (Exception e) - { - failed(e, "Unexpected Exception."); - } - } - } + Object nClob = JDReflectionUtil.callMethod_O(conn2_, "createNClob"); + JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "Dubl211"); - /** - * updateBinaryStream(). - **/ - public void Var202() - { - if (checkJdbc40()) - { - String key_ = "JDRSupdateBinaryStream"; - try - { - - RowSet rowset = updater(key_); - position(rowset, key_); - - byte[] ba = new byte[] { (byte) 12, (byte) 44, (byte) 98, (byte) -2 }; - //rowset.updateBinaryStream (18, new ByteArrayInputStream (ba), ba.length); - JDReflectionUtil.callMethod_V_IS(rowset, "updateBinaryStream", "C_VARBINARY_20", new ByteArrayInputStream(ba), (Integer.valueOf(ba.length)).longValue()); - - rowset.updateRow(); - rowset.close(); - - // Validate. - RowSet validater = validater(); - position(validater, key_); - InputStream v = validater.getBinaryStream("C_VARBINARY_20"); - validater.close(); - sb.setLength(0); - - assertCondition(JDTestcase.compare(v, ba,sb),sb); - } catch (Exception e) - { - failed(e, "Unexpected Exception."); - } - } - } + JDReflectionUtil.callMethod_V(rowset, "updateNClob", 14, nClob); + rowset.updateRow(); + rowset.close(); - /** - * updateBlob(). - **/ - public void Var203() - { - if (checkJdbc40()) - { - String key_ = "JDRSupdateBlob"; - try - { - - RowSet rowset = updater(key_); - position(rowset, key_); - - byte[] ba = new byte[] { (byte) 1, (byte) 2, (byte) 3, (byte) 4 }; - //rowset.updateBinaryStream (18, new ByteArrayInputStream (ba), ba.length); - JDReflectionUtil.callMethod_V_IS(rowset, "updateBlob", "C_VARBINARY_20", new ByteArrayInputStream(ba), (Integer.valueOf(ba.length)).longValue()); - - rowset.updateRow(); - rowset.close(); - - // Validate. - RowSet validater = validater(); - position(validater, key_); - InputStream v = validater.getBinaryStream("C_VARBINARY_20"); - validater.close(); - sb.setLength(0); - assertCondition(JDTestcase.compare(v, ba,sb),sb); - } catch (Exception e) - { - failed(e, "Unexpected Exception."); - } - } + // Validate. + RowSet validater = validater(); + position(validater, key_); + String v = validater.getString(14); + validater.close(); + assertCondition(v.equals("Dubl211")); + } catch (Exception e) { + failed(e, "Unexpected Exception."); + } finally { + + } } + } - /** - * updateBlob(). - **/ - public void Var204() - { - if (checkJdbc40()) - { - String key_ = "JDRSupdateBlob"; - try - { - - RowSet rowset = updater(key_); - position(rowset, key_); - - byte[] ba = new byte[] { (byte) 1, (byte) 2, (byte) 3, (byte) 4 }; - //rowset.updateBinaryStream (18, new ByteArrayInputStream (ba), ba.length); - JDReflectionUtil.callMethod_V(rowset, "updateBlob", 18, new ByteArrayInputStream(ba), (Integer.valueOf(ba.length)).longValue()); - - rowset.updateRow(); - rowset.close(); - - // Validate. - RowSet validater = validater(); - position(validater, key_); - InputStream v = validater.getBinaryStream(18); - validater.close(); - sb.setLength(0); - - assertCondition(JDTestcase.compare(v, ba,sb),sb); - } catch (Exception e) - { - failed(e, "Unexpected Exception."); - } - } - } + /** + * updateNClob(). + **/ + public void Var212() { + if (checkJdbc40()) { + String key_ = "JDRowSUpdClob"; + + try { + - /** - * updateCharacterStream(). - **/ - public void Var205() - { - if (checkJdbc40()) - { - String key_ = "JDRSUpdateCharacterStream"; - try - { - - RowSet rowset = updater(key_); - position(rowset, key_); - - //rowset.updateAsciiStream (14, stringToAsciiStream ("Dublin"), 6L); - JDReflectionUtil.callMethod_V(rowset, "updateCharacterStream", 14, new StringReader("Dublin4"), 7L); - rowset.updateRow(); - rowset.close(); - - // Validate. - RowSet validater = validater(); - position(validater, key_); - String v = validater.getString(14); - validater.close(); - assertCondition(v.equals("Dublin4")); - } catch (Exception e) - { - failed(e, "Unexpected Exception."); - } - } - } + RowSet rowset = updater(key_); + position(rowset, key_); - /** - * updateCharacterStream(). - **/ - public void Var206() - { - if (checkJdbc40()) - { - String key_ = "JDRSUpdateCharacterStream"; - try - { - - RowSet rowset = updater(key_); - position(rowset, key_); - - //rowset.updateAsciiStream (14, stringToAsciiStream ("Dublin"), 6L); - JDReflectionUtil.callMethod_V(rowset, "updateCharacterStream", "C_VARCHAR_50", new StringReader("Dublin5"), 7L); - rowset.updateRow(); - rowset.close(); - - // Validate. - RowSet validater = validater(); - position(validater, key_); - String v = validater.getString("C_VARCHAR_50"); - validater.close(); - assertCondition(v.equals("Dublin5")); - } catch (Exception e) - { - failed(e, "Unexpected Exception."); - } - } - } + Object nClob = JDReflectionUtil.callMethod_O(conn2_, "createNClob"); + JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "Dubl212"); - /** - * updateClob(). - **/ - public void Var207() - { - if (checkJdbc40()) - { - String key_ = "JDRSUpdateClob"; - try - { - - RowSet rowset = updater(key_); - position(rowset, key_); - - //rowset.updateAsciiStream (14, stringToAsciiStream ("Dublin"), 6L); - JDReflectionUtil.callMethod_V(rowset, "updateClob", 14, new StringReader("Dublin6"), 7L); - rowset.updateRow(); - rowset.close(); - - // Validate. - RowSet validater = validater(); - position(validater, key_); - String v = validater.getString(14); - validater.close(); - assertCondition(v.equals("Dublin6")); - } catch (Exception e) - { - failed(e, "Unexpected Exception."); - } - } - } + JDReflectionUtil.callMethod_V(rowset, "updateNClob", "C_VARCHAR_50", nClob); + rowset.updateRow(); + rowset.close(); - /** - * updateClob(). - **/ - public void Var208() - { - if (checkJdbc40()) - { - String key_ = "JDRSUpdateClob"; - try - { - - RowSet rowset = updater(key_); - position(rowset, key_); - - //rowset.updateAsciiStream (14, stringToAsciiStream ("Dublin"), 6L); - JDReflectionUtil.callMethod_V(rowset, "updateClob", "C_VARCHAR_50", new StringReader("Dublin7"), 7L); - rowset.updateRow(); - rowset.close(); - - // Validate. - RowSet validater = validater(); - position(validater, key_); - String v = validater.getString("C_VARCHAR_50"); - validater.close(); - assertCondition(v.equals("Dublin7")); - } catch (Exception e) - { - failed(e, "Unexpected Exception."); - } - } + // Validate. + RowSet validater = validater(); + position(validater, key_); + String v = validater.getString("C_VARCHAR_50"); + validater.close(); + assertCondition(v.equals("Dubl212")); + } catch (Exception e) { + failed(e, "Unexpected Exception."); + } finally { + + } } + } - /** - * updateNCharacterStream(). - **/ - public void Var209() - { - if (checkJdbc40()) - { - String key_ = "JDRSUpdateCharacterStream"; - try - { - - RowSet rowset = updater(key_); - position(rowset, key_); - - //rowset.updateAsciiStream (14, stringToAsciiStream ("Dublin"), 6L); - JDReflectionUtil.callMethod_V(rowset, "updateNCharacterStream", 14, new StringReader("Dublin8"), 7L); - rowset.updateRow(); - rowset.close(); - - // Validate. - RowSet validater = validater(); - position(validater, key_); - String v = validater.getString(14); - validater.close(); - assertCondition(v.equals("Dublin8")); - } catch (Exception e) - { - failed(e, "Unexpected Exception."); - } - } + /** + * updateNClob(). + **/ + public void Var213() { + if (checkJdbc40()) { + String key_ = "JDRowSUpdCharacterStream"; + + try { + + + RowSet rowset = updater(key_); + position(rowset, key_); + + // rowset.updateAsciiStream (14, stringToAsciiStream ("Dublin"), 6L); + JDReflectionUtil.callMethod_V(rowset, "updateNClob", 14, new StringReader("Dubl213"), 7L); + rowset.updateRow(); + rowset.close(); + + // Validate. + RowSet validater = validater(); + position(validater, key_); + String v = validater.getString(14); + validater.close(); + assertCondition(v.equals("Dubl213")); + } catch (Exception e) { + failed(e, "Unexpected Exception."); + } finally { + + } } + } - /** - * updateNCharacterStream(). - **/ - public void Var210() - { - if (checkJdbc40()) - { - String key_ = "JDRSUpdateCharacterStream"; - try - { - - RowSet rowset = updater(key_); - position(rowset, key_); - - //rowset.updateAsciiStream (14, stringToAsciiStream ("Dublin"), 6L); - JDReflectionUtil.callMethod_V(rowset, "updateNCharacterStream", "C_VARCHAR_50", new StringReader("Dublin9"), 7L); - rowset.updateRow(); - rowset.close(); - - // Validate. - RowSet validater = validater(); - position(validater, key_); - String v = validater.getString("C_VARCHAR_50"); - validater.close(); - assertCondition(v.equals("Dublin9")); - } catch (Exception e) - { - failed(e, "Unexpected Exception."); - } - } + /** + * updateNClob(). + **/ + public void Var214() { + if (checkJdbc40()) { + String key_ = "JDRowSUpdCharacterStream"; + + try { + + + RowSet rowset = updater(key_); + position(rowset, key_); + + // rowset.updateAsciiStream (14, stringToAsciiStream ("Dublin"), 6L); + JDReflectionUtil.callMethod_V(rowset, "updateNClob", "C_VARCHAR_50", new StringReader("Dubl214"), 7L); + rowset.updateRow(); + rowset.close(); + + // Validate. + RowSet validater = validater(); + position(validater, key_); + String v = validater.getString("C_VARCHAR_50"); + validater.close(); + assertCondition(v.equals("Dubl214")); + } catch (Exception e) { + failed(e, "Unexpected Exception."); + } finally { + + } } + } - /** - * updateNClob(). - **/ - public void Var211() - { - if (checkJdbc40()) - { - String key_ = "JDRSUpdateClob"; - try - { - - RowSet rowset = updater(key_); - position(rowset, key_); - - Object nClob = JDReflectionUtil.callMethod_O(conn2_, "createNClob"); - JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "Dubl211"); - - JDReflectionUtil.callMethod_V(rowset, "updateNClob", 14, nClob); - rowset.updateRow(); - rowset.close(); - - // Validate. - RowSet validater = validater(); - position(validater, key_); - String v = validater.getString(14); - validater.close(); - assertCondition(v.equals("Dubl211")); - } catch (Exception e) - { - failed(e, "Unexpected Exception."); - } - } - } + /** + * updateNString() - Should work when the column index is valid. + **/ + public void Var215() { + String key_ = "JDRowSUpdString"; - /** - * updateNClob(). - **/ - public void Var212() - { - if (checkJdbc40()) - { - String key_ = "JDRSUpdateClob"; - try - { - - RowSet rowset = updater(key_); - position(rowset, key_); - - Object nClob = JDReflectionUtil.callMethod_O(conn2_, "createNClob"); - JDReflectionUtil.callMethod_V(nClob, "setString", 1L, "Dubl212"); - - - JDReflectionUtil.callMethod_V(rowset, "updateNClob", "C_VARCHAR_50", nClob); - rowset.updateRow(); - rowset.close(); - - // Validate. - RowSet validater = validater(); - position(validater, key_); - String v = validater.getString("C_VARCHAR_50"); - validater.close(); - assertCondition(v.equals("Dubl212")); - } catch (Exception e) - { - failed(e, "Unexpected Exception."); - } - } - } + if (checkJdbc40()) { + + try { + + RowSet rowset = updater(key_); - /** - * updateNClob(). - **/ - public void Var213() - { - if (checkJdbc40()) - { - String key_ = "JDRSUpdateCharacterStream"; - try - { - - RowSet rowset = updater(key_); - position(rowset, key_); - - //rowset.updateAsciiStream (14, stringToAsciiStream ("Dublin"), 6L); - JDReflectionUtil.callMethod_V(rowset, "updateNClob", 14, new StringReader("Dubl213"), 7L); - rowset.updateRow(); - rowset.close(); - - // Validate. - RowSet validater = validater(); - position(validater, key_); - String v = validater.getString(14); - validater.close(); - assertCondition(v.equals("Dubl213")); - } catch (Exception e) - { - failed(e, "Unexpected Exception."); - } - } - } + position(rowset, key_); - /** - * updateNClob(). - **/ - public void Var214() - { - if (checkJdbc40()) - { - String key_ = "JDRSUpdateCharacterStream"; - try - { - - RowSet rowset = updater(key_); - position(rowset, key_); - - //rowset.updateAsciiStream (14, stringToAsciiStream ("Dublin"), 6L); - JDReflectionUtil.callMethod_V(rowset, "updateNClob", "C_VARCHAR_50", new StringReader("Dubl214"), 7L); - rowset.updateRow(); - rowset.close(); - - // Validate. - RowSet validater = validater(); - position(validater, key_); - String v = validater.getString("C_VARCHAR_50"); - validater.close(); - assertCondition(v.equals("Dubl214")); - } catch (Exception e) - { - failed(e, "Unexpected Exception."); - } - } - } + JDReflectionUtil.callMethod_V(rowset, "updateNString", 14, "Quer215"); + rowset.updateRow(); + rowset.close(); - /** - updateNString() - Should work when the column index is valid. - **/ - public void Var215() - { - String key_ = "JDRSUpdateString"; - - if (checkJdbc40()) - { - try - { - RowSet rowset = updater(key_); - - position(rowset, key_); - - JDReflectionUtil.callMethod_V(rowset, "updateNString", 14, "Quer215"); - rowset.updateRow(); - rowset.close(); - - // Validate. - RowSet validater = validater(); - position(validater, key_); - String v = validater.getString("C_VARCHAR_50"); - validater.close(); - assertCondition(v.equals("Quer215")); - } catch (Exception e) - { - failed(e, "Unexpected Exception"); - } - } + // Validate. + RowSet validater = validater(); + position(validater, key_); + String v = validater.getString("C_VARCHAR_50"); + validater.close(); + assertCondition(v.equals("Quer215")); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } finally { + + } } + } - /** - updateNString() - Should work when the column index is valid. - **/ - public void Var216() - { - String key_ = "JDRSUpdateString"; - - if (checkJdbc40()) - { - try - { - RowSet rowset = updater(key_); - - position(rowset, key_); - - JDReflectionUtil.callMethod_V(rowset, "updateNString", "C_VARCHAR_50", "Quer215"); - rowset.updateRow(); - rowset.close(); - - // Validate. - RowSet validater = validater(); - position(validater, key_); - String v = validater.getString("C_VARCHAR_50"); - validater.close(); - assertCondition(v.equals("Quer215")); - } catch (Exception e) - { - failed(e, "Unexpected Exception"); - } - } - } + /** + * updateNString() - Should work when the column index is valid. + **/ + public void Var216() { + String key_ = "JDRowSUpdString"; - /** - * updateRowId(). - **/ - public void Var217() - { - RowSet rowset2 = null; - RowSet rowset = null; - if (checkJdbc40()) - { - String key_ = "JDRSUpdateBlob"; - try - { - //get any valid rowid from the get table - rowset2 = getRowSet(jndiName_); - rowset2.setUsername(systemObject_.getUserId()); - rowset2.setPassword(PasswordVault.decryptPasswordLeak(encryptedPassword_)); - rowset2.setType(ResultSet.TYPE_SCROLL_SENSITIVE); - rowset2.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); - rowset2.execute(); - position(rowset2, "CHAR_FULL"); //any row - Object ri2 = JDReflectionUtil.callMethod_O(rowset2, "getRowId", 28); - rowset2.close(); - - rowset = updater(key_); - position(rowset, key_); - - /* Object ri = */ JDReflectionUtil.callMethod_O(rowset, "getRowId", 28); - - JDReflectionUtil.callMethod_V(rowset, "updateRowId", 29, ri2); - - rowset.updateRow(); - rowset.close(); - - // Validate. - RowSet validater = validater(); - position(validater, key_); - Object v = JDReflectionUtil.callMethod_O(validater, "getRowId", 29); - validater.close(); - - assertCondition(ri2.toString().equals(v.toString())); - } catch (Exception e) - { - if (getDriver () == JDTestDriver.DRIVER_TOOLBOX) - { - assertCondition(e.getMessage().indexOf("mismatch") != -1); - try{ - rowset.close(); - rowset2.close(); - }catch(Exception e1){} - return; - } - failed(e, "Unexpected Exception."); - } - } - } + if (checkJdbc40()) { + + try { + + RowSet rowset = updater(key_); - /** - * updateRowId(). - **/ - public void Var218() - { - RowSet rowset2 = null; - RowSet rowset = null; - if (checkJdbc40()) - { - String key_ = "JDRSupdateBlob"; - try - { - //get any valid rowid from the get table - rowset2 = getRowSet(jndiName_); - rowset2.setUsername(systemObject_.getUserId()); - rowset2.setPassword(PasswordVault.decryptPasswordLeak(encryptedPassword_)); - rowset2.setType(ResultSet.TYPE_SCROLL_SENSITIVE); - rowset2.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); - rowset2.execute(); - position(rowset2, "CHAR_FULL"); //any row - Object ri2 = JDReflectionUtil.callMethod_O(rowset2, "getRowId", 28); - rowset2.close(); - - - rowset = updater(key_); - position(rowset, key_); - - /* Object ri = */ JDReflectionUtil.callMethod_O( rowset, "getRowId", 28); - //note, that as of today, i cannot update the rowid with new values (error from host server) - JDReflectionUtil.callMethod_V(rowset, "updateRowId", "C_VARBINARY_40", ri2); - - rowset.updateRow(); - rowset.close(); - - // Validate. - RowSet validater = validater(); - position(validater, key_); - Object v = JDReflectionUtil.callMethod_O(validater, "getRowId", 29); - validater.close(); - assertCondition(ri2.equals(v), "\nretrieved='"+v+"'"+ - "\nexpected ='"+ri2+"'"); - } catch (Exception e) - { - if (getDriver () == JDTestDriver.DRIVER_TOOLBOX) - { - assertCondition(e.getMessage().indexOf("mismatch") != -1); - try{ - rowset.close(); - rowset2.close(); - }catch(Exception e1){} - return; - } - failed(e, "Unexpected Exception."); - } - } + position(rowset, key_); + + JDReflectionUtil.callMethod_V(rowset, "updateNString", "C_VARCHAR_50", "Quer215"); + rowset.updateRow(); + rowset.close(); + + // Validate. + RowSet validater = validater(); + position(validater, key_); + String v = validater.getString("C_VARCHAR_50"); + validater.close(); + assertCondition(v.equals("Quer215")); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } finally { + + } } + } - /** - * updateSQLXML(). - **/ - public void Var219() - { - if (checkJdbc40()) - { - String key_ = "JDRSUpdateClob"; - try - { - - RowSet rowset = updater(key_); - position(rowset, key_); - - Object xmlObj = JDReflectionUtil.callMethod_O(conn2_, "createSQLXML"); - JDReflectionUtil.callMethod_V(xmlObj, "setString", "Dubl219"); - - JDReflectionUtil.callMethod_V(rowset, "updateSQLXML", 23, xmlObj); - rowset.updateRow(); - rowset.close(); - - // Validate. - RowSet validater = validater(); - position(validater, key_); - String v = validater.getString(23); - validater.close(); - assertCondition(v.equals("Dubl219"), "Retrieved='"+v+"' expected='Dubl219'"); - } catch (Exception e) - { - failed(e, "Unexpected Exception."); - } + /** + * updateRowId(). + **/ + public void Var217() { + if (checkJdbc40()) { + String key_ = "JDRowSUpdBlob"; + + try (RowSet rowset2 = getRowSet(jndiName_)) {// get any valid rowid from the get table + + + rowset2.setUsername(systemObject_.getUserId()); + rowset2.setPassword(PasswordVault.decryptPasswordLeak(encryptedPassword_)); + rowset2.setType(ResultSet.TYPE_SCROLL_SENSITIVE); + rowset2.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); + rowset2.execute(); + position(rowset2, "CHAR_FULL"); // any row + Object ri2 = JDReflectionUtil.callMethod_O(rowset2, "getRowId", 28); + rowset2.close(); + + try (RowSet rowset = updater(key_)) { + position(rowset, key_); + + /* Object ri = */ JDReflectionUtil.callMethod_O(rowset, "getRowId", 28); + + JDReflectionUtil.callMethod_V(rowset, "updateRowId", 29, ri2); + + rowset.updateRow(); + } + + // Validate. + RowSet validater = validater(); + position(validater, key_); + Object v = JDReflectionUtil.callMethod_O(validater, "getRowId", 29); + validater.close(); + assertCondition(ri2.toString().equals(v.toString())); + } catch (Exception e) { + if (getDriver() == JDTestDriver.DRIVER_TOOLBOX) { + assertCondition(e.getMessage().indexOf("mismatch") != -1); + return; } + failed(e, "Unexpected Exception."); + } finally { + + } } + } - /** - * updateSQLXML(). - **/ - public void Var220() - { - if (checkJdbc40()) - { - String key_ = "JDRSUpdateClob"; - try - { - - RowSet rowset = updater(key_); - position(rowset, key_); - - Object xmlObj = JDReflectionUtil.callMethod_O(conn2_, "createSQLXML"); - JDReflectionUtil.callMethod_V(xmlObj, "setString", "Dubl220"); - - JDReflectionUtil.callMethod_V(rowset, "updateSQLXML", "C_CLOB", xmlObj); - rowset.updateRow(); - rowset.close(); - - // Validate. - RowSet validater = validater(); - position(validater, key_); - String v = validater.getString("C_CLOB"); - validater.close(); - assertCondition(v.equals("Dubl220"), "Retrieved='"+v+"' expected='Dubl220'"); - } catch (Exception e) - { - failed(e, "Unexpected Exception."); - } + /** + * updateRowId(). + **/ + public void Var218() { + if (checkJdbc40()) { + String key_ = "JDRowSUpdBlob"; + + try (RowSet rowset2 = getRowSet(jndiName_)) {// get any valid rowid from the get table + + + rowset2.setUsername(systemObject_.getUserId()); + rowset2.setPassword(PasswordVault.decryptPasswordLeak(encryptedPassword_)); + rowset2.setType(ResultSet.TYPE_SCROLL_SENSITIVE); + rowset2.setCommand("SELECT * FROM " + JDRSTest.RSTEST_GET); + rowset2.execute(); + position(rowset2, "CHAR_FULL"); // any row + Object ri2 = JDReflectionUtil.callMethod_O(rowset2, "getRowId", 28); + rowset2.close(); + + try (RowSet rowset = updater(key_)) { + position(rowset, key_); + + /* Object ri = */ JDReflectionUtil.callMethod_O(rowset, "getRowId", 28); + // note, that as of today, i cannot update the rowid with new values (error from + // host server) + JDReflectionUtil.callMethod_V(rowset, "updateRowId", "C_VARBINARY_40", ri2); + + rowset.updateRow(); + } + + // Validate. + RowSet validater = validater(); + position(validater, key_); + Object v = JDReflectionUtil.callMethod_O(validater, "getRowId", 29); + validater.close(); + + assertCondition(ri2.equals(v), "\nretrieved='" + v + "'" + "\nexpected ='" + ri2 + "'"); + } catch (Exception e) { + if (getDriver() == JDTestDriver.DRIVER_TOOLBOX) { + + assertCondition(e.getMessage().indexOf("mismatch") != -1); + return; } + failed(e, "Unexpected Exception."); + } finally { + + } } - - - /** -updateBoolean() - Should work when the column index is valid on a BOOLEAN column -**/ - public void Var221() - { - String key_ = "JDRSUpdateBoolean"; - if (checkJdbc20 ()) { - try { - RowSet rowset = updater(key_); + } - position (rowset, key_); - rowset.updateBoolean ("C_BOOLEAN", true); - rowset.updateRow (); + /** + * updateSQLXML(). + **/ + public void Var219() { + if (checkJdbc40()) { + String key_ = "JDRowSUpdClob"; + + try { + - rowset.close(); + RowSet rowset = updater(key_); + position(rowset, key_); - // Validate. - RowSet validater = validater(); - position (validater, key_); - boolean v = validater.getBoolean ("C_BOOLEAN"); - validater.close (); + Object xmlObj = JDReflectionUtil.callMethod_O(conn2_, "createSQLXML"); + JDReflectionUtil.callMethod_V(xmlObj, "setString", "Dubl219"); - assertCondition (v == true); - } - catch (Exception e) { - failed (e, "Unexpected Exception"); - } - } + JDReflectionUtil.callMethod_V(rowset, "updateSQLXML", 23, xmlObj); + rowset.updateRow(); + rowset.close(); + + // Validate. + RowSet validater = validater(); + position(validater, key_); + String v = validater.getString(23); + validater.close(); + assertCondition(v.equals("Dubl219"), "Retrieved='" + v + "' expected='Dubl219'"); + } catch (Exception e) { + failed(e, "Unexpected Exception."); + } finally { + + } } + } + /** + * updateSQLXML(). + **/ + public void Var220() { + if (checkJdbc40()) { + String key_ = "JDRowSUpdClob"; + + try { + -} + RowSet rowset = updater(key_); + position(rowset, key_); + + Object xmlObj = JDReflectionUtil.callMethod_O(conn2_, "createSQLXML"); + JDReflectionUtil.callMethod_V(xmlObj, "setString", "Dubl220"); + + JDReflectionUtil.callMethod_V(rowset, "updateSQLXML", "C_CLOB", xmlObj); + rowset.updateRow(); + rowset.close(); + + // Validate. + RowSet validater = validater(); + position(validater, key_); + String v = validater.getString("C_CLOB"); + validater.close(); + assertCondition(v.equals("Dubl220"), "Retrieved='" + v + "' expected='Dubl220'"); + } catch (Exception e) { + failed(e, "Unexpected Exception."); + } finally { + + } + } + } + /** + * updateBoolean() - Should work when the column index is valid on a BOOLEAN + * column + **/ + public void Var221() { + String key_ = "JDRowSet221"; + if (checkJdbc20()) { + + try { + + RowSet rowset = updater(key_); + + position(rowset, key_); + rowset.updateBoolean("C_BOOLEAN", true); + rowset.updateRow(); + + rowset.close(); + + // Validate. + RowSet validater = validater(); + position(validater, key_); + boolean v = validater.getBoolean("C_BOOLEAN"); + validater.close(); + cleanUpdateTable(); + assertCondition(v == true, "got " + v + " sb true"); + } catch (Exception e) { + failed(e, "Unexpected Exception"); + } finally { + + } + } + } +} diff --git a/src/test/JD/Statement/JDStatementGetGeneratedKeys.java b/src/test/JD/Statement/JDStatementGetGeneratedKeys.java index 7042eb28..1c32c86f 100644 --- a/src/test/JD/Statement/JDStatementGetGeneratedKeys.java +++ b/src/test/JD/Statement/JDStatementGetGeneratedKeys.java @@ -1649,8 +1649,6 @@ public void Var036() /** * genGeneratedKeys() -- obtain multiple keys -- multiple rows - * not supported in V5R2. - * This is supported in V5R5 */ @@ -1666,18 +1664,20 @@ public void Var037() return; } Statement s = null; + Statement s2 = null; try { String table1 = JDStatementTest.COLLECTION + ".JDGENKEYSV37A"; String table2 = JDStatementTest.COLLECTION + ".JDGENKEYSV37B"; s = connection_.createStatement (); - initTable(s, table1," (NAME VARCHAR(10))"); + s2 = connection_.createStatement(); + initTable(s2, table1," (NAME VARCHAR(10))"); s.executeUpdate("insert into "+table1+" values('Abraham')"); s.executeUpdate("insert into "+table1+" values('John')"); s.executeUpdate("insert into "+table1+" values('Zedekiah')"); - JDTestDriver.dropTable(s, table2); + JDTestDriver.dropTable(s2, table2); - initTable(s, table2, " (NAME VARCHAR(10), "+ + initTable(s2, table2, " (NAME VARCHAR(10), "+ "GENID INT GENERATED ALWAYS AS IDENTITY ( START WITH 10, increment BY 3 ))"); s.execute ("INSERT INTO " + table2 @@ -1716,12 +1716,14 @@ public void Var037() } assertCondition(condition); s.close(); + s2.close(); } catch (Exception e) { failed (e, "Unexpected Exception"); try { if (s != null) s.close(); + if (s2 != null) s2.close(); } catch (SQLException se) { @@ -3303,19 +3305,20 @@ public void Var077() return; } Statement s = null; + Statement s2 = null; try { String table1 = JDStatementTest.COLLECTION + "/JDGENKEYSV37A"; String table2 = JDStatementTest.COLLECTION + "/JDGENKEYSV37B"; s = connectionSystemNaming_.createStatement (); - - initTable(s, table1," (NAME VARCHAR(10))"); + s2 = connectionSystemNaming_.createStatement (); + initTable(s2, table1," (NAME VARCHAR(10))", null, false); s.executeUpdate("insert into "+table1+" values('Abraham')"); s.executeUpdate("insert into "+table1+" values('John')"); s.executeUpdate("insert into "+table1+" values('Zedekiah')"); - JDTestDriver.dropTable(s, table2); + JDTestDriver.dropTable(s2, table2); - initTable(s, table2," (NAME VARCHAR(10), GENID INT GENERATED ALWAYS AS IDENTITY ( START WITH 10, increment BY 3 ))"); + initTable(s2, table2," (NAME VARCHAR(10), GENID INT GENERATED ALWAYS AS IDENTITY ( START WITH 10, increment BY 3 ))", null, false); s.execute ("INSERT INTO " + table2 + " (NAME) SELECT * from "+table1, Statement.RETURN_GENERATED_KEYS); @@ -3358,12 +3361,14 @@ public void Var077() } assertCondition(condition, "system naming test added 12/2/2003"); s.close(); + s2.close(); } catch (Exception e) { failed (e, "Unexpected Exception -- system naming testing added 12/2/2003"); try { if (s != null) s.close(); + if (s2 != null) s2.close(); } catch (SQLException se) { @@ -3633,18 +3638,20 @@ public void Var084() } Statement s = null; + Statement s2 = null; try { String table1 = JDStatementTest.COLLECTION + ".JDGENKEYSV84A"; String table2 = JDStatementTest.COLLECTION + ".JDGENKEYSV84B"; s = connection_.createStatement (); - initTable(s, table1," (NAME VARCHAR(10))"); + s2 = connection_.createStatement (); + initTable(s2, table1," (NAME VARCHAR(10))", null, false); s.executeUpdate("insert into "+table1+" values('Abraham')"); s.executeUpdate("insert into "+table1+" values('John')"); s.executeUpdate("insert into "+table1+" values('Zedekiah')"); - JDTestDriver.dropTable(s, table2); + JDTestDriver.dropTable(s2, table2); - initTable(s, table2," (NAME VARCHAR(10), GENID INT GENERATED ALWAYS AS IDENTITY ( START WITH 10, increment BY 3 ))"); + initTable(s2, table2," (NAME VARCHAR(10), GENID INT GENERATED ALWAYS AS IDENTITY ( START WITH 10, increment BY 3 ))", null, false); int columnIndexes[] = {2}; s.execute ("INSERT INTO " + table2 @@ -3705,14 +3712,14 @@ public void Var085() String table1 = JDStatementTest.COLLECTION + "/JDGENKEYSV85A"; String table2 = JDStatementTest.COLLECTION + "/JDGENKEYSV85B"; s = connectionSystemNaming_.createStatement (); - initTable(s, table1," (NAME VARCHAR(10))"); + initTable(s, table1," (NAME VARCHAR(10))", null, false); s.executeUpdate("insert into "+table1+" values('Abraham')"); s.executeUpdate("insert into "+table1+" values('John')"); s.executeUpdate("insert into "+table1+" values('Zedekiah')"); JDTestDriver.dropTable(s, table2); - initTable(s, table2, " (NAME VARCHAR(10), GENID INT GENERATED ALWAYS AS IDENTITY ( START WITH 10, increment BY 3 ))"); + initTable(s, table2, " (NAME VARCHAR(10), GENID INT GENERATED ALWAYS AS IDENTITY ( START WITH 10, increment BY 3 ))", null, false); String[] columnNames = new String[] {"GENID"}; s.execute ("INSERT INTO " + table2 @@ -3775,14 +3782,14 @@ public void Var086() String table1 = JDStatementTest.COLLECTION + ".JDGENKEYSV86A"; String table2 = JDStatementTest.COLLECTION + ".JDGENKEYSV86B"; s = connection_.createStatement (); - initTable(s, table1," (NAME VARCHAR(10))"); + initTable(s, table1," (NAME VARCHAR(10))", null, false); s.executeUpdate("insert into "+table1+" values('Abraham')"); s.executeUpdate("insert into "+table1+" values('John')"); s.executeUpdate("insert into "+table1+" values('Zedekiah')"); JDTestDriver.dropTable(s, table2); - initTable(s, table2," (NAME VARCHAR(10), GENID INT GENERATED ALWAYS AS IDENTITY ( START WITH 10, increment BY 3 ))"); + initTable(s, table2," (NAME VARCHAR(10), GENID INT GENERATED ALWAYS AS IDENTITY ( START WITH 10, increment BY 3 ))", null, false); int columnIndexes[] = {2}; int rowCount = s.executeUpdate ("INSERT INTO " + table2 @@ -3843,14 +3850,14 @@ public void Var087() String table1 = JDStatementTest.COLLECTION + "/JDGENKEYSV87A"; String table2 = JDStatementTest.COLLECTION + "/JDGENKEYSV87B"; s = connectionSystemNaming_.createStatement (); - initTable(s, table1," (NAME VARCHAR(10))"); + initTable(s, table1," (NAME VARCHAR(10))", null, false); s.executeUpdate("insert into "+table1+" values('Abraham')"); s.executeUpdate("insert into "+table1+" values('John')"); s.executeUpdate("insert into "+table1+" values('Zedekiah')"); JDTestDriver.dropTable(s, table2); - initTable(s, table2," (NAME VARCHAR(10), GENID INT GENERATED ALWAYS AS IDENTITY ( START WITH 10, increment BY 3 ))"); + initTable(s, table2," (NAME VARCHAR(10), GENID INT GENERATED ALWAYS AS IDENTITY ( START WITH 10, increment BY 3 ))", null, false); String[] columnNames = new String[] {"GENID"}; int rowCount = s.executeUpdate ("INSERT INTO " + table2 @@ -3912,14 +3919,14 @@ public void Var088() String table1 = JDStatementTest.COLLECTION + ".JDGENKEYSV88A"; String table2 = JDStatementTest.COLLECTION + ".JDGENKEYSV88B"; s = connection_.createStatement (); - initTable(s, table1, " (NAME VARCHAR(10))"); + initTable(s, table1, " (NAME VARCHAR(10))", null, false); s.executeUpdate("insert into "+table1+" values('Abraham')"); s.executeUpdate("insert into "+table1+" values('John')"); s.executeUpdate("insert into "+table1+" values('Zedekiah')"); JDTestDriver.dropTable(s, table2); - initTable(s, table2," (NAME VARCHAR(10), GENID INT GENERATED ALWAYS AS IDENTITY ( START WITH 10, increment BY 3 ))"); + initTable(s, table2," (NAME VARCHAR(10), GENID INT GENERATED ALWAYS AS IDENTITY ( START WITH 10, increment BY 3 ))", null, false); int columnIndexes[] = {2}; PreparedStatement ps = connection_.prepareStatement("INSERT INTO " + table2 @@ -3983,14 +3990,14 @@ public void Var089() String table2 = JDStatementTest.COLLECTION + "/JDGENKEYSV89B"; s = connectionSystemNaming_.createStatement (); - initTable(s, table1, " (NAME VARCHAR(10))"); + initTable(s, table1, " (NAME VARCHAR(10))", null, false); s.executeUpdate("insert into "+table1+" values('Abraham')"); s.executeUpdate("insert into "+table1+" values('John')"); s.executeUpdate("insert into "+table1+" values('Zedekiah')"); JDTestDriver.dropTable(s, table2); - initTable(s, table2," (NAME VARCHAR(10), GENID INT GENERATED ALWAYS AS IDENTITY ( START WITH 10, increment BY 3 ))"); + initTable(s, table2," (NAME VARCHAR(10), GENID INT GENERATED ALWAYS AS IDENTITY ( START WITH 10, increment BY 3 ))", null, false); String[] columnNames = new String[] {"GENID"}; PreparedStatement ps = connectionSystemNaming_.prepareStatement("INSERT INTO " + table2 @@ -4049,7 +4056,7 @@ public void Var090() s = connectionSystemNaming_.createStatement (); JDTestDriver.dropTable(s, table1); - initTable(s, table1, " (NAME VARCHAR(10), GENID INT GENERATED ALWAYS AS IDENTITY(START WITH 10, increment BY 3))"); + initTable(s, table1, " (NAME VARCHAR(10), GENID INT GENERATED ALWAYS AS IDENTITY(START WITH 10, increment BY 3))", null, false); s.execute("INSERT INTO " + table1 + " (NAME) VALUES('Snickers'), ('Kim')", Statement.RETURN_GENERATED_KEYS); ResultSet rs1 = s.getGeneratedKeys(); if (rs1 == null) throw new SQLException("no keys returned"); @@ -4099,7 +4106,7 @@ public void Var091() s = connectionSystemNaming_.createStatement (); JDTestDriver.dropTable(s, table1); - initTable(s, table1, " (NAME VARCHAR(10), GENID INT GENERATED ALWAYS AS IDENTITY(START WITH 10, increment BY 3))"); + initTable(s, table1, " (NAME VARCHAR(10), GENID INT GENERATED ALWAYS AS IDENTITY(START WITH 10, increment BY 3))", null, false); int rowCount = s.executeUpdate("INSERT INTO " + table1 + " (NAME) VALUES('Snickers'), ('Heath')", Statement.RETURN_GENERATED_KEYS); ResultSet rs1 = s.getGeneratedKeys(); if (rs1 == null) throw new SQLException("no keys returned"); @@ -4155,7 +4162,7 @@ public void Var092() s = connectionSystemNaming_.createStatement (); JDTestDriver.dropTable(s, table1); - initTable(s, table1, " (NAME VARCHAR(10), ID ROWID GENERATED ALWAYS, GENID INT GENERATED ALWAYS AS IDENTITY(START WITH 10, increment BY 3))"); + initTable(s, table1, " (NAME VARCHAR(10), ID ROWID GENERATED ALWAYS, GENID INT GENERATED ALWAYS AS IDENTITY(START WITH 10, increment BY 3))", null, false); int[] columnIndexes = {3}; s.execute("INSERT INTO " + table1 + " (NAME) VALUES('Snickers'), ('Heath')", columnIndexes); ResultSet rs1 = s.getGeneratedKeys(); @@ -4211,7 +4218,7 @@ public void Var093() s = connectionSystemNaming_.createStatement (); JDTestDriver.dropTable(s, table1); - initTable(s, table1, " (NAME VARCHAR(10), ID ROWID GENERATED ALWAYS, GENID INT GENERATED ALWAYS AS IDENTITY(START WITH 10, increment BY 3))"); + initTable(s, table1, " (NAME VARCHAR(10), ID ROWID GENERATED ALWAYS, GENID INT GENERATED ALWAYS AS IDENTITY(START WITH 10, increment BY 3))", null, false); String[] columnNames = new String[] {"GENID"}; s.execute("INSERT INTO " + table1 + " (NAME) VALUES('Snickers'), ('Heath')", columnNames); ResultSet rs1 = s.getGeneratedKeys(); @@ -4267,7 +4274,7 @@ public void Var094() s = connectionSystemNaming_.createStatement (); JDTestDriver.dropTable(s, table1); - initTable(s, table1, " (NAME VARCHAR(10), ID ROWID GENERATED ALWAYS, GENID INT GENERATED ALWAYS AS IDENTITY(START WITH 10, increment BY 3))"); + initTable(s, table1, " (NAME VARCHAR(10), ID ROWID GENERATED ALWAYS, GENID INT GENERATED ALWAYS AS IDENTITY(START WITH 10, increment BY 3))", null, false); int[] columnIndexes = {3}; int rowCount = s.executeUpdate("INSERT INTO " + table1 + " (NAME) VALUES('Snickers'), ('Heath')", columnIndexes); ResultSet rs1 = s.getGeneratedKeys(); @@ -4324,7 +4331,7 @@ public void Var095() s = connectionSystemNaming_.createStatement (); JDTestDriver.dropTable(s, table1); - initTable(s, table1, " (NAME VARCHAR(10), ID ROWID GENERATED ALWAYS, GENID INT GENERATED ALWAYS AS IDENTITY(START WITH 10, increment BY 3))"); + initTable(s, table1, " (NAME VARCHAR(10), ID ROWID GENERATED ALWAYS, GENID INT GENERATED ALWAYS AS IDENTITY(START WITH 10, increment BY 3))", null, false); String[] columnNames = new String[] {"GENID"}; int rowCount = s.executeUpdate("INSERT INTO " + table1 + " (NAME) VALUES('Snickers'), ('Heath')", columnNames); ResultSet rs1 = s.getGeneratedKeys(); @@ -4376,7 +4383,7 @@ public void Var096() s = connectionSystemNaming_.createStatement (); JDTestDriver.dropTable(s, table1); - initTable(s, table1, " (NAME VARCHAR(10), ID ROWID GENERATED ALWAYS, GENID INT GENERATED ALWAYS AS IDENTITY(START WITH 10, increment BY 3))"); + initTable(s, table1, " (NAME VARCHAR(10), ID ROWID GENERATED ALWAYS, GENID INT GENERATED ALWAYS AS IDENTITY(START WITH 10, increment BY 3))", null, false); PreparedStatement ps = connectionSystemNaming_.prepareStatement("INSERT INTO " + table1 + " (NAME) VALUES('Snickers')", Statement.RETURN_GENERATED_KEYS); ps.execute(); ResultSet rs1 = ps.getGeneratedKeys(); @@ -4432,7 +4439,7 @@ public void Var097() s = connectionSystemNaming_.createStatement (); JDTestDriver.dropTable(s, table1); - initTable(s, table1, " (NAME VARCHAR(10), ID ROWID GENERATED ALWAYS, GENID INT GENERATED ALWAYS AS IDENTITY(START WITH 10, increment BY 3))"); + initTable(s, table1, " (NAME VARCHAR(10), ID ROWID GENERATED ALWAYS, GENID INT GENERATED ALWAYS AS IDENTITY(START WITH 10, increment BY 3))", null, false); int[] columnIndexes = {2,3}; PreparedStatement ps = connectionSystemNaming_.prepareStatement("INSERT INTO " + table1 + " (NAME) VALUES('Snickers')", columnIndexes); ps.execute(); @@ -4489,7 +4496,7 @@ public void Var098() s = connectionSystemNaming_.createStatement (); JDTestDriver.dropTable(s, table1); - initTable(s, table1, " (NAME VARCHAR(10), ID ROWID GENERATED ALWAYS, GENID INT GENERATED ALWAYS AS IDENTITY(START WITH 10, increment BY 3))"); + initTable(s, table1, " (NAME VARCHAR(10), ID ROWID GENERATED ALWAYS, GENID INT GENERATED ALWAYS AS IDENTITY(START WITH 10, increment BY 3))", null, false); String[] columnNames = new String[] {"ID", "GENID"}; PreparedStatement ps = connectionSystemNaming_.prepareStatement("INSERT INTO " + table1 + " (NAME) VALUES('Snickers')", columnNames); ps.execute(); @@ -4533,7 +4540,7 @@ public void stringTruncationTest(String datatype, String tablename, String inser String table1 = JDStatementTest.COLLECTION + "/"+tablename; s = connectionSystemNaming_.createStatement (); - initTable(s, table1, " (NAME "+datatype+", ID INTEGER GENERATED ALWAYS AS IDENTITY)"); + initTable(s, table1, " (NAME "+datatype+", ID INTEGER GENERATED ALWAYS AS IDENTITY)", null, false); ps = connectionSystemNaming_.prepareStatement("INSERT INTO " + table1 + " (NAME) VALUES(?)", Statement.RETURN_GENERATED_KEYS); try { ps.setString(1,insertValue); @@ -4592,7 +4599,7 @@ public void binaryTruncationTest(String datatype, String tablename, byte[] inser try { String table1 = JDStatementTest.COLLECTION + "/"+tablename; s = connectionSystemNaming_.createStatement (); - initTable(s, table1, " (NAME "+datatype+", ID INTEGER GENERATED ALWAYS AS IDENTITY)"); + initTable(s, table1, " (NAME "+datatype+", ID INTEGER GENERATED ALWAYS AS IDENTITY)", null, false); ps = connectionSystemNaming_.prepareStatement("INSERT INTO " + table1 + " (NAME) VALUES(?)", Statement.RETURN_GENERATED_KEYS); try { @@ -4720,7 +4727,7 @@ public void Var109() try { String table1 = JDStatementTest.COLLECTION + "/JDSGKYV109"; s = connectionSystemNaming_.createStatement (); - initTable(s, table1, " (NAME VARCHAR(80), INSERT VARCHAR(80), ID INTEGER GENERATED ALWAYS AS IDENTITY)"); + initTable(s, table1, " (NAME VARCHAR(80), INSERT VARCHAR(80), ID INTEGER GENERATED ALWAYS AS IDENTITY)", null, false); s.executeUpdate("insert into "+table1+" (NAME,INSERT) VALUES('one','ONE')"); s.executeUpdate("insert into "+table1+" (NAME,INSERT) VALUES('two','TWO')"); s.executeUpdate("insert into "+table1+" (NAME,INSERT) VALUES('three','THREE')"); @@ -4782,7 +4789,7 @@ public void Var110() try { String table1 = JDStatementTest.COLLECTION + "/JDSGKYV110"; s = connectionSystemNaming_.createStatement (); - initTable(s, table1, " (NAME VARCHAR(80), ID INTEGER GENERATED ALWAYS AS IDENTITY)"); + initTable(s, table1, " (NAME VARCHAR(80), ID INTEGER GENERATED ALWAYS AS IDENTITY)", null, false); ps = connectionSystemNaming_.prepareStatement("SELECT NAME,ID FROM FINAL TABLE ( INSERT INTO " + table1 + " (NAME) VALUES(?))"); ps.setString(1,"HELLO"); ResultSet rs = ps.executeQuery(); @@ -4834,7 +4841,7 @@ public void Var111() try { String table1 = JDStatementTest.COLLECTION + "/JDSGKYV111"; s = connectionSystemNaming_.createStatement (); - initTable(s, table1, " (NAME VARCHAR(80), ID INTEGER GENERATED ALWAYS AS IDENTITY)"); + initTable(s, table1, " (NAME VARCHAR(80), ID INTEGER GENERATED ALWAYS AS IDENTITY)", null, false); ps = connectionSystemNaming_.prepareStatement("SELECT NAME,ID FROM FINAL TABLE (INSERT INTO " + table1 + " (NAME) VALUES(?))"); ps.setString(1,"HELLO"); ResultSet rs = ps.executeQuery(); @@ -5576,14 +5583,14 @@ public void Var135() String table1 = JDStatementTest.COLLECTION + ".JDGENKEYSV86A"; String table2 = JDStatementTest.COLLECTION + ".JDGENKEYSV86B"; s = connection_.createStatement (); - initTable(s, table1, " (NAME VARCHAR(10))"); + initTable(s, table1, " (NAME VARCHAR(10))", null, false); s.executeUpdate("insert into "+table1+" values('Abraham')"); s.executeUpdate("insert into "+table1+" values('John')"); s.executeUpdate("insert into "+table1+" values('Zedekiah')"); JDTestDriver.dropTable(s, table2); - initTable(s, table2," (NAME VARCHAR(10), GENID INT GENERATED ALWAYS AS IDENTITY ( START WITH 10, increment BY 3 ))"); + initTable(s, table2," (NAME VARCHAR(10), GENID INT GENERATED ALWAYS AS IDENTITY ( START WITH 10, increment BY 3 ))", null, false); int columnIndexes[] = {2}; long rowCount = JDReflectionUtil.callMethod_L(s,"executeLargeUpdate","INSERT INTO " + table2 @@ -5645,14 +5652,14 @@ public void Var136() String table1 = JDStatementTest.COLLECTION + "/JDGENKEYSV87A"; String table2 = JDStatementTest.COLLECTION + "/JDGENKEYSV87B"; s = connectionSystemNaming_.createStatement (); - initTable(s, table1, " (NAME VARCHAR(10))"); + initTable(s, table1, " (NAME VARCHAR(10))", null, false); s.executeUpdate("insert into "+table1+" values('Abraham')"); s.executeUpdate("insert into "+table1+" values('John')"); s.executeUpdate("insert into "+table1+" values('Zedekiah')"); JDTestDriver.dropTable(s, table2); - initTable(s, table2," (NAME VARCHAR(10), GENID INT GENERATED ALWAYS AS IDENTITY ( START WITH 10, increment BY 3 ))"); + initTable(s, table2," (NAME VARCHAR(10), GENID INT GENERATED ALWAYS AS IDENTITY ( START WITH 10, increment BY 3 ))", null, false); String[] columnNames = new String[] {"GENID"}; long rowCount = JDReflectionUtil.callMethod_L(s,"executeLargeUpdate","INSERT INTO " + table2 @@ -5710,7 +5717,7 @@ public void Var137() s = connectionSystemNaming_.createStatement (); JDTestDriver.dropTable(s, table1); - initTable(s, table1, " (NAME VARCHAR(10), GENID INT GENERATED ALWAYS AS IDENTITY(START WITH 10, increment BY 3))"); + initTable(s, table1, " (NAME VARCHAR(10), GENID INT GENERATED ALWAYS AS IDENTITY(START WITH 10, increment BY 3))", null, false); long rowCount = JDReflectionUtil.callMethod_L(s,"executeLargeUpdate", "INSERT INTO " + table1 + " (NAME) VALUES('Snickers'), ('Heath')", Statement.RETURN_GENERATED_KEYS); ResultSet rs1 = s.getGeneratedKeys(); if (rs1 == null) throw new SQLException("no keys returned"); @@ -5769,7 +5776,7 @@ public void Var138() s = connectionSystemNaming_.createStatement (); JDTestDriver.dropTable(s, table1); - initTable(s, table1, " (NAME VARCHAR(10), ID ROWID GENERATED ALWAYS, GENID INT GENERATED ALWAYS AS IDENTITY(START WITH 10, increment BY 3))"); + initTable(s, table1, " (NAME VARCHAR(10), ID ROWID GENERATED ALWAYS, GENID INT GENERATED ALWAYS AS IDENTITY(START WITH 10, increment BY 3))", null, false); int[] columnIndexes = {3}; long rowCount = JDReflectionUtil.callMethod_L(s,"executeLargeUpdate","INSERT INTO " + table1 + " (NAME) VALUES('Snickers'), ('Heath')", columnIndexes); ResultSet rs1 = s.getGeneratedKeys(); @@ -5827,7 +5834,7 @@ public void Var139() s = connectionSystemNaming_.createStatement (); JDTestDriver.dropTable(s, table1); - initTable(s, table1, " (NAME VARCHAR(10), ID ROWID GENERATED ALWAYS, GENID INT GENERATED ALWAYS AS IDENTITY(START WITH 10, increment BY 3))"); + initTable(s, table1, " (NAME VARCHAR(10), ID ROWID GENERATED ALWAYS, GENID INT GENERATED ALWAYS AS IDENTITY(START WITH 10, increment BY 3))", null, false); String[] columnNames = new String[] {"GENID"}; long rowCount = JDReflectionUtil.callMethod_L(s,"executeLargeUpdate","INSERT INTO " + table1 + " (NAME) VALUES('Snickers'), ('Heath')", columnNames); ResultSet rs1 = s.getGeneratedKeys(); @@ -5881,7 +5888,8 @@ public void Var140() s = connectionSystemNaming_.createStatement (); JDTestDriver.dropTable(s, table1); - initTable(s, table1, " (NAME VARCHAR(10), ID ROWID GENERATED ALWAYS, GENID INT GENERATED ALWAYS AS IDENTITY(START WITH 10, increment BY 3), GENTS TIMESTAMP FOR EACH ROW ON UPDATE AS ROW CHANGE TIMESTAMP NOT NULL )"); + initTable(s, table1, " (NAME VARCHAR(10), ID ROWID GENERATED ALWAYS, GENID INT GENERATED ALWAYS AS IDENTITY(START WITH 10, increment BY 3), " + + "GENTS TIMESTAMP FOR EACH ROW ON UPDATE AS ROW CHANGE TIMESTAMP NOT NULL )", null, false); PreparedStatement ps = connectionSystemNaming_.prepareStatement("INSERT INTO " + table1 + " (NAME) VALUES('Snickers')", Statement.RETURN_GENERATED_KEYS); ps.execute(); ResultSet rs1 = ps.getGeneratedKeys(); @@ -5919,6 +5927,91 @@ public void Var140() } } + + /** + * genGeneratedKeys() -- obtain multiple keys -- + * Use a statement and use it for all the actions, this + * exposes a bug in the Native JDBC driver. + */ + + + public void Var141() + { + if (getDriver() == JDTestDriver.DRIVER_JCC) { + notApplicable("JCC doesn't support insert / select"); + return; + } + if (false || getJdbcLevel() < 3) + { + notApplicable("v5r2/JDK 1.4 variation"); + return; + } + Statement s = null; + try { + String table1 = JDStatementTest.COLLECTION + ".JDGENKEYSV141A"; + String table2 = JDStatementTest.COLLECTION + ".JDGENKEYSV141B"; + s = connection_.createStatement (); + initTable(s, table1," (NAME VARCHAR(10))"); + s.executeUpdate("insert into "+table1+" values('Abraham')"); + s.executeUpdate("insert into "+table1+" values('John')"); + s.executeUpdate("insert into "+table1+" values('Zedekiah')"); + + JDTestDriver.dropTable(s, table2); + + initTable(s, table2, " (NAME VARCHAR(10), "+ + "GENID INT GENERATED ALWAYS AS IDENTITY ( START WITH 10, increment BY 3 ))"); + + s.execute ("INSERT INTO " + table2 + + " (NAME) SELECT * from "+table1, Statement.RETURN_GENERATED_KEYS); + ResultSet rs1 = s.getGeneratedKeys(); + if (rs1 == null) throw new SQLException("no keys returned"); + boolean check1 = rs1.next(); + String key1 = rs1.getString(1); + boolean condition = true; + // For V5R5, we should be able to get all the values because the + // implementation uses SELECT from INSERT + boolean check2 = rs1.next(); + String key2="NOTFOUND"; + if (check2) { + key2 = rs1.getString(1); + } + boolean check3 = rs1.next(); + String key3 = "NOTFOUND"; + if (check3) { + key3 = rs1.getString(1); + } + condition = check1 && key1.equals("10") && + check2 && key2.equals("13") && + check3 && key3.equals("16") ; + if (!condition) { + output_.println(" check1 should be true but is "+check1); + output_.println(" key1 should be 10 but is "+key1); + output_.println(" check2 should be true but is "+check2); + output_.println(" key2 should be 13 but is "+key2); + output_.println(" check3 should be true but is "+check3); + output_.println(" key3 should be 16 but is "+key3); + } + if (condition) { + cleanupTable(s, table1); + cleanupTable(s, table2); + } + assertCondition(condition); + s.close(); + } + catch (Exception e) { + failed (e, "Unexpected Exception"); + try + { + if (s != null) s.close(); + } + catch (SQLException se) + { + //ignore at this point + } + } + } + + } diff --git a/src/test/JD/XML/JDXMLBlob.java b/src/test/JD/XML/JDXMLBlob.java index 6d8b2dcc..b0f0b704 100644 --- a/src/test/JD/XML/JDXMLBlob.java +++ b/src/test/JD/XML/JDXMLBlob.java @@ -11,12 +11,6 @@ // /////////////////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////// -// -// -// -// -// //////////////////////////////////////////////////////////////////////// // // File Name: JDXMLBlob.java @@ -24,11 +18,6 @@ // Classes: JDXMLBlob // //////////////////////////////////////////////////////////////////////// -// -// -// -// -//////////////////////////////////////////////////////////////////////// package test.JD.XML; @@ -134,6 +123,7 @@ public static void main(String args[]) throws Exception { private ResultSet rs2_; StringBuffer sb = new StringBuffer(); private JDXMLErrorListener errorListener = new JDXMLErrorListener(); + String suffix = "B"; // // We create tables with different encodings // For each table the following rows are set @@ -149,7 +139,7 @@ public static void main(String args[]) throws Exception { // Row 10 -- xml declaration, but invalid XML - public static String TABLE37_ = JDXMLTest.COLLECTION + ".XMLBLB37"; + public static String TABLE37_ = JDXMLTest.COLLECTION + ".XMLBL37"; public static String TABLE1208_ = JDXMLTest.COLLECTION + ".XMLBLB1208"; public static String TABLE1200_ = JDXMLTest.COLLECTION + ".XMLBLB1200"; public static String TABLE1202_ = JDXMLTest.COLLECTION + ".XMLBLB1202"; @@ -353,11 +343,11 @@ public JDXMLBlob (AS400 systemObject, protected void setup () throws Exception { - TABLE37_ = JDXMLTest.COLLECTION + ".XMLBLB37"; - TABLE1208_ = JDXMLTest.COLLECTION + ".XMLBLB1208"; - TABLE1200_ = JDXMLTest.COLLECTION + ".XMLBLB1200"; - TABLE1202_ = JDXMLTest.COLLECTION + ".XMLBLB1202"; - TABLE819_ = JDXMLTest.COLLECTION + ".XMLBLB819"; + TABLE37_ = JDXMLTest.COLLECTION + ".XMLBL"+suffix+"37"; + TABLE1208_ = JDXMLTest.COLLECTION + ".XMLBL"+suffix+"1208"; + TABLE1200_ = JDXMLTest.COLLECTION + ".XMLBL"+suffix+"1200"; + TABLE1202_ = JDXMLTest.COLLECTION + ".XMLBL"+suffix+"1202"; + TABLE819_ = JDXMLTest.COLLECTION + ".XMLBL"+suffix+"819"; if (isJdbc40 ()) { diff --git a/src/test/JD/XML/JDXMLBlobLocator.java b/src/test/JD/XML/JDXMLBlobLocator.java index 912b4049..4564e3c7 100644 --- a/src/test/JD/XML/JDXMLBlobLocator.java +++ b/src/test/JD/XML/JDXMLBlobLocator.java @@ -79,6 +79,7 @@ public JDXMLBlobLocator (AS400 systemObject, protected void setup () throws Exception { + suffix="L"; lobThreshold = ";lob threshold=1"; super.setup(); } diff --git a/src/test/JD/XML/JDXMLClob.java b/src/test/JD/XML/JDXMLClob.java index 370b6e72..9551b025 100644 --- a/src/test/JD/XML/JDXMLClob.java +++ b/src/test/JD/XML/JDXMLClob.java @@ -108,6 +108,7 @@ public static void main(String args[]) throws Exception { private ResultSet rs1200_; private ResultSet rs930_; private ResultSet rs2_; + String suffix="B"; StringBuffer sb = new StringBuffer(); private JDXMLErrorListener errorListener = new JDXMLErrorListener(); @@ -405,10 +406,10 @@ boolean isHeaderStripped() { protected void setup () throws Exception { - TABLE37_ = JDXMLTest.COLLECTION + ".XMLCLB37"; - TABLE1208_ = JDXMLTest.COLLECTION + ".XMLCLB1208"; - TABLE1200_ = JDXMLTest.COLLECTION + ".XMLCLB1200"; - TABLE930_ = JDXMLTest.COLLECTION + ".XMLCLB930"; + TABLE37_ = JDXMLTest.COLLECTION + ".XMLCL"+suffix+"37"; + TABLE1208_ = JDXMLTest.COLLECTION + ".XMLCL"+suffix+"1208"; + TABLE1200_ = JDXMLTest.COLLECTION + ".XMLCL"+suffix+"1200"; + TABLE930_ = JDXMLTest.COLLECTION + ".XMLCL"+suffix+"930"; if (isJdbc40 ()) { if (getDriver() == JDTestDriver.DRIVER_JCC) { diff --git a/src/test/JD/XML/JDXMLClobLocator.java b/src/test/JD/XML/JDXMLClobLocator.java index 1b655cb1..26d8fe06 100644 --- a/src/test/JD/XML/JDXMLClobLocator.java +++ b/src/test/JD/XML/JDXMLClobLocator.java @@ -79,6 +79,7 @@ public JDXMLClobLocator (AS400 systemObject, protected void setup () throws Exception { + suffix="L"; lobThreshold = ";lob threshold=1"; isLocator = true; super.setup(); diff --git a/src/test/JD/XML/JDXMLXML.java b/src/test/JD/XML/JDXMLXML.java index 616c1d58..a7099580 100644 --- a/src/test/JD/XML/JDXMLXML.java +++ b/src/test/JD/XML/JDXMLXML.java @@ -139,13 +139,13 @@ public static void main(String args[]) throws Exception { // Row 11 -- xml declaration with invalid encoding -- larger than 80 // characters (Based on Row 5) - public static String TABLE37_ = JDXMLTest.COLLECTION + ".XMLCLB37"; + public static String TABLE37_ = JDXMLTest.COLLECTION + ".XMLXML37"; - public static String TABLE1208_ = JDXMLTest.COLLECTION + ".XMLCLB1208"; + public static String TABLE1208_ = JDXMLTest.COLLECTION + ".XMLXML1208"; - public static String TABLE1200_ = JDXMLTest.COLLECTION + ".XMLCLB1200"; + public static String TABLE1200_ = JDXMLTest.COLLECTION + ".XMLXML1200"; - public static String TABLE930_ = JDXMLTest.COLLECTION + ".XMLCLB930"; + public static String TABLE930_ = JDXMLTest.COLLECTION + ".XMLXMLB930"; public static String ROW1_S_ = "";//optimized public static String ROW1_S37_ = ""; @@ -702,10 +702,10 @@ public JDXMLXML(AS400 systemObject, String testname, Hashtable handles = null; - private Timestamp startTimestamp; + private Timestamp startTimestamp; + + private JDParallelCounter parallelCounter_; @@ -328,41 +330,8 @@ public void setup() throws Exception { is400 =false; } - /* Make sure PSTEST_CONCUR is handled transactionally */ - boolean autocommit = connection_.getAutoCommit(); - if (autocommit) { - connection_.setAutoCommit(false); - } - /* Wait for a long time if there is much contention */ - statement_.executeUpdate("CALL QSYS2.QCMDEXC('CHGJOB DFTWAIT(3600)')"); - String sql = "SELECT * FROM QSYS2.SYSTABLES where TABLE_NAME='"+PSTEST_CONCUR_BASE+"' and TABLE_SCHEMA='"+COLLECTION+"' " ; - ResultSet rs = statement_.executeQuery(sql); - if (!rs.next()) { - rs.close(); - - sql = "CREATE OR REPLACE TABLE "+PSTEST_CONCUR+" (JOBNAME VARCHAR(80), STARTTIME TIMESTAMP) ON REPLACE PRESERVE ROWS"; - System.out.println("Running "+sql); - statement_.executeUpdate(sql); - connection_.commit(); - } else { - rs.close(); - sql = "VALUES JOB_NAME"; - rs = statement_.executeQuery(sql); - rs.next(); - System.out.println("job name is "+rs.getString(1)); - rs.close(); - } - startTimestamp = new Timestamp(System.currentTimeMillis()); - PreparedStatement ps = connection_.prepareStatement("INSERT INTO "+PSTEST_CONCUR+" VALUES(JOB_NAME,?)"); - ps.setTimestamp(1,startTimestamp); - ps.executeUpdate(); - ps.close(); - connection_.commit(); - if (autocommit) { - connection_.setAutoCommit(true); - } - statement_.executeUpdate("CALL QSYS2.QCMDEXC('CHGJOB DFTWAIT(30)')"); + parallelCounter_ = new JDParallelCounter(connection_, COLLECTION); // Added With comparisons 12/28/2006 so would work on LUW also try { @@ -570,18 +539,7 @@ public void cleanup () connection_.setAutoCommit(false); } - PreparedStatement ps = connection_.prepareStatement("DELETE FROM " + PSTEST_CONCUR + " WHERE STARTTIME=?"); - ps.setTimestamp(1, startTimestamp); - ps.executeUpdate(); - - statement_.executeUpdate("DELETE FROM " + PSTEST_CONCUR + " WHERE STARTTIME < CURRENT TIMESTAMP - 2 HOURS"); - - ResultSet rs = statement_.executeQuery("SELECT COUNT(*) FROM " + PSTEST_CONCUR); - int count; - rs.next(); - count = rs.getInt(1); - rs.close(); - if (count == 0) { + if (parallelCounter_.doCleanup()) { cleanupTable(statement_, PSTEST_SET); @@ -601,19 +559,10 @@ public void cleanup () cleanupTable(statement_, PSTEST_SETXML); } else { - System.out.println("JDPSTest.cleanup not cleanning because "+count+" jobs are running"); + System.out.println("JDPSTest.cleanup not cleaning because jobs are running"); } - try { - connection_.commit(); // for xa - if (autocommit) { - connection_.setAutoCommit(true); - } - } catch (Exception e) { - System.out.println("Warning on commit"); - e.printStackTrace(System.out); - } - + parallelCounter_.close(); statement_.close (); try { diff --git a/src/test/JDRSMDTest.java b/src/test/JDRSMDTest.java index aab65665..bfd666a2 100644 --- a/src/test/JDRSMDTest.java +++ b/src/test/JDRSMDTest.java @@ -11,12 +11,6 @@ // /////////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////// -// -// -// -// -// //////////////////////////////////////////////////////////////////////// // // File Name: JDRSTest.java @@ -36,6 +30,7 @@ import com.ibm.as400.access.AS400SecurityException; import com.ibm.as400.access.Job; +import test.JD.JDParallelCounter; import test.JD.JDSetupCollection; import test.JD.RSMD.JDRSMDGetCatalogName; import test.JD.RSMD.JDRSMDGetColumnClassName; @@ -83,6 +78,8 @@ public class JDRSMDTest private Connection connection_; private Statement statement_; + private JDParallelCounter parallelCounter_; + /** @@ -144,6 +141,9 @@ public void setup () connection_ = getConnection (getBaseURL (), systemObject_.getUserId (), encryptedPassword_); + parallelCounter_ = new JDParallelCounter(connection_, COLLECTION); + + if(testLib_ != null) { // @E1A COLLECTION = testLib_; @@ -305,7 +305,7 @@ public void setup () initTable(statement, RSMDTEST_GET_BIG_PRECISION, buffer.toString()); connection.commit(); } - + } @@ -315,39 +315,46 @@ public void setup () @exception Exception If an exception occurs. **/ - public void cleanup () - throws Exception - { - // - // Force gc to clean up open statement - // - System.gc(); + public void cleanup() throws Exception { - cleanupTable(statement_, RSMDTEST_GET); + boolean doCleanup = true; + if (!parallelCounter_.doCleanup()) { + out_.println("JDRTest.cleanup not cleaning other parallel tests running =" + parallelCounter_.toString()); + doCleanup = false; + } + + // + // Force gc to clean up open statement + // + System.gc(); + + if (doCleanup) { + cleanupTable(statement_, RSMDTEST_GET); cleanupTable(statement_, RSMDTEST_GET2); - if(areLargeDecimalPrecisionsSupported()) { - cleanupTable(statement_, RSMDTEST_GET_BIG_PRECISION); + if (areLargeDecimalPrecisionsSupported()) { + cleanupTable(statement_, RSMDTEST_GET_BIG_PRECISION); } - if(areLobsSupported ()) { + if (areLobsSupported()) { try { - statement_.executeUpdate("DROP DISTINCT TYPE " + COLLECTION + ".MONEY"); - } catch (Exception e) { - e.printStackTrace(); - } + statement_.executeUpdate("DROP DISTINCT TYPE " + COLLECTION + ".MONEY"); + } catch (Exception e) { + e.printStackTrace(); + } } - connection_.commit(); // for xa - - statement_.close (); - connection_.close (); + } + + parallelCounter_.close(); + + connection_.commit(); + statement_.close(); + connection_.close(); } - - /** * Cleanup - - this does not run automatically - - it is called by * JDCleanup. @@ -360,47 +367,36 @@ public static void dropCollections(Connection c) /** - Creates the testcases. - **/ - public void createTestcases2 () - { - - if(TestDriverStatic.pause_) - { - try - { - systemObject_.connectService(AS400.DATABASE); - } - catch (AS400SecurityException e) - { - e.printStackTrace(); - } - catch (IOException e) - { - e.printStackTrace(); - } - - try - { - Job[] jobs = systemObject_.getJobs(AS400.DATABASE); - System.out.println("Host Server job(s): "); - - for(int i = 0 ; i< jobs.length; i++) - { - System.out.println(jobs[i]); - } - } - catch(Exception exc){} - - try - { - System.out.println ("Toolbox is paused. Press ENTER to continue."); - System.in.read (); - } - catch (Exception exc) {}; - } - - + * Creates the testcases. + **/ + public void createTestcases2() { + + if (TestDriverStatic.pause_) { + try { + systemObject_.connectService(AS400.DATABASE); + } catch (AS400SecurityException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + + try { + Job[] jobs = systemObject_.getJobs(AS400.DATABASE); + System.out.println("Host Server job(s): "); + + for (int i = 0; i < jobs.length; i++) { + System.out.println(jobs[i]); + } + } catch (Exception exc) { + } + + try { + System.out.println("Toolbox is paused. Press ENTER to continue."); + System.in.read(); + } catch (Exception exc) { + } + ; + } addTestcase (new JDRSMDGetCatalogName (systemObject_, namesAndVars_, runMode_, fileOutputStream_, diff --git a/src/test/JDRSTest.java b/src/test/JDRSTest.java index 8e320f93..77f38e8c 100644 --- a/src/test/JDRSTest.java +++ b/src/test/JDRSTest.java @@ -28,6 +28,8 @@ import com.ibm.as400.access.AS400SecurityException; import com.ibm.as400.access.Job; +import test.JD.JDParallelCounter; +import test.JD.JDSerializeFile; import test.JD.JDSetupCollection; import test.JD.RS.JDRSAbsolute; import test.JD.RS.JDRSAfterLast; @@ -147,16 +149,18 @@ public class JDRSTest extends JDTestDriver { public static String RSTEST_GRAPHIC = COLLECTION + ".RSTESTGRAPHIC"; public static String RSTEST_SENSITIVE = COLLECTION + ".RSTESTSENS"; // @G1A - public static String RSTEST_DFP16 = COLLECTION + ".RSDFP16"; - public static String RSTEST_DFP16NAN = COLLECTION + ".RSDFP16NAN"; - public static String RSTEST_DFP16INF = COLLECTION + ".RSDFP16INF"; - public static String RSTEST_DFP16NNAN = COLLECTION + ".RSDFP16NNAN"; - public static String RSTEST_DFP16NINF = COLLECTION + ".RSDFP16NINF"; - public static String RSTEST_DFP34 = COLLECTION + ".RSDFP34"; + public static String RSTEST_GETDFP16 = COLLECTION + ".RSGDFP16"; + public static String RSTEST_UPDDFP16 = COLLECTION + ".RSUDFP16"; + public static String RSTEST_GETDFP16NAN = COLLECTION + ".RSDFP16NAN"; + public static String RSTEST_GETDFP16INF = COLLECTION + ".RSDFP16INF"; + public static String RSTEST_GETDFP16NNAN = COLLECTION + ".RSDFP16NNAN"; + public static String RSTEST_GETDFP16NINF = COLLECTION + ".RSDFP16NINF"; + public static String RSTEST_GETDFP34 = COLLECTION + ".RSGDFP34"; + public static String RSTEST_UPDDFP34 = COLLECTION + ".RSUDFP34"; public static String RSTEST_DFP34NAN = COLLECTION + ".RSDFP34NAN"; - public static String RSTEST_DFP34INF = COLLECTION + ".RSDFP34INF"; - public static String RSTEST_DFP34NNAN = COLLECTION + ".RSDFP34NNAN"; - public static String RSTEST_DFP34NINF = COLLECTION + ".RSDFP34NINF"; + public static String RSTEST_GETDFP34INF = COLLECTION + ".RSDFP34INF"; + public static String RSTEST_GETDFP34NNAN = COLLECTION + ".RSDFP34NNAN"; + public static String RSTEST_GETDFP34NINF = COLLECTION + ".RSDFP34NINF"; public static String RSTEST_GETXML = COLLECTION + ".RSTESTGETX"; public static String RSTEST_UPDATEXML = COLLECTION + ".RSTESTUPDX"; @@ -373,6 +377,7 @@ public class JDRSTest extends JDTestDriver { // Private data. private Connection connection_; private Statement statement_; + private JDParallelCounter parallelCounter_; /** * Run the test as an application. This should be called from the test @@ -481,10 +486,149 @@ void setupRstestGet() throws SQLException { buffer.append(")"); sql = buffer.toString(); - JDTestcase.initTable(statement_, RSTEST_GET, sql, errorBuffer); - boolean tableCreated = true; + + + // Generate sample lobs. + Random random = new Random(1); + if (getDriver() == JDTestDriver.DRIVER_JCC) { + BLOB_FULL = new byte[3743]; + } else { + BLOB_FULL = new byte[15743]; + } + random.setSeed(1); + random.nextBytes(BLOB_FULL); + + // Generate sample lobs. + if (getDriver() == JDTestDriver.DRIVER_JCC) { + BLOB_FULLX = new byte[3743]; + } else { + BLOB_FULLX = new byte[15743]; + } + // Create random XML characters in ASCII + int blobFullLength = BLOB_FULLX.length; + BLOB_FULLX[0] = (byte) '<'; + BLOB_FULLX[1] = (byte) 'd'; + BLOB_FULLX[2] = (byte) '>'; + for (int i = 3; i < blobFullLength - 4; i++) { + BLOB_FULLX[i] = (byte) (' ' + random.nextInt(0x5f)); + } + + BLOB_FULLX[blobFullLength - 4] = (byte) '<'; + BLOB_FULLX[blobFullLength - 3] = (byte) '/'; + BLOB_FULLX[blobFullLength - 2] = (byte) 'd'; + BLOB_FULLX[blobFullLength - 1] = (byte) '>'; + + /* Alway generate the lobs */ + buffer = new StringBuffer(); + for (int i = 0; i < 2348; ++i) + buffer.append("All work and no play, etc. "); + CLOB_FULL = buffer.toString(); + CLOB_FULLX = "" + buffer.toString() + ""; + + // The native driver is aware of the lengths of the + // lobs and therefore this value has to get truncated + // the the length of the column that it is going to be + // put into. The LOB default column length is 2556. + // I do not know why. + if (getDriver() == JDTestDriver.DRIVER_NATIVE + || getDriver() == JDTestDriver.DRIVER_JCC) + CLOB_FULL = CLOB_FULL.substring(0, 2556); + + buffer = new StringBuffer(); + for (int i = 0; i < 3348; ++i) + buffer.append("Clobs are the best of all lobs!"); + DBCLOB_FULL = buffer.toString(); + + // The native driver is aware of the lengths of the + // lobs and therefore this value has to get truncated + // the the length of the column that it is going to be + // put into. The LOB default column length is 2556. + // I do not know why. + if (getDriver() == JDTestDriver.DRIVER_NATIVE + || getDriver() == JDTestDriver.DRIVER_JCC) + DBCLOB_FULL = DBCLOB_FULL.substring(0, 2556); + + if (getDriver() == JDTestDriver.DRIVER_JCC) { + BLOB_MEDIUM = new byte[2500]; + } else { + BLOB_MEDIUM = new byte[6500]; + } + random.setSeed(2); + random.nextBytes(BLOB_MEDIUM); + + buffer = new StringBuffer(); + for (int i = 0; i < 24; ++i) + buffer.append("JDBC is really fast."); + CLOB_MEDIUM = buffer.toString(); + + buffer = new StringBuffer(); + for (int i = 0; i < 24; ++i) + buffer.append("DBCLOBs are best"); + DBCLOB_MEDIUM = buffer.toString(); + + + + buffer = new StringBuffer(); + buffer.append(""); + for (int i = 0; i < 2348; ++i) + buffer.append("All work and no play, etc. "); + buffer.append(""); + CLOB_FULLX = buffer.toString(); + + // The native driver is aware of the lengths of the + // lobs and therefore this value has to get truncated + // the the length of the column that it is going to be + // put into. The LOB default column length is 2556. + // I do not know why. + if (getDriver() == JDTestDriver.DRIVER_NATIVE + || getDriver() == JDTestDriver.DRIVER_JCC) + CLOB_FULLX = CLOB_FULLX.substring(0, 2556); + + buffer = new StringBuffer(); + buffer.append(""); + for (int i = 0; i < 3348; ++i) + buffer.append("Clobs are the best of all lobs!"); + buffer.append(""); + DBCLOB_FULLX = buffer.toString(); + + // The native driver is aware of the lengths of the + // lobs and therefore this value has to get truncated + // the the length of the column that it is going to be + // put into. The LOB default column length is 2556. + // I do not know why. + if (getDriver() == JDTestDriver.DRIVER_NATIVE + || getDriver() == JDTestDriver.DRIVER_JCC) + DBCLOB_FULLX = DBCLOB_FULLX.substring(0, 2556); + + if (getDriver() == JDTestDriver.DRIVER_JCC) { + BLOB_MEDIUMX = new byte[2500]; + } else { + BLOB_MEDIUMX = new byte[6500]; + } + + int blobMediumLength = BLOB_MEDIUMX.length; + BLOB_MEDIUMX[0] = (byte) '<'; + BLOB_MEDIUMX[1] = (byte) 'd'; + BLOB_MEDIUMX[2] = (byte) '>'; + for (int i = 3; i < blobMediumLength - 4; i++) { + BLOB_MEDIUMX[i] = (byte) (' ' + random.nextInt(0x5f)); + } + + BLOB_MEDIUMX[blobMediumLength - 4] = (byte) '<'; + BLOB_MEDIUMX[blobMediumLength - 3] = (byte) '/'; + BLOB_MEDIUMX[blobMediumLength - 2] = (byte) 'd'; + BLOB_MEDIUMX[blobMediumLength - 1] = (byte) '>'; + + buffer = new StringBuffer(); + buffer.append(""); + for (int i = 0; i < 24; ++i) + buffer.append("JDBC is really fast."); + buffer.append(""); + CLOB_MEDIUMX = buffer.toString(); - if (tableCreated) { + + JDSerializeFile serializeFile = JDTestDriver.createTableIfNeeded(statement_, RSTEST_GET, sql, errorBuffer); + if (serializeFile != null) { // Key == NUMBER_0. sql = "INSERT INTO " + RSTEST_GET + " (C_KEY, C_SMALLINT, C_INTEGER, C_BIGINT, C_REAL, C_FLOAT, " // @D0A @@ -695,60 +839,7 @@ void setupRstestGet() throws SQLException { PreparedStatement ps4 = connection_.prepareStatement(sql); - // Generate sample lobs. - Random random = new Random(); - if (getDriver() == JDTestDriver.DRIVER_JCC) { - BLOB_FULL = new byte[3743]; - } else { - BLOB_FULL = new byte[15743]; - } - random.nextBytes(BLOB_FULL); - - buffer = new StringBuffer(); - for (int i = 0; i < 2348; ++i) - buffer.append("All work and no play, etc. "); - CLOB_FULL = buffer.toString(); - CLOB_FULLX = "" + buffer.toString() + ""; - - // The native driver is aware of the lengths of the - // lobs and therefore this value has to get truncated - // the the length of the column that it is going to be - // put into. The LOB default column length is 2556. - // I do not know why. - if (getDriver() == JDTestDriver.DRIVER_NATIVE - || getDriver() == JDTestDriver.DRIVER_JCC) - CLOB_FULL = CLOB_FULL.substring(0, 2556); - - buffer = new StringBuffer(); - for (int i = 0; i < 3348; ++i) - buffer.append("Clobs are the best of all lobs!"); - DBCLOB_FULL = buffer.toString(); - - // The native driver is aware of the lengths of the - // lobs and therefore this value has to get truncated - // the the length of the column that it is going to be - // put into. The LOB default column length is 2556. - // I do not know why. - if (getDriver() == JDTestDriver.DRIVER_NATIVE - || getDriver() == JDTestDriver.DRIVER_JCC) - DBCLOB_FULL = DBCLOB_FULL.substring(0, 2556); - - if (getDriver() == JDTestDriver.DRIVER_JCC) { - BLOB_MEDIUM = new byte[2500]; - } else { - BLOB_MEDIUM = new byte[6500]; - } - random.nextBytes(BLOB_MEDIUM); - - buffer = new StringBuffer(); - for (int i = 0; i < 24; ++i) - buffer.append("JDBC is really fast."); - CLOB_MEDIUM = buffer.toString(); - buffer = new StringBuffer(); - for (int i = 0; i < 24; ++i) - buffer.append("DBCLOBs are best"); - DBCLOB_MEDIUM = buffer.toString(); try { // Key == LOB_FULL. @@ -807,7 +898,7 @@ void setupRstestGet() throws SQLException { sql = "INSERT INTO " + RSTEST_GET + " (C_KEY) VALUES ('UPDATE_SANDBOX')"; statement_.executeUpdate(sql); - + serializeFile.close(); } // tableCreated RSTEST_GET } catch (SQLException e) { @@ -879,11 +970,9 @@ void setupRstestGetX() throws SQLException { } buffer.append(", C_VARBINARY_40 VARCHAR(40) FOR BIT DATA "); buffer.append(")"); - JDTestcase.initTable(statement_, RSTEST_GETX, buffer.toString(), + JDSerializeFile serializeFile = JDTestDriver.createTableIfNeeded(statement_, RSTEST_GETX, buffer.toString(), errorBuffer); - boolean tableCreated = true; - - if (tableCreated) { + if (serializeFile != null ) { // Key == NUMBER_0. statement_.executeUpdate("INSERT INTO " + RSTEST_GETX + " (C_KEY, C_SMALLINT, C_INTEGER, C_BIGINT, C_REAL, C_FLOAT, " // @D0A @@ -1076,85 +1165,6 @@ void setupRstestGetX() throws SQLException { + RSTEST_GETX + " (C_KEY, C_BLOB, C_CLOB, C_NCLOB, C_DBCLOB, " + " C_DISTINCT) " + " VALUES (?, ?, ?, ?,?, " + "?)"); - // Generate sample lobs. - Random random = new Random(); - if (getDriver() == JDTestDriver.DRIVER_JCC) { - BLOB_FULLX = new byte[3743]; - } else { - BLOB_FULLX = new byte[15743]; - } - // Create random XML characters in ASCII - int blobFullLength = BLOB_FULLX.length; - BLOB_FULLX[0] = (byte) '<'; - BLOB_FULLX[1] = (byte) 'd'; - BLOB_FULLX[2] = (byte) '>'; - for (int i = 3; i < blobFullLength - 4; i++) { - BLOB_FULLX[i] = (byte) (' ' + random.nextInt(0x5f)); - } - - BLOB_FULLX[blobFullLength - 4] = (byte) '<'; - BLOB_FULLX[blobFullLength - 3] = (byte) '/'; - BLOB_FULLX[blobFullLength - 2] = (byte) 'd'; - BLOB_FULLX[blobFullLength - 1] = (byte) '>'; - - buffer = new StringBuffer(); - buffer.append(""); - for (int i = 0; i < 2348; ++i) - buffer.append("All work and no play, etc. "); - buffer.append(""); - CLOB_FULLX = buffer.toString(); - - // The native driver is aware of the lengths of the - // lobs and therefore this value has to get truncated - // the the length of the column that it is going to be - // put into. The LOB default column length is 2556. - // I do not know why. - if (getDriver() == JDTestDriver.DRIVER_NATIVE - || getDriver() == JDTestDriver.DRIVER_JCC) - CLOB_FULLX = CLOB_FULLX.substring(0, 2556); - - buffer = new StringBuffer(); - buffer.append(""); - for (int i = 0; i < 3348; ++i) - buffer.append("Clobs are the best of all lobs!"); - buffer.append(""); - DBCLOB_FULLX = buffer.toString(); - - // The native driver is aware of the lengths of the - // lobs and therefore this value has to get truncated - // the the length of the column that it is going to be - // put into. The LOB default column length is 2556. - // I do not know why. - if (getDriver() == JDTestDriver.DRIVER_NATIVE - || getDriver() == JDTestDriver.DRIVER_JCC) - DBCLOB_FULLX = DBCLOB_FULLX.substring(0, 2556); - - if (getDriver() == JDTestDriver.DRIVER_JCC) { - BLOB_MEDIUMX = new byte[2500]; - } else { - BLOB_MEDIUMX = new byte[6500]; - } - - int blobMediumLength = BLOB_MEDIUMX.length; - BLOB_MEDIUMX[0] = (byte) '<'; - BLOB_MEDIUMX[1] = (byte) 'd'; - BLOB_MEDIUMX[2] = (byte) '>'; - for (int i = 3; i < blobMediumLength - 4; i++) { - BLOB_MEDIUMX[i] = (byte) (' ' + random.nextInt(0x5f)); - } - - BLOB_MEDIUMX[blobMediumLength - 4] = (byte) '<'; - BLOB_MEDIUMX[blobMediumLength - 3] = (byte) '/'; - BLOB_MEDIUMX[blobMediumLength - 2] = (byte) 'd'; - BLOB_MEDIUMX[blobMediumLength - 1] = (byte) '>'; - - buffer = new StringBuffer(); - buffer.append(""); - for (int i = 0; i < 24; ++i) - buffer.append("JDBC is really fast."); - buffer.append(""); - CLOB_MEDIUMX = buffer.toString(); - try { // Key == LOB_FULL. ps4.setString(1, "LOB_FULL"); @@ -1210,7 +1220,7 @@ void setupRstestGetX() throws SQLException { // Key == UPDATE_SANDBOX. statement_.executeUpdate("INSERT INTO " + RSTEST_GETX + " (C_KEY) VALUES ('UPDATE_SANDBOX')"); - + serializeFile.close(); } // tableCreated RSTEST_GETX } catch (SQLException e) { @@ -1231,6 +1241,11 @@ public void setup() throws Exception { super.setup(); // @D2A + connection_ = getConnection(getBaseURL(), systemObject_.getUserId(), + encryptedPassword_, "INFO_JDRSTEST_SETUP2"); + + parallelCounter_ = new JDParallelCounter(connection_, COLLECTION); + try { setup2(); } catch (Exception e) { @@ -1270,10 +1285,7 @@ public void setup2() throws Exception { String sql = ""; System.out.println("Running JDRSTest.setup2()"); try { - boolean tableCreated; // Initialization. - connection_ = getConnection(getBaseURL(), systemObject_.getUserId(), - encryptedPassword_, "INFO_JDRSTEST_SETUP2"); if (testLib_ != null) { // @E2A COLLECTION = testLib_; @@ -1289,16 +1301,18 @@ public void setup2() throws Exception { RSTEST_GRAPHIC = COLLECTION + ".RSTESTGRAPHIC"; RSTEST_SENSITIVE = COLLECTION + ".RSTESTSENS"; // @G1A - RSTEST_DFP16 = COLLECTION + ".RSDFP16"; - RSTEST_DFP16NAN = COLLECTION + ".RSDFP16NAN"; - RSTEST_DFP16INF = COLLECTION + ".RSDFP16INF"; - RSTEST_DFP16NNAN = COLLECTION + ".RSDFP16NNAN"; - RSTEST_DFP16NINF = COLLECTION + ".RSDFP16NINF"; - RSTEST_DFP34 = COLLECTION + ".RSDFP34"; + RSTEST_GETDFP16 = COLLECTION + ".RSGDFP16"; + RSTEST_UPDDFP16 = COLLECTION + ".RSUDFP16"; + RSTEST_GETDFP16NAN = COLLECTION + ".RSDFP16NAN"; + RSTEST_GETDFP16INF = COLLECTION + ".RSDFP16INF"; + RSTEST_GETDFP16NNAN = COLLECTION + ".RSDFP16NNAN"; + RSTEST_GETDFP16NINF = COLLECTION + ".RSDFP16NINF"; + RSTEST_GETDFP34 = COLLECTION + ".RSGDFP34"; + RSTEST_UPDDFP34 = COLLECTION + ".RSUDFP34"; RSTEST_DFP34NAN = COLLECTION + ".RSDFP34NAN"; - RSTEST_DFP34INF = COLLECTION + ".RSDFP34INF"; - RSTEST_DFP34NNAN = COLLECTION + ".RSDFP34NNAN"; - RSTEST_DFP34NINF = COLLECTION + ".RSDFP34NINF"; + RSTEST_GETDFP34INF = COLLECTION + ".RSDFP34INF"; + RSTEST_GETDFP34NNAN = COLLECTION + ".RSDFP34NNAN"; + RSTEST_GETDFP34NINF = COLLECTION + ".RSDFP34NINF"; RSTEST_GETXML = COLLECTION + ".RSTESTGETX"; RSTEST_UPDATEXML = COLLECTION + ".RSTESTUPDX"; @@ -1342,10 +1356,9 @@ public void setup2() throws Exception { buffer.append(",C_DATALINK VARCHAR(150) )"); } sql = buffer.toString(); - JDTestcase.initTable(statement_, RSTEST_GETDL, sql, errorBuffer); + JDSerializeFile serializeFile = JDTestDriver.createTableIfNeeded(statement_, RSTEST_GETDL, sql, errorBuffer); - tableCreated = true; - if (tableCreated) { + if (serializeFile != null ) { PreparedStatement ps4; if (JDTestDriver.getDatabaseTypeStatic() == JDTestDriver.DB_SYSTEMI) { sql = "INSERT INTO " + RSTEST_GETDL + " (C_KEY, C_DATALINK) " @@ -1377,6 +1390,7 @@ public void setup2() throws Exception { sql = "INSERT INTO " + RSTEST_GETDL + " (C_KEY) VALUES ('UPDATE_SANDBOX')"; statement_.executeUpdate(sql); + serializeFile.close(); } // tableCreated RSTEST_GETDL } @@ -1401,18 +1415,18 @@ public void setup2() throws Exception { } buffer.append(")"); sql = buffer.toString(); - JDTestcase.initTable(statement_, RSTEST_GRAPHIC, sql, errorBuffer); - tableCreated = true; + JDSerializeFile serializeFile = JDTestDriver.createTableIfNeeded(statement_, RSTEST_GRAPHIC, sql, errorBuffer); char[] mychar = { '\u5e03', '\u5f17', '\u672b', '\u5378' }; // @G2 String unicode = new String(mychar); // @G2 - if (tableCreated) { + if (serializeFile != null) { // Key == GRAPHIC_FULL. statement_.executeUpdate("INSERT INTO " + RSTEST_GRAPHIC + " (C_KEY, C_GRAPHIC, C_VARGRAPHIC, C_GRAPHIC_835, C_VARGRAPHIC_835)" // @G2 + " VALUES ('GRAPHIC_FULL', 'TOOLBOX FOR JAVA', 'JAVA TOOLBOX', '" + unicode + "' , '" + unicode + "')"); // @G2 + serializeFile.close(); } // tableCreated RSTEST_GRAPH } // @F1 @@ -1434,10 +1448,9 @@ public void setup2() throws Exception { buffer.append(",C_PADDED VARCHAR(20) FOR BIT DATA"); } buffer.append(")"); - JDTestcase.initTable(statement_, RSTEST_BINARY, buffer.toString(), + JDSerializeFile serializeFile = JDTestDriver.createTableIfNeeded(statement_, RSTEST_BINARY, buffer.toString(), errorBuffer); - tableCreated = true; - if (tableCreated) { + if (serializeFile != null) { // Key == BINARY_NOTRANS. PreparedStatement ps5 = connection_.prepareStatement("INSERT INTO " + RSTEST_BINARY + " (C_KEY, C_BINARY_1, C_BINARY_20, " @@ -1493,18 +1506,19 @@ public void setup2() throws Exception { // Key == UPDATE_SANDBOX statement_.executeUpdate("INSERT INTO " + RSTEST_BINARY + " (C_KEY) VALUES('UPDATE_SANDBOX')"); - } - } // tableCreated RSTEST_BINARY + serializeFile.close(); + } // tableCreated RSTEST_BINARY + } // Setup RSTEST_POS table. - JDTestcase.initTable(statement_, RSTEST_POS, + JDSerializeFile serializeFile = JDTestDriver.createTableIfNeeded(statement_, RSTEST_POS, " (ID INT, VALUE VARCHAR(20))", errorBuffer); - tableCreated = true; - if (tableCreated) { + if (serializeFile != null) { for (int i = 1; i <= 99; ++i) { statement_.executeUpdate("INSERT INTO " + RSTEST_POS + " (ID, VALUE) VALUES (" + i + ", 'Speed on, JDBC.')"); } + serializeFile.close(); } // tableCreated RSTEST_POS // Setup RSTEST_UPDATE table. @@ -1562,45 +1576,45 @@ public void setup2() throws Exception { buffer.append(")"); - JDTestcase.initTable(statement_, RSTEST_UPDATE, buffer.toString(), + serializeFile = JDTestDriver.createTableIfNeeded(statement_, RSTEST_UPDATE, buffer.toString(), errorBuffer); - tableCreated = true; - - // Make use the table is usable with a transactional connection - Connection c = getConnection(getBaseURL(), systemObject_.getUserId(), - encryptedPassword_, "INFO_JDRSTEST_SETUP2_TRANS"); - try { - c.setTransactionIsolation(Connection.TRANSACTION_SERIALIZABLE); - c.setAutoCommit(false); - } catch (Exception e) { - System.out - .println("Warning: Exception thrown changing isolation level"); - System.err.flush(); - System.out.flush(); - e.printStackTrace(); - System.err.flush(); - System.out.flush(); - } - Statement stmt = c.createStatement(); - stmt.executeUpdate("INSERT INTO " + JDRSTest.RSTEST_UPDATE - + " (C_KEY) VALUES ('DUMMY_ROW')"); - stmt.executeUpdate("DELETE FROM " + JDRSTest.RSTEST_UPDATE); - stmt.close(); - c.commit(); - c.close(); - - try { - connection_.commit(); // needed for XA testing - } catch (Exception e) { - System.out.println("Exception calling commit"); - if (JDTestDriver.getDatabaseTypeStatic() == JDTestDriver.DB_SYSTEMI) { + + if (serializeFile != null) { + // Make use the table is usable with a transactional connection + Connection c = getConnection(getBaseURL(), systemObject_.getUserId(), encryptedPassword_, + "INFO_JDRSTEST_SETUP2_TRANS"); + try { + c.setTransactionIsolation(Connection.TRANSACTION_SERIALIZABLE); + c.setAutoCommit(false); + } catch (Exception e) { + System.out.println("Warning: Exception thrown changing isolation level"); + System.err.flush(); System.out.flush(); e.printStackTrace(); System.err.flush(); + System.out.flush(); + } + Statement stmt = c.createStatement(); + stmt.executeUpdate("INSERT INTO " + JDRSTest.RSTEST_UPDATE + " (C_KEY) VALUES ('DUMMY_ROW')"); + stmt.executeUpdate("DELETE FROM " + JDRSTest.RSTEST_UPDATE); + stmt.close(); + c.commit(); + c.close(); - } else { - System.out.println("Ignoring for LUW"); + try { + connection_.commit(); // needed for XA testing + } catch (Exception e) { + System.out.println("Exception calling commit"); + if (JDTestDriver.getDatabaseTypeStatic() == JDTestDriver.DB_SYSTEMI) { + System.out.flush(); + e.printStackTrace(); + System.err.flush(); + + } else { + System.out.println("Ignoring for LUW"); + } } + serializeFile.close(); } // @@ -1613,17 +1627,19 @@ public void setup2() throws Exception { buffer.append(",C_VARCHAR_50 VARCHAR(50) "); buffer.append(",C_NVARCHAR_50 NVARCHAR(50) ) "); - JDTestcase.initTable(statement_, RSTEST_SCROLL, buffer.toString(), + serializeFile = JDTestDriver.createTableIfNeeded(statement_, RSTEST_SCROLL, buffer.toString(), errorBuffer); - tableCreated = true; + - if (tableCreated) { + if (serializeFile != null) { for (int i = 0; i < 97; i++) { statement_.executeUpdate("INSERT INTO " + RSTEST_SCROLL + " ( ROWNUMBER, C_INTEGER, C_VARCHAR_50, C_NVARCHAR_50 )" // @D0A + " VALUES ( " + (i + 1) + " ," + (i + 1) + " , 'Hi Mom', 'Hi Mom')"); } + serializeFile.close(); + } // G1A @@ -1634,15 +1650,16 @@ public void setup2() throws Exception { buffer.setLength(0); buffer.append(" ( C_INTEGER INTEGER ) "); - JDTestcase.initTable(statement_, RSTEST_SENSITIVE, buffer.toString(), + serializeFile = JDTestDriver.createTableIfNeeded(statement_, RSTEST_SENSITIVE, buffer.toString(), errorBuffer); - tableCreated = true; - if (tableCreated) { + if (serializeFile != null) { for (int i = 0; i < 97; i++) { statement_.executeUpdate("INSERT INTO " + RSTEST_SENSITIVE + " ( C_INTEGER )" + " VALUES ( " + (i + 1) + ")"); } + serializeFile.close(); + } // @@ -1652,28 +1669,33 @@ public void setup2() throws Exception { if (true) { if (getDatabaseType() == JDTestDriver.DB_ZOS || getDatabaseType() == JDTestDriver.DB_LUW) { - createAndPopulateTable(RSTEST_DFP16, "C1 DECFLOAT(16)", VALUES_DFP16); - createAndPopulateTable(RSTEST_DFP16NAN, "C1 DECFLOAT(16)", "NAN"); - createAndPopulateTable(RSTEST_DFP16INF, "C1 DECFLOAT(16)", "INF"); - createAndPopulateTable(RSTEST_DFP16NNAN, "C1 DECFLOAT(16)", "-NAN"); - createAndPopulateTable(RSTEST_DFP16NINF, "C1 DECFLOAT(16)", "-INF"); - createAndPopulateTable(RSTEST_DFP34, "C1 DECFLOAT(34)", + createAndPopulateTable(RSTEST_GETDFP16, "C1 DECFLOAT(16)", VALUES_DFP16); + createAndPopulateTable(RSTEST_UPDDFP16, "C1 DECFLOAT(16)", VALUES_DFP16); + createAndPopulateTable(RSTEST_GETDFP16NAN, "C1 DECFLOAT(16)", "NAN"); + createAndPopulateTable(RSTEST_GETDFP16INF, "C1 DECFLOAT(16)", "INF"); + createAndPopulateTable(RSTEST_GETDFP16NNAN, "C1 DECFLOAT(16)", "-NAN"); + createAndPopulateTable(RSTEST_GETDFP16NINF, "C1 DECFLOAT(16)", "-INF"); + createAndPopulateTable(RSTEST_GETDFP34, "C1 DECFLOAT(34)", + VALUES_DFP34_LUWSET); + createAndPopulateTable(RSTEST_UPDDFP34, "C1 DECFLOAT(34)", VALUES_DFP34_LUWSET); createAndPopulateTable(RSTEST_DFP34NAN, "C1 DECFLOAT(34)", "NAN"); - createAndPopulateTable(RSTEST_DFP34INF, "C1 DECFLOAT(34)", "INF"); - createAndPopulateTable(RSTEST_DFP34NNAN, "C1 DECFLOAT(34)", "-NAN"); - createAndPopulateTable(RSTEST_DFP34NINF, "C1 DECFLOAT(34)", "-INF"); + createAndPopulateTable(RSTEST_GETDFP34INF, "C1 DECFLOAT(34)", "INF"); + createAndPopulateTable(RSTEST_GETDFP34NNAN, "C1 DECFLOAT(34)", "-NAN"); + createAndPopulateTable(RSTEST_GETDFP34NINF, "C1 DECFLOAT(34)", "-INF"); } else { - createAndPopulateTable(RSTEST_DFP16, "C1 DECFLOAT(16)", VALUES_DFP16); - createAndPopulateTable(RSTEST_DFP16NAN, "C1 DECFLOAT(16)", "'NAN'"); - createAndPopulateTable(RSTEST_DFP16INF, "C1 DECFLOAT(16)", "'INF'"); - createAndPopulateTable(RSTEST_DFP16NNAN, "C1 DECFLOAT(16)", "'-NAN'"); - createAndPopulateTable(RSTEST_DFP16NINF, "C1 DECFLOAT(16)", "'-INF'"); - createAndPopulateTable(RSTEST_DFP34, "C1 DECFLOAT(34)", VALUES_DFP34); + createAndPopulateTable(RSTEST_GETDFP16, "C1 DECFLOAT(16)", VALUES_DFP16); + createAndPopulateTable(RSTEST_UPDDFP16, "C1 DECFLOAT(16)", VALUES_DFP16); + createAndPopulateTable(RSTEST_GETDFP16NAN, "C1 DECFLOAT(16)", "'NAN'"); + createAndPopulateTable(RSTEST_GETDFP16INF, "C1 DECFLOAT(16)", "'INF'"); + createAndPopulateTable(RSTEST_GETDFP16NNAN, "C1 DECFLOAT(16)", "'-NAN'"); + createAndPopulateTable(RSTEST_GETDFP16NINF, "C1 DECFLOAT(16)", "'-INF'"); + createAndPopulateTable(RSTEST_GETDFP34, "C1 DECFLOAT(34)", VALUES_DFP34); + createAndPopulateTable(RSTEST_UPDDFP34, "C1 DECFLOAT(34)", VALUES_DFP34); createAndPopulateTable(RSTEST_DFP34NAN, "C1 DECFLOAT(34)", "'NAN'"); - createAndPopulateTable(RSTEST_DFP34INF, "C1 DECFLOAT(34)", "'INF'"); - createAndPopulateTable(RSTEST_DFP34NNAN, "C1 DECFLOAT(34)", "'-NAN'"); - createAndPopulateTable(RSTEST_DFP34NINF, "C1 DECFLOAT(34)", "'-INF'"); + createAndPopulateTable(RSTEST_GETDFP34INF, "C1 DECFLOAT(34)", "'INF'"); + createAndPopulateTable(RSTEST_GETDFP34NNAN, "C1 DECFLOAT(34)", "'-NAN'"); + createAndPopulateTable(RSTEST_GETDFP34NINF, "C1 DECFLOAT(34)", "'-INF'"); } } @@ -1699,14 +1721,11 @@ public void setup2() throws Exception { buffer.append(", C_BLOB0037 BLOB(1M) "); buffer.append(", C_BLOB1208 BLOB(1M) "); buffer.append(", C_BLOB1200 BLOB(1M) "); - if (true) { - buffer.append(", C_XML XML "); - } + buffer.append(", C_XML XML "); buffer.append(")"); - JDTestcase.initTable(statement_, RSTEST_GETXML, buffer.toString(), + serializeFile = JDTestDriver.createTableIfNeeded(statement_, RSTEST_GETXML, buffer.toString(), errorBuffer); - tableCreated = true; - if (tableCreated) { + if (serializeFile != null) { // Key == BINARY_NOTRANS. try { PreparedStatement ps5; @@ -1755,6 +1774,7 @@ public void setup2() throws Exception { e.printStackTrace(); System.err.flush(); } + serializeFile.close(); } /* tableCreated */ @@ -1776,10 +1796,9 @@ public void setup2() throws Exception { buffer.append(", C_BLOB1208 BLOB(1M) "); buffer.append(", C_BLOB1200 BLOB(1M) "); buffer.append(")"); - JDTestcase.initTable(statement_, RSTEST_UPDATEXML, buffer.toString(), + serializeFile = JDTestDriver.createTableIfNeeded(statement_, RSTEST_UPDATEXML, buffer.toString(), errorBuffer); - tableCreated = true; - if (tableCreated) { + if (serializeFile != null) { // Key == BINARY_NOTRANS. try { PreparedStatement ps5 = connection_.prepareStatement("INSERT INTO " @@ -1820,6 +1839,7 @@ public void setup2() throws Exception { System.out.println("Unable to setup row for " + RSTEST_UPDATEXML); System.out.println("Error buffer = " + errorBuffer.toString()); } + serializeFile.close(); } /* tableCreated */ @@ -1831,10 +1851,9 @@ public void setup2() throws Exception { buffer.append(" (C_KEY VARCHAR(20) "); buffer.append(",C_BOOLEAN BOOLEAN "); buffer.append(")"); - JDTestcase.initTable(statement_, RSTEST_BOOLEAN, buffer.toString(), + serializeFile = JDTestDriver.createTableIfNeeded(statement_, RSTEST_BOOLEAN, buffer.toString(), errorBuffer); - tableCreated = true; - if (tableCreated) { + if (serializeFile != null) { // Key == BINARY_NOTRANS. PreparedStatement ps5 = connection_.prepareStatement("INSERT INTO " + RSTEST_BOOLEAN + " (C_KEY, C_BOOLEAN) VALUES (?, ?)"); @@ -1862,6 +1881,7 @@ public void setup2() throws Exception { ps5.executeUpdate(); ps5.close(); + serializeFile.close(); } // tableCreated RSTEST_BOOLEAN } /* V7R5 or later */ @@ -1895,11 +1915,14 @@ public static void createAndPopulateTable(String tableName, StringBuffer errorBuffer = new StringBuffer(); try { - JDTestcase.initTable(statementParm, tableName, + JDSerializeFile serializeFile = JDTestDriver.createTableIfNeeded(statementParm, tableName, " (" + columnDefinition + ")", errorBuffer); - - statementParm + if (serializeFile != null) { + statementParm .executeUpdate("INSERT INTO " + tableName + " VALUES(" + value + ")"); + serializeFile.close(); + + } } catch (Exception e) { System.out.println("Unable to insert '" + value + "' into " + tableName); System.out.flush(); @@ -1921,14 +1944,12 @@ public static void createAndPopulateTable(String tableName, String columnDefinition, String values[], Statement statementParm) throws SQLException { - boolean tableCreated; StringBuffer errorBuffer = new StringBuffer(); try { - JDTestcase.initTable(statementParm, tableName, + JDSerializeFile serializeFile = JDTestDriver.createTableIfNeeded(statementParm, tableName, " (" + columnDefinition + ")", errorBuffer); - tableCreated = true; - if (tableCreated) { + if (serializeFile != null ) { for (int i = 0; i < values.length; i++) { String sql; if (getDatabaseTypeStatic() == JDTestDriver.DB_ZOS @@ -1947,6 +1968,8 @@ public static void createAndPopulateTable(String tableName, } } + serializeFile.close(); + } } catch (SQLException e) { System.out.println("Exception caught " + e.toString() + " "); @@ -1968,6 +1991,7 @@ public static void dropCollections(Connection c) { Statement stmt = c.createStatement(); stmt.executeUpdate( "CALL QSYS.QCMDEXC('CHGJOB INQMSGRPY(*SYSRPYL) ', 0000000030.00000)"); + stmt.close(); } catch (Exception e) { System.out.flush(); e.printStackTrace(); @@ -2063,43 +2087,63 @@ public static void position0(ResultSet rs, String key) throws SQLException { * If an exception occurs. **/ public void cleanup() throws Exception { - /* Only cleanup if there are no failures */ - if (totalFail_ == 0) { - boolean dropUDTfailed = false; - if (areLobsSupported()) { - cleanupTable(statement_, RSTEST_GETDL); + /* Only cleanup if there are no failures */ + /* And no other concurrent tests are running */ + boolean doCleanup = true; + if (!parallelCounter_.doCleanup()) { + out_.println("JDRTest.cleanup not cleaning other parallel tests running ="+parallelCounter_.toString()); + doCleanup = false; + } + if (doCleanup) { + if (totalFail_ > 0) { + out_.println("JDRTest.cleanup not cleaning because failures > 0"); + doCleanup = false; } - cleanupTable(statement_, RSTEST_GET); + if (doCleanup) { + /* Do not cleanup if files created within last day */ + if (newerFile(statement_, RSTEST_GET)) { + out_.println("JDRTest.cleanup not cleaning because "+RSTEST_GET +" is newer file"); + doCleanup = false; + } + } + if (doCleanup) { + boolean dropUDTfailed = false; + if (areLobsSupported()) { + cleanupTable(statement_, RSTEST_GETDL); + } + cleanupTable(statement_, RSTEST_GET); - cleanupTable(statement_, RSTEST_GETX); + cleanupTable(statement_, RSTEST_GETX); - cleanupTable(statement_, RSTEST_POS); - if (true) { - cleanupTable(statement_, RSTEST_BINARY); - cleanupTable(statement_, RSTEST_GRAPHIC); - } - cleanupTable(statement_, RSTEST_UPDATE); - cleanupTable(statement_, RSTEST_SCROLL); - cleanupTable(statement_, RSTEST_SENSITIVE); // @G1A + cleanupTable(statement_, RSTEST_POS); + if (true) { + cleanupTable(statement_, RSTEST_BINARY); + cleanupTable(statement_, RSTEST_GRAPHIC); + } + cleanupTable(statement_, RSTEST_UPDATE); + cleanupTable(statement_, RSTEST_SCROLL); + cleanupTable(statement_, RSTEST_SENSITIVE); // @G1A - if (areLobsSupported()) { + if (areLobsSupported()) { - statement_.executeUpdate("DROP DISTINCT TYPE " + COLLECTION + ".SSN"); - } + statement_.executeUpdate("DROP DISTINCT TYPE " + COLLECTION + ".SSN"); + } - if (true) { - cleanupTable(statement_, RSTEST_GETXML); - cleanupTable(statement_, RSTEST_UPDATEXML); + if (true) { + cleanupTable(statement_, RSTEST_GETXML); + cleanupTable(statement_, RSTEST_UPDATEXML); - } + } - statement_.close(); + statement_.close(); - if (dropUDTfailed) { - System.out.println("Deleting collection since drop UDT failed"); - dropCollections(connection_); + if (dropUDTfailed) { + System.out.println("Deleting collection since drop UDT failed"); + dropCollections(connection_); + } } } + parallelCounter_.close(); connection_.close(); } diff --git a/src/test/JDReflectionUtil.java b/src/test/JDReflectionUtil.java index 68733027..56ebe6b8 100644 --- a/src/test/JDReflectionUtil.java +++ b/src/test/JDReflectionUtil.java @@ -1886,7 +1886,7 @@ public static void callMethod_V(Object o, String methodName, String p1, char[] p Class thisClass = o.getClass(); Class[] argTypes = new Class[8]; argTypes[0] = String.class; - argTypes[1] = classLoader_.loadClass("[C");; + argTypes[1] = Class.forName("[C");; argTypes[2] = argTypes[1]; argTypes[3] = String.class; argTypes[4] = classLoader_.loadClass("java.net.InetAddress"); @@ -3648,7 +3648,7 @@ public static Object createObject(String classname, byte[] arg) throws Exception Class objectClass11 = classLoader_.loadClass(classname); Class[] oneArgTypes = new Class[1]; - oneArgTypes[0] = classLoader_.loadClass("[B"); + oneArgTypes[0] = Class.forName("[B"); Object[] oneArgs = new Object[1]; oneArgs[0] = arg; Object newObject =null; @@ -3667,8 +3667,8 @@ public static Object createObject(String classname, byte[] arg) throws Exception public static Object createObject(String classname, long arg) throws Exception { - - Class objectClass11 = classLoader_.loadClass(classname); + Class objectClass11 ; + objectClass11 = classLoader_.loadClass(classname); Class[] oneArgTypes = new Class[1]; oneArgTypes[0] = Long.TYPE; Object[] oneArgs = new Object[1]; diff --git a/src/test/JDRunit.java b/src/test/JDRunit.java index e202b9a8..4aa81cce 100644 --- a/src/test/JDRunit.java +++ b/src/test/JDRunit.java @@ -68,7 +68,7 @@ import java.util.Vector; import java.util.concurrent.TimeUnit; - +import test.JD.JDDataAreaLock; import test.JD.DataSource.JDDatabaseOverride; import test.JTA.JTACleanupTx; diff --git a/src/test/JDTestDriver.java b/src/test/JDTestDriver.java index b48e7ea3..39428340 100644 --- a/src/test/JDTestDriver.java +++ b/src/test/JDTestDriver.java @@ -1703,7 +1703,16 @@ protected static void initTable(Statement s, String tableName, String tableDefin } protected static void initTable(Statement stmt, String tableName, String tableDefinition, - StringBuffer sb) throws SQLException { + StringBuffer sb ) throws SQLException { + initTable(stmt,tableName, tableDefinition, sb, true); + } + + + /** + * Create or initialize a table as a blank table + */ + protected static void initTable(Statement stmt, String tableName, String tableDefinition, + StringBuffer sb, boolean serializeAccess ) throws SQLException { tableDefinition = tableDefinition.trim(); String oldDefinition = (String) tableDefinitions.get(tableName); if (oldDefinition == null) { @@ -1717,7 +1726,7 @@ protected static void initTable(Statement stmt, String tableName, String tableDe // Serialize access to the table JDSerializeFile setupLock = null; try { - setupLock = new JDSerializeFile(stmt, tableName); + if (serializeAccess) setupLock = new JDSerializeFile(stmt, tableName); String sql; try { @@ -1780,6 +1789,74 @@ protected static void initTable(Statement stmt, String tableName, String tableDe } + + + /** + * Creates a table if needed. If the table is created, then a JDSerializeFile object is returned. JDSerializeFile should be closed after the inserts complete. + * If the table exists, nothing happens and null is returned. + */ + protected static JDSerializeFile createTableIfNeeded(Statement stmt, String tableName, String tableDefinition, + StringBuffer sb ) throws SQLException { + + JDSerializeFile serializeFile = null; + boolean tableCreated = false; + tableDefinition = tableDefinition.trim(); + String oldDefinition = (String) tableDefinitions.get(tableName); + if (oldDefinition == null) { + tableDefinitions.put(tableName, tableDefinition); + } else { + if (!oldDefinition.equals(tableDefinition)) { + throw new SQLException("ERROR: definition of " + tableName + "\n" + + tableDefinition + "\nCHANGED FROM\n" + oldDefinition); + } + } + String baseFilename = null; + String baseCollection = null; + int dotIndex = tableName.indexOf("."); + if (dotIndex > 0) { + baseFilename = tableName.substring(dotIndex+1); + baseCollection = tableName.substring(0,dotIndex); + } else { + throw new SQLException("Unable to find schema in "+tableName); + } + serializeFile = new JDSerializeFile(stmt, tableName); + String sql = "SELECT * FROM QSYS2.SYSTABLES where TABLE_NAME='"+baseFilename+"' and TABLE_SCHEMA='"+baseCollection+"' " ; + ResultSet rs = stmt.executeQuery(sql); + if (!rs.next()) { + sql = "CREATE TABLE " + tableName + tableDefinition; + if (sb != null) + sb.append("Running "+sql + "\n"); + try { + stmt.executeUpdate(sql); + + sql = "GRANT ALL ON "+tableName+" TO PUBLIC"; + if (sb != null) + sb.append("Running "+sql + "\n"); + stmt.executeUpdate(sql); + tableCreated = true; + } catch (SQLException e2) { + int code = e2.getErrorCode(); + if (code == -901) { + System.out + .println("SQL0901 found -- trying to recover using RCLDBXREF"); + stmt.executeUpdate("CALL QSYS2.QCMDEXC(' RCLDBXREF OPTION(*FIX) ')"); + stmt.executeUpdate(sql); + tableCreated = true; + } else { + rs.close(); + throw e2; + } + } + } + if (!tableCreated) { + serializeFile.close(); + serializeFile = null; + } + rs.close(); + return serializeFile; + + } + protected void cleanupTable(Statement s, String tableName) { if (!skipCleanup) { try { @@ -1846,4 +1923,26 @@ void cleanupTrigger(Statement s, String triggerName) { } } + protected boolean newerFile(Statement s, String filename) throws SQLException { + boolean newerFile = true; + String schema; + String baseName; + filename=filename.toUpperCase(); + int dotIndex = filename.indexOf('.'); + if (dotIndex < 0) throw new SQLException("File "+filename+" does not have a '.'"); + schema = filename.substring(0,dotIndex); + baseName = filename.substring(dotIndex+1); + String sql = " select * from qsys2.systables where TABLE_SCHEMA='" + schema + "'" + " AND TABLE_NAME='" + baseName + + "' " + "AND LAST_ALTERED_TIMESTAMP > CURRENT_TIMESTAMP - 1 day "; + ResultSet rs = s.executeQuery(sql); + if (rs.next()) { + newerFile = true; + } else { + newerFile = false; + } + rs.close(); + + return newerFile; + } + } diff --git a/src/test/JDTestcase.java b/src/test/JDTestcase.java index 2fcbf0d9..6123f1e5 100644 --- a/src/test/JDTestcase.java +++ b/src/test/JDTestcase.java @@ -3114,6 +3114,12 @@ public static void initTable(Statement s, String tableName, String tableDefiniti JDTestDriver.initTable(s, tableName, tableDefinition, sb); } + + public static void initTable(Statement s, String tableName, String tableDefinition, StringBuffer sb, boolean serializeAccess) + throws SQLException { + JDTestDriver.initTable(s, tableName, tableDefinition, sb, serializeAccess ); + } + public static void initTrigger(Statement s, String triggerName, String triggerDefinition) throws SQLException { StringBuffer sb = new StringBuffer(); try {