Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
methane committed Dec 12, 2024
1 parent 9fad4c0 commit 44d7dee
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
4 changes: 4 additions & 0 deletions compress.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ func newCompIO(mc *mysqlConn) *compIO {
}
}

func (c *compIO) reset() {
c.buff.Reset()
}

func (c *compIO) readNext(need int, r readwriteFunc) ([]byte, error) {
for c.buff.Len() < need {
if err := c.readCompressedPacket(r); err != nil {
Expand Down
1 change: 1 addition & 0 deletions connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ func (mc *mysqlConn) syncSequenceNr() {
// https://github.com/mysql/mysql-server/blob/824e2b4064053f7daf17d7f3f84b7a3ed92e5fb4/sql-common/net_serv.cc#L293
if mc.compress {
mc.sequence = mc.compressSequence
mc.compIO.reset()
}
}

Expand Down
8 changes: 6 additions & 2 deletions driver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -971,12 +971,16 @@ func TestDateTime(t *testing.T) {
var err error
rows, err = dbt.db.Query(`SELECT cast("00:00:00.1" as TIME(1)) = "00:00:00.1"`)
if err == nil {
rows.Scan(&microsecsSupported)
if rows.Next() {
rows.Scan(&microsecsSupported)
}
rows.Close()
}
rows, err = dbt.db.Query(`SELECT cast("0000-00-00" as DATE) = "0000-00-00"`)
if err == nil {
rows.Scan(&zeroDateSupported)
if rows.Next() {
rows.Scan(&zeroDateSupported)
}
rows.Close()
}
for _, setups := range testcases {
Expand Down

0 comments on commit 44d7dee

Please sign in to comment.