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-226 added missing checks
Date Fri, 11 Sep 2015 13:51:36 GMT
Repository: empire-db
Updated Branches:
  refs/heads/master 1336b1068 -> fd1adb557


EMPIREDB-226
added missing checks


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

Branch: refs/heads/master
Commit: fd1adb557aec8b129ad59cba1aa347a189a41482
Parents: 1336b10
Author: Rainer Döbele <doebele@apache.org>
Authored: Fri Sep 11 15:51:32 2015 +0200
Committer: Rainer Döbele <doebele@apache.org>
Committed: Fri Sep 11 15:51:32 2015 +0200

----------------------------------------------------------------------
 .../src/main/java/org/apache/empire/db/DBCommand.java   | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/empire-db/blob/fd1adb55/empire-db/src/main/java/org/apache/empire/db/DBCommand.java
----------------------------------------------------------------------
diff --git a/empire-db/src/main/java/org/apache/empire/db/DBCommand.java b/empire-db/src/main/java/org/apache/empire/db/DBCommand.java
index d910063..746f1d7 100644
--- a/empire-db/src/main/java/org/apache/empire/db/DBCommand.java
+++ b/empire-db/src/main/java/org/apache/empire/db/DBCommand.java
@@ -982,7 +982,7 @@ public abstract class DBCommand extends DBCommandExpr
             return null;
         StringBuilder buf = new StringBuilder("UPDATE ");
         DBRowSet table =  set.get(0).getTable();
-        if ( joins!=null )
+        if (joins!=null && !joins.isEmpty())
         {   // Join Update
             buf.append( table.getAlias() );
             long context = CTX_DEFAULT;
@@ -1027,7 +1027,7 @@ public abstract class DBCommand extends DBCommandExpr
         buf.append("( ");
         // Set Expressions
         ArrayList<DBCompareColExpr> compexpr = null;
-        if (where != null)
+        if (where!=null && !where.isEmpty())
         {   // Convert ColumnExpression List to Column List
             compexpr = new ArrayList<DBCompareColExpr>(where.size());
             for (DBCompareExpr expr : where)
@@ -1079,7 +1079,7 @@ public abstract class DBCommand extends DBCommandExpr
         StringBuilder buf = new StringBuilder("DELETE FROM ");
         table.addSQL(buf, CTX_FULLNAME);
         // Set Expressions
-        if (where != null)
+        if (where!=null && !where.isEmpty())
         { // add where condition
             buf.append("\r\nWHERE ");
             if (where != null)
@@ -1167,12 +1167,12 @@ public abstract class DBCommand extends DBCommandExpr
 
     protected void addGrouping(StringBuilder buf)
     {
-        if (groupBy != null)
+        if (groupBy!=null && !groupBy.isEmpty())
         { // Having
             buf.append("\r\nGROUP BY ");
             addListExpr(buf, groupBy, CTX_DEFAULT, ", ");
         }
-        if (having != null)
+        if (having!=null && !having.isEmpty())
         { // Having
             buf.append("\r\nHAVING ");
             addListExpr(buf, having, CTX_DEFAULT, " AND ");
@@ -1181,7 +1181,7 @@ public abstract class DBCommand extends DBCommandExpr
 
     protected void addOrder(StringBuilder buf)
     {
-        if (orderBy != null)
+        if (orderBy!=null && !orderBy.isEmpty())
         { // order By
             buf.append("\r\nORDER BY ");
             addListExpr(buf, orderBy, CTX_DEFAULT, ", ");


Mime
View raw message