From c5be9cf1cf1249ffa4f3ce85d7b4617c28dcc579 Mon Sep 17 00:00:00 2001 From: liuqiufeng <775038282@qq.com> Date: Sat, 11 Nov 2023 19:57:13 +0800 Subject: [PATCH 1/8] support openGuass and GuassDB --- .../java/io/seata/common/util/PageUtil.java | 2 + .../java/io/seata/core/constants/DBType.java | 7 ++- .../db/sql/lock/GaussDBLockStoreSql.java | 28 ++++++++++ .../store/db/sql/log/GaussDBLogStoreSqls.java | 28 ++++++++++ ....seata.core.store.db.sql.lock.LockStoreSql | 3 +- ...o.seata.core.store.db.sql.log.LogStoreSqls | 3 +- dependencies/pom.xml | 8 ++- .../exec/gaussdb/GaussDBInsertExecutor.java | 45 +++++++++++++++ .../handler/gaussdb/GaussDBEscapeHandler.java | 30 ++++++++++ .../struct/cache/GaussDBTableMetaCache.java | 29 ++++++++++ .../gaussdb/GaussDBUndoDeleteExecutor.java | 37 +++++++++++++ .../gaussdb/GaussDBUndoExecutorHolder.java | 47 ++++++++++++++++ .../gaussdb/GaussDBUndoInsertExecutor.java | 37 +++++++++++++ .../undo/gaussdb/GaussDBUndoLogManager.java | 29 ++++++++++ .../gaussdb/GaussDBUndoUpdateExecutor.java | 37 +++++++++++++ ...io.seata.rm.datasource.exec.InsertExecutor | 3 +- ...eata.rm.datasource.undo.UndoExecutorHolder | 3 +- ...io.seata.rm.datasource.undo.UndoLogManager | 3 +- .../services/io.seata.sqlparser.EscapeHandler | 3 +- .../io.seata.sqlparser.struct.TableMetaCache | 3 +- script/server/db/postgresql.sql | 10 ++-- server/pom.xml | 4 ++ .../seata/sqlparser/util/JdbcConstants.java | 2 + .../gaussdb/GaussDBDeleteRecognizer.java | 38 +++++++++++++ .../gaussdb/GaussDBInsertRecognizer.java | 38 +++++++++++++ .../GaussDBOperateRecognizerHolder.java | 55 +++++++++++++++++++ .../GaussDBSelectForUpdateRecognizer.java | 38 +++++++++++++ .../gaussdb/GaussDBUpdateRecognizer.java | 38 +++++++++++++ ...sqlparser.druid.SQLOperateRecognizerHolder | 3 +- 29 files changed, 596 insertions(+), 15 deletions(-) create mode 100644 core/src/main/java/io/seata/core/store/db/sql/lock/GaussDBLockStoreSql.java create mode 100644 core/src/main/java/io/seata/core/store/db/sql/log/GaussDBLogStoreSqls.java create mode 100644 rm-datasource/src/main/java/io/seata/rm/datasource/exec/gaussdb/GaussDBInsertExecutor.java create mode 100644 rm-datasource/src/main/java/io/seata/rm/datasource/sql/handler/gaussdb/GaussDBEscapeHandler.java create mode 100644 rm-datasource/src/main/java/io/seata/rm/datasource/sql/struct/cache/GaussDBTableMetaCache.java create mode 100644 rm-datasource/src/main/java/io/seata/rm/datasource/undo/gaussdb/GaussDBUndoDeleteExecutor.java create mode 100644 rm-datasource/src/main/java/io/seata/rm/datasource/undo/gaussdb/GaussDBUndoExecutorHolder.java create mode 100644 rm-datasource/src/main/java/io/seata/rm/datasource/undo/gaussdb/GaussDBUndoInsertExecutor.java create mode 100644 rm-datasource/src/main/java/io/seata/rm/datasource/undo/gaussdb/GaussDBUndoLogManager.java create mode 100644 rm-datasource/src/main/java/io/seata/rm/datasource/undo/gaussdb/GaussDBUndoUpdateExecutor.java create mode 100644 sqlparser/seata-sqlparser-druid/src/main/java/io/seata/sqlparser/druid/gaussdb/GaussDBDeleteRecognizer.java create mode 100644 sqlparser/seata-sqlparser-druid/src/main/java/io/seata/sqlparser/druid/gaussdb/GaussDBInsertRecognizer.java create mode 100644 sqlparser/seata-sqlparser-druid/src/main/java/io/seata/sqlparser/druid/gaussdb/GaussDBOperateRecognizerHolder.java create mode 100644 sqlparser/seata-sqlparser-druid/src/main/java/io/seata/sqlparser/druid/gaussdb/GaussDBSelectForUpdateRecognizer.java create mode 100644 sqlparser/seata-sqlparser-druid/src/main/java/io/seata/sqlparser/druid/gaussdb/GaussDBUpdateRecognizer.java diff --git a/common/src/main/java/io/seata/common/util/PageUtil.java b/common/src/main/java/io/seata/common/util/PageUtil.java index 6e40c6dd67a..ea2a6b903dc 100644 --- a/common/src/main/java/io/seata/common/util/PageUtil.java +++ b/common/src/main/java/io/seata/common/util/PageUtil.java @@ -111,6 +111,7 @@ public static String pageSql(String sourceSql, String dbType, int pageNum, int p case "postgresql": case "oceanbase": case "dm": + case "gaussdb": return LIMIT_TEMPLATE.replace(SOURCE_SQL_PLACE_HOLD, sourceSql) .replace(LIMIT_PLACE_HOLD, String.valueOf(pageSize)) .replace(OFFSET_PLACE_HOLD, String.valueOf((pageNum - 1) * pageSize)); @@ -144,6 +145,7 @@ public static String countSql(String sourceSql, String dbType) { return sourceSql.replaceAll("(?i)(?<=select)(.*)(?=from)", " count(1) "); case "postgresql": case "sqlserver": + case "gaussdb": int lastIndexOfOrderBy = sourceSql.toLowerCase().lastIndexOf("order by"); if (lastIndexOfOrderBy != -1) { return sourceSql.substring(0, lastIndexOfOrderBy).replaceAll("(?i)(?<=select)(.*)(?=from)", " count(1) "); diff --git a/core/src/main/java/io/seata/core/constants/DBType.java b/core/src/main/java/io/seata/core/constants/DBType.java index 49063bb802e..6b618ddeae6 100644 --- a/core/src/main/java/io/seata/core/constants/DBType.java +++ b/core/src/main/java/io/seata/core/constants/DBType.java @@ -192,7 +192,12 @@ public enum DBType { /** * PolarDB db type. */ - POLARDB; + POLARDB, + + /** + * GaussDB db type. + */ + GAUSSDB; /** * Valueof db type. diff --git a/core/src/main/java/io/seata/core/store/db/sql/lock/GaussDBLockStoreSql.java b/core/src/main/java/io/seata/core/store/db/sql/lock/GaussDBLockStoreSql.java new file mode 100644 index 00000000000..21681f246c6 --- /dev/null +++ b/core/src/main/java/io/seata/core/store/db/sql/lock/GaussDBLockStoreSql.java @@ -0,0 +1,28 @@ +/* + * Copyright 1999-2019 Seata.io Group. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.seata.core.store.db.sql.lock; + +import io.seata.common.loader.LoadLevel; + +/** + * the database lock store GaussDB sql + * + * @author liuqiufeng + */ +@LoadLevel(name = "gaussdb") +public class GaussDBLockStoreSql extends PostgresqlLockStoreSql{ +} diff --git a/core/src/main/java/io/seata/core/store/db/sql/log/GaussDBLogStoreSqls.java b/core/src/main/java/io/seata/core/store/db/sql/log/GaussDBLogStoreSqls.java new file mode 100644 index 00000000000..0286674ed30 --- /dev/null +++ b/core/src/main/java/io/seata/core/store/db/sql/log/GaussDBLogStoreSqls.java @@ -0,0 +1,28 @@ +/* + * Copyright 1999-2019 Seata.io Group. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.seata.core.store.db.sql.log; + +import io.seata.common.loader.LoadLevel; + +/** + * Database log store GaussDB sql + * + * @author liuqiufeng + */ +@LoadLevel(name = "gaussdb") +public class GaussDBLogStoreSqls extends PostgresqlLogStoreSqls{ +} diff --git a/core/src/main/resources/META-INF/services/io.seata.core.store.db.sql.lock.LockStoreSql b/core/src/main/resources/META-INF/services/io.seata.core.store.db.sql.lock.LockStoreSql index 0e33fb2da14..806962c77f5 100644 --- a/core/src/main/resources/META-INF/services/io.seata.core.store.db.sql.lock.LockStoreSql +++ b/core/src/main/resources/META-INF/services/io.seata.core.store.db.sql.lock.LockStoreSql @@ -6,4 +6,5 @@ io.seata.core.store.db.sql.lock.H2LockStoreSql io.seata.core.store.db.sql.lock.SqlServerLockStoreSql io.seata.core.store.db.sql.lock.MariadbLockStoreSql io.seata.core.store.db.sql.lock.PolarDBXLockStoreSql -io.seata.core.store.db.sql.lock.DmLockStoreSql \ No newline at end of file +io.seata.core.store.db.sql.lock.DmLockStoreSql +io.seata.core.store.db.sql.lock.GaussDBLockStoreSql \ No newline at end of file diff --git a/core/src/main/resources/META-INF/services/io.seata.core.store.db.sql.log.LogStoreSqls b/core/src/main/resources/META-INF/services/io.seata.core.store.db.sql.log.LogStoreSqls index 758ddddc247..d0e6c82bfed 100644 --- a/core/src/main/resources/META-INF/services/io.seata.core.store.db.sql.log.LogStoreSqls +++ b/core/src/main/resources/META-INF/services/io.seata.core.store.db.sql.log.LogStoreSqls @@ -6,4 +6,5 @@ io.seata.core.store.db.sql.log.H2LogStoreSqls io.seata.core.store.db.sql.log.SqlServerLogStoreSqls io.seata.core.store.db.sql.log.MariadbLogStoreSqls io.seata.core.store.db.sql.log.PolarDBXLogStoreSqls -io.seata.core.store.db.sql.log.DmLogStoreSqls \ No newline at end of file +io.seata.core.store.db.sql.log.DmLogStoreSqls +io.seata.core.store.db.sql.log.GaussDBLogStoreSqls \ No newline at end of file diff --git a/dependencies/pom.xml b/dependencies/pom.xml index 4b3378be038..3fa401ca009 100644 --- a/dependencies/pom.xml +++ b/dependencies/pom.xml @@ -104,8 +104,9 @@ 42.3.3 1.4.181 2.7.2 + 5.0.0-og - 1.2.7 + 1.2.12 2.9.0 3.4.3 @@ -222,6 +223,11 @@ DmJdbcDriver18 ${dm.version} + + org.opengauss + opengauss-jdbc + ${opengauss.version} + org.mariadb.jdbc mariadb-java-client diff --git a/rm-datasource/src/main/java/io/seata/rm/datasource/exec/gaussdb/GaussDBInsertExecutor.java b/rm-datasource/src/main/java/io/seata/rm/datasource/exec/gaussdb/GaussDBInsertExecutor.java new file mode 100644 index 00000000000..a31b0833ce9 --- /dev/null +++ b/rm-datasource/src/main/java/io/seata/rm/datasource/exec/gaussdb/GaussDBInsertExecutor.java @@ -0,0 +1,45 @@ +/* + * Copyright 1999-2019 Seata.io Group. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.seata.rm.datasource.exec.gaussdb; + +import io.seata.common.loader.LoadLevel; +import io.seata.common.loader.Scope; +import io.seata.rm.datasource.StatementProxy; +import io.seata.rm.datasource.exec.StatementCallback; +import io.seata.rm.datasource.exec.postgresql.PostgresqlInsertExecutor; +import io.seata.sqlparser.SQLRecognizer; +import io.seata.sqlparser.util.JdbcConstants; + +/** + * The type GaussDB insert executor. + * + * @author liuqiufeng + */ +@LoadLevel(name = JdbcConstants.GAUSSDB, scope = Scope.PROTOTYPE) +public class GaussDBInsertExecutor extends PostgresqlInsertExecutor { + + /** + * Instantiates a new Abstract dml base executor. + * + * @param statementProxy the statement proxy + * @param statementCallback the statement callback + * @param sqlRecognizer the sql recognizer + */ + public GaussDBInsertExecutor(StatementProxy statementProxy, StatementCallback statementCallback, SQLRecognizer sqlRecognizer) { + super(statementProxy, statementCallback, sqlRecognizer); + } +} diff --git a/rm-datasource/src/main/java/io/seata/rm/datasource/sql/handler/gaussdb/GaussDBEscapeHandler.java b/rm-datasource/src/main/java/io/seata/rm/datasource/sql/handler/gaussdb/GaussDBEscapeHandler.java new file mode 100644 index 00000000000..2d049b0ff75 --- /dev/null +++ b/rm-datasource/src/main/java/io/seata/rm/datasource/sql/handler/gaussdb/GaussDBEscapeHandler.java @@ -0,0 +1,30 @@ +/* + * Copyright 1999-2019 Seata.io Group. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.seata.rm.datasource.sql.handler.gaussdb; + +import io.seata.common.loader.LoadLevel; +import io.seata.rm.datasource.sql.handler.postgresql.PostgresqlEscapeHandler; +import io.seata.sqlparser.util.JdbcConstants; + +/** + * The type GaussDB escape handler. + * + * @author liuqiufeng + */ +@LoadLevel(name = JdbcConstants.GAUSSDB) +public class GaussDBEscapeHandler extends PostgresqlEscapeHandler { +} diff --git a/rm-datasource/src/main/java/io/seata/rm/datasource/sql/struct/cache/GaussDBTableMetaCache.java b/rm-datasource/src/main/java/io/seata/rm/datasource/sql/struct/cache/GaussDBTableMetaCache.java new file mode 100644 index 00000000000..23e82ac3a34 --- /dev/null +++ b/rm-datasource/src/main/java/io/seata/rm/datasource/sql/struct/cache/GaussDBTableMetaCache.java @@ -0,0 +1,29 @@ +/* + * Copyright 1999-2019 Seata.io Group. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.seata.rm.datasource.sql.struct.cache; + +import io.seata.common.loader.LoadLevel; +import io.seata.sqlparser.util.JdbcConstants; + +/** + * The type Table meta cache. + * + * @author liuqiufeng + */ +@LoadLevel(name = JdbcConstants.GAUSSDB) +public class GaussDBTableMetaCache extends PostgresqlTableMetaCache{ +} diff --git a/rm-datasource/src/main/java/io/seata/rm/datasource/undo/gaussdb/GaussDBUndoDeleteExecutor.java b/rm-datasource/src/main/java/io/seata/rm/datasource/undo/gaussdb/GaussDBUndoDeleteExecutor.java new file mode 100644 index 00000000000..f4ad20e4b00 --- /dev/null +++ b/rm-datasource/src/main/java/io/seata/rm/datasource/undo/gaussdb/GaussDBUndoDeleteExecutor.java @@ -0,0 +1,37 @@ +/* + * Copyright 1999-2019 Seata.io Group. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.seata.rm.datasource.undo.gaussdb; + +import io.seata.rm.datasource.undo.SQLUndoLog; +import io.seata.rm.datasource.undo.postgresql.PostgresqlUndoDeleteExecutor; + +/** + * The type GaussDB undo delete executor. + * + * @author liuqiufeng + */ +public class GaussDBUndoDeleteExecutor extends PostgresqlUndoDeleteExecutor { + + /** + * Instantiates a new GaussDB undo delete executor. + * + * @param sqlUndoLog the sql undo log + */ + public GaussDBUndoDeleteExecutor(SQLUndoLog sqlUndoLog) { + super(sqlUndoLog); + } +} diff --git a/rm-datasource/src/main/java/io/seata/rm/datasource/undo/gaussdb/GaussDBUndoExecutorHolder.java b/rm-datasource/src/main/java/io/seata/rm/datasource/undo/gaussdb/GaussDBUndoExecutorHolder.java new file mode 100644 index 00000000000..aa9547c7bf0 --- /dev/null +++ b/rm-datasource/src/main/java/io/seata/rm/datasource/undo/gaussdb/GaussDBUndoExecutorHolder.java @@ -0,0 +1,47 @@ +/* + * Copyright 1999-2019 Seata.io Group. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.seata.rm.datasource.undo.gaussdb; + +import io.seata.common.loader.LoadLevel; +import io.seata.rm.datasource.undo.AbstractUndoExecutor; +import io.seata.rm.datasource.undo.SQLUndoLog; +import io.seata.rm.datasource.undo.UndoExecutorHolder; +import io.seata.sqlparser.util.JdbcConstants; + +/** + * Undo executor holder for GaussDB + * + * @author liuqiufeng + */ +@LoadLevel(name = JdbcConstants.GAUSSDB) +public class GaussDBUndoExecutorHolder implements UndoExecutorHolder { + + @Override + public AbstractUndoExecutor getInsertExecutor(SQLUndoLog sqlUndoLog) { + return new GaussDBUndoInsertExecutor(sqlUndoLog); + } + + @Override + public AbstractUndoExecutor getUpdateExecutor(SQLUndoLog sqlUndoLog) { + return new GaussDBUndoUpdateExecutor(sqlUndoLog); + } + + @Override + public AbstractUndoExecutor getDeleteExecutor(SQLUndoLog sqlUndoLog) { + return new GaussDBUndoDeleteExecutor(sqlUndoLog); + } +} diff --git a/rm-datasource/src/main/java/io/seata/rm/datasource/undo/gaussdb/GaussDBUndoInsertExecutor.java b/rm-datasource/src/main/java/io/seata/rm/datasource/undo/gaussdb/GaussDBUndoInsertExecutor.java new file mode 100644 index 00000000000..665dfd0082e --- /dev/null +++ b/rm-datasource/src/main/java/io/seata/rm/datasource/undo/gaussdb/GaussDBUndoInsertExecutor.java @@ -0,0 +1,37 @@ +/* + * Copyright 1999-2019 Seata.io Group. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.seata.rm.datasource.undo.gaussdb; + +import io.seata.rm.datasource.undo.SQLUndoLog; +import io.seata.rm.datasource.undo.postgresql.PostgresqlUndoInsertExecutor; + +/** + * The type GaussDB undo insert executor. + * + * @author liuqiufeng + */ +public class GaussDBUndoInsertExecutor extends PostgresqlUndoInsertExecutor { + + /** + * Instantiates a new GaussDB undo insert executor. + * + * @param sqlUndoLog the sql undo log + */ + public GaussDBUndoInsertExecutor(SQLUndoLog sqlUndoLog) { + super(sqlUndoLog); + } +} diff --git a/rm-datasource/src/main/java/io/seata/rm/datasource/undo/gaussdb/GaussDBUndoLogManager.java b/rm-datasource/src/main/java/io/seata/rm/datasource/undo/gaussdb/GaussDBUndoLogManager.java new file mode 100644 index 00000000000..2d62c0c6df8 --- /dev/null +++ b/rm-datasource/src/main/java/io/seata/rm/datasource/undo/gaussdb/GaussDBUndoLogManager.java @@ -0,0 +1,29 @@ +/* + * Copyright 1999-2019 Seata.io Group. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package io.seata.rm.datasource.undo.gaussdb; + +import io.seata.common.loader.LoadLevel; +import io.seata.rm.datasource.undo.postgresql.PostgresqlUndoLogManager; +import io.seata.sqlparser.util.JdbcConstants; + +/** + * Undo log manager for GaussDB + * + * @author liuqiufeng + */ +@LoadLevel(name = JdbcConstants.GAUSSDB) +public class GaussDBUndoLogManager extends PostgresqlUndoLogManager { +} diff --git a/rm-datasource/src/main/java/io/seata/rm/datasource/undo/gaussdb/GaussDBUndoUpdateExecutor.java b/rm-datasource/src/main/java/io/seata/rm/datasource/undo/gaussdb/GaussDBUndoUpdateExecutor.java new file mode 100644 index 00000000000..3b3c338d3c7 --- /dev/null +++ b/rm-datasource/src/main/java/io/seata/rm/datasource/undo/gaussdb/GaussDBUndoUpdateExecutor.java @@ -0,0 +1,37 @@ +/* + * Copyright 1999-2019 Seata.io Group. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.seata.rm.datasource.undo.gaussdb; + +import io.seata.rm.datasource.undo.SQLUndoLog; +import io.seata.rm.datasource.undo.postgresql.PostgresqlUndoUpdateExecutor; + +/** + * The type GaussDB undo update executor. + * + * @author liuqiufeng + */ +public class GaussDBUndoUpdateExecutor extends PostgresqlUndoUpdateExecutor { + + /** + * Instantiates a new GaussDB undo update executor. + * + * @param sqlUndoLog the sql undo log + */ + public GaussDBUndoUpdateExecutor(SQLUndoLog sqlUndoLog) { + super(sqlUndoLog); + } +} diff --git a/rm-datasource/src/main/resources/META-INF/services/io.seata.rm.datasource.exec.InsertExecutor b/rm-datasource/src/main/resources/META-INF/services/io.seata.rm.datasource.exec.InsertExecutor index fe4579afad5..566aa9c755c 100644 --- a/rm-datasource/src/main/resources/META-INF/services/io.seata.rm.datasource.exec.InsertExecutor +++ b/rm-datasource/src/main/resources/META-INF/services/io.seata.rm.datasource.exec.InsertExecutor @@ -4,4 +4,5 @@ io.seata.rm.datasource.exec.postgresql.PostgresqlInsertExecutor io.seata.rm.datasource.exec.sqlserver.SqlServerInsertExecutor io.seata.rm.datasource.exec.mariadb.MariadbInsertExecutor io.seata.rm.datasource.exec.polardbx.PolarDBXInsertExecutor -io.seata.rm.datasource.exec.dm.DmInsertExecutor \ No newline at end of file +io.seata.rm.datasource.exec.dm.DmInsertExecutor +io.seata.rm.datasource.exec.gaussdb.GaussDBInsertExecutor \ No newline at end of file diff --git a/rm-datasource/src/main/resources/META-INF/services/io.seata.rm.datasource.undo.UndoExecutorHolder b/rm-datasource/src/main/resources/META-INF/services/io.seata.rm.datasource.undo.UndoExecutorHolder index e608478ece9..83c1616672f 100644 --- a/rm-datasource/src/main/resources/META-INF/services/io.seata.rm.datasource.undo.UndoExecutorHolder +++ b/rm-datasource/src/main/resources/META-INF/services/io.seata.rm.datasource.undo.UndoExecutorHolder @@ -4,4 +4,5 @@ io.seata.rm.datasource.undo.postgresql.PostgresqlUndoExecutorHolder io.seata.rm.datasource.undo.sqlserver.SqlServerUndoExecutorHolder io.seata.rm.datasource.undo.mariadb.MariadbUndoExecutorHolder io.seata.rm.datasource.undo.polardbx.PolarDBXUndoExecutorHolder -io.seata.rm.datasource.undo.dm.DmUndoExecutorHolder \ No newline at end of file +io.seata.rm.datasource.undo.dm.DmUndoExecutorHolder +io.seata.rm.datasource.undo.gaussdb.GaussDBUndoExecutorHolder \ No newline at end of file diff --git a/rm-datasource/src/main/resources/META-INF/services/io.seata.rm.datasource.undo.UndoLogManager b/rm-datasource/src/main/resources/META-INF/services/io.seata.rm.datasource.undo.UndoLogManager index c3e813f1e72..0a38aef6e7d 100644 --- a/rm-datasource/src/main/resources/META-INF/services/io.seata.rm.datasource.undo.UndoLogManager +++ b/rm-datasource/src/main/resources/META-INF/services/io.seata.rm.datasource.undo.UndoLogManager @@ -4,4 +4,5 @@ io.seata.rm.datasource.undo.postgresql.PostgresqlUndoLogManager io.seata.rm.datasource.undo.sqlserver.SqlServerUndoLogManager io.seata.rm.datasource.undo.mariadb.MariadbUndoLogManager io.seata.rm.datasource.undo.polardbx.PolarDBXUndoLogManager -io.seata.rm.datasource.undo.dm.DmUndoLogManager \ No newline at end of file +io.seata.rm.datasource.undo.dm.DmUndoLogManager +io.seata.rm.datasource.undo.gaussdb.GaussDBUndoLogManager \ No newline at end of file diff --git a/rm-datasource/src/main/resources/META-INF/services/io.seata.sqlparser.EscapeHandler b/rm-datasource/src/main/resources/META-INF/services/io.seata.sqlparser.EscapeHandler index da68f82bd06..ed6da0e05ae 100644 --- a/rm-datasource/src/main/resources/META-INF/services/io.seata.sqlparser.EscapeHandler +++ b/rm-datasource/src/main/resources/META-INF/services/io.seata.sqlparser.EscapeHandler @@ -4,4 +4,5 @@ io.seata.rm.datasource.sql.handler.postgresql.PostgresqlEscapeHandler io.seata.rm.datasource.sql.handler.mariadb.MariadbEscapeHandler io.seata.rm.datasource.sql.handler.sqlserver.SqlServerEscapeHandler io.seata.rm.datasource.sql.handler.polardbx.PolarDBXEscapeHandler -io.seata.rm.datasource.sql.handler.dm.DmEscapeHandler \ No newline at end of file +io.seata.rm.datasource.sql.handler.dm.DmEscapeHandler +io.seata.rm.datasource.sql.handler.gaussdb.GaussDBEscapeHandler \ No newline at end of file diff --git a/rm-datasource/src/main/resources/META-INF/services/io.seata.sqlparser.struct.TableMetaCache b/rm-datasource/src/main/resources/META-INF/services/io.seata.sqlparser.struct.TableMetaCache index d1e6a194961..b204d41a836 100644 --- a/rm-datasource/src/main/resources/META-INF/services/io.seata.sqlparser.struct.TableMetaCache +++ b/rm-datasource/src/main/resources/META-INF/services/io.seata.sqlparser.struct.TableMetaCache @@ -4,4 +4,5 @@ io.seata.rm.datasource.sql.struct.cache.PostgresqlTableMetaCache io.seata.rm.datasource.sql.struct.cache.SqlServerTableMetaCache io.seata.rm.datasource.sql.struct.cache.MariadbTableMetaCache io.seata.rm.datasource.sql.struct.cache.PolarDBXTableMetaCache -io.seata.rm.datasource.sql.struct.cache.DmTableMetaCache \ No newline at end of file +io.seata.rm.datasource.sql.struct.cache.DmTableMetaCache +io.seata.rm.datasource.sql.struct.cache.GaussDBTableMetaCache \ No newline at end of file diff --git a/script/server/db/postgresql.sql b/script/server/db/postgresql.sql index f716f0dc6e3..9b47bbad714 100644 --- a/script/server/db/postgresql.sql +++ b/script/server/db/postgresql.sql @@ -59,14 +59,14 @@ CREATE INDEX idx_branch_id ON public.lock_table (branch_id); CREATE INDEX idx_xid ON public.lock_table (xid); CREATE INDEX idx_status ON public.lock_table (status); -CREATE TABLE distributed_lock ( +CREATE TABLE IF NOT EXISTS public.distributed_lock ( lock_key VARCHAR(20) NOT NULL, lock_value VARCHAR(20) NOT NULL, expire BIGINT NOT NULL, CONSTRAINT pk_distributed_lock_table PRIMARY KEY (lock_key) ); -INSERT INTO distributed_lock (lock_key, lock_value, expire) VALUES ('AsyncCommitting', ' ', 0); -INSERT INTO distributed_lock (lock_key, lock_value, expire) VALUES ('RetryCommitting', ' ', 0); -INSERT INTO distributed_lock (lock_key, lock_value, expire) VALUES ('RetryRollbacking', ' ', 0); -INSERT INTO distributed_lock (lock_key, lock_value, expire) VALUES ('TxTimeoutCheck', ' ', 0); +INSERT INTO public.distributed_lock (lock_key, lock_value, expire) VALUES ('AsyncCommitting', ' ', 0); +INSERT INTO public.distributed_lock (lock_key, lock_value, expire) VALUES ('RetryCommitting', ' ', 0); +INSERT INTO public.distributed_lock (lock_key, lock_value, expire) VALUES ('RetryRollbacking', ' ', 0); +INSERT INTO public.distributed_lock (lock_key, lock_value, expire) VALUES ('TxTimeoutCheck', ' ', 0); diff --git a/server/pom.xml b/server/pom.xml index 0e44ece71c4..b6ed81abe81 100644 --- a/server/pom.xml +++ b/server/pom.xml @@ -178,6 +178,10 @@ com.dameng DmJdbcDriver18 + + org.opengauss + opengauss-jdbc + ### feature: -- [[#PR_NO](https://github.com/seata/seata/pull/PR_NO)] A brief and accurate description of PR +- [[#6020](https://github.com/seata/seata/pull/6020)] support openGuass and GuassDB in AT mode ### bugfix: - [[#PR_NO](https://github.com/seata/seata/pull/PR_NO)] A brief and accurate description of PR @@ -22,5 +22,6 @@ Thanks to these contributors for their code commits. Please report an unintended - [slievrly](https://github.com/slievrly) - [imcmai](https://github.com/imcmai) +- [liuqiufeng](https://github.com/liuqiufeng) Also, we receive many valuable issues, questions and advices from our community. Thanks for you all. diff --git a/changes/zh-cn/2.x.md b/changes/zh-cn/2.x.md index f155efa1195..ca2a4a17fb2 100644 --- a/changes/zh-cn/2.x.md +++ b/changes/zh-cn/2.x.md @@ -3,7 +3,7 @@ ### feature: -- [[#PR_NO](https://github.com/seata/seata/pull/PR_NO)] 准确简要的PR描述 +- [[#6020](https://github.com/seata/seata/pull/6020)] AT模式下支持openGauss和GaussDB ### bugfix: - [[#PR_NO](https://github.com/seata/seata/pull/PR_NO)] 准确简要的PR描述 @@ -22,5 +22,6 @@ - [slievrly](https://github.com/slievrly) - [imcmai](https://github.com/imcmai) +- [liuqiufeng](https://github.com/liuqiufeng) 同时,我们收到了社区反馈的很多有价值的issue和建议,非常感谢大家。 diff --git a/core/src/main/java/io/seata/core/store/db/sql/lock/GaussDBLockStoreSql.java b/core/src/main/java/io/seata/core/store/db/sql/lock/GaussDBLockStoreSql.java index 21681f246c6..421d2d792a6 100644 --- a/core/src/main/java/io/seata/core/store/db/sql/lock/GaussDBLockStoreSql.java +++ b/core/src/main/java/io/seata/core/store/db/sql/lock/GaussDBLockStoreSql.java @@ -20,9 +20,9 @@ /** * the database lock store GaussDB sql - * + * * @author liuqiufeng */ @LoadLevel(name = "gaussdb") -public class GaussDBLockStoreSql extends PostgresqlLockStoreSql{ +public class GaussDBLockStoreSql extends PostgresqlLockStoreSql { } diff --git a/core/src/main/java/io/seata/core/store/db/sql/log/GaussDBLogStoreSqls.java b/core/src/main/java/io/seata/core/store/db/sql/log/GaussDBLogStoreSqls.java index 0286674ed30..4cd5e1f52dc 100644 --- a/core/src/main/java/io/seata/core/store/db/sql/log/GaussDBLogStoreSqls.java +++ b/core/src/main/java/io/seata/core/store/db/sql/log/GaussDBLogStoreSqls.java @@ -20,9 +20,9 @@ /** * Database log store GaussDB sql - * + * * @author liuqiufeng */ @LoadLevel(name = "gaussdb") -public class GaussDBLogStoreSqls extends PostgresqlLogStoreSqls{ +public class GaussDBLogStoreSqls extends PostgresqlLogStoreSqls { } From 554e65873763aed25cfad185842283ff6136cee3 Mon Sep 17 00:00:00 2001 From: liuqiufeng <775038282@qq.com> Date: Mon, 27 Nov 2023 09:59:01 +0800 Subject: [PATCH 3/8] fix code style --- .../rm/datasource/sql/struct/cache/GaussDBTableMetaCache.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rm-datasource/src/main/java/io/seata/rm/datasource/sql/struct/cache/GaussDBTableMetaCache.java b/rm-datasource/src/main/java/io/seata/rm/datasource/sql/struct/cache/GaussDBTableMetaCache.java index 23e82ac3a34..9b1cd0b8411 100644 --- a/rm-datasource/src/main/java/io/seata/rm/datasource/sql/struct/cache/GaussDBTableMetaCache.java +++ b/rm-datasource/src/main/java/io/seata/rm/datasource/sql/struct/cache/GaussDBTableMetaCache.java @@ -21,9 +21,9 @@ /** * The type Table meta cache. - * + * * @author liuqiufeng */ @LoadLevel(name = JdbcConstants.GAUSSDB) -public class GaussDBTableMetaCache extends PostgresqlTableMetaCache{ +public class GaussDBTableMetaCache extends PostgresqlTableMetaCache { } From 8c4a3d151f14ba63c02e73baa72ab56377b192a5 Mon Sep 17 00:00:00 2001 From: liuqiufeng <775038282@qq.com> Date: Fri, 1 Dec 2023 17:05:33 +0800 Subject: [PATCH 4/8] rollback sql that should not be modified --- script/server/db/postgresql.sql | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/script/server/db/postgresql.sql b/script/server/db/postgresql.sql index 9b47bbad714..f0418837e4c 100644 --- a/script/server/db/postgresql.sql +++ b/script/server/db/postgresql.sql @@ -59,14 +59,14 @@ CREATE INDEX idx_branch_id ON public.lock_table (branch_id); CREATE INDEX idx_xid ON public.lock_table (xid); CREATE INDEX idx_status ON public.lock_table (status); -CREATE TABLE IF NOT EXISTS public.distributed_lock ( +CREATE TABLE distributed_lock ( lock_key VARCHAR(20) NOT NULL, lock_value VARCHAR(20) NOT NULL, expire BIGINT NOT NULL, CONSTRAINT pk_distributed_lock_table PRIMARY KEY (lock_key) ); -INSERT INTO public.distributed_lock (lock_key, lock_value, expire) VALUES ('AsyncCommitting', ' ', 0); -INSERT INTO public.distributed_lock (lock_key, lock_value, expire) VALUES ('RetryCommitting', ' ', 0); -INSERT INTO public.distributed_lock (lock_key, lock_value, expire) VALUES ('RetryRollbacking', ' ', 0); -INSERT INTO public.distributed_lock (lock_key, lock_value, expire) VALUES ('TxTimeoutCheck', ' ', 0); +INSERT INTO distributed_lock (lock_key, lock_value, expire) VALUES ('AsyncCommitting', ' ', 0); +INSERT INTO distributed_lock (lock_key, lock_value, expire) VALUES ('RetryCommitting', ' ', 0); +INSERT INTO distributed_lock (lock_key, lock_value, expire) VALUES ('RetryRollbacking', ' ', 0); +INSERT INTO distributed_lock (lock_key, lock_value, expire) VALUES ('TxTimeoutCheck', ' ', 0); \ No newline at end of file From 10167887cc1c3070937147497c667fd4fade3e0e Mon Sep 17 00:00:00 2001 From: liuqiufeng <775038282@qq.com> Date: Fri, 1 Dec 2023 17:55:37 +0800 Subject: [PATCH 5/8] rollback sql that should not be modified --- script/server/db/postgresql.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/server/db/postgresql.sql b/script/server/db/postgresql.sql index f0418837e4c..f716f0dc6e3 100644 --- a/script/server/db/postgresql.sql +++ b/script/server/db/postgresql.sql @@ -69,4 +69,4 @@ CREATE TABLE distributed_lock ( INSERT INTO distributed_lock (lock_key, lock_value, expire) VALUES ('AsyncCommitting', ' ', 0); INSERT INTO distributed_lock (lock_key, lock_value, expire) VALUES ('RetryCommitting', ' ', 0); INSERT INTO distributed_lock (lock_key, lock_value, expire) VALUES ('RetryRollbacking', ' ', 0); -INSERT INTO distributed_lock (lock_key, lock_value, expire) VALUES ('TxTimeoutCheck', ' ', 0); \ No newline at end of file +INSERT INTO distributed_lock (lock_key, lock_value, expire) VALUES ('TxTimeoutCheck', ' ', 0); From 311d23f877589797d5d88ab6993a673e9f07420f Mon Sep 17 00:00:00 2001 From: liuqiufeng <775038282@qq.com> Date: Tue, 2 Jan 2024 10:13:39 +0800 Subject: [PATCH 6/8] =?UTF-8?q?=E8=B0=83=E6=95=B4copyright?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../db/sql/lock/GaussDBLockStoreSql.java | 27 ++++++++++--------- .../store/db/sql/log/GaussDBLogStoreSqls.java | 27 ++++++++++--------- .../exec/gaussdb/GaussDBInsertExecutor.java | 27 ++++++++++--------- .../handler/gaussdb/GaussDBEscapeHandler.java | 27 ++++++++++--------- .../struct/cache/GaussDBTableMetaCache.java | 27 ++++++++++--------- .../gaussdb/GaussDBUndoDeleteExecutor.java | 27 ++++++++++--------- .../gaussdb/GaussDBUndoExecutorHolder.java | 27 ++++++++++--------- .../gaussdb/GaussDBUndoInsertExecutor.java | 27 ++++++++++--------- .../undo/gaussdb/GaussDBUndoLogManager.java | 27 ++++++++++--------- .../gaussdb/GaussDBUndoUpdateExecutor.java | 27 ++++++++++--------- .../gaussdb/GaussDBDeleteRecognizer.java | 27 ++++++++++--------- .../gaussdb/GaussDBInsertRecognizer.java | 27 ++++++++++--------- .../GaussDBOperateRecognizerHolder.java | 27 ++++++++++--------- .../GaussDBSelectForUpdateRecognizer.java | 27 ++++++++++--------- .../gaussdb/GaussDBUpdateRecognizer.java | 27 ++++++++++--------- 15 files changed, 210 insertions(+), 195 deletions(-) diff --git a/core/src/main/java/io/seata/core/store/db/sql/lock/GaussDBLockStoreSql.java b/core/src/main/java/io/seata/core/store/db/sql/lock/GaussDBLockStoreSql.java index 421d2d792a6..8250b1c13a9 100644 --- a/core/src/main/java/io/seata/core/store/db/sql/lock/GaussDBLockStoreSql.java +++ b/core/src/main/java/io/seata/core/store/db/sql/lock/GaussDBLockStoreSql.java @@ -1,17 +1,18 @@ /* - * Copyright 1999-2019 Seata.io Group. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package io.seata.core.store.db.sql.lock; diff --git a/core/src/main/java/io/seata/core/store/db/sql/log/GaussDBLogStoreSqls.java b/core/src/main/java/io/seata/core/store/db/sql/log/GaussDBLogStoreSqls.java index 4cd5e1f52dc..4bc06a51d21 100644 --- a/core/src/main/java/io/seata/core/store/db/sql/log/GaussDBLogStoreSqls.java +++ b/core/src/main/java/io/seata/core/store/db/sql/log/GaussDBLogStoreSqls.java @@ -1,17 +1,18 @@ /* - * Copyright 1999-2019 Seata.io Group. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package io.seata.core.store.db.sql.log; diff --git a/rm-datasource/src/main/java/io/seata/rm/datasource/exec/gaussdb/GaussDBInsertExecutor.java b/rm-datasource/src/main/java/io/seata/rm/datasource/exec/gaussdb/GaussDBInsertExecutor.java index a31b0833ce9..6a132d2c299 100644 --- a/rm-datasource/src/main/java/io/seata/rm/datasource/exec/gaussdb/GaussDBInsertExecutor.java +++ b/rm-datasource/src/main/java/io/seata/rm/datasource/exec/gaussdb/GaussDBInsertExecutor.java @@ -1,17 +1,18 @@ /* - * Copyright 1999-2019 Seata.io Group. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package io.seata.rm.datasource.exec.gaussdb; diff --git a/rm-datasource/src/main/java/io/seata/rm/datasource/sql/handler/gaussdb/GaussDBEscapeHandler.java b/rm-datasource/src/main/java/io/seata/rm/datasource/sql/handler/gaussdb/GaussDBEscapeHandler.java index 2d049b0ff75..f42b6cebc46 100644 --- a/rm-datasource/src/main/java/io/seata/rm/datasource/sql/handler/gaussdb/GaussDBEscapeHandler.java +++ b/rm-datasource/src/main/java/io/seata/rm/datasource/sql/handler/gaussdb/GaussDBEscapeHandler.java @@ -1,17 +1,18 @@ /* - * Copyright 1999-2019 Seata.io Group. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package io.seata.rm.datasource.sql.handler.gaussdb; diff --git a/rm-datasource/src/main/java/io/seata/rm/datasource/sql/struct/cache/GaussDBTableMetaCache.java b/rm-datasource/src/main/java/io/seata/rm/datasource/sql/struct/cache/GaussDBTableMetaCache.java index 9b1cd0b8411..b71b074a3f4 100644 --- a/rm-datasource/src/main/java/io/seata/rm/datasource/sql/struct/cache/GaussDBTableMetaCache.java +++ b/rm-datasource/src/main/java/io/seata/rm/datasource/sql/struct/cache/GaussDBTableMetaCache.java @@ -1,17 +1,18 @@ /* - * Copyright 1999-2019 Seata.io Group. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package io.seata.rm.datasource.sql.struct.cache; diff --git a/rm-datasource/src/main/java/io/seata/rm/datasource/undo/gaussdb/GaussDBUndoDeleteExecutor.java b/rm-datasource/src/main/java/io/seata/rm/datasource/undo/gaussdb/GaussDBUndoDeleteExecutor.java index f4ad20e4b00..501016dd4a6 100644 --- a/rm-datasource/src/main/java/io/seata/rm/datasource/undo/gaussdb/GaussDBUndoDeleteExecutor.java +++ b/rm-datasource/src/main/java/io/seata/rm/datasource/undo/gaussdb/GaussDBUndoDeleteExecutor.java @@ -1,17 +1,18 @@ /* - * Copyright 1999-2019 Seata.io Group. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package io.seata.rm.datasource.undo.gaussdb; diff --git a/rm-datasource/src/main/java/io/seata/rm/datasource/undo/gaussdb/GaussDBUndoExecutorHolder.java b/rm-datasource/src/main/java/io/seata/rm/datasource/undo/gaussdb/GaussDBUndoExecutorHolder.java index aa9547c7bf0..c61feabfcd3 100644 --- a/rm-datasource/src/main/java/io/seata/rm/datasource/undo/gaussdb/GaussDBUndoExecutorHolder.java +++ b/rm-datasource/src/main/java/io/seata/rm/datasource/undo/gaussdb/GaussDBUndoExecutorHolder.java @@ -1,17 +1,18 @@ /* - * Copyright 1999-2019 Seata.io Group. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package io.seata.rm.datasource.undo.gaussdb; diff --git a/rm-datasource/src/main/java/io/seata/rm/datasource/undo/gaussdb/GaussDBUndoInsertExecutor.java b/rm-datasource/src/main/java/io/seata/rm/datasource/undo/gaussdb/GaussDBUndoInsertExecutor.java index 665dfd0082e..73e0aa57fde 100644 --- a/rm-datasource/src/main/java/io/seata/rm/datasource/undo/gaussdb/GaussDBUndoInsertExecutor.java +++ b/rm-datasource/src/main/java/io/seata/rm/datasource/undo/gaussdb/GaussDBUndoInsertExecutor.java @@ -1,17 +1,18 @@ /* - * Copyright 1999-2019 Seata.io Group. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package io.seata.rm.datasource.undo.gaussdb; diff --git a/rm-datasource/src/main/java/io/seata/rm/datasource/undo/gaussdb/GaussDBUndoLogManager.java b/rm-datasource/src/main/java/io/seata/rm/datasource/undo/gaussdb/GaussDBUndoLogManager.java index 2d62c0c6df8..98f349be61c 100644 --- a/rm-datasource/src/main/java/io/seata/rm/datasource/undo/gaussdb/GaussDBUndoLogManager.java +++ b/rm-datasource/src/main/java/io/seata/rm/datasource/undo/gaussdb/GaussDBUndoLogManager.java @@ -1,17 +1,18 @@ /* - * Copyright 1999-2019 Seata.io Group. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package io.seata.rm.datasource.undo.gaussdb; diff --git a/rm-datasource/src/main/java/io/seata/rm/datasource/undo/gaussdb/GaussDBUndoUpdateExecutor.java b/rm-datasource/src/main/java/io/seata/rm/datasource/undo/gaussdb/GaussDBUndoUpdateExecutor.java index 3b3c338d3c7..5be9a7d528c 100644 --- a/rm-datasource/src/main/java/io/seata/rm/datasource/undo/gaussdb/GaussDBUndoUpdateExecutor.java +++ b/rm-datasource/src/main/java/io/seata/rm/datasource/undo/gaussdb/GaussDBUndoUpdateExecutor.java @@ -1,17 +1,18 @@ /* - * Copyright 1999-2019 Seata.io Group. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package io.seata.rm.datasource.undo.gaussdb; diff --git a/sqlparser/seata-sqlparser-druid/src/main/java/io/seata/sqlparser/druid/gaussdb/GaussDBDeleteRecognizer.java b/sqlparser/seata-sqlparser-druid/src/main/java/io/seata/sqlparser/druid/gaussdb/GaussDBDeleteRecognizer.java index 5b6befe11c7..d06c2d8f6d8 100644 --- a/sqlparser/seata-sqlparser-druid/src/main/java/io/seata/sqlparser/druid/gaussdb/GaussDBDeleteRecognizer.java +++ b/sqlparser/seata-sqlparser-druid/src/main/java/io/seata/sqlparser/druid/gaussdb/GaussDBDeleteRecognizer.java @@ -1,17 +1,18 @@ /* - * Copyright 1999-2019 Seata.io Group. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package io.seata.sqlparser.druid.gaussdb; diff --git a/sqlparser/seata-sqlparser-druid/src/main/java/io/seata/sqlparser/druid/gaussdb/GaussDBInsertRecognizer.java b/sqlparser/seata-sqlparser-druid/src/main/java/io/seata/sqlparser/druid/gaussdb/GaussDBInsertRecognizer.java index 8fbf635f6ca..260ac878605 100644 --- a/sqlparser/seata-sqlparser-druid/src/main/java/io/seata/sqlparser/druid/gaussdb/GaussDBInsertRecognizer.java +++ b/sqlparser/seata-sqlparser-druid/src/main/java/io/seata/sqlparser/druid/gaussdb/GaussDBInsertRecognizer.java @@ -1,17 +1,18 @@ /* - * Copyright 1999-2019 Seata.io Group. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package io.seata.sqlparser.druid.gaussdb; diff --git a/sqlparser/seata-sqlparser-druid/src/main/java/io/seata/sqlparser/druid/gaussdb/GaussDBOperateRecognizerHolder.java b/sqlparser/seata-sqlparser-druid/src/main/java/io/seata/sqlparser/druid/gaussdb/GaussDBOperateRecognizerHolder.java index a9a4d4d0c0d..86da8137ab1 100644 --- a/sqlparser/seata-sqlparser-druid/src/main/java/io/seata/sqlparser/druid/gaussdb/GaussDBOperateRecognizerHolder.java +++ b/sqlparser/seata-sqlparser-druid/src/main/java/io/seata/sqlparser/druid/gaussdb/GaussDBOperateRecognizerHolder.java @@ -1,17 +1,18 @@ /* - * Copyright 1999-2019 Seata.io Group. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package io.seata.sqlparser.druid.gaussdb; diff --git a/sqlparser/seata-sqlparser-druid/src/main/java/io/seata/sqlparser/druid/gaussdb/GaussDBSelectForUpdateRecognizer.java b/sqlparser/seata-sqlparser-druid/src/main/java/io/seata/sqlparser/druid/gaussdb/GaussDBSelectForUpdateRecognizer.java index b2d00f7d7e4..c04ed9759a3 100644 --- a/sqlparser/seata-sqlparser-druid/src/main/java/io/seata/sqlparser/druid/gaussdb/GaussDBSelectForUpdateRecognizer.java +++ b/sqlparser/seata-sqlparser-druid/src/main/java/io/seata/sqlparser/druid/gaussdb/GaussDBSelectForUpdateRecognizer.java @@ -1,17 +1,18 @@ /* - * Copyright 1999-2019 Seata.io Group. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package io.seata.sqlparser.druid.gaussdb; diff --git a/sqlparser/seata-sqlparser-druid/src/main/java/io/seata/sqlparser/druid/gaussdb/GaussDBUpdateRecognizer.java b/sqlparser/seata-sqlparser-druid/src/main/java/io/seata/sqlparser/druid/gaussdb/GaussDBUpdateRecognizer.java index 2d422ec4b0a..aab79469e00 100644 --- a/sqlparser/seata-sqlparser-druid/src/main/java/io/seata/sqlparser/druid/gaussdb/GaussDBUpdateRecognizer.java +++ b/sqlparser/seata-sqlparser-druid/src/main/java/io/seata/sqlparser/druid/gaussdb/GaussDBUpdateRecognizer.java @@ -1,17 +1,18 @@ /* - * Copyright 1999-2019 Seata.io Group. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package io.seata.sqlparser.druid.gaussdb; From 35dcf7952b7dd92099f44b6a21595a37f51785d1 Mon Sep 17 00:00:00 2001 From: liuqiufeng <775038282@qq.com> Date: Thu, 4 Jan 2024 09:43:01 +0800 Subject: [PATCH 7/8] =?UTF-8?q?=E8=B0=83=E6=95=B4=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sqlparser/druid/gaussdb/GaussDBDeleteRecognizer.java | 4 ++-- .../sqlparser/druid/gaussdb/GaussDBInsertRecognizer.java | 4 ++-- .../druid/gaussdb/GaussDBSelectForUpdateRecognizer.java | 4 ++-- .../sqlparser/druid/gaussdb/GaussDBUpdateRecognizer.java | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/sqlparser/seata-sqlparser-druid/src/main/java/io/seata/sqlparser/druid/gaussdb/GaussDBDeleteRecognizer.java b/sqlparser/seata-sqlparser-druid/src/main/java/io/seata/sqlparser/druid/gaussdb/GaussDBDeleteRecognizer.java index d06c2d8f6d8..7c613b91092 100644 --- a/sqlparser/seata-sqlparser-druid/src/main/java/io/seata/sqlparser/druid/gaussdb/GaussDBDeleteRecognizer.java +++ b/sqlparser/seata-sqlparser-druid/src/main/java/io/seata/sqlparser/druid/gaussdb/GaussDBDeleteRecognizer.java @@ -21,14 +21,14 @@ import io.seata.sqlparser.druid.postgresql.PostgresqlDeleteRecognizer; /** - * The type openGauss delete recognizer. + * The type GaussDB delete recognizer. * * @author liuqiufeng */ public class GaussDBDeleteRecognizer extends PostgresqlDeleteRecognizer { /** - * Instantiates a new openGauss delete recognizer. + * Instantiates a new GaussDB delete recognizer. * * @param originalSQL the original sql * @param ast the ast diff --git a/sqlparser/seata-sqlparser-druid/src/main/java/io/seata/sqlparser/druid/gaussdb/GaussDBInsertRecognizer.java b/sqlparser/seata-sqlparser-druid/src/main/java/io/seata/sqlparser/druid/gaussdb/GaussDBInsertRecognizer.java index 260ac878605..86ce397ee3d 100644 --- a/sqlparser/seata-sqlparser-druid/src/main/java/io/seata/sqlparser/druid/gaussdb/GaussDBInsertRecognizer.java +++ b/sqlparser/seata-sqlparser-druid/src/main/java/io/seata/sqlparser/druid/gaussdb/GaussDBInsertRecognizer.java @@ -21,14 +21,14 @@ import io.seata.sqlparser.druid.postgresql.PostgresqlInsertRecognizer; /** - * The type openGauss insert recognizer. + * The type GaussDB insert recognizer. * * @author liuqiufeng */ public class GaussDBInsertRecognizer extends PostgresqlInsertRecognizer { /** - * Instantiates a new openGauss insert recognizer. + * Instantiates a new GaussDB insert recognizer. * * @param originalSQL the original sql * @param ast the ast diff --git a/sqlparser/seata-sqlparser-druid/src/main/java/io/seata/sqlparser/druid/gaussdb/GaussDBSelectForUpdateRecognizer.java b/sqlparser/seata-sqlparser-druid/src/main/java/io/seata/sqlparser/druid/gaussdb/GaussDBSelectForUpdateRecognizer.java index c04ed9759a3..84702019536 100644 --- a/sqlparser/seata-sqlparser-druid/src/main/java/io/seata/sqlparser/druid/gaussdb/GaussDBSelectForUpdateRecognizer.java +++ b/sqlparser/seata-sqlparser-druid/src/main/java/io/seata/sqlparser/druid/gaussdb/GaussDBSelectForUpdateRecognizer.java @@ -21,14 +21,14 @@ import io.seata.sqlparser.druid.postgresql.PostgresqlSelectForUpdateRecognizer; /** - * The type openGauss select for update recognizer. + * The type GaussDB select for update recognizer. * * @author liuqiufeng */ public class GaussDBSelectForUpdateRecognizer extends PostgresqlSelectForUpdateRecognizer { /** - * Instantiates a new openGauss select for update recognizer. + * Instantiates a new GaussDB select for update recognizer. * * @param originalSQL the original sql * @param ast the ast diff --git a/sqlparser/seata-sqlparser-druid/src/main/java/io/seata/sqlparser/druid/gaussdb/GaussDBUpdateRecognizer.java b/sqlparser/seata-sqlparser-druid/src/main/java/io/seata/sqlparser/druid/gaussdb/GaussDBUpdateRecognizer.java index aab79469e00..e712e2229f2 100644 --- a/sqlparser/seata-sqlparser-druid/src/main/java/io/seata/sqlparser/druid/gaussdb/GaussDBUpdateRecognizer.java +++ b/sqlparser/seata-sqlparser-druid/src/main/java/io/seata/sqlparser/druid/gaussdb/GaussDBUpdateRecognizer.java @@ -21,14 +21,14 @@ import io.seata.sqlparser.druid.postgresql.PostgresqlUpdateRecognizer; /** - * The type openGauss update recognizer. + * The type GaussDB update recognizer. * * @author liuqiufeng */ public class GaussDBUpdateRecognizer extends PostgresqlUpdateRecognizer { /** - * Instantiates a new openGauss update recognizer. + * Instantiates a new GaussDB update recognizer. * * @param originalSQL the original sql * @param ast the ast From 386df09cda66445da4f3cecde7a403938c5b4dae Mon Sep 17 00:00:00 2001 From: liuqiufeng <775038282@qq.com> Date: Thu, 4 Jan 2024 11:49:10 +0800 Subject: [PATCH 8/8] =?UTF-8?q?bug=E4=BF=AE=E5=A4=8D=E5=8F=8A=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/store/db/sql/lock/GaussDBLockStoreSql.java | 1 - .../core/store/db/sql/log/GaussDBLogStoreSqls.java | 1 - .../java/io/seata/rm/datasource/DataSourceProxy.java | 2 +- .../datasource/exec/gaussdb/GaussDBInsertExecutor.java | 3 +-- .../sql/handler/gaussdb/GaussDBEscapeHandler.java | 3 +-- .../sql/struct/cache/GaussDBTableMetaCache.java | 1 - .../undo/gaussdb/GaussDBUndoDeleteExecutor.java | 9 +++++++-- .../undo/gaussdb/GaussDBUndoExecutorHolder.java | 3 +-- .../undo/gaussdb/GaussDBUndoInsertExecutor.java | 9 +++++++-- .../datasource/undo/gaussdb/GaussDBUndoLogManager.java | 3 +-- .../undo/gaussdb/GaussDBUndoUpdateExecutor.java | 9 +++++++-- .../undo/postgresql/PostgresqlUndoDeleteExecutor.java | 8 ++++++-- .../undo/postgresql/PostgresqlUndoInsertExecutor.java | 8 ++++++-- .../undo/postgresql/PostgresqlUndoUpdateExecutor.java | 10 +++++++--- .../io/seata/sqlparser/druid/DruidDbTypeAdapter.java | 3 +++ .../druid/gaussdb/GaussDBDeleteRecognizer.java | 9 +++++++-- .../druid/gaussdb/GaussDBInsertRecognizer.java | 9 +++++++-- .../druid/gaussdb/GaussDBOperateRecognizerHolder.java | 7 +++---- .../gaussdb/GaussDBSelectForUpdateRecognizer.java | 9 +++++++-- .../druid/gaussdb/GaussDBUpdateRecognizer.java | 9 +++++++-- 20 files changed, 79 insertions(+), 37 deletions(-) diff --git a/core/src/main/java/io/seata/core/store/db/sql/lock/GaussDBLockStoreSql.java b/core/src/main/java/io/seata/core/store/db/sql/lock/GaussDBLockStoreSql.java index 8250b1c13a9..8a5cc9b2592 100644 --- a/core/src/main/java/io/seata/core/store/db/sql/lock/GaussDBLockStoreSql.java +++ b/core/src/main/java/io/seata/core/store/db/sql/lock/GaussDBLockStoreSql.java @@ -22,7 +22,6 @@ /** * the database lock store GaussDB sql * - * @author liuqiufeng */ @LoadLevel(name = "gaussdb") public class GaussDBLockStoreSql extends PostgresqlLockStoreSql { diff --git a/core/src/main/java/io/seata/core/store/db/sql/log/GaussDBLogStoreSqls.java b/core/src/main/java/io/seata/core/store/db/sql/log/GaussDBLogStoreSqls.java index 4bc06a51d21..c9846814396 100644 --- a/core/src/main/java/io/seata/core/store/db/sql/log/GaussDBLogStoreSqls.java +++ b/core/src/main/java/io/seata/core/store/db/sql/log/GaussDBLogStoreSqls.java @@ -22,7 +22,6 @@ /** * Database log store GaussDB sql * - * @author liuqiufeng */ @LoadLevel(name = "gaussdb") public class GaussDBLogStoreSqls extends PostgresqlLogStoreSqls { diff --git a/rm-datasource/src/main/java/io/seata/rm/datasource/DataSourceProxy.java b/rm-datasource/src/main/java/io/seata/rm/datasource/DataSourceProxy.java index 292859058db..2c237a09431 100644 --- a/rm-datasource/src/main/java/io/seata/rm/datasource/DataSourceProxy.java +++ b/rm-datasource/src/main/java/io/seata/rm/datasource/DataSourceProxy.java @@ -229,7 +229,7 @@ public String getResourceId() { } private void initResourceId() { - if (JdbcConstants.POSTGRESQL.equals(dbType)) { + if (JdbcConstants.POSTGRESQL.equals(dbType) || JdbcConstants.GAUSSDB.equals(dbType)) { initPGResourceId(); } else if (JdbcConstants.ORACLE.equals(dbType) && userName != null) { initOracleResourceId(); diff --git a/rm-datasource/src/main/java/io/seata/rm/datasource/exec/gaussdb/GaussDBInsertExecutor.java b/rm-datasource/src/main/java/io/seata/rm/datasource/exec/gaussdb/GaussDBInsertExecutor.java index 6a132d2c299..6cc943babb9 100644 --- a/rm-datasource/src/main/java/io/seata/rm/datasource/exec/gaussdb/GaussDBInsertExecutor.java +++ b/rm-datasource/src/main/java/io/seata/rm/datasource/exec/gaussdb/GaussDBInsertExecutor.java @@ -27,8 +27,7 @@ /** * The type GaussDB insert executor. - * - * @author liuqiufeng + * */ @LoadLevel(name = JdbcConstants.GAUSSDB, scope = Scope.PROTOTYPE) public class GaussDBInsertExecutor extends PostgresqlInsertExecutor { diff --git a/rm-datasource/src/main/java/io/seata/rm/datasource/sql/handler/gaussdb/GaussDBEscapeHandler.java b/rm-datasource/src/main/java/io/seata/rm/datasource/sql/handler/gaussdb/GaussDBEscapeHandler.java index f42b6cebc46..8afbf60b85a 100644 --- a/rm-datasource/src/main/java/io/seata/rm/datasource/sql/handler/gaussdb/GaussDBEscapeHandler.java +++ b/rm-datasource/src/main/java/io/seata/rm/datasource/sql/handler/gaussdb/GaussDBEscapeHandler.java @@ -23,8 +23,7 @@ /** * The type GaussDB escape handler. - * - * @author liuqiufeng + * */ @LoadLevel(name = JdbcConstants.GAUSSDB) public class GaussDBEscapeHandler extends PostgresqlEscapeHandler { diff --git a/rm-datasource/src/main/java/io/seata/rm/datasource/sql/struct/cache/GaussDBTableMetaCache.java b/rm-datasource/src/main/java/io/seata/rm/datasource/sql/struct/cache/GaussDBTableMetaCache.java index b71b074a3f4..935981e8807 100644 --- a/rm-datasource/src/main/java/io/seata/rm/datasource/sql/struct/cache/GaussDBTableMetaCache.java +++ b/rm-datasource/src/main/java/io/seata/rm/datasource/sql/struct/cache/GaussDBTableMetaCache.java @@ -23,7 +23,6 @@ /** * The type Table meta cache. * - * @author liuqiufeng */ @LoadLevel(name = JdbcConstants.GAUSSDB) public class GaussDBTableMetaCache extends PostgresqlTableMetaCache { diff --git a/rm-datasource/src/main/java/io/seata/rm/datasource/undo/gaussdb/GaussDBUndoDeleteExecutor.java b/rm-datasource/src/main/java/io/seata/rm/datasource/undo/gaussdb/GaussDBUndoDeleteExecutor.java index 501016dd4a6..ae02f9c393d 100644 --- a/rm-datasource/src/main/java/io/seata/rm/datasource/undo/gaussdb/GaussDBUndoDeleteExecutor.java +++ b/rm-datasource/src/main/java/io/seata/rm/datasource/undo/gaussdb/GaussDBUndoDeleteExecutor.java @@ -19,11 +19,11 @@ import io.seata.rm.datasource.undo.SQLUndoLog; import io.seata.rm.datasource.undo.postgresql.PostgresqlUndoDeleteExecutor; +import io.seata.sqlparser.util.JdbcConstants; /** * The type GaussDB undo delete executor. - * - * @author liuqiufeng + * */ public class GaussDBUndoDeleteExecutor extends PostgresqlUndoDeleteExecutor { @@ -35,4 +35,9 @@ public class GaussDBUndoDeleteExecutor extends PostgresqlUndoDeleteExecutor { public GaussDBUndoDeleteExecutor(SQLUndoLog sqlUndoLog) { super(sqlUndoLog); } + + @Override + public String getDbType() { + return JdbcConstants.GAUSSDB; + } } diff --git a/rm-datasource/src/main/java/io/seata/rm/datasource/undo/gaussdb/GaussDBUndoExecutorHolder.java b/rm-datasource/src/main/java/io/seata/rm/datasource/undo/gaussdb/GaussDBUndoExecutorHolder.java index c61feabfcd3..de5256623d1 100644 --- a/rm-datasource/src/main/java/io/seata/rm/datasource/undo/gaussdb/GaussDBUndoExecutorHolder.java +++ b/rm-datasource/src/main/java/io/seata/rm/datasource/undo/gaussdb/GaussDBUndoExecutorHolder.java @@ -25,8 +25,7 @@ /** * Undo executor holder for GaussDB - * - * @author liuqiufeng + * */ @LoadLevel(name = JdbcConstants.GAUSSDB) public class GaussDBUndoExecutorHolder implements UndoExecutorHolder { diff --git a/rm-datasource/src/main/java/io/seata/rm/datasource/undo/gaussdb/GaussDBUndoInsertExecutor.java b/rm-datasource/src/main/java/io/seata/rm/datasource/undo/gaussdb/GaussDBUndoInsertExecutor.java index 73e0aa57fde..435e915667f 100644 --- a/rm-datasource/src/main/java/io/seata/rm/datasource/undo/gaussdb/GaussDBUndoInsertExecutor.java +++ b/rm-datasource/src/main/java/io/seata/rm/datasource/undo/gaussdb/GaussDBUndoInsertExecutor.java @@ -19,11 +19,11 @@ import io.seata.rm.datasource.undo.SQLUndoLog; import io.seata.rm.datasource.undo.postgresql.PostgresqlUndoInsertExecutor; +import io.seata.sqlparser.util.JdbcConstants; /** * The type GaussDB undo insert executor. - * - * @author liuqiufeng + * */ public class GaussDBUndoInsertExecutor extends PostgresqlUndoInsertExecutor { @@ -35,4 +35,9 @@ public class GaussDBUndoInsertExecutor extends PostgresqlUndoInsertExecutor { public GaussDBUndoInsertExecutor(SQLUndoLog sqlUndoLog) { super(sqlUndoLog); } + + @Override + public String getDbType() { + return JdbcConstants.GAUSSDB; + } } diff --git a/rm-datasource/src/main/java/io/seata/rm/datasource/undo/gaussdb/GaussDBUndoLogManager.java b/rm-datasource/src/main/java/io/seata/rm/datasource/undo/gaussdb/GaussDBUndoLogManager.java index 98f349be61c..4f48e948ee8 100644 --- a/rm-datasource/src/main/java/io/seata/rm/datasource/undo/gaussdb/GaussDBUndoLogManager.java +++ b/rm-datasource/src/main/java/io/seata/rm/datasource/undo/gaussdb/GaussDBUndoLogManager.java @@ -22,8 +22,7 @@ /** * Undo log manager for GaussDB - * - * @author liuqiufeng + * */ @LoadLevel(name = JdbcConstants.GAUSSDB) public class GaussDBUndoLogManager extends PostgresqlUndoLogManager { diff --git a/rm-datasource/src/main/java/io/seata/rm/datasource/undo/gaussdb/GaussDBUndoUpdateExecutor.java b/rm-datasource/src/main/java/io/seata/rm/datasource/undo/gaussdb/GaussDBUndoUpdateExecutor.java index 5be9a7d528c..f292d516d7e 100644 --- a/rm-datasource/src/main/java/io/seata/rm/datasource/undo/gaussdb/GaussDBUndoUpdateExecutor.java +++ b/rm-datasource/src/main/java/io/seata/rm/datasource/undo/gaussdb/GaussDBUndoUpdateExecutor.java @@ -19,11 +19,11 @@ import io.seata.rm.datasource.undo.SQLUndoLog; import io.seata.rm.datasource.undo.postgresql.PostgresqlUndoUpdateExecutor; +import io.seata.sqlparser.util.JdbcConstants; /** * The type GaussDB undo update executor. - * - * @author liuqiufeng + * */ public class GaussDBUndoUpdateExecutor extends PostgresqlUndoUpdateExecutor { @@ -35,4 +35,9 @@ public class GaussDBUndoUpdateExecutor extends PostgresqlUndoUpdateExecutor { public GaussDBUndoUpdateExecutor(SQLUndoLog sqlUndoLog) { super(sqlUndoLog); } + + @Override + public String getDbType() { + return JdbcConstants.GAUSSDB; + } } diff --git a/rm-datasource/src/main/java/io/seata/rm/datasource/undo/postgresql/PostgresqlUndoDeleteExecutor.java b/rm-datasource/src/main/java/io/seata/rm/datasource/undo/postgresql/PostgresqlUndoDeleteExecutor.java index b13820b9198..02358b83a41 100644 --- a/rm-datasource/src/main/java/io/seata/rm/datasource/undo/postgresql/PostgresqlUndoDeleteExecutor.java +++ b/rm-datasource/src/main/java/io/seata/rm/datasource/undo/postgresql/PostgresqlUndoDeleteExecutor.java @@ -59,12 +59,12 @@ protected String buildUndoSQL() { } Row row = beforeImageRows.get(0); List fields = new ArrayList<>(row.nonPrimaryKeys()); - fields.addAll(getOrderedPkList(beforeImage,row,JdbcConstants.POSTGRESQL)); + fields.addAll(getOrderedPkList(beforeImage, row, getDbType())); // delete sql undo log before image all field come from table meta, need add escape. // see BaseTransactionalExecutor#buildTableRecords String insertColumns = fields.stream() - .map(field -> ColumnUtils.addEscape(field.getName(), JdbcConstants.POSTGRESQL)) + .map(field -> ColumnUtils.addEscape(field.getName(), getDbType())) .collect(Collectors.joining(", ")); String insertValues = fields.stream().map(field -> "?") .collect(Collectors.joining(", ")); @@ -76,4 +76,8 @@ protected String buildUndoSQL() { protected TableRecords getUndoRows() { return sqlUndoLog.getBeforeImage(); } + + public String getDbType() { + return JdbcConstants.POSTGRESQL; + } } diff --git a/rm-datasource/src/main/java/io/seata/rm/datasource/undo/postgresql/PostgresqlUndoInsertExecutor.java b/rm-datasource/src/main/java/io/seata/rm/datasource/undo/postgresql/PostgresqlUndoInsertExecutor.java index 33356eabc18..86cd6075ef1 100644 --- a/rm-datasource/src/main/java/io/seata/rm/datasource/undo/postgresql/PostgresqlUndoInsertExecutor.java +++ b/rm-datasource/src/main/java/io/seata/rm/datasource/undo/postgresql/PostgresqlUndoInsertExecutor.java @@ -63,9 +63,9 @@ protected void undoPrepare(PreparedStatement undoPST, ArrayList undoValue } private String generateDeleteSql(List rows, TableRecords afterImage) { - List pkNameList = getOrderedPkList(afterImage, rows.get(0), JdbcConstants.POSTGRESQL).stream().map( + List pkNameList = getOrderedPkList(afterImage, rows.get(0), getDbType()).stream().map( e -> e.getName()).collect(Collectors.toList()); - String whereSql = SqlGenerateUtils.buildWhereConditionByPKs(pkNameList, JdbcConstants.POSTGRESQL); + String whereSql = SqlGenerateUtils.buildWhereConditionByPKs(pkNameList, getDbType()); return String.format(DELETE_SQL_TEMPLATE, sqlUndoLog.getTableName(), whereSql); } @@ -82,4 +82,8 @@ public PostgresqlUndoInsertExecutor(SQLUndoLog sqlUndoLog) { protected TableRecords getUndoRows() { return sqlUndoLog.getAfterImage(); } + + public String getDbType() { + return JdbcConstants.POSTGRESQL; + } } diff --git a/rm-datasource/src/main/java/io/seata/rm/datasource/undo/postgresql/PostgresqlUndoUpdateExecutor.java b/rm-datasource/src/main/java/io/seata/rm/datasource/undo/postgresql/PostgresqlUndoUpdateExecutor.java index 79753bf638d..65f06cc8ec7 100644 --- a/rm-datasource/src/main/java/io/seata/rm/datasource/undo/postgresql/PostgresqlUndoUpdateExecutor.java +++ b/rm-datasource/src/main/java/io/seata/rm/datasource/undo/postgresql/PostgresqlUndoUpdateExecutor.java @@ -52,12 +52,12 @@ protected String buildUndoSQL() { // update sql undo log before image all field come from table meta. need add escape. // see BaseTransactionalExecutor#buildTableRecords String updateColumns = nonPkFields.stream().map( - field -> ColumnUtils.addEscape(field.getName(), JdbcConstants.POSTGRESQL) + " = ?").collect( + field -> ColumnUtils.addEscape(field.getName(), getDbType()) + " = ?").collect( Collectors.joining(", ")); - List pkNameList = getOrderedPkList(beforeImage, row, JdbcConstants.POSTGRESQL).stream().map( + List pkNameList = getOrderedPkList(beforeImage, row, getDbType()).stream().map( e -> e.getName()).collect(Collectors.toList()); - String whereSql = SqlGenerateUtils.buildWhereConditionByPKs(pkNameList, JdbcConstants.POSTGRESQL); + String whereSql = SqlGenerateUtils.buildWhereConditionByPKs(pkNameList, getDbType()); return String.format(UPDATE_SQL_TEMPLATE, sqlUndoLog.getTableName(), updateColumns, whereSql); } @@ -75,4 +75,8 @@ public PostgresqlUndoUpdateExecutor(SQLUndoLog sqlUndoLog) { protected TableRecords getUndoRows() { return sqlUndoLog.getBeforeImage(); } + + public String getDbType() { + return JdbcConstants.POSTGRESQL; + } } diff --git a/sqlparser/seata-sqlparser-druid/src/main/java/io/seata/sqlparser/druid/DruidDbTypeAdapter.java b/sqlparser/seata-sqlparser-druid/src/main/java/io/seata/sqlparser/druid/DruidDbTypeAdapter.java index 798d5c90ab7..03049281a69 100644 --- a/sqlparser/seata-sqlparser-druid/src/main/java/io/seata/sqlparser/druid/DruidDbTypeAdapter.java +++ b/sqlparser/seata-sqlparser-druid/src/main/java/io/seata/sqlparser/druid/DruidDbTypeAdapter.java @@ -33,6 +33,9 @@ static String getAdaptiveDbType(String dbType) { if (JdbcConstants.POLARDBX.equals(dbType)) { return JdbcConstants.MYSQL; } + if (JdbcConstants.GAUSSDB.equals(dbType)) { + return JdbcConstants.POSTGRESQL; + } return dbType; } } diff --git a/sqlparser/seata-sqlparser-druid/src/main/java/io/seata/sqlparser/druid/gaussdb/GaussDBDeleteRecognizer.java b/sqlparser/seata-sqlparser-druid/src/main/java/io/seata/sqlparser/druid/gaussdb/GaussDBDeleteRecognizer.java index 7c613b91092..9c599bf5559 100644 --- a/sqlparser/seata-sqlparser-druid/src/main/java/io/seata/sqlparser/druid/gaussdb/GaussDBDeleteRecognizer.java +++ b/sqlparser/seata-sqlparser-druid/src/main/java/io/seata/sqlparser/druid/gaussdb/GaussDBDeleteRecognizer.java @@ -19,11 +19,11 @@ import com.alibaba.druid.sql.ast.SQLStatement; import io.seata.sqlparser.druid.postgresql.PostgresqlDeleteRecognizer; +import io.seata.sqlparser.util.JdbcConstants; /** * The type GaussDB delete recognizer. - * - * @author liuqiufeng + * */ public class GaussDBDeleteRecognizer extends PostgresqlDeleteRecognizer { @@ -36,4 +36,9 @@ public class GaussDBDeleteRecognizer extends PostgresqlDeleteRecognizer { public GaussDBDeleteRecognizer(String originalSQL, SQLStatement ast) { super(originalSQL, ast); } + + @Override + public String getDbType() { + return JdbcConstants.GAUSSDB; + } } diff --git a/sqlparser/seata-sqlparser-druid/src/main/java/io/seata/sqlparser/druid/gaussdb/GaussDBInsertRecognizer.java b/sqlparser/seata-sqlparser-druid/src/main/java/io/seata/sqlparser/druid/gaussdb/GaussDBInsertRecognizer.java index 86ce397ee3d..0539d63af8f 100644 --- a/sqlparser/seata-sqlparser-druid/src/main/java/io/seata/sqlparser/druid/gaussdb/GaussDBInsertRecognizer.java +++ b/sqlparser/seata-sqlparser-druid/src/main/java/io/seata/sqlparser/druid/gaussdb/GaussDBInsertRecognizer.java @@ -19,11 +19,11 @@ import com.alibaba.druid.sql.ast.SQLStatement; import io.seata.sqlparser.druid.postgresql.PostgresqlInsertRecognizer; +import io.seata.sqlparser.util.JdbcConstants; /** * The type GaussDB insert recognizer. - * - * @author liuqiufeng + * */ public class GaussDBInsertRecognizer extends PostgresqlInsertRecognizer { @@ -36,4 +36,9 @@ public class GaussDBInsertRecognizer extends PostgresqlInsertRecognizer { public GaussDBInsertRecognizer(String originalSQL, SQLStatement ast) { super(originalSQL, ast); } + + @Override + public String getDbType() { + return JdbcConstants.GAUSSDB; + } } diff --git a/sqlparser/seata-sqlparser-druid/src/main/java/io/seata/sqlparser/druid/gaussdb/GaussDBOperateRecognizerHolder.java b/sqlparser/seata-sqlparser-druid/src/main/java/io/seata/sqlparser/druid/gaussdb/GaussDBOperateRecognizerHolder.java index 86da8137ab1..647eb158a1c 100644 --- a/sqlparser/seata-sqlparser-druid/src/main/java/io/seata/sqlparser/druid/gaussdb/GaussDBOperateRecognizerHolder.java +++ b/sqlparser/seata-sqlparser-druid/src/main/java/io/seata/sqlparser/druid/gaussdb/GaussDBOperateRecognizerHolder.java @@ -20,14 +20,12 @@ import com.alibaba.druid.sql.ast.SQLStatement; import com.alibaba.druid.sql.ast.statement.SQLSelectStatement; +import com.alibaba.druid.sql.dialect.postgresql.ast.stmt.PGSelectQueryBlock; import io.seata.common.loader.LoadLevel; import io.seata.sqlparser.SQLRecognizer; import io.seata.sqlparser.druid.SQLOperateRecognizerHolder; import io.seata.sqlparser.util.JdbcConstants; -/** - * @author liuqiufeng - */ @LoadLevel(name = JdbcConstants.GAUSSDB) public class GaussDBOperateRecognizerHolder implements SQLOperateRecognizerHolder { @@ -48,7 +46,8 @@ public SQLRecognizer getUpdateRecognizer(String sql, SQLStatement ast) { @Override public SQLRecognizer getSelectForUpdateRecognizer(String sql, SQLStatement ast) { - if (((SQLSelectStatement) ast).getSelect().getFirstQueryBlock().isForUpdate()) { + PGSelectQueryBlock selectQueryBlock = (PGSelectQueryBlock) ((SQLSelectStatement) ast).getSelect().getFirstQueryBlock(); + if (selectQueryBlock.getForClause() != null && selectQueryBlock.getForClause().getOption().equals(PGSelectQueryBlock.ForClause.Option.UPDATE)) { return new GaussDBSelectForUpdateRecognizer(sql, ast); } return null; diff --git a/sqlparser/seata-sqlparser-druid/src/main/java/io/seata/sqlparser/druid/gaussdb/GaussDBSelectForUpdateRecognizer.java b/sqlparser/seata-sqlparser-druid/src/main/java/io/seata/sqlparser/druid/gaussdb/GaussDBSelectForUpdateRecognizer.java index 84702019536..25c04b3d319 100644 --- a/sqlparser/seata-sqlparser-druid/src/main/java/io/seata/sqlparser/druid/gaussdb/GaussDBSelectForUpdateRecognizer.java +++ b/sqlparser/seata-sqlparser-druid/src/main/java/io/seata/sqlparser/druid/gaussdb/GaussDBSelectForUpdateRecognizer.java @@ -19,11 +19,11 @@ import com.alibaba.druid.sql.ast.SQLStatement; import io.seata.sqlparser.druid.postgresql.PostgresqlSelectForUpdateRecognizer; +import io.seata.sqlparser.util.JdbcConstants; /** * The type GaussDB select for update recognizer. - * - * @author liuqiufeng + * */ public class GaussDBSelectForUpdateRecognizer extends PostgresqlSelectForUpdateRecognizer { @@ -36,4 +36,9 @@ public class GaussDBSelectForUpdateRecognizer extends PostgresqlSelectForUpdateR public GaussDBSelectForUpdateRecognizer(String originalSQL, SQLStatement ast) { super(originalSQL, ast); } + + @Override + public String getDbType() { + return JdbcConstants.GAUSSDB; + } } diff --git a/sqlparser/seata-sqlparser-druid/src/main/java/io/seata/sqlparser/druid/gaussdb/GaussDBUpdateRecognizer.java b/sqlparser/seata-sqlparser-druid/src/main/java/io/seata/sqlparser/druid/gaussdb/GaussDBUpdateRecognizer.java index e712e2229f2..176e409d0e2 100644 --- a/sqlparser/seata-sqlparser-druid/src/main/java/io/seata/sqlparser/druid/gaussdb/GaussDBUpdateRecognizer.java +++ b/sqlparser/seata-sqlparser-druid/src/main/java/io/seata/sqlparser/druid/gaussdb/GaussDBUpdateRecognizer.java @@ -19,11 +19,11 @@ import com.alibaba.druid.sql.ast.SQLStatement; import io.seata.sqlparser.druid.postgresql.PostgresqlUpdateRecognizer; +import io.seata.sqlparser.util.JdbcConstants; /** * The type GaussDB update recognizer. - * - * @author liuqiufeng + * */ public class GaussDBUpdateRecognizer extends PostgresqlUpdateRecognizer { @@ -36,4 +36,9 @@ public class GaussDBUpdateRecognizer extends PostgresqlUpdateRecognizer { public GaussDBUpdateRecognizer(String originalSQL, SQLStatement ast) { super(originalSQL, ast); } + + @Override + public String getDbType() { + return JdbcConstants.GAUSSDB; + } }