Skip to content
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

make sure dual queries set found_rows correctly #6718

Merged
merged 2 commits into from
Sep 14, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
10 changes: 10 additions & 0 deletions go/test/endtoend/vtgate/misc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,16 @@ func TestSwitchBetweenOlapAndOltp(t *testing.T) {
exec(t, conn, "set workload='oltp'")
}

func TestFoundRowsOnDualQueries(t *testing.T) {
ctx := context.Background()
conn, err := mysql.Connect(ctx, &vtParams)
require.NoError(t, err)
defer conn.Close()

exec(t, conn, "select 42")
assertMatches(t, conn, "select found_rows()", "[[UINT64(1)]]")
}

func TestUseStmtInOLAP(t *testing.T) {
defer cluster.PanicHandler(t)
ctx := context.Background()
Expand Down
8 changes: 2 additions & 6 deletions go/vt/vtgate/engine/singlerow.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,7 @@ func (s *SingleRow) GetTableName() string {
// Execute performs a non-streaming exec.
func (s *SingleRow) Execute(vcursor VCursor, bindVars map[string]*query.BindVariable, wantfields bool) (*sqltypes.Result, error) {
result := sqltypes.Result{
Fields: nil,
RowsAffected: 0,
InsertID: 0,
RowsAffected: 1,
Rows: [][]sqltypes.Value{
{},
},
Expand All @@ -60,9 +58,7 @@ func (s *SingleRow) Execute(vcursor VCursor, bindVars map[string]*query.BindVari
// StreamExecute performs a streaming exec.
func (s *SingleRow) StreamExecute(vcursor VCursor, bindVars map[string]*query.BindVariable, wantields bool, callback func(*sqltypes.Result) error) error {
result := sqltypes.Result{
Fields: nil,
RowsAffected: 0,
InsertID: 0,
RowsAffected: 1,
Rows: [][]sqltypes.Value{
{},
},
Expand Down