Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
chore: upgrade mysql parser for more bin and hex (#13221)
rebeliced5c787acff49
diff --git a/backend/plugin/db/mysql/mysql.go b/backend/plugin/db/mysql/mysql.goindex 6e88797858..1bdb9c8b38 100644--- a/backend/plugin/db/mysql/mysql.go+++ b/backend/plugin/db/mysql/mysql.go@@ -458,8 +458,6 @@ func (d *Driver) QueryConn(ctx context.Context, conn *sql.Conn, statement string_, allQuery, err := base.ValidateSQLForEditor(storepb.Engine_MYSQL, statement)if err != nil {- // TODO(d): need to fix parser.- // INSERT INTO tbl (id, name, gender, height) VALUES(1, 'Alice', B'0', B'01111111');slog.Error("failed to validate sql", slog.String("statement", statement), log.BBError(err))allQuery = true}diff --git a/backend/plugin/parser/mysql/mysql_test.go b/backend/plugin/parser/mysql/mysql_test.goindex 705883e0e7..2660ce8afe 100644--- a/backend/plugin/parser/mysql/mysql_test.go+++ b/backend/plugin/parser/mysql/mysql_test.go@@ -66,6 +66,10 @@ func TestMySQLParser(t *testing.T) {errorMessage stringtotal int}{+ {+ statement: "INSERT INTO tbl (id, name, gender, height) VALUES(1, 'Alice', B'0', B'01111111');",+ total: 1,+ },{statement: "aaa",errorMessage: "Syntax error at line 1:0 \nrelated text: aaa",diff --git a/backend/tests/sql_export_test.go b/backend/tests/sql_export_test.goindex d5f54b9d23..43557ead3b 100644--- a/backend/tests/sql_export_test.go+++ b/backend/tests/sql_export_test.go@@ -46,6 +46,15 @@ func TestSQLExport(t *testing.T) {password: "123",queryResult: []*v1pb.QueryResult{{+ ColumnNames: []string{"Affected Rows"},+ ColumnTypeNames: []string{"INT"},+ Rows: []*v1pb.QueryRow{+ {+ Values: []*v1pb.RowValue{+ {Kind: &v1pb.RowValue_Int64Value{Int64Value: 1}},+ },+ },+ },Statement: "INSERT INTO Test1.tbl (id, name, gender, height) VALUES(1, 'Alice', B'0', B'01111111');",},},diff --git a/go.mod b/go.modindex 195177cb37..630adb10d7 100644--- a/go.mod+++ b/go.mod@@ -19,7 +19,7 @@ require (github.com/beltran/gohive v1.7.0github.com/blang/semver/v4 v4.0.0github.com/bytebase/bq-parser v0.0.0-20240529032606-614a0230b8f7- github.com/bytebase/mysql-parser v0.0.0-20240708171745-888dff8b5915+ github.com/bytebase/mysql-parser v0.0.0-20240807032652-f13bb3f05afcgithub.com/bytebase/plsql-parser v0.0.0-20240724030234-55445b9c5491github.com/bytebase/postgresql-parser v0.0.0-20231221075352-cf5025e0d56fgithub.com/bytebase/snowsql-parser v0.0.0-20240304100801-bb357ccb5535diff --git a/go.sum b/go.sumindex 31401d738f..aa6851550f 100644--- a/go.sum+++ b/go.sum@@ -792,8 +792,8 @@ github.com/bytebase/gohive v0.0.0-20240422092929-d76993a958a4 h1:5o+GWOu+j68eAODgithub.com/bytebase/gohive v0.0.0-20240422092929-d76993a958a4/go.mod h1:sV29Oj7v/xsXJjJwLRYimdnEX6aZOA1ofAlZ+D/snOo=github.com/bytebase/gosasl v0.0.0-20240422091407-6b7481e86f08 h1:S1GgjJLspz4E4z4CvomGvKgxyv0ATfZm27qHM418jWc=github.com/bytebase/gosasl v0.0.0-20240422091407-6b7481e86f08/go.mod h1:Qx8cW6jkI8riyzmklj80kAIkv+iezFUTBiGU0qHhHes=-github.com/bytebase/mysql-parser v0.0.0-20240708171745-888dff8b5915 h1:2W7JSIzcEKoyYZxF/ob6u0ocC70IjMta3F+tFhRbeNc=-github.com/bytebase/mysql-parser v0.0.0-20240708171745-888dff8b5915/go.mod h1:n22yoTeLcphIYQlV6nbufQbHMxNceOjeGDOrpaRIhiY=+github.com/bytebase/mysql-parser v0.0.0-20240807032652-f13bb3f05afc h1:B6nmeqEW5RlRR30y0yoKuViYm6FVud9rSMzVj8QFkx8=+github.com/bytebase/mysql-parser v0.0.0-20240807032652-f13bb3f05afc/go.mod h1:n22yoTeLcphIYQlV6nbufQbHMxNceOjeGDOrpaRIhiY=github.com/bytebase/partiql-parser v0.0.0-20240531101102-1962ff456f2c h1:TMANvCCN7gpqXHrzRWeWRkPTXmFvTSEyXTZ1Fz20EvM=github.com/bytebase/partiql-parser v0.0.0-20240531101102-1962ff456f2c/go.mod h1:hNMKtZBMCbNyhUFR47Ct9mqmpzZVtHgC0OsOIQhR27k=github.com/bytebase/pg_query_go2/v5 v5.0.0-20240429070353-41837024e3d6 h1:BzWyLTYLMT4H9fmqTQOD/hCvTNAxAJAIjQ8Q+KyOi2s=