empire-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From doeb...@apache.org
Subject svn commit: r810686 - in /incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire/db: DBQuery.java DBTable.java DBView.java
Date Wed, 02 Sep 2009 19:49:55 GMT
Author: doebele
Date: Wed Sep  2 19:49:54 2009
New Revision: 810686

URL: http://svn.apache.org/viewvc?rev=810686&view=rev
Log:
EMPIREDB-49

Modified:
    incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/DBQuery.java
    incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/DBTable.java
    incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/DBView.java

Modified: incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/DBQuery.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/DBQuery.java?rev=810686&r1=810685&r2=810686&view=diff
==============================================================================
--- incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/DBQuery.java (original)
+++ incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/DBQuery.java Wed
Sep  2 19:49:54 2009
@@ -22,6 +22,7 @@
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
+import java.util.concurrent.atomic.AtomicInteger;
 
 import org.apache.empire.commons.Errors;
 import org.apache.empire.commons.ObjectUtils;
@@ -137,7 +138,7 @@
         }
     }
 
-    private static int        queryCount   = 1;
+    private static AtomicInteger queryCount = new AtomicInteger(0);
 
     protected DBCommand       cmd;
     protected DBColumn[]      keyColumns = null;
@@ -166,8 +167,7 @@
         // Set the key Column
         this.keyColumns = keyColumns;
         // set alias
-        this.alias = "q" + String.valueOf(queryCount);
-        queryCount++;
+        this.alias = "q" + String.valueOf(queryCount.incrementAndGet());
     }
 
     /**

Modified: incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/DBTable.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/DBTable.java?rev=810686&r1=810685&r2=810686&view=diff
==============================================================================
--- incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/DBTable.java (original)
+++ incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/DBTable.java Wed
Sep  2 19:49:54 2009
@@ -23,6 +23,7 @@
 import java.sql.Connection;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.concurrent.atomic.AtomicInteger;
 
 import org.apache.empire.commons.Errors;
 import org.apache.empire.data.DataType;
@@ -37,7 +38,7 @@
  */
 public class DBTable extends DBRowSet implements Cloneable
 {
-    private static int     tableCount    = 1;
+    private static AtomicInteger tableCount  = new AtomicInteger(0);
     private final String   name;
     private String         alias;
     private List<DBIndex>  indexes       = new ArrayList<DBIndex>();
@@ -56,8 +57,7 @@
         super(db);
         // init
         this.name = name;
-        this.alias = "t" + String.valueOf(tableCount);
-        tableCount++;
+        this.alias = "t" + String.valueOf(tableCount.incrementAndGet());
         // Add Table to Database
         if (db != null)
             db.addTable(this);
@@ -126,8 +126,7 @@
                 }
             }
             // set new alias
-            clone.alias = "t" + String.valueOf(tableCount);
-            tableCount++;
+            clone.alias = "t" + String.valueOf(tableCount.incrementAndGet());
             // done
             log.info("clone: Table " + name + " cloned! Alias old=" + alias + " new=" + clone.alias);
             return clone;

Modified: incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/DBView.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/DBView.java?rev=810686&r1=810685&r2=810686&view=diff
==============================================================================
--- incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/DBView.java (original)
+++ incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/DBView.java Wed
Sep  2 19:49:54 2009
@@ -19,6 +19,7 @@
 package org.apache.empire.db;
 
 import java.sql.Connection;
+import java.util.concurrent.atomic.AtomicInteger;
 
 import org.apache.empire.commons.Errors;
 import org.apache.empire.commons.Options;
@@ -160,7 +161,7 @@
 
     }
 
-    private static int viewCount = 1;
+    private static AtomicInteger viewCount = new AtomicInteger(0);
 
     private String     name;
     private String     alias;
@@ -182,9 +183,8 @@
             db.addView(this);
         // Set Name and Alias
         this.name = name;
-        this.alias = "v" + String.valueOf(viewCount);
+        this.alias = "v" + String.valueOf(viewCount.incrementAndGet());
         this.updateable = isUpdateable;
-        viewCount++;
     }
 
     /**



Mime
View raw message