зеркало из https://github.com/github/vitess-gh.git
Merge pull request #5209 from planetscale/sa-5204
Fixed Panic for handlePrepare in Prepared statements
This commit is contained in:
Коммит
3f4970b890
|
@ -1573,9 +1573,9 @@ func (e *Executor) handlePrepare(ctx context.Context, safeSession *SafeSession,
|
|||
if err != nil {
|
||||
logStats.Error = err
|
||||
errCount = 1
|
||||
} else {
|
||||
logStats.RowsAffected = qr.RowsAffected
|
||||
return nil, err
|
||||
}
|
||||
logStats.RowsAffected = qr.RowsAffected
|
||||
|
||||
plan.AddStats(1, time.Since(logStats.StartTime), uint64(logStats.ShardQueries), logStats.RowsAffected, errCount)
|
||||
|
||||
|
|
|
@ -255,6 +255,16 @@ class TestPreparedStatements(unittest.TestCase):
|
|||
cursor.fetchone()
|
||||
cursor.close()
|
||||
|
||||
# Send an invalid table name to ensure that python's mysql client will not fail before entering vtgate
|
||||
cursor = conn.cursor(cursor_class=MySQLCursorPrepared)
|
||||
try:
|
||||
cursor.execute('select * from prepare_stmt_test where id = %s', (1,))
|
||||
except mysql.connector.Error as err:
|
||||
if err.errno == 1105:
|
||||
print "Could not find the table"
|
||||
else:
|
||||
raise
|
||||
|
||||
cursor = conn.cursor(cursor_class=MySQLCursorPrepared)
|
||||
cursor.execute('select * from vt_prepare_stmt_test where id = %s', (1,))
|
||||
result = cursor.fetchall()
|
||||
|
|
Загрузка…
Ссылка в новой задаче