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
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
Next Next commit
make sure dual queries set found_rows correctly
Signed-off-by: Andres Taylor <[email protected]>
systay committed Sep 14, 2020

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit 31edcf0b5e14d07627cc1ad79a4861459c831b05
10 changes: 10 additions & 0 deletions go/test/endtoend/vtgate/misc_test.go
Original file line number Diff line number Diff line change
@@ -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()
8 changes: 2 additions & 6 deletions go/vt/vtgate/engine/singlerow.go
Original file line number Diff line number Diff line change
@@ -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{
{},
},
@@ -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{
{},
},