empire-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From der...@apache.org
Subject [12/14] empire-db git commit: EMPIREDB-247
Date Wed, 09 Nov 2016 10:59:19 GMT
EMPIREDB-247

- added Support for DBCmdParam

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

Branch: refs/heads/EMPIREDB-247
Commit: 16c3111cab83b9eccc0ce300acc23b57bc7309c1
Parents: 3e27a77
Author: Jan Glaubitz <jan@glaubitz.org>
Authored: Fri Aug 19 13:18:36 2016 +0200
Committer: Jan Glaubitz <jan@glaubitz.org>
Committed: Wed Nov 9 11:56:53 2016 +0100

----------------------------------------------------------------------
 .../empire/db/mysql/DBDatabaseDriverMySQL.java       | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/empire-db/blob/16c3111c/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 a02f7d8..dfc7aba 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
@@ -125,10 +125,21 @@ public class DBDatabaseDriverMySQL extends DBDatabaseDriver
         @Override
         public synchronized String getUpdateOrInsert()
         {
+        	// Start with SELECT
         	StringBuilder buf = new StringBuilder(getInsert());
+        	// Add
         	buf.append(" ON DUPLICATE KEY UPDATE ");
-            long context = CTX_NAME | CTX_VALUE;
-            addListExpr(buf, set, context, ", ");
+    		for (int i = 0; i < this.set.size(); i++)
+    		{
+    			if (i > 0)
+    			{
+    				buf.append(", ");
+    			}
+    			buf.append(this.set.get(i).getColumn().getName());
+    			buf.append("=VALUES(");
+    			buf.append(this.set.get(i).getColumn().getName());
+    			buf.append(")");
+    		}
         	return buf.toString();
         }
         


Mime
View raw message