db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhille...@apache.org
Subject svn commit: r1438600 - in /db/derby/code/trunk/java/engine/org/apache/derby: iapi/jdbc/ iapi/sql/ impl/jdbc/ impl/sql/execute/
Date Fri, 25 Jan 2013 17:26:55 GMT
Author: rhillegas
Date: Fri Jan 25 17:26:55 2013
New Revision: 1438600

URL: http://svn.apache.org/viewvc?rev=1438600&view=rev
Log:
DERBY-6000: Add new JDBC 4.2 Statement.executeLargeUpdate() methods to the embeddeded JDBC
3.0 implementation.

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredStatement.java
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/EngineStatement.java
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/ResultSet.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedPreparedStatement.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedStatement.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/BasicNoPutResultSetImpl.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/DMLWriteResultSet.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/DeleteResultSet.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/InsertResultSet.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/NoRowsResultSetImpl.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/RealResultSetStatisticsFactory.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/TemporaryRowHolderResultSet.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/UpdateResultSet.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredStatement.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredStatement.java?rev=1438600&r1=1438599&r2=1438600&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredStatement.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredStatement.java Fri
Jan 25 17:26:55 2013
@@ -618,4 +618,27 @@ public class BrokeredStatement implement
         return ((EngineStatement) getStatement()).isCloseOnCompletion();
     }
     
+    ////////////////////////////////////////////////////////////////////
+    //
+    // INTRODUCED BY JDBC 4.2 IN JAVA 8
+    //
+    ////////////////////////////////////////////////////////////////////
+
+    public  long executeLargeUpdate( String sql ) throws SQLException
+    {
+        return ((EngineStatement) getStatement()).executeLargeUpdate( sql );
+    }
+    public  long executeLargeUpdate( String sql, int autoGeneratedKeys) throws SQLException
+    {
+        return ((EngineStatement) getStatement()).executeLargeUpdate( sql, autoGeneratedKeys
);
+    }
+    public  long executeLargeUpdate( String sql, int[] columnIndexes ) throws SQLException
+    {
+        return ((EngineStatement) getStatement()).executeLargeUpdate( sql, columnIndexes
);
+    }
+    public  long executeLargeUpdate( String sql, String[] columnNames ) throws SQLException
+    {
+        return ((EngineStatement) getStatement()).executeLargeUpdate( sql, columnNames );
+    }
+
 }

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/EngineStatement.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/EngineStatement.java?rev=1438600&r1=1438599&r2=1438600&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/EngineStatement.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/EngineStatement.java Fri Jan
25 17:26:55 2013
@@ -61,4 +61,15 @@ public interface EngineStatement extends
     public  void    closeOnCompletion() throws SQLException;
     public  boolean isCloseOnCompletion() throws SQLException;
     
+    ////////////////////////////////////////////////////////////////////
+    //
+    // INTRODUCED BY JDBC 4.2 IN JAVA 8
+    //
+    ////////////////////////////////////////////////////////////////////
+
+    public  long executeLargeUpdate( String sql ) throws SQLException;
+    public  long executeLargeUpdate( String sql, int autoGeneratedKeys) throws SQLException;
+    public  long executeLargeUpdate( String sql, int[] columnIndexes ) throws SQLException;
+    public  long executeLargeUpdate( String sql, String[] columnNames ) throws SQLException;
+
 }

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/ResultSet.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/ResultSet.java?rev=1438600&r1=1438599&r2=1438600&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/ResultSet.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/ResultSet.java Fri Jan 25 17:26:55
2013
@@ -83,7 +83,7 @@ public interface ResultSet
 	 *
 	 * @return	The number of rows affect by the statement, so far.
 	 */
-	int	modifiedRowCount();
+	long	modifiedRowCount();
 
 	/**
 	 * Returns a ResultDescription object, which describes the results

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedPreparedStatement.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedPreparedStatement.java?rev=1438600&r1=1438599&r2=1438600&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedPreparedStatement.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedPreparedStatement.java
Fri Jan 25 17:26:55 2013
@@ -312,7 +312,7 @@ public class EmbedPreparedStatement
             } catch(SQLException sqle) {
                 checkStatementValidity(sqle);
             }
-            return updateCount;
+            return (int) updateCount;
         }
 
     /**

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedStatement.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedStatement.java?rev=1438600&r1=1438599&r2=1438600&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedStatement.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedStatement.java Fri Jan
25 17:26:55 2013
@@ -75,7 +75,7 @@ public class EmbedStatement extends Conn
      */
     protected EngineStatement applicationStatement;
 
-	int updateCount = -1;
+	long updateCount = -1;
 	EmbedResultSet results;
 	//for jdbc3.0 feature, where you can get a resultset of rows inserted
 	//for auto generated columns after an insert
@@ -176,6 +176,17 @@ public class EmbedStatement extends Conn
      */
 	public int executeUpdate(String sql) throws SQLException
 	{
+		return (int) executeLargeUpdate( sql );
+	}
+
+    /**
+     * JDBC 4.2
+     *
+     * Execute a SQL INSERT, UPDATE or DELETE statement. For use with
+     * statements which may touch more than Integer.MAX_VALUE rows.
+     */
+	public long executeLargeUpdate(String sql) throws SQLException
+	{
 		execute(sql, false, true, Statement.NO_GENERATED_KEYS, null, null);
 		return updateCount;
 	}
@@ -198,7 +209,20 @@ public class EmbedStatement extends Conn
      */
 	public int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException
 	{
-		execute(sql, false, true, autoGeneratedKeys, null, null);
+		return (int) executeLargeUpdate( sql, autoGeneratedKeys );
+	}
+
+    /**
+     * JDBC 4.2
+     *
+     * Execute the given SQL statement and signals the driver with the given flag
+     * about whether the auto-generated keys produced by this Statement object
+     * should be made available for retrieval. For use with
+     * statements which may touch more than Integer.MAX_VALUE rows.
+     */
+	public long executeLargeUpdate( String sql, int autoGeneratedKeys ) throws SQLException
+	{
+		execute( sql, false, true, autoGeneratedKeys, null, null );
 		return updateCount;
 	}
 
@@ -220,6 +244,20 @@ public class EmbedStatement extends Conn
      */
 	public int executeUpdate(String sql, int[] columnIndexes) throws SQLException
 	{
+		return (int) executeLargeUpdate( sql, columnIndexes );
+	}
+
+    /**
+     * JDBC 4.2
+     *
+     * Executes the given SQL statement and signals the driver that the
+     * auto-generated keys indicated in the given array should be made
+     * available for retrieval. The driver will ignore the array if the SQL
+     * statement is not an INSERT statement. For use with
+     * statements which may touch more than Integer.MAX_VALUE rows.
+     */
+	public long executeLargeUpdate( String sql, int[] columnIndexes ) throws SQLException
+	{
 		execute(sql, false, true,
 			((columnIndexes == null) || (columnIndexes.length == 0))
 				? Statement.NO_GENERATED_KEYS
@@ -247,6 +285,20 @@ public class EmbedStatement extends Conn
      */
 	public int executeUpdate(String sql, String[] columnNames) throws SQLException
 	{
+		return (int) executeLargeUpdate( sql, columnNames );
+	}
+
+    /**
+     * JDBC 4.2
+     *
+     * Executes the given SQL statement and signals the driver that the
+     * auto-generated keys indicated in the given array should be made
+     * available for retrieval. The driver will ignore the array if the SQL
+     * statement is not an INSERT statement. For use with
+     * statements which may touch more than Integer.MAX_VALUE rows.
+     */
+	public long executeLargeUpdate(String sql, String[] columnNames) throws SQLException
+	{
 		execute(sql, false, true,
 			((columnNames == null) || (columnNames.length == 0))
 				? Statement.NO_GENERATED_KEYS
@@ -745,7 +797,7 @@ public class EmbedStatement extends Conn
      */
 	public final int getUpdateCount()	throws SQLException  {
 		checkStatus();
-		return updateCount;
+		return (int) updateCount;
 	}
 
     /**
@@ -1109,7 +1161,7 @@ public class EmbedStatement extends Conn
 				throw se;
 			}
 
-			updateCount = -1;
+			updateCount = -1L;
 
 			while (++currentDynamicResultSet < dynamicResults.length) {
 
@@ -1264,7 +1316,7 @@ public class EmbedStatement extends Conn
 					if (a.isSingleExecution())
 						lresults.singleUseActivation = a;
 
-					updateCount = -1;
+					updateCount = -1L;
 					retval = true;
 				}
 				else {
@@ -1508,7 +1560,7 @@ public class EmbedStatement extends Conn
 			  requests.  There is no close method on database statement objects.
 		*/
 
-		updateCount = -1; // reset field
+		updateCount = -1L; // reset field
 
 		if (sqle != null)
 			throw sqle;
@@ -1620,7 +1672,7 @@ public class EmbedStatement extends Conn
 			}
 
 
-			updateCount = -1;
+			updateCount = -1L;
 			results = sorted[0];
 			currentDynamicResultSet = 0;
 

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/BasicNoPutResultSetImpl.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/BasicNoPutResultSetImpl.java?rev=1438600&r1=1438599&r2=1438600&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/BasicNoPutResultSetImpl.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/BasicNoPutResultSetImpl.java
Fri Jan 25 17:26:55 2013
@@ -584,7 +584,7 @@ implements NoPutResultSet
 	 */
 	 public boolean	returnsRows() { return true; }
 
-	public final int	modifiedRowCount() { return 0; }
+	public final long	modifiedRowCount() { return 0; }
 
 	/**
      * Clean up on error

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/DMLWriteResultSet.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/DMLWriteResultSet.java?rev=1438600&r1=1438599&r2=1438600&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/DMLWriteResultSet.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/DMLWriteResultSet.java
Fri Jan 25 17:26:55 2013
@@ -55,7 +55,7 @@ abstract class DMLWriteResultSet extends
 	private boolean needToObjectifyStream;
 
 
-	public int rowCount;
+	public long rowCount;
 
 
 	/**
@@ -112,7 +112,7 @@ abstract class DMLWriteResultSet extends
 		needToObjectifyStream = (this.constantAction.getTriggerInfo() != null);
 	}
 
-	public final int	modifiedRowCount() { return rowCount; }
+	public final long	modifiedRowCount() { return rowCount; }
 
 
 	/**

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/DeleteResultSet.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/DeleteResultSet.java?rev=1438600&r1=1438599&r2=1438600&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/DeleteResultSet.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/DeleteResultSet.java
Fri Jan 25 17:26:55 2013
@@ -250,7 +250,7 @@ class DeleteResultSet extends DMLWriteRe
 			activation.clearIndexScanInfo();
 		}
 
-        rowCount = 0;
+        rowCount = 0L;
         if(!cascadeDelete)
 			row = getNextRowCore(source);
 

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/InsertResultSet.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/InsertResultSet.java?rev=1438600&r1=1438599&r2=1438600&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/InsertResultSet.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/InsertResultSet.java
Fri Jan 25 17:26:55 2013
@@ -422,7 +422,7 @@ class InsertResultSet extends DMLWriteRe
 			else  if (activation.getAutoGeneratedKeysColumnNames() != null)
 				verifyAutoGeneratedColumnsNames(activation.getAutoGeneratedKeysColumnNames());
 		}
-		rowCount = 0;
+		rowCount = 0L;
 
 		if (numOpens++ == 0)
 		{
@@ -1364,7 +1364,7 @@ class InsertResultSet extends DMLWriteRe
 		}
 
 		// Find out how many rows were inserted
-		rowCount = (int) loadedRowCount[0];
+		rowCount = loadedRowCount[0];
 
 		// Set the "estimated" row count
 		setEstimatedRowCount(newHeapConglom);

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/NoRowsResultSetImpl.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/NoRowsResultSetImpl.java?rev=1438600&r1=1438599&r2=1438600&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/NoRowsResultSetImpl.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/NoRowsResultSetImpl.java
Fri Jan 25 17:26:55 2013
@@ -127,7 +127,7 @@ abstract class NoRowsResultSetImpl imple
 	/**
 	 * Returns zero.
 	 */
-	public int	modifiedRowCount() { return 0; }
+	public long	modifiedRowCount() { return 0L; }
 
 	/**
 	 * Returns null.

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/RealResultSetStatisticsFactory.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/RealResultSetStatisticsFactory.java?rev=1438600&r1=1438599&r2=1438600&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/RealResultSetStatisticsFactory.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/RealResultSetStatisticsFactory.java
Fri Jan 25 17:26:55 2013
@@ -243,7 +243,7 @@ public class RealResultSetStatisticsFact
 			InsertResultSet irs = (InsertResultSet) rs;
 
 			retval = new RealInsertResultSetStatistics(
-									irs.rowCount,
+                                    (int) irs.rowCount,
 									irs.constants.deferred,
 									irs.constants.irgs.length,
 									irs.userSpecifiedBulkInsert,
@@ -261,7 +261,7 @@ public class RealResultSetStatisticsFact
 			InsertVTIResultSet iVTIrs = (InsertVTIResultSet) rs;
 
 			retval = new RealInsertVTIResultSetStatistics(
-									iVTIrs.rowCount,
+                                    (int) iVTIrs.rowCount,
 									iVTIrs.constants.deferred,
 									iVTIrs.getExecuteTime(), 
 									getResultSetStatistics(iVTIrs.savedSource)
@@ -274,7 +274,7 @@ public class RealResultSetStatisticsFact
 			UpdateResultSet urs = (UpdateResultSet) rs;
 
 			retval = new RealUpdateResultSetStatistics(
-									urs.rowCount,
+                                    (int) urs.rowCount,
 									urs.constants.deferred,
 									urs.constants.irgs.length,
 									urs.constants.lockMode ==
@@ -310,7 +310,7 @@ public class RealResultSetStatisticsFact
 			}
 
 			retval = new RealDeleteCascadeResultSetStatistics(
-									dcrs.rowCount,
+                                    (int) dcrs.rowCount,
 									dcrs.constants.deferred,
 									dcrs.constants.irgs.length,
 									dcrs.constants.lockMode ==
@@ -327,7 +327,7 @@ public class RealResultSetStatisticsFact
 			DeleteResultSet drs = (DeleteResultSet) rs;
 
 			retval = new RealDeleteResultSetStatistics(
-									drs.rowCount,
+									(int) drs.rowCount,
 									drs.constants.deferred,
 									drs.constants.irgs.length,
 									drs.constants.lockMode ==
@@ -343,7 +343,7 @@ public class RealResultSetStatisticsFact
 			DeleteVTIResultSet dVTIrs = (DeleteVTIResultSet) rs;
 
 			retval = new RealDeleteVTIResultSetStatistics(
-									dVTIrs.rowCount,
+									(int) dVTIrs.rowCount,
 									dVTIrs.getExecuteTime(), 
 									getResultSetStatistics(dVTIrs.savedSource)
 									);

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/TemporaryRowHolderResultSet.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/TemporaryRowHolderResultSet.java?rev=1438600&r1=1438599&r2=1438600&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/TemporaryRowHolderResultSet.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/TemporaryRowHolderResultSet.java
Fri Jan 25 17:26:55 2013
@@ -769,7 +769,7 @@ class TemporaryRowHolderResultSet implem
 		return true;
 	}
 
-	public int modifiedRowCount() { return 0;};
+	public long modifiedRowCount() { return 0L;};
 
 	/**
 	 * Returns a ResultDescription object, which describes the results

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/UpdateResultSet.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/UpdateResultSet.java?rev=1438600&r1=1438599&r2=1438600&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/UpdateResultSet.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/UpdateResultSet.java
Fri Jan 25 17:26:55 2013
@@ -300,7 +300,7 @@ class UpdateResultSet extends DMLWriteRe
 
 		boolean firstOpen = (rowChanger == null);
 
-		rowCount = 0;
+		rowCount = 0L;
 		
 		/* Cache query plan text for source, before it gets blown away */
 		if (lcc.getRunTimeStatisticsMode())



Mime
View raw message