Skip to content

Commit 788d756

Browse files
authored
Merge pull request #3090 from dolthub/main
pull from main
2 parents 2cf9b49 + af68faa commit 788d756

File tree

152 files changed

+8622
-2720
lines changed

Some content is hidden

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

152 files changed

+8622
-2720
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ func main() {
122122
Protocol: "tcp",
123123
Address: fmt.Sprintf("%s:%d", address, port),
124124
}
125-
s, err := server.NewServer(config, engine, memory.NewSessionBuilder(pro), nil)
125+
s, err := server.NewServer(config, engine, sql.NewContext, memory.NewSessionBuilder(pro), nil)
126126
if err != nil {
127127
panic(err)
128128
}

_integration/go/go.mod

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,25 @@
11
module github.com/dolthub/go-mysql-server/integration/go
22

3-
go 1.14
3+
go 1.22
4+
5+
toolchain go1.24.1
6+
7+
require (
8+
github.com/go-mysql-org/go-mysql v1.12.0
9+
github.com/go-sql-driver/mysql v1.7.1
10+
)
411

512
require (
6-
github.com/go-sql-driver/mysql v1.4.0
7-
google.golang.org/appengine v1.2.0 // indirect
13+
filippo.io/edwards25519 v1.1.0 // indirect
14+
github.com/Masterminds/semver v1.5.0 // indirect
15+
github.com/google/uuid v1.3.0 // indirect
16+
github.com/klauspost/compress v1.17.8 // indirect
17+
github.com/pingcap/errors v0.11.5-0.20240311024730-e056997136bb // indirect
18+
github.com/pingcap/log v1.1.1-0.20230317032135-a0d097d16e22 // indirect
19+
github.com/pingcap/tidb/pkg/parser v0.0.0-20241118164214-4f047be191be // indirect
20+
go.uber.org/atomic v1.11.0 // indirect
21+
go.uber.org/multierr v1.11.0 // indirect
22+
go.uber.org/zap v1.27.0 // indirect
23+
golang.org/x/text v0.20.0 // indirect
24+
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
825
)

_integration/go/go.sum

Lines changed: 74 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,75 @@
1-
github.com/go-sql-driver/mysql v1.4.0 h1:7LxgVwFb2hIQtMm87NdgAVfXjnt4OePseqT1tKx+opk=
2-
github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w=
3-
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
4-
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
1+
filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA=
2+
filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4=
3+
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
4+
github.com/Masterminds/semver v1.5.0 h1:H65muMkzWKEuNDnfl9d70GUjFniHKHRbFPGBuZ3QEww=
5+
github.com/Masterminds/semver v1.5.0/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y=
6+
github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA=
7+
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
8+
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
9+
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
10+
github.com/go-mysql-org/go-mysql v1.12.0 h1:tyToNggfCfl11OY7GbWa2Fq3ofyScO9GY8b5f5wAmE4=
11+
github.com/go-mysql-org/go-mysql v1.12.0/go.mod h1:/XVjs1GlT6NPSf13UgXLv/V5zMNricTCqeNaehSBghs=
12+
github.com/go-sql-driver/mysql v1.7.1 h1:lUIinVbN1DY0xBg0eMOzmmtGoHwWBbvnWubQUrtU8EI=
13+
github.com/go-sql-driver/mysql v1.7.1/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI=
14+
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
15+
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
16+
github.com/klauspost/compress v1.17.8 h1:YcnTYrq7MikUT7k0Yb5eceMmALQPYBW/Xltxn0NAMnU=
17+
github.com/klauspost/compress v1.17.8/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw=
18+
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
19+
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
20+
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
21+
github.com/pingcap/errors v0.11.0/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8=
22+
github.com/pingcap/errors v0.11.5-0.20240311024730-e056997136bb h1:3pSi4EDG6hg0orE1ndHkXvX6Qdq2cZn8gAPir8ymKZk=
23+
github.com/pingcap/errors v0.11.5-0.20240311024730-e056997136bb/go.mod h1:X2r9ueLEUZgtx2cIogM0v4Zj5uvvzhuuiu7Pn8HzMPg=
24+
github.com/pingcap/log v1.1.1-0.20230317032135-a0d097d16e22 h1:2SOzvGvE8beiC1Y4g9Onkvu6UmuBBOeWRGQEjJaT/JY=
25+
github.com/pingcap/log v1.1.1-0.20230317032135-a0d097d16e22/go.mod h1:DWQW5jICDR7UJh4HtxXSM20Churx4CQL0fwL/SoOSA4=
26+
github.com/pingcap/tidb/pkg/parser v0.0.0-20241118164214-4f047be191be h1:t5EkCmZpxLCig5GQA0AZG47aqsuL5GTsJeeUD+Qfies=
27+
github.com/pingcap/tidb/pkg/parser v0.0.0-20241118164214-4f047be191be/go.mod h1:Hju1TEWZvrctQKbztTRwXH7rd41Yq0Pgmq4PrEKcq7o=
28+
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
29+
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
30+
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
31+
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
32+
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
33+
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
34+
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
35+
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
36+
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
37+
go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ=
38+
go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
39+
go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
40+
go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE=
41+
go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0=
42+
go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A=
43+
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
44+
go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
45+
go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU=
46+
go.uber.org/multierr v1.7.0/go.mod h1:7EAYxJLBy9rStEaz58O2t4Uvip6FSURkq8/ppBp95ak=
47+
go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
48+
go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
49+
go.uber.org/zap v1.19.0/go.mod h1:xg/QME4nWcxGxrpdeYfq7UvYrLh66cuVKdrbD1XF/NI=
50+
go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8=
51+
go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E=
52+
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
53+
golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
54+
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
55+
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
56+
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
57+
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
558
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
6-
google.golang.org/appengine v1.2.0 h1:S0iUepdCWODXRvtE+gcRDd15L+k+k1AiHlMiMjefH24=
7-
google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
59+
golang.org/x/text v0.20.0 h1:gK/Kv2otX8gz+wn7Rmb3vT96ZwuoxnQlY+HlJVj7Qug=
60+
golang.org/x/text v0.20.0/go.mod h1:D4IsuqiFMhST5bX19pQ9ikHC2GsaKyk/oF+pn3ducp4=
61+
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
62+
golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
63+
golang.org/x/tools v0.0.0-20191108193012-7d206e10da11/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
64+
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
65+
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
66+
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
67+
gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k=
68+
gopkg.in/natefinch/lumberjack.v2 v2.2.1 h1:bBRl1b0OH9s/DuPhuXpNl+VtCaJXFZ5/uEFST95x9zc=
69+
gopkg.in/natefinch/lumberjack.v2 v2.2.1/go.mod h1:YD8tP3GAjkrDg1eZH7EGmyESg/lsYskCTPBJVb9jqSc=
70+
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
71+
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
72+
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
73+
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
74+
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
75+
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

_integration/go/mysql_test.go

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ import (
1919
"reflect"
2020
"testing"
2121

22+
"github.com/go-mysql-org/go-mysql/client"
23+
"github.com/go-mysql-org/go-mysql/mysql"
2224
_ "github.com/go-sql-driver/mysql"
2325
)
2426

@@ -120,6 +122,101 @@ func TestGrafana(t *testing.T) {
120122
}
121123
}
122124

125+
func TestMySQLStreaming(t *testing.T) {
126+
conn, err := client.Connect("127.0.0.1:3306", "root", "", "mydb")
127+
if err != nil {
128+
t.Fatalf("can't connect to mysql: %s", err)
129+
}
130+
defer func() {
131+
err = conn.Close()
132+
if err != nil {
133+
t.Fatalf("error closing mysql connection: %s", err)
134+
}
135+
}()
136+
137+
var result mysql.Result
138+
var rows [][2]string
139+
err = conn.ExecuteSelectStreaming("SELECT name, email FROM mytable ORDER BY name, email", &result, func(row []mysql.FieldValue) error {
140+
if len(row) != 2 {
141+
t.Fatalf("expected 2 columns, got %d", len(row))
142+
}
143+
rows = append(rows, [2]string{row[0].String(), row[1].String()})
144+
return nil
145+
}, nil)
146+
147+
expected := [][2]string{
148+
{"Evil Bob", "[email protected]"},
149+
{"Jane Doe", "[email protected]"},
150+
{"John Doe", "[email protected]"},
151+
{"John Doe", "[email protected]"},
152+
}
153+
154+
if len(expected) != len(rows) {
155+
t.Errorf("got %d rows, expecting %d", len(rows), len(expected))
156+
}
157+
158+
for i := range rows {
159+
if rows[i][0] != expected[i][0] || rows[i][1] != expected[i][1] {
160+
t.Errorf(
161+
"incorrect row %d, got: {%s, %s}, expected: {%s, %s}",
162+
i,
163+
rows[i][0], rows[i][1],
164+
expected[i][0], expected[i][1],
165+
)
166+
}
167+
}
168+
}
169+
170+
func TestMySQLStreamingPrepared(t *testing.T) {
171+
conn, err := client.Connect("127.0.0.1:3306", "root", "", "mydb")
172+
if err != nil {
173+
t.Fatalf("can't connect to mysql: %s", err)
174+
}
175+
defer func() {
176+
err = conn.Close()
177+
if err != nil {
178+
t.Fatalf("error closing mysql connection: %s", err)
179+
}
180+
}()
181+
182+
stmt, err := conn.Prepare("SELECT name, email, ? FROM mytable ORDER BY name, email")
183+
if err != nil {
184+
t.Fatalf("error preparing statement: %s", err)
185+
}
186+
187+
var result mysql.Result
188+
var rows [][3]string
189+
err = stmt.ExecuteSelectStreaming(&result, func(row []mysql.FieldValue) error {
190+
if len(row) != 3 {
191+
t.Fatalf("expected 3 columns, got %d", len(row))
192+
}
193+
rows = append(rows, [3]string{row[0].String(), row[1].String(), row[2].String()})
194+
return nil
195+
}, nil, "abc")
196+
197+
expected := [][3]string{
198+
{"Evil Bob", "[email protected]", "abc"},
199+
{"Jane Doe", "[email protected]", "abc"},
200+
{"John Doe", "[email protected]", "abc"},
201+
{"John Doe", "[email protected]", "abc"},
202+
}
203+
204+
if len(expected) != len(rows) {
205+
t.Errorf("got %d rows, expecting %d", len(rows), len(expected))
206+
}
207+
208+
for i := range rows {
209+
if rows[i][0] != expected[i][0] || rows[i][1] != expected[i][1] || rows[i][2] != expected[i][2] {
210+
t.Errorf(
211+
"incorrect row %d, got: {%s, %s, %s}, expected: {%s, %s, %s}",
212+
i,
213+
rows[i][0], rows[i][1], rows[i][2],
214+
expected[i][0], expected[i][1], expected[i][2],
215+
)
216+
}
217+
}
218+
}
219+
123220
func getResult(t *testing.T, rs *sql.Rows) [][]string {
124221
t.Helper()
125222

enginetest/enginetests.go

Lines changed: 43 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,20 @@ func TestQueries(t *testing.T, harness Harness) {
7474
})
7575
}
7676

77+
for _, tt := range queries.FunctionQueryTests {
78+
t.Run(tt.Query, func(t *testing.T) {
79+
if sh, ok := harness.(SkippingHarness); ok {
80+
if sh.SkipQueryTest(tt.Query) {
81+
t.Skipf("Skipping query plan for %s", tt.Query)
82+
}
83+
}
84+
if IsServerEngine(e) && tt.SkipServerEngine {
85+
t.Skip("skipping for server engine")
86+
}
87+
TestQueryWithContext(t, ctx, e, harness, tt.Query, tt.Expected, tt.ExpectedColumns, nil, nil)
88+
})
89+
}
90+
7791
// TODO: move this into its own test method
7892
if keyless, ok := harness.(KeylessTableHarness); ok && keyless.SupportsKeylessTables() {
7993
for _, tt := range queries.KeylessQueries {
@@ -218,6 +232,17 @@ func TestQueriesPrepared(t *testing.T, harness Harness) {
218232
}
219233
})
220234

235+
t.Run("function query prepared tests", func(t *testing.T) {
236+
for _, tt := range queries.FunctionQueryTests {
237+
if tt.SkipPrepared {
238+
continue
239+
}
240+
t.Run(tt.Query, func(t *testing.T) {
241+
TestPreparedQueryWithEngine(t, harness, e, tt)
242+
})
243+
}
244+
})
245+
221246
t.Run("keyless prepared tests", func(t *testing.T) {
222247
harness.Setup(setup.MydbData, setup.KeylessData, setup.Keyless_idxData, setup.MytableData)
223248
for _, tt := range queries.KeylessQueries {
@@ -487,6 +512,7 @@ func TestReadOnlyDatabases(t *testing.T, harness ReadOnlyDatabaseHarness) {
487512

488513
for _, querySet := range [][]queries.QueryTest{
489514
queries.QueryTests,
515+
queries.FunctionQueryTests,
490516
queries.KeylessQueries,
491517
} {
492518
for _, tt := range querySet {
@@ -496,7 +522,7 @@ func TestReadOnlyDatabases(t *testing.T, harness ReadOnlyDatabaseHarness) {
496522

497523
for _, querySet := range [][]queries.WriteQueryTest{
498524
queries.InsertQueries,
499-
queries.UpdateTests,
525+
queries.UpdateWriteQueryTests,
500526
queries.DeleteTests,
501527
queries.ReplaceQueries,
502528
} {
@@ -1352,9 +1378,12 @@ func TestReplaceIntoErrors(t *testing.T, harness Harness) {
13521378

13531379
func TestUpdate(t *testing.T, harness Harness) {
13541380
harness.Setup(setup.MydbData, setup.MytableData, setup.Mytable_del_idxData, setup.FloattableData, setup.NiltableData, setup.TypestableData, setup.Pk_tablesData, setup.OthertableData, setup.TabletestData)
1355-
for _, tt := range queries.UpdateTests {
1381+
for _, tt := range queries.UpdateWriteQueryTests {
13561382
RunWriteQueryTest(t, harness, tt)
13571383
}
1384+
for _, tt := range queries.UpdateScriptTests {
1385+
TestScript(t, harness, tt)
1386+
}
13581387
}
13591388

13601389
func TestUpdateIgnore(t *testing.T, harness Harness) {
@@ -1421,9 +1450,12 @@ func TestDelete(t *testing.T, harness Harness) {
14211450

14221451
func TestUpdateQueriesPrepared(t *testing.T, harness Harness) {
14231452
harness.Setup(setup.MydbData, setup.MytableData, setup.Mytable_del_idxData, setup.OthertableData, setup.TypestableData, setup.Pk_tablesData, setup.FloattableData, setup.NiltableData, setup.TabletestData)
1424-
for _, tt := range queries.UpdateTests {
1453+
for _, tt := range queries.UpdateWriteQueryTests {
14251454
runWriteQueryTestPrepared(t, harness, tt)
14261455
}
1456+
for _, tt := range queries.UpdateScriptTests {
1457+
TestScriptPrepared(t, harness, tt)
1458+
}
14271459
}
14281460

14291461
func TestDeleteQueriesPrepared(t *testing.T, harness Harness) {
@@ -4112,7 +4144,7 @@ func TestVariables(t *testing.T, harness Harness) {
41124144
},
41134145
{
41144146
Query: "SET GLOBAL select_into_buffer_size = 9001",
4115-
Expected: []sql.Row{{}},
4147+
Expected: []sql.Row{{types.NewOkResult(0)}},
41164148
},
41174149
{
41184150
Query: "SELECT @@SESSION.select_into_buffer_size",
@@ -4124,7 +4156,7 @@ func TestVariables(t *testing.T, harness Harness) {
41244156
},
41254157
{
41264158
Query: "SET @@GLOBAL.select_into_buffer_size = 9002",
4127-
Expected: []sql.Row{{}},
4159+
Expected: []sql.Row{{types.NewOkResult(0)}},
41284160
},
41294161
{
41304162
Query: "SELECT @@GLOBAL.select_into_buffer_size",
@@ -4133,7 +4165,7 @@ func TestVariables(t *testing.T, harness Harness) {
41334165
{
41344166
// For boolean types, OFF/ON is converted
41354167
Query: "SET @@GLOBAL.activate_all_roles_on_login = 'ON'",
4136-
Expected: []sql.Row{{}},
4168+
Expected: []sql.Row{{types.NewOkResult(0)}},
41374169
},
41384170
{
41394171
Query: "SELECT @@GLOBAL.activate_all_roles_on_login",
@@ -4142,7 +4174,7 @@ func TestVariables(t *testing.T, harness Harness) {
41424174
{
41434175
// For non-boolean types, OFF/ON is not converted
41444176
Query: "SET @@GLOBAL.delay_key_write = 'OFF'",
4145-
Expected: []sql.Row{{}},
4177+
Expected: []sql.Row{{types.NewOkResult(0)}},
41464178
},
41474179
{
41484180
Query: "SELECT @@GLOBAL.delay_key_write",
@@ -4168,7 +4200,7 @@ func TestVariables(t *testing.T, harness Harness) {
41684200
},
41694201
{
41704202
Query: "SET GLOBAL select_into_buffer_size = 131072",
4171-
Expected: []sql.Row{{}},
4203+
Expected: []sql.Row{{types.NewOkResult(0)}},
41724204
},
41734205
} {
41744206
t.Run(assertion.Query, func(t *testing.T) {
@@ -5271,17 +5303,17 @@ func TestPersist(t *testing.T, harness Harness, newPersistableSess func(ctx *sql
52715303
}{
52725304
{
52735305
Query: "SET PERSIST max_connections = 1000;",
5274-
Expected: []sql.Row{{}},
5306+
Expected: []sql.Row{{types.NewOkResult(0)}},
52755307
ExpectedGlobal: int64(1000),
52765308
ExpectedPersist: int64(1000),
52775309
}, {
52785310
Query: "SET @@PERSIST.max_connections = 1000;",
5279-
Expected: []sql.Row{{}},
5311+
Expected: []sql.Row{{types.NewOkResult(0)}},
52805312
ExpectedGlobal: int64(1000),
52815313
ExpectedPersist: int64(1000),
52825314
}, {
52835315
Query: "SET PERSIST_ONLY max_connections = 1000;",
5284-
Expected: []sql.Row{{}},
5316+
Expected: []sql.Row{{types.NewOkResult(0)}},
52855317
ExpectedGlobal: int64(151),
52865318
ExpectedPersist: int64(1000),
52875319
},

0 commit comments

Comments
 (0)