EMPIREDB-238
new overrides for DBQuery constructor
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 @@
}
/**
+ * 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.
*
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 @@
*
* @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 @@
// 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 @@
* 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