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: EMPIREDB-247
Date Fri, 19 Aug 2016 11:19:02 GMT
Repository: empire-db
Updated Branches:
  refs/heads/EMPIREDB-247 7a41de0a6 -> 9452199b9


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/9452199b
Tree: http://git-wip-us.apache.org/repos/asf/empire-db/tree/9452199b
Diff: http://git-wip-us.apache.org/repos/asf/empire-db/diff/9452199b

Branch: refs/heads/EMPIREDB-247
Commit: 9452199b95241720a693181de57b478cfdc787f7
Parents: 7a41de0
Author: Jan Glaubitz <jan@glaubitz.org>
Authored: Fri Aug 19 13:18:36 2016 +0200
Committer: Jan Glaubitz <jan@glaubitz.org>
Committed: Fri Aug 19 13:18:36 2016 +0200

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


http://git-wip-us.apache.org/repos/asf/empire-db/blob/9452199b/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