Skip to content

Commit 381c29a

Browse files
committed
add syntax err
1 parent 8ec0aa3 commit 381c29a

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

sql/rowexec/binlog.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,10 @@ func binlogSessClearTableMaps() {
9898
// not in ha_write_row().
9999
// See https://github.com/MariaDB/server/blob/mariadb-11.4.8/sql/sql_binlog.cc#L267-L428
100100
func (b *BaseBuilder) buildBinlog(ctx *sql.Context, n *plan.Binlog, row sql.Row) (sql.RowIter, error) {
101+
if n.Base64Str == "" {
102+
return nil, sql.ErrSyntaxError.New("BINLOG")
103+
}
104+
101105
var decoded []byte
102106

103107
lines := strings.Split(n.Base64Str, "\n")

sql/rowexec/binlog_test.go

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ package rowexec
1717
import (
1818
"encoding/base64"
1919
"encoding/binary"
20-
"io"
2120
"testing"
2221

2322
"github.com/dolthub/go-mysql-server/memory"
@@ -53,13 +52,9 @@ func TestBuildBinlog_EmptyString(t *testing.T) {
5352

5453
binlogNode := plan.NewBinlog("", catalog)
5554

56-
iter, err := builder.buildBinlog(ctx, binlogNode, nil)
57-
require.NoError(t, err)
58-
require.NotNil(t, iter)
59-
60-
row, err := iter.Next(ctx)
61-
require.Equal(t, io.EOF, err)
62-
require.Nil(t, row)
55+
_, err := builder.buildBinlog(ctx, binlogNode, nil)
56+
require.Error(t, err)
57+
require.True(t, sql.ErrSyntaxError.Is(err))
6358
}
6459

6560
func TestBuildBinlog_IncompleteEventHeader(t *testing.T) {

0 commit comments

Comments
 (0)