Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Introduce a new method mysqlConn.Reset() #1734

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
zenovich wants to merge 10 commits into go-sql-driver:master
base: master
Choose a base branch
Loading
from zenovich:mysqlConnReset
Open
Changes from 1 commit
Commits
Show all changes
10 commits
Select commit Hold shift + click to select a range
a3f2c66
introduce a new method mysqlConn.sendNoArgsCommandWithResultOK() base...
zenovich Aug 25, 2025
d6400de
introduce a new method mysqlConn.Reset() allowing to reset the mysql ...
zenovich Aug 25, 2025
43cdc22
add Dmitry Zenovich into the list of authors
zenovich Aug 25, 2025
8630716
rename constant comConnReset to comResetConnection, add preceding con...
zenovich Aug 26, 2025
527b0ab
rename method mysqlConn.sendNoArgsCommandWithResultOK() to mysqlConn....
zenovich Aug 26, 2025
3d484fc
improve the comment of mysqlConn.Reset()
zenovich Aug 26, 2025
272fe81
fix issues in tests TestNoArgsCommand (+ rename it to TestSimpleComma...
zenovich Aug 26, 2025
9c308f1
allow skipping TestReset and TestSimpleCommandOK_Reset when COM_RESET...
zenovich Aug 26, 2025
203cac4
use QueryContext instead of Query in TestSimpleCommandOK and verify r...
zenovich Aug 26, 2025
02afe1d
seed the result with a sentinel explicitly in TestReset
zenovich Aug 26, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix issues in tests TestNoArgsCommand (+ rename it to TestSimpleComma...
...ndOK) and TestReset: fix messages and comments, close DB connections
  • Loading branch information
zenovich committed Aug 26, 2025
commit 272fe8157fcbe90463c5f56586e7d684d8730f1d
10 changes: 6 additions & 4 deletions driver_test.go
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -2329,14 +2329,14 @@ func TestPing(t *testing.T) {
})
}

func TestNoArgsCommand(t *testing.T) {
func TestSimpleCommandOK(t *testing.T) {
ctx := context.Background()
for _, test := range []struct{
method string
query string
funcToCall func(ctx context.Context, mc *mysqlConn) error
} {
{method: "Ping", query: "Ping", funcToCall: func(ctx context.Context, mc *mysqlConn) error {return mc.Ping(ctx)}},
{method: "Pinger", query: "Ping", funcToCall: func(ctx context.Context, mc *mysqlConn) error {return mc.Ping(ctx)}},
{method: "Conn", query: "Reset", funcToCall: func(ctx context.Context, mc *mysqlConn) error {return mc.Reset(ctx)}},
} {
test := test
Expand All @@ -2346,6 +2346,7 @@ func TestNoArgsCommand(t *testing.T) {
if err != nil {
dbt.fail("db", "Conn", err)
}
defer conn.Close()

// Check that affectedRows and insertIds are cleared after each call.
conn.Raw(func(conn any) error {
Expand Down Expand Up @@ -2373,7 +2374,7 @@ func TestNoArgsCommand(t *testing.T) {
t.Errorf("bad affectedRows: got %v, want=%v", got, want)
}
if got, want := c.result.insertIds, []int64(nil); !reflect.DeepEqual(got, want) {
t.Errorf("bad affectedRows: got %v, want=%v", got, want)
t.Errorf("bad insertIds: got %v, want=%v", got, want)
}
}
return nil
Expand All @@ -2390,8 +2391,9 @@ func TestReset(t *testing.T) {
if err != nil {
dbt.fail("db", "Conn", err)
}
defer conn.Close()

// Check that affectedRows and insertIds are cleared after each call.
// Verify that COM_RESET_CONNECTION clears session state (e.g., user variables).
conn.Raw(func(conn any) error {
c := conn.(*mysqlConn)

Expand Down

AltStyle によって変換されたページ (->オリジナル) /