db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d..@apache.org
Subject svn commit: r516076 - /db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedResultSet.java
Date Thu, 08 Mar 2007 15:39:20 GMT
Author: djd
Date: Thu Mar  8 07:39:19 2007
New Revision: 516076

URL: http://svn.apache.org/viewvc?view=rev&rev=516076
Log:
Minor cleanup in EmebedResultSet to fetch the lcc once in insert/update/deleteRow.

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedResultSet.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedResultSet.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedResultSet.java?view=diff&rev=516076&r1=516075&r2=516076
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedResultSet.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedResultSet.java Thu Mar
 8 07:39:19 2007
@@ -3592,7 +3592,7 @@
         synchronized (getConnectionSynchronization()) {
             checksBeforeInsert();
             setupContextStack();
-            LanguageConnectionContext lcc = null;
+            LanguageConnectionContext lcc = getEmbedConnection().getLanguageConnection();
             StatementContext statementContext = null;
             try {
                 /*
@@ -3607,8 +3607,7 @@
                 boolean foundOneColumnAlready = false;
                 StringBuffer insertSQL = new StringBuffer("INSERT INTO ");
                 StringBuffer valuesSQL = new StringBuffer("VALUES (");
-                CursorActivation activation = getEmbedConnection().
-                        getLanguageConnection().lookupCursorActivation(getCursorName());
+                CursorActivation activation = lcc.lookupCursorActivation(getCursorName());
 
                 ExecCursorTableReference targetTable = 
                         activation.getPreparedStatement().getTargetTable();
@@ -3639,8 +3638,6 @@
                 valuesSQL.append(") ");
                 insertSQL.append(valuesSQL);
 
-                lcc = getEmbedConnection().getLanguageConnection();
-
                 // Context used for preparing, don't set any timeout (use 0)
                 statementContext = lcc.pushStatementContext(
                         isAtomic, 
@@ -3698,7 +3695,7 @@
         checkNotOnInsertRow();
         
         setupContextStack();
-        LanguageConnectionContext lcc = null;
+        LanguageConnectionContext lcc = getEmbedConnection().getLanguageConnection();
         StatementContext statementContext = null;
         try {
             if (currentRowHasBeenUpdated == false) //nothing got updated on this row 
@@ -3707,7 +3704,7 @@
             //now construct the update where current of sql
             boolean foundOneColumnAlready = false;
             StringBuffer updateWhereCurrentOfSQL = new StringBuffer("UPDATE ");
-            CursorActivation activation = getEmbedConnection().getLanguageConnection().lookupCursorActivation(getCursorName());
+            CursorActivation activation = lcc.lookupCursorActivation(getCursorName());
 
 
             ExecCursorTableReference targetTable = activation.getPreparedStatement().getTargetTable();
@@ -3728,7 +3725,6 @@
             //using quotes around the cursor name to preserve case sensitivity
             updateWhereCurrentOfSQL.append(" WHERE CURRENT OF " + 
                     quoteSqlIdentifier(getCursorName()));
-            lcc = getEmbedConnection().getLanguageConnection();
 
             // Context used for preparing, don't set any timeout (use 0)
             statementContext = lcc.pushStatementContext(isAtomic, false, updateWhereCurrentOfSQL.toString(),
null, false, 0L);
@@ -3785,19 +3781,17 @@
 
             setupContextStack();
             
-            LanguageConnectionContext lcc = null;
+            LanguageConnectionContext lcc = getEmbedConnection().getLanguageConnection();
             StatementContext statementContext = null;
             
             //now construct the delete where current of sql
             try {
                 StringBuffer deleteWhereCurrentOfSQL = new StringBuffer("DELETE FROM ");
-                CursorActivation activation = getEmbedConnection().getLanguageConnection().lookupCursorActivation(getCursorName());
+                CursorActivation activation = lcc.lookupCursorActivation(getCursorName());
                 deleteWhereCurrentOfSQL.append(getFullBaseTableName(activation.getPreparedStatement().getTargetTable()));//get
the underlying (schema.)table name
                 //using quotes around the cursor name to preserve case sensitivity
                 deleteWhereCurrentOfSQL.append(" WHERE CURRENT OF " + 
                         quoteSqlIdentifier(getCursorName()));
-
-                lcc = getEmbedConnection().getLanguageConnection();
                 
                 // Context used for preparing, don't set any timeout (use 0)
                 statementContext = lcc.pushStatementContext(isAtomic, false, deleteWhereCurrentOfSQL.toString(),
null, false, 0L);



Mime
View raw message