empire-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From der...@apache.org
Subject empire-db git commit: Added Support for DELETE with JOIN via Multiple-Table Syntax
Date Thu, 21 Jul 2016 08:52:46 GMT
Repository: empire-db
Updated Branches:
  refs/heads/master a0c6a6f45 -> 335bfcc1f


Added Support for DELETE with JOIN via Multiple-Table Syntax

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

Branch: refs/heads/master
Commit: 335bfcc1fa4770c1427667011fc0f72a43f9e39d
Parents: a0c6a6f
Author: Jan Glaubitz <jan@glaubitz.org>
Authored: Thu Jul 21 10:47:10 2016 +0200
Committer: Jan Glaubitz <jan@glaubitz.org>
Committed: Thu Jul 21 10:47:10 2016 +0200

----------------------------------------------------------------------
 .../empire/db/mysql/DBDatabaseDriverMySQL.java  | 22 ++++++++++++++++++++
 1 file changed, 22 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/empire-db/blob/335bfcc1/empire-db/src/main/java/org/apache/empire/db/mysql/DBDatabaseDriverMySQL.java
----------------------------------------------------------------------
diff --git a/empire-db/src/main/java/org/apache/empire/db/mysql/DBDatabaseDriverMySQL.java
b/empire-db/src/main/java/org/apache/empire/db/mysql/DBDatabaseDriverMySQL.java
index 5da5611..e2517ab 100644
--- a/empire-db/src/main/java/org/apache/empire/db/mysql/DBDatabaseDriverMySQL.java
+++ b/empire-db/src/main/java/org/apache/empire/db/mysql/DBDatabaseDriverMySQL.java
@@ -99,6 +99,28 @@ public class DBDatabaseDriverMySQL extends DBDatabaseDriver
                 }    
             }
         }
+        
+        /**
+         * Creates an MySQL specific delete statement.
+         * @return the delete SQL-Command
+         */
+        @Override
+        public synchronized String getDelete(DBTable table)
+        {
+        	if (joins == null) {
+        		// Default
+        		return super.getDelete(table);
+        	}
+        	
+        	// DELETE with Multiple-Table Syntax
+        	// http://dev.mysql.com/doc/refman/5.7/en/delete.html
+            resetParamUsage();
+            StringBuilder buf = new StringBuilder("DELETE ");
+            buf.append(table.getAlias());
+            addFrom(buf);
+            addWhere(buf);
+            return buf.toString();
+        }
     }
     
     // Properties


Mime
View raw message