Skip to content

Commit e5d927d

Browse files
liubao68beikov
authored andcommitted
HHH-19365 GaussDB Dialect Support-initial
1 parent 804c604 commit e5d927d

File tree

64 files changed

+7031
-5
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+7031
-5
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ jobs:
4444
- rdbms: mysql
4545
- rdbms: mariadb
4646
- rdbms: postgresql
47+
- rdbms: gaussdb
4748
- rdbms: edb
4849
- rdbms: oracle
4950
- rdbms: db2

ci/build.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ elif [ "$RDBMS" == "mariadb" ] || [ "$RDBMS" == "mariadb_10_6" ]; then
1414
goal="-Pdb=mariadb_ci"
1515
elif [ "$RDBMS" == "postgresql" ] || [ "$RDBMS" == "postgresql_13" ]; then
1616
goal="-Pdb=pgsql_ci"
17+
elif [ "$RDBMS" == "gaussdb" ]; then
18+
goal="-Pdb=gaussdb -DdbHost=localhost:8000"
1719
elif [ "$RDBMS" == "edb" ] || [ "$RDBMS" == "edb_13" ]; then
1820
goal="-Pdb=edb_ci -DdbHost=localhost:5444"
1921
elif [ "$RDBMS" == "oracle" ]; then

ci/database-start.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ elif [ "$RDBMS" == 'mariadb' ]; then
88
bash $DIR/../docker_db.sh mariadb
99
elif [ "$RDBMS" == 'postgresql' ]; then
1010
bash $DIR/../docker_db.sh postgresql
11+
elif [ "$RDBMS" == 'gaussdb' ]; then
12+
bash $DIR/../docker_db.sh gaussdb
1113
elif [ "$RDBMS" == 'edb' ]; then
1214
bash $DIR/../docker_db.sh edb
1315
elif [ "$RDBMS" == 'db2' ]; then

docker_db.sh

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,47 @@ postgresql_17() {
211211
$CONTAINER_CLI exec postgres bash -c '/usr/share/postgresql-common/pgdg/apt.postgresql.org.sh -y && apt install -y postgresql-17-pgvector && psql -U hibernate_orm_test -d hibernate_orm_test -c "create extension vector;"'
212212
}
213213

214+
gaussdb() {
215+
$CONTAINER_CLI rm -f opengauss || true
216+
217+
# config param
218+
CONTAINER_NAME=opengauss
219+
IMAGE=opengauss/opengauss:7.0.0-RC1
220+
PORT=8000
221+
DB_USER=hibernate_orm_test
222+
DB_PASSWORD=Hibernate_orm_test@1234
223+
DB_NAME=hibernate_orm_test
224+
PSQL_IMAGE=postgres:14
225+
226+
echo "start OpenGauss container..."
227+
$CONTAINER_CLI run --name ${CONTAINER_NAME} \
228+
--privileged \
229+
-e GS_PASSWORD=${DB_PASSWORD} \
230+
-e GS_NODENAME=opengauss \
231+
-e GS_PORT=${PORT} \
232+
-e GS_CGROUP_DISABLE=YES \
233+
-p ${PORT}:8000 \
234+
-d ${IMAGE}
235+
236+
echo "wait OpenGauss starting..."
237+
sleep 20
238+
239+
echo " Initialize the database using the PostgreSQL client container..."
240+
241+
$CONTAINER_CLI run --rm --network=host ${PSQL_IMAGE} \
242+
bash -c "
243+
PGPASSWORD='${DB_PASSWORD}' psql -h localhost -p ${PORT} -U gaussdb -d postgres -c \"CREATE USER ${DB_USER} WITH PASSWORD '${DB_PASSWORD}';\" &&
244+
PGPASSWORD='${DB_PASSWORD}' psql -h localhost -p ${PORT} -U gaussdb -d postgres -c \"CREATE DATABASE ${DB_NAME} OWNER ${DB_USER};\" &&
245+
PGPASSWORD='${DB_PASSWORD}' psql -h localhost -p ${PORT} -U gaussdb -d ${DB_NAME} -c \"CREATE SCHEMA test AUTHORIZATION ${DB_USER};\"
246+
"
247+
248+
echo "Initialization completed"
249+
echo "connection information"
250+
echo " Host: localhost"
251+
echo " Port: ${PORT}"
252+
echo " Database: ${DB_NAME}"
253+
}
254+
214255
edb() {
215256
edb_17
216257
}
@@ -1089,6 +1130,7 @@ if [ -z ${1} ]; then
10891130
echo -e "\toracle"
10901131
echo -e "\toracle_23"
10911132
echo -e "\toracle_21"
1133+
echo -e "\tgaussdb"
10921134
echo -e "\tpostgresql"
10931135
echo -e "\tpostgresql_17"
10941136
echo -e "\tpostgresql_16"

hibernate-agroal/src/test/java/org/hibernate/test/agroal/AgroalTransactionIsolationConfigTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
import org.hibernate.community.dialect.AltibaseDialect;
88
import org.hibernate.community.dialect.TiDBDialect;
9+
import org.hibernate.dialect.GaussDBDialect;
910
import org.hibernate.engine.jdbc.connections.spi.ConnectionProvider;
1011
import org.hibernate.agroal.internal.AgroalConnectionProvider;
1112

@@ -17,6 +18,7 @@
1718
*/
1819
@SkipForDialect(value = TiDBDialect.class, comment = "Doesn't support SERIALIZABLE isolation")
1920
@SkipForDialect(value = AltibaseDialect.class, comment = "Altibase cannot change isolation level in autocommit mode")
21+
@SkipForDialect(value = GaussDBDialect.class, comment = "GaussDB query serialization level of SERIALIZABLE has some problem")
2022
public class AgroalTransactionIsolationConfigTest extends BaseTransactionIsolationConfigTest {
2123
@Override
2224
protected ConnectionProvider getConnectionProviderUnderTest() {

hibernate-c3p0/src/test/java/org/hibernate/test/c3p0/C3p0TransactionIsolationConfigTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
99
import org.hibernate.c3p0.internal.C3P0ConnectionProvider;
1010
import org.hibernate.community.dialect.AltibaseDialect;
11+
import org.hibernate.dialect.GaussDBDialect;
1112
import org.hibernate.dialect.SybaseASEDialect;
1213
import org.hibernate.community.dialect.TiDBDialect;
1314
import org.hibernate.engine.jdbc.connections.spi.ConnectionProvider;
@@ -23,6 +24,7 @@
2324
@SkipForDialect(value = TiDBDialect.class, comment = "Doesn't support SERIALIZABLE isolation")
2425
@SkipForDialect(value = AltibaseDialect.class, comment = "Altibase cannot change isolation level in autocommit mode")
2526
@SkipForDialect(value = SybaseASEDialect.class, comment = "JtdsConnection.isValid not implemented")
27+
@SkipForDialect(value = GaussDBDialect.class, comment = "GaussDB query serialization level of SERIALIZABLE has some problem")
2628
public class C3p0TransactionIsolationConfigTest extends BaseTransactionIsolationConfigTest {
2729
private StandardServiceRegistry ssr;
2830

0 commit comments

Comments
 (0)