empire-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From doeb...@apache.org
Subject svn commit: r1298281 - in /empire-db/trunk/empire-db/src/main/java/org/apache/empire/db: DBDatabase.java DBTable.java DBView.java
Date Thu, 08 Mar 2012 07:26:29 GMT
Author: doebele
Date: Thu Mar  8 07:26:29 2012
New Revision: 1298281

URL: http://svn.apache.org/viewvc?rev=1298281&view=rev
Log:
EMPIREDB-126
code consistency

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

Modified: empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/DBDatabase.java
URL: http://svn.apache.org/viewvc/empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/DBDatabase.java?rev=1298281&r1=1298280&r2=1298281&view=diff
==============================================================================
--- empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/DBDatabase.java (original)
+++ empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/DBDatabase.java Thu Mar 
8 07:26:29 2012
@@ -424,7 +424,7 @@ public abstract class DBDatabase extends
      * <P> 
      * @param table the DBTable object
      */
-    void addTable(DBTable table)
+    protected void addTable(DBTable table)
     { // find column by name
         if (table == null || table.getDatabase() != this)
             throw new InvalidArgumentException("table", table);
@@ -561,7 +561,7 @@ public abstract class DBDatabase extends
      * <P> 
      * @param view the DBView object
      */
-    void addView(DBView view)
+    protected void addView(DBView view)
     { // find column by name
         if (view == null || view.getDatabase() != this)
             throw new InvalidArgumentException("view", view);

Modified: empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/DBTable.java
URL: http://svn.apache.org/viewvc/empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/DBTable.java?rev=1298281&r1=1298280&r2=1298281&view=diff
==============================================================================
--- empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/DBTable.java (original)
+++ empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/DBTable.java Thu Mar  8 07:26:29
2012
@@ -179,7 +179,7 @@ public class DBTable extends DBRowSet im
      * 
      * @param column a column object
      */
-    protected DBTableColumn addColumn(DBTableColumn column)
+    protected void addColumn(DBTableColumn column)
     { // find column by name
         if (column==null || column.getRowSet()!=this)
             throw new InvalidArgumentException("column", column);
@@ -187,7 +187,6 @@ public class DBTable extends DBRowSet im
             throw new ItemExistsException(column.getName());
         // add now
         columns.add(column);
-        return column;
     }
 
     /**

Modified: empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/DBView.java
URL: http://svn.apache.org/viewvc/empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/DBView.java?rev=1298281&r1=1298280&r2=1298281&view=diff
==============================================================================
--- empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/DBView.java (original)
+++ empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/DBView.java Thu Mar  8 07:26:29
2012
@@ -60,6 +60,9 @@ public abstract class DBView extends DBR
             this.expr = expr;
             // Update Column
             this.updateColumn = expr.getUpdateColumn();
+            // Add to view
+            if (view != null)
+                view.addColumn(this);
         }
 
         public DBColumnExpr getSourceColumnExpr()
@@ -285,7 +288,7 @@ public abstract class DBView extends DBR
      * @param col a view column object
      * @return true if the column was successfully added or false otherwise
      */
-    protected DBViewColumn addColumn(DBViewColumn col)
+    protected void addColumn(DBViewColumn col)
     { // find column by name
         if (col == null || col.getRowSet() != this)
             throw new InvalidArgumentException("col", col);
@@ -293,7 +296,6 @@ public abstract class DBView extends DBR
             throw new ItemExistsException(col.getName());
         // add now
         columns.add(col);
-        return col;
     }
 
     /**
@@ -305,9 +307,7 @@ public abstract class DBView extends DBR
      */
     protected final DBViewColumn addColumn(String columnName, DataType dataType)
     { // find column by name
-        DBViewColumn vc = new DBViewColumn(this, columnName, new DBValueExpr(db, null, dataType));
-        addColumn(vc);
-        return vc;
+        return new DBViewColumn(this, columnName, new DBValueExpr(db, null, dataType));
     }
 
     /**
@@ -319,9 +319,7 @@ public abstract class DBView extends DBR
      */
     protected final DBViewColumn addColumn(String columnName, DBColumnExpr columnExpr)
     { // find column by name
-        DBViewColumn vc = new DBViewColumn(this, columnName, columnExpr);
-        addColumn(vc);
-        return vc;
+        return new DBViewColumn(this, columnName, columnExpr);
     }
 
     /**
@@ -332,9 +330,7 @@ public abstract class DBView extends DBR
      */
     protected final DBViewColumn addColumn(DBTableColumn sourceColumn)
     { // find column by name
-        DBViewColumn vc = new DBViewColumn(this, sourceColumn.getName(), sourceColumn);
-        addColumn(vc);
-        return vc;
+        return new DBViewColumn(this, sourceColumn.getName(), sourceColumn);
     }
 
     /**



Mime
View raw message