empire-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From doeb...@apache.org
Subject empire-db git commit: EMPIREDB-238 allow to modify the value of a DBValueExpr
Date Wed, 24 Feb 2016 13:40:23 GMT
Repository: empire-db
Updated Branches:
  refs/heads/master d511fc0c2 -> 9fd060de8


EMPIREDB-238
allow to modify the value of a DBValueExpr


Project: http://git-wip-us.apache.org/repos/asf/empire-db/repo
Commit: http://git-wip-us.apache.org/repos/asf/empire-db/commit/9fd060de
Tree: http://git-wip-us.apache.org/repos/asf/empire-db/tree/9fd060de
Diff: http://git-wip-us.apache.org/repos/asf/empire-db/diff/9fd060de

Branch: refs/heads/master
Commit: 9fd060de868512322fc11f01c3a59068f3a932e6
Parents: d511fc0
Author: Rainer Döbele <doebele@apache.org>
Authored: Wed Feb 24 14:40:17 2016 +0100
Committer: Rainer Döbele <doebele@apache.org>
Committed: Wed Feb 24 14:40:17 2016 +0100

----------------------------------------------------------------------
 .../main/java/org/apache/empire/db/DBQuery.java | 20 ++++++++++++++++-
 .../empire/db/expr/column/DBValueExpr.java      | 23 ++++++++++++++++++--
 2 files changed, 40 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/empire-db/blob/9fd060de/empire-db/src/main/java/org/apache/empire/db/DBQuery.java
----------------------------------------------------------------------
diff --git a/empire-db/src/main/java/org/apache/empire/db/DBQuery.java b/empire-db/src/main/java/org/apache/empire/db/DBQuery.java
index a5ef238..d638979 100644
--- a/empire-db/src/main/java/org/apache/empire/db/DBQuery.java
+++ b/empire-db/src/main/java/org/apache/empire/db/DBQuery.java
@@ -26,6 +26,7 @@ import java.util.concurrent.atomic.AtomicInteger;
 
 import org.apache.empire.commons.ObjectUtils;
 import org.apache.empire.commons.Options;
+import org.apache.empire.commons.StringUtils;
 import org.apache.empire.data.DataType;
 import org.apache.empire.db.DBCmdParam;
 import org.apache.empire.db.exceptions.InvalidKeyException;
@@ -278,7 +279,7 @@ public class DBQuery extends DBRowSet
      * specified DBColumnExpr object.
      * 
      * @param expr the DBColumnExpr object
-     * @return the located column (only DBViewColumn onjects)
+     * @return the located column
      */
     public DBQueryColumn findQueryColumn(DBColumnExpr expr)
     {
@@ -290,6 +291,23 @@ public class DBQuery extends DBRowSet
         // not found
         return null;
     }
+    
+    /**
+     * This function searchs for a query column by name
+     * 
+     * @param the column name
+     * @return the located column
+     */
+    public DBQueryColumn findQueryColumn(String name)
+    {
+        for (int i = 0; i < queryColumns.length; i++)
+        {
+            if (StringUtils.compareEqual(queryColumns[i].getName(), name, true))
+                return queryColumns[i];
+        }
+        // not found
+        return null;
+    }
 
     /**
      * return query key columns

http://git-wip-us.apache.org/repos/asf/empire-db/blob/9fd060de/empire-db/src/main/java/org/apache/empire/db/expr/column/DBValueExpr.java
----------------------------------------------------------------------
diff --git a/empire-db/src/main/java/org/apache/empire/db/expr/column/DBValueExpr.java b/empire-db/src/main/java/org/apache/empire/db/expr/column/DBValueExpr.java
index 9a5f37e..1947df6 100644
--- a/empire-db/src/main/java/org/apache/empire/db/expr/column/DBValueExpr.java
+++ b/empire-db/src/main/java/org/apache/empire/db/expr/column/DBValueExpr.java
@@ -43,9 +43,10 @@ public class DBValueExpr extends DBColumnExpr
     private final static long serialVersionUID = 1L;
   
     public final DBDatabase   db;
-    public final Object       value;
     public final DataType     type;
     public final DBColumnExpr column;
+    // the underlying value
+    protected Object          value;
 
     /**
      * Constructs a new DBValueExpr object.
@@ -57,9 +58,9 @@ public class DBValueExpr extends DBColumnExpr
     public DBValueExpr(DBDatabase db, Object value, DataType type)
     {
         this.db = db;
-        this.value = value;
         this.type = type;
         this.column = null;
+        this.value = value;
     }
 
     /**
@@ -76,6 +77,24 @@ public class DBValueExpr extends DBColumnExpr
     }
 
     /**
+     * return the value associated with this value expression
+     * @return the current value
+     */
+    public Object getValue()
+    {
+        return value;
+    }
+
+    /**
+     * set the value associated with this value expression
+     * @param the value
+     */
+    public void setValue(Object value)
+    {
+        this.value = value;
+    }
+
+    /**
      * Returns the current DBDatabase object.
      * 
      * @return the current DBDatabase object


Mime
View raw message