-
Notifications
You must be signed in to change notification settings - Fork 997
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
allow packet.Conn buffersize to be adjustable (#892)
- Loading branch information
1 parent
7ee1864
commit 8d0b3e3
Showing
4 changed files
with
39 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ import ( | |
"math" | ||
"net" | ||
"reflect" | ||
"strconv" | ||
"strings" | ||
"testing" | ||
"time" | ||
|
@@ -73,6 +74,29 @@ func TestDriverOptions_ConnectTimeout(t *testing.T) { | |
conn.Close() | ||
} | ||
|
||
func TestDriverOptions_BufferSize(t *testing.T) { | ||
log.SetLevel(log.LevelDebug) | ||
srv := CreateMockServer(t) | ||
defer srv.Stop() | ||
|
||
SetDSNOptions(map[string]DriverOption{ | ||
"bufferSize": func(c *client.Conn, value string) error { | ||
var err error | ||
c.BufferSize, err = strconv.Atoi(value) | ||
return err | ||
}, | ||
}) | ||
|
||
conn, err := sql.Open("mysql", "[email protected]:3307/test?bufferSize=4096") | ||
require.NoError(t, err) | ||
|
||
rows, err := conn.QueryContext(context.TODO(), "select * from table;") | ||
require.NotNil(t, rows) | ||
require.NoError(t, err) | ||
|
||
conn.Close() | ||
} | ||
|
||
func TestDriverOptions_ReadTimeout(t *testing.T) { | ||
log.SetLevel(log.LevelDebug) | ||
srv := CreateMockServer(t) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters