You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
returnString.format("DELETE FROM %s WHERE task_id = ?", tableName);
39
+
}
40
+
41
+
publicStringgetMarkSqlString(StringtableName) {
42
+
switch (sqlDialect) {
43
+
caseMYSQL:
44
+
caseMARIADB:
45
+
returnString.format(
46
+
"INSERT INTO %s (task_id, operation) VALUES (?, ?) ON DUPLICATE KEY UPDATE operation = VALUES(operation)",
47
+
tableName);
48
+
casePOSTGRESQL:
49
+
returnString.format(
50
+
"INSERT INTO %s (task_id, operation) VALUES (?, ?) ON CONFLICT (task_id) DO UPDATE SET operation = EXCLUDED.operation",
51
+
tableName);
52
+
caseSQLITE:
53
+
returnString.format(
54
+
"INSERT OR REPLACE INTO %s (task_id, operation) VALUES (?, ?)",
55
+
tableName);
56
+
caseSQLSERVER:
57
+
caseSYBASE:
58
+
returnString.format(
59
+
"MERGE INTO %s AS target USING (SELECT ? AS task_id, ? AS operation) AS source ON (target.task_id = source.task_id) " +
60
+
"WHEN MATCHED THEN UPDATE SET operation = source.operation WHEN NOT MATCHED THEN INSERT (task_id, operation) VALUES (source.task_id, source.operation);",
61
+
tableName);
62
+
caseORACLE:
63
+
returnString.format(
64
+
"MERGE INTO %s t USING (SELECT ? AS task_id, ? AS operation FROM dual) s ON (t.task_id = s.task_id) " +
65
+
"WHEN MATCHED THEN UPDATE SET t.operation = s.operation WHEN NOT MATCHED THEN INSERT (task_id, operation) VALUES (s.task_id, s.operation)",
66
+
tableName);
67
+
caseDB2:
68
+
returnString.format(
69
+
"MERGE INTO %s USING (SELECT ? AS task_id, ? AS operation FROM SYSIBM.SYSDUMMY1) AS src ON (%s.task_id = src.task_id) " +
70
+
"WHEN MATCHED THEN UPDATE SET operation = src.operation WHEN NOT MATCHED THEN INSERT (task_id, operation) VALUES (src.task_id, src.operation)",
71
+
tableName, tableName);
72
+
caseFIREBIRD:
73
+
returnString.format(
74
+
"UPDATE OR INSERT INTO %s (task_id, operation) VALUES (?, ?) MATCHING (task_id)",
75
+
tableName);
76
+
caseH2:
77
+
caseHSQLDB:
78
+
caseDERBY:
79
+
returnString.format(
80
+
"MERGE INTO %s (task_id, operation) KEY (task_id) VALUES (?, ?)",
81
+
tableName);
82
+
caseINFORMIX:
83
+
returnString.format(
84
+
"INSERT INTO %s (task_id, operation) VALUES (?, ?) ON DUPLICATE KEY UPDATE operation = ?",
85
+
tableName);
86
+
default:
87
+
thrownewUnsupportedOperationException("Dialect not supported for upsert: " + sqlDialect.name());
Copy file name to clipboardExpand all lines: core/target-systems/sql-target-system/src/main/java/io/flamingock/targetsystem/sql/SqlTargetSystemAuditMarker.java
+20-15Lines changed: 20 additions & 15 deletions
Original file line number
Diff line number
Diff line change
@@ -13,9 +13,10 @@
13
13
* See the License for the specific language governing permissions and
Copy file name to clipboardExpand all lines: core/target-systems/sql-target-system/src/test/java/io/flamingock/targetsystem/sql/PipelineTestHelper.java
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,7 @@
13
13
* See the License for the specific language governing permissions and
0 commit comments