You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by kr...@apache.org on 2012/05/15 12:12:14 UTC

svn commit: r1338618 - /db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java

Author: kristwaa
Date: Tue May 15 10:12:13 2012
New Revision: 1338618

URL: http://svn.apache.org/viewvc?rev=1338618&view=rev
Log:
DERBY-5746: Minor refactoring of DataDictionaryImpl.getSetAutoincrementValue

Dropped unused return value from the fetch-call.
Moved the instantiation/delcaration/modification of the bit set inside the code
block where it is actually used.

Patch file: derby-5746-1a-minor_refactoring.diff


Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java?rev=1338618&r1=1338617&r2=1338618&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java Tue May 15 10:12:13 2012
@@ -8843,9 +8843,6 @@ public final class	DataDictionaryImpl
 											boolean wait)
 	       throws StandardException
 	{
-
-		FormatableBitSet columnToUpdate = new 
-  			FormatableBitSet(SYSCOLUMNSRowFactory.SYSCOLUMNS_COLUMN_COUNT);
   		int columnNum = SYSCOLUMNSRowFactory.SYSCOLUMNS_AUTOINCREMENTVALUE;
 		TabInfoImpl ti = coreInfo[SYSCOLUMNS_CORE_NUM];
   		ConglomerateController heapCC = null;
@@ -8875,10 +8872,8 @@ public final class	DataDictionaryImpl
                     TransactionController.MODE_RECORD,
                     TransactionController.ISOLATION_REPEATABLE_READ);
 
-            boolean baseRowExists = 
-                heapCC.fetch(rl, row.getRowArray(), columnToRead, wait);
-
-            columnToUpdate.set(columnNum - 1); // current value.
+            // fetch the current value
+            heapCC.fetch(rl, row.getRowArray(), columnToRead, wait);
 
             // while the Row interface is 1 based.
             NumberDataValue currentAI = (NumberDataValue)row.getColumn(columnNum);
@@ -8886,10 +8881,15 @@ public final class	DataDictionaryImpl
             
             if (doUpdate)
             {
-                // we increment and store the new value in SYSCOLUMNS
+                // increment the value
                 NumberDataValue increment = (NumberDataValue)row.getColumn(columnNum + 2);
                 currentAI = currentAI.plus(currentAI, increment, currentAI);
                 row.setColumn(columnNum, currentAI);
+
+                // store the new value in SYSCOLUMNS
+                FormatableBitSet columnToUpdate = new FormatableBitSet(
+                    SYSCOLUMNSRowFactory.SYSCOLUMNS_COLUMN_COUNT);
+                columnToUpdate.set(columnNum - 1); // current value.
                 heapCC.replace(rl, row.getRowArray(), columnToUpdate);
             }