You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@empire-db.apache.org by do...@apache.org on 2016/03/12 19:00:51 UTC
empire-db git commit: EMPIREDB-238 new overrides for DBQuery
constructor
Repository: empire-db
Updated Branches:
refs/heads/master 59db7a5b0 -> d3dd3fa18
EMPIREDB-238
new overrides for DBQuery constructor
Project: http://git-wip-us.apache.org/repos/asf/empire-db/repo
Commit: http://git-wip-us.apache.org/repos/asf/empire-db/commit/d3dd3fa1
Tree: http://git-wip-us.apache.org/repos/asf/empire-db/tree/d3dd3fa1
Diff: http://git-wip-us.apache.org/repos/asf/empire-db/diff/d3dd3fa1
Branch: refs/heads/master
Commit: d3dd3fa184b834913f2ae6146be14e2748c39a7d
Parents: 59db7a5
Author: Rainer Döbele <do...@esteam.de>
Authored: Sat Mar 12 19:00:36 2016 +0100
Committer: Rainer Döbele <do...@esteam.de>
Committed: Sat Mar 12 19:00:36 2016 +0100
----------------------------------------------------------------------
.../java/org/apache/empire/db/DBColumnExpr.java | 20 ++++++++++
.../main/java/org/apache/empire/db/DBQuery.java | 41 +++++++++++++++++++-
2 files changed, 59 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/empire-db/blob/d3dd3fa1/empire-db/src/main/java/org/apache/empire/db/DBColumnExpr.java
----------------------------------------------------------------------
diff --git a/empire-db/src/main/java/org/apache/empire/db/DBColumnExpr.java b/empire-db/src/main/java/org/apache/empire/db/DBColumnExpr.java
index 0deef0f..c3a583f 100644
--- a/empire-db/src/main/java/org/apache/empire/db/DBColumnExpr.java
+++ b/empire-db/src/main/java/org/apache/empire/db/DBColumnExpr.java
@@ -869,6 +869,26 @@ public abstract class DBColumnExpr extends DBExpr
}
/**
+ * Create and returns an expression for the SQL-function floor()
+ *
+ * @return the new DBFuncExpr object
+ */
+ public DBColumnExpr floor()
+ {
+ return getExprFromPhrase(DBDatabaseDriver.SQL_FUNC_FLOOR, null, getUpdateColumn(), false);
+ }
+
+ /**
+ * Create and returns an expression for the SQL-function ceil()
+ *
+ * @return the new DBFuncExpr object
+ */
+ public DBColumnExpr ceiling()
+ {
+ return getExprFromPhrase(DBDatabaseDriver.SQL_FUNC_CEILING, null, getUpdateColumn(), false);
+ }
+
+ /**
* Creates and returns an function object that
* rounds a number espression with the given decimals.
*
http://git-wip-us.apache.org/repos/asf/empire-db/blob/d3dd3fa1/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 d638979..db0dbe6 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
@@ -174,8 +174,9 @@ public class DBQuery extends DBRowSet
*
* @param cmd the SQL-Command
* @param keyColumns an array of the primary key columns
+ * @param the query alias
*/
- public DBQuery(DBCommandExpr cmd, DBColumn[] keyColumns)
+ public DBQuery(DBCommandExpr cmd, DBColumn[] keyColumns, String alias)
{ // Set the column expressions
super(cmd.getDatabase());
this.cmdExpr = cmd;
@@ -190,10 +191,35 @@ public class DBQuery extends DBRowSet
// Set the key Column
this.keyColumns = keyColumns;
// set alias
- this.alias = "q" + String.valueOf(queryCount.incrementAndGet());
+ this.alias = alias;
}
/**
+ * Constructor initializes the query object.
+ * Saves the columns and the primary keys of this query.
+ *
+ * @param cmd the SQL-Command
+ * @param keyColumns an array of the primary key columns
+ */
+ public DBQuery(DBCommandExpr cmd, DBColumn[] keyColumns)
+ { // Set the column expressions
+ this(cmd, keyColumns, "q" + String.valueOf(queryCount.incrementAndGet()));
+ }
+
+ /**
+ * Constructs a new DBQuery object initialize the query object.
+ * Save the columns and the primary key of this query.
+ *
+ * @param cmd the SQL-Command
+ * @param keyColumn the primary key column
+ * @param the query alias
+ */
+ public DBQuery(DBCommandExpr cmd, DBColumn keyColumn, String alias)
+ { // Set the column expressions
+ this(cmd, new DBColumn[] { keyColumn }, alias);
+ }
+
+ /**
* Constructs a new DBQuery object initialize the query object.
* Save the columns and the primary key of this query.
*
@@ -209,6 +235,17 @@ public class DBQuery extends DBRowSet
* Creaes a DBQuery object from a given command object.
*
* @param cmd the command object representing an SQL-Command.
+ * @param the query alias
+ */
+ public DBQuery(DBCommandExpr cmd, String alias)
+ { // Set the column expressions
+ this(cmd, (DBColumn[]) null, alias);
+ }
+
+ /**
+ * Creaes a DBQuery object from a given command object.
+ *
+ * @param cmd the command object representing an SQL-Command.
*/
public DBQuery(DBCommandExpr cmd)
{ // Set the column expressions