db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Db-derby Wiki] Update of "ErandaSooriyabandara" by ErandaSooriyabandara
Date Tue, 04 Aug 2009 20:17:19 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Db-derby Wiki" for change notification.

The following page has been changed by ErandaSooriyabandara:
http://wiki.apache.org/db-derby/ErandaSooriyabandara

------------------------------------------------------------------------------
  
  But it is differ from what we expect as the result.
  
+ Without the previous error I got another error from the code,
+ rs = st.executeQuery(
+             " values SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS()");
+         
+         expColNames = new String [] {"1"};
+         JDBC.assertColumnNames(rs, expColNames);
+         
+         expRS = new String [][]
+         {
+             {"Statement Name:"},
+             {"null"},
+             {"Statement Text:"},
+             {"call SYSCS_UTIL.SYSCS_SET_RUNTIMESTATISTICS(1)"},
+             {"Parse Time: 0"},
+             {"Bind Time: 0"},
+             {"Optimize Time: 0"},
+             {"Generate Time: 0"},
+             {"Compile Time: 0"},
+             {"Execute Time: 0"},
+             {"Begin Compilation Timestamp : null"},
+             {"End Compilation Timestamp : null"},
+             {"Begin Execution Timestamp : null"},
+             {"End Execution Timestamp : null"},
+             {"Statement Execution Plan Text:"},
+             {"null"}
+         };
+         
+         JDBC.assertFullResultSet(rs, expRS, true);
+ And as Mamta suggest I did the correction as,
+ 
+ st.executeQuery("call SYSCS_UTIL.SYSCS_SET_RUNTIMESTATISTICS(1)");
+ rs=st.executeQuery("SELECT R FROM t");
+         while(rs.next()){}
+         rs.close();
+         
+         rs = st.executeQuery(
+             " values SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS()");
+         rs.next();
+ 
+         if(usingEmbedded()){
+             RuntimeStatisticsParser rtsp = new RuntimeStatisticsParser(rs.getString(1));
+             rs.close();
+             assertTrue(rtsp.usedTableScan());
+             assertFalse(rtsp.usedDistinctScan());
+         }
+ 
+ And this works but I don't know for sure this is correct or wrong.
+ 
+ There were other 3 errors remains in the testing. They are
+ 
+ 1.In row 687,
+ if(usingEmbedded()){
+             rs = st.executeQuery(
+                 "values ConsistencyChecker()");
+ 
+             expColNames = new String [] {"1"};
+             JDBC.assertColumnNames(rs, expColNames);
+ 
+             expRS = new String [][]
+             {
+                 {"No open scans, etc"},
+                 {"30 dependencies found"}
+             };
+ 
+             JDBC.assertFullResultSet(rs, expRS, true);
+         }
+ 
+ 2.In the row 2891,
+ rs = st.executeQuery("values (3, cast (null as int))");
+ for (int i = 1;
+                  i <= rsmd.getColumnCount(); i++) {
+              pSt.setObject(i, rs.getObject(i));            //exception throws from this
row
+          }
+ 
+ 3.In row 4620,
+ st.executeUpdate(
+             " create view v1(c1)"
+             + "as"
+             + "select c1 from t1"
+             + "union all"
+             + "select c2 from t2 ");
+ 
+ The final one gives Syntax Error and I gave the solution by adding braces to the select
c1 from t1 and select c2 from t2.
+ 
+ The second error the solution gave by Bryan by changing the code,
+ for (int i = 1;
+                  i <= rsmd.getColumnCount(); i++) {
+              pSt.setObject(i, rs.getObject(i));
+          }
+ 
+ to
+ 
+          for (int i = 1;
+                  i <= rsmd.getColumnCount(); i++) {
+              pSt.setObject(i, rs.getObject(i), Types.INTEGER);
+          }
+ 
+ We can see the solution as below,
+ 
+ Though we cast null into integer it remains as the same and it just help to
+ pass from,
+ 
+ rs = st.executeQuery("values (3, cast (null as int))");
+ 
+ which does not allow null in the values.
+ But after we cast, it proceed as a null object(not null Integer) and when
+ execution time it gave the NullPointerException. We cannot directly cast the
+ null into Integer ((INTEGER)rs.getObject(i)). But we can do it by give the
+ data type as integer,
+ 
+ pSt.setObject(i, rs.getObject(i), Types.INTEGER);.
+ 
+ 
+ 
  ==== DERBY-4256 ====
  ==== allow alter table to increase the maximum size of a blob and a clob ====
  (https://issues.apache.org/jira/browse/DERBY-4256)

Mime
View raw message