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
Copy file name to clipboardExpand all lines: community/flamingock-auditstore-sql/src/main/java/io/flamingock/community/sql/internal/SqlAuditorDialectHelper.java
+27-22Lines changed: 27 additions & 22 deletions
Original file line number
Diff line number
Diff line change
@@ -138,28 +138,33 @@ public String getCreateTableSqlString(String tableName) {
138
138
")'; EXCEPTION WHEN OTHERS THEN IF SQLCODE != -955 THEN RAISE; END IF; END;", tableName, getAutoIncrementType(), getClobType(), getBigIntType(), getClobType(), getBooleanType(), getBooleanType());
139
139
caseDB2:
140
140
returnString.format(
141
-
"CREATE TABLE %s (" +
142
-
"id %s PRIMARY KEY, " +
143
-
"execution_id VARCHAR(255), " +
144
-
"stage_id VARCHAR(255), " +
145
-
"task_id VARCHAR(255), " +
146
-
"author VARCHAR(255), " +
147
-
"created_at TIMESTAMP DEFAULT CURRENT TIMESTAMP, " +
Copy file name to clipboardExpand all lines: community/flamingock-auditstore-sql/src/main/java/io/flamingock/community/sql/internal/SqlLockDialectHelper.java
+46-10Lines changed: 46 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -78,12 +78,14 @@ public String getCreateTableSqlString(String tableName) {
78
78
")'; EXCEPTION WHEN OTHERS THEN IF SQLCODE != -955 THEN RAISE; END IF; END;", tableName);
79
79
caseDB2:
80
80
returnString.format(
81
-
"CREATE TABLE %s (" +
82
-
"\"key\" VARCHAR(255) PRIMARY KEY," +
83
-
"status VARCHAR(32)," +
84
-
"owner VARCHAR(255)," +
85
-
"expires_at TIMESTAMP" +
86
-
")", tableName);
81
+
"BEGIN " +
82
+
"DECLARE CONTINUE HANDLER FOR SQLSTATE '42710' BEGIN END; " +
83
+
"EXECUTE IMMEDIATE 'CREATE TABLE %s (" +
84
+
"lock_key VARCHAR(255) NOT NULL PRIMARY KEY, " +
85
+
"status VARCHAR(32), " +
86
+
"owner VARCHAR(255), " +
87
+
"expires_at TIMESTAMP)'; " +
88
+
"END", tableName);
87
89
default:
88
90
thrownewUnsupportedOperationException("Dialect not supported for CREATE TABLE: " + sqlDialect.name());
89
91
}
@@ -93,6 +95,9 @@ public String getSelectLockSqlString(String tableName) {
93
95
switch (sqlDialect) {
94
96
casePOSTGRESQL:
95
97
returnString.format("SELECT \"key\", status, owner, expires_at FROM %s WHERE \"key\" = ?", tableName);
98
+
caseDB2:
99
+
// Select lock_key as the first column (getLockEntry expects rs.getString(1) to be the key)
100
+
returnString.format("SELECT lock_key, status, owner, expires_at FROM %s WHERE lock_key = ?", tableName);
96
101
caseSQLSERVER:
97
102
caseSYBASE:
98
103
returnString.format("SELECT [key], status, owner, expires_at FROM %s WITH (UPDLOCK, ROWLOCK) WHERE [key] = ?", tableName);
@@ -145,12 +150,13 @@ public String getInsertOrUpdateLockSqlString(String tableName) {
Copy file name to clipboardExpand all lines: community/flamingock-auditstore-sql/src/main/java/io/flamingock/community/sql/internal/SqlLockService.java
0 commit comments