db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kahat...@apache.org
Subject svn commit: r1518534 - /db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/
Date Thu, 29 Aug 2013 08:01:56 GMT
Author: kahatlen
Date: Thu Aug 29 08:01:56 2013
New Revision: 1518534

URL: http://svn.apache.org/r1518534
Log:
DERBY-6318: Simplify setting of possibly null parameters in XPLAIN descriptors

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/XPLAINResultSetDescriptor.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/XPLAINResultSetTimingsDescriptor.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/XPLAINScanPropsDescriptor.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/XPLAINSortPropsDescriptor.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/XPLAINStatementTimingsDescriptor.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/XPLAINResultSetDescriptor.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/XPLAINResultSetDescriptor.java?rev=1518534&r1=1518533&r2=1518534&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/XPLAINResultSetDescriptor.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/XPLAINResultSetDescriptor.java
Thu Aug 29 08:01:56 2013
@@ -116,54 +116,21 @@ public class XPLAINResultSetDescriptor e
         ps.setString(1, rs_id.toString());
         ps.setString(2, op_identifier);
         ps.setString(3, op_details);
-        if (no_opens != null)
-            ps.setInt(4, no_opens.intValue());
-        else
-            ps.setNull(4, Types.INTEGER);
-        if (no_index_updates != null)
-            ps.setInt(5, no_index_updates.intValue());
-        else
-            ps.setNull(5, Types.INTEGER);
+        ps.setObject(4, no_opens, Types.INTEGER);
+        ps.setObject(5, no_index_updates, Types.INTEGER);
         ps.setString(6, lock_mode);
         ps.setString(7, lock_granularity);
         ps.setString(8, (parent_rs_id != null ? parent_rs_id.toString():null));
-        if (est_row_count != null)
-            ps.setDouble(9, est_row_count.doubleValue());
-        else
-            ps.setNull(9, Types.DOUBLE);
-        if (est_cost != null)
-            ps.setDouble(10, est_cost.doubleValue());
-        else
-            ps.setNull(10, Types.DOUBLE);
-        if (affected_rows != null)
-            ps.setInt(11, affected_rows.intValue());
-        else
-            ps.setNull(11, Types.INTEGER);
+        ps.setObject(9, est_row_count, Types.DOUBLE);
+        ps.setObject(10, est_cost, Types.DOUBLE);
+        ps.setObject(11, affected_rows, Types.INTEGER);
         ps.setString(12, deferred_rows);
-        if (input_rows != null)
-            ps.setInt(13, input_rows.intValue());
-        else
-            ps.setNull(13, Types.INTEGER);
-        if (seen_rows != null)
-            ps.setInt(14, seen_rows.intValue());
-        else
-            ps.setNull(14, Types.INTEGER);
-        if (seen_rows_right != null)
-            ps.setInt(15, seen_rows_right.intValue());
-        else
-            ps.setNull(15, Types.INTEGER);
-        if (filtered_rows != null)
-            ps.setInt(16, filtered_rows.intValue());
-        else
-            ps.setNull(16, Types.INTEGER);
-        if (returned_rows != null)
-            ps.setInt(17, returned_rows.intValue());
-        else
-            ps.setNull(17, Types.INTEGER);
-        if (empty_right_rows != null)
-            ps.setInt(18, empty_right_rows.intValue());
-        else
-            ps.setNull(18, Types.INTEGER);
+        ps.setObject(13, input_rows, Types.INTEGER);
+        ps.setObject(14, seen_rows, Types.INTEGER);
+        ps.setObject(15, seen_rows_right, Types.INTEGER);
+        ps.setObject(16, filtered_rows, Types.INTEGER);
+        ps.setObject(17, returned_rows, Types.INTEGER);
+        ps.setObject(18, empty_right_rows, Types.INTEGER);
         ps.setString(19, index_key_optimization);
         ps.setString(20, (scan_rs_id != null ? scan_rs_id.toString():null));
         ps.setString(21, (sort_rs_id != null ? sort_rs_id.toString():null));

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/XPLAINResultSetTimingsDescriptor.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/XPLAINResultSetTimingsDescriptor.java?rev=1518534&r1=1518533&r2=1518534&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/XPLAINResultSetTimingsDescriptor.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/XPLAINResultSetTimingsDescriptor.java
Thu Aug 29 08:01:56 2013
@@ -26,7 +26,6 @@ import java.sql.SQLException;
 
 import org.apache.derby.catalog.UUID;
 import org.apache.derby.iapi.sql.dictionary.SystemColumn;
-import org.apache.derby.impl.sql.catalog.SystemColumnImpl;
 import java.sql.Types;
 
 public class XPLAINResultSetTimingsDescriptor extends XPLAINTableDescriptor 
@@ -79,46 +78,16 @@ public class XPLAINResultSetTimingsDescr
         throws SQLException
     {
         ps.setString(1, timing_id.toString());
-        if (constructor_time != null)
-            ps.setLong(2, constructor_time.longValue());
-        else
-            ps.setNull(2, Types.BIGINT);
-        if (open_time != null)
-            ps.setLong(3, open_time.longValue());
-        else
-            ps.setNull(3, Types.BIGINT);
-        if (next_time != null)
-            ps.setLong(4, next_time.longValue());
-        else
-            ps.setNull(4, Types.BIGINT);
-        if (close_time != null)
-            ps.setLong(5, close_time.longValue());
-        else
-            ps.setNull(5, Types.BIGINT);
-        if (execute_time != null)
-            ps.setLong(6, execute_time.longValue());
-        else
-            ps.setNull(6, Types.BIGINT);
-        if (avg_next_time_per_row != null)
-            ps.setLong(7, avg_next_time_per_row.longValue());
-        else
-            ps.setNull(7, Types.BIGINT);
-        if (projection_time != null)
-            ps.setLong(8, projection_time.longValue());
-        else
-            ps.setNull(8, Types.BIGINT);
-        if (restriction_time != null)
-            ps.setLong(9, restriction_time.longValue());
-        else
-            ps.setNull(9, Types.BIGINT);
-        if (temp_cong_create_time != null)
-            ps.setLong(10, temp_cong_create_time.longValue());
-        else
-            ps.setNull(10, Types.BIGINT);
-        if (temp_cong_fetch_time != null)
-            ps.setLong(11, temp_cong_fetch_time.longValue());
-        else
-            ps.setNull(11, Types.BIGINT);
+        ps.setObject(2, constructor_time, Types.BIGINT);
+        ps.setObject(3, open_time, Types.BIGINT);
+        ps.setObject(4, next_time, Types.BIGINT);
+        ps.setObject(5, close_time, Types.BIGINT);
+        ps.setObject(6, execute_time, Types.BIGINT);
+        ps.setObject(7, avg_next_time_per_row, Types.BIGINT);
+        ps.setObject(8, projection_time, Types.BIGINT);
+        ps.setObject(9, restriction_time, Types.BIGINT);
+        ps.setObject(10, temp_cong_create_time, Types.BIGINT);
+        ps.setObject(11, temp_cong_fetch_time, Types.BIGINT);
     }
 
     public String getCatalogName() { return TABLENAME_STRING; }

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/XPLAINScanPropsDescriptor.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/XPLAINScanPropsDescriptor.java?rev=1518534&r1=1518533&r2=1518534&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/XPLAINScanPropsDescriptor.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/XPLAINScanPropsDescriptor.java
Thu Aug 29 08:01:56 2013
@@ -105,44 +105,20 @@ public class XPLAINScanPropsDescriptor e
         ps.setString(3, scan_object_type);
         ps.setString(4, scan_type);
         ps.setString(5, isolation_level);
-        if (no_visited_pages != null)
-            ps.setInt(6, no_visited_pages.intValue());
-        else
-            ps.setNull(6, Types.INTEGER);
-        if (no_visited_rows != null)
-            ps.setInt(7, no_visited_rows.intValue());
-        else
-            ps.setNull(7, Types.INTEGER);
-        if (no_qualified_rows != null)
-            ps.setInt(8, no_qualified_rows.intValue());
-        else
-            ps.setNull(8, Types.INTEGER);
-        if (no_visited_deleted_rows != null)
-            ps.setInt(9, no_visited_deleted_rows.intValue());
-        else
-            ps.setNull(9, Types.INTEGER);
-        if (no_fetched_columns != null)
-            ps.setInt(10, no_fetched_columns.intValue());
-        else
-            ps.setNull(10, Types.INTEGER);
+        ps.setObject(6, no_visited_pages, Types.INTEGER);
+        ps.setObject(7, no_visited_rows, Types.INTEGER);
+        ps.setObject(8, no_qualified_rows, Types.INTEGER);
+        ps.setObject(9, no_visited_deleted_rows, Types.INTEGER);
+        ps.setObject(10, no_fetched_columns, Types.INTEGER);
         ps.setString(11, bitset_of_fetched_columns);
-        if (btree_height != null)
-            ps.setInt(12, btree_height.intValue());
-        else
-            ps.setNull(12, Types.INTEGER);
-        if (fetch_size != null)
-            ps.setInt(13, fetch_size.intValue());
-        else
-            ps.setNull(13, Types.INTEGER);
+        ps.setObject(12, btree_height, Types.INTEGER);
+        ps.setObject(13, fetch_size, Types.INTEGER);
         ps.setString(14, start_position);
         ps.setString(15, stop_position);
         ps.setString(16, scan_qualifiers);
         ps.setString(17, next_qualifiers);
         ps.setString(18, hash_key_column_numbers);
-        if (hash_table_size != null)
-            ps.setInt(19, hash_table_size.intValue());
-        else
-            ps.setNull(19, Types.INTEGER);
+        ps.setObject(19, hash_table_size, Types.INTEGER);
     }
 
     public void setScan_type(String scan_type) {

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/XPLAINSortPropsDescriptor.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/XPLAINSortPropsDescriptor.java?rev=1518534&r1=1518533&r2=1518534&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/XPLAINSortPropsDescriptor.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/XPLAINSortPropsDescriptor.java
Thu Aug 29 08:01:56 2013
@@ -76,18 +76,9 @@ public class XPLAINSortPropsDescriptor e
     {
         ps.setString(1, sort_rs_id.toString());
         ps.setString(2, sort_type);
-        if (no_input_rows != null)
-            ps.setInt(3, no_input_rows.intValue());
-        else
-            ps.setNull(3, Types.INTEGER);
-        if (no_output_rows != null)
-            ps.setInt(4, no_output_rows.intValue());
-        else
-            ps.setNull(4, Types.INTEGER);
-        if (no_merge_runs != null)
-            ps.setInt(5, no_merge_runs.intValue());
-        else
-            ps.setNull(5, Types.INTEGER);
+        ps.setObject(3, no_input_rows, Types.INTEGER);
+        ps.setObject(4, no_output_rows, Types.INTEGER);
+        ps.setObject(5, no_merge_runs, Types.INTEGER);
         ps.setString(6, merge_run_details);
         ps.setString(7, eliminate_dups);
         ps.setString(8, in_sort_order);

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/XPLAINStatementTimingsDescriptor.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/XPLAINStatementTimingsDescriptor.java?rev=1518534&r1=1518533&r2=1518534&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/XPLAINStatementTimingsDescriptor.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/XPLAINStatementTimingsDescriptor.java
Thu Aug 29 08:01:56 2013
@@ -28,7 +28,6 @@ import java.sql.Types;
 
 import org.apache.derby.catalog.UUID;
 import org.apache.derby.iapi.sql.dictionary.SystemColumn;
-import org.apache.derby.impl.sql.catalog.SystemColumnImpl;
 import org.apache.derby.iapi.types.DataTypeUtilities;
 
 public class XPLAINStatementTimingsDescriptor extends XPLAINTableDescriptor 
@@ -79,30 +78,12 @@ public class XPLAINStatementTimingsDescr
         throws SQLException
     {
         ps.setString(1, timing_id.toString());
-        if (parse_time != null)
-            ps.setLong(2, parse_time.longValue());
-        else
-            ps.setNull(2, Types.BIGINT);
-        if (bind_time != null)
-            ps.setLong(3, bind_time.longValue());
-        else
-            ps.setNull(3, Types.BIGINT);
-        if (optimize_time != null)
-            ps.setLong(4, optimize_time.longValue());
-        else
-            ps.setNull(4, Types.BIGINT);
-        if (generate_time != null)
-            ps.setLong(5, generate_time.longValue());
-        else
-            ps.setNull(5, Types.BIGINT);
-        if (compile_time != null)
-            ps.setLong(6, compile_time.longValue());
-        else
-            ps.setNull(6, Types.BIGINT);
-        if (execute_time != null)
-            ps.setLong(7, execute_time.longValue());
-        else
-            ps.setNull(7, Types.BIGINT);
+        ps.setObject(2, parse_time, Types.BIGINT);
+        ps.setObject(3, bind_time, Types.BIGINT);
+        ps.setObject(4, optimize_time, Types.BIGINT);
+        ps.setObject(5, generate_time, Types.BIGINT);
+        ps.setObject(6, compile_time, Types.BIGINT);
+        ps.setObject(7, execute_time, Types.BIGINT);
         ps.setTimestamp(8, begin_comp_time);
         ps.setTimestamp(9, end_comp_time);
         ps.setTimestamp(10, begin_exe_time);



Mime
View raw message