You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Recently I made PR to make MySQLCapabilities available (#170).
Now we can use CLIENT_MULTI_STATEMENTS. However I found MySQLPacketDecoder doesn't support results of such queries.
The result packet of multi statements query contains the status flag SERVER_MORE_RESULTS_EXISTS, but the decoder doesn't read more.
So if we execute next query, it'll recieves invalid bytes previous query left.
Reproduction code.
letconfig=MySQLDatabaseConfig(hostname:"localhost",
port:3306,
username:"root",
password:"PASSWORD",
database:"DATABASE",
capabilities:MySQLCapabilities.default.union([.CLIENT_MULTI_STATEMENTS]))letmysql=MySQLDatabase(config: config)leteventLoop=MultiThreadedEventLoopGroup(numberOfThreads:1)letconn=try! mysql.newConnection(on: eventLoop).wait()letquery="""set time_zone = "+00:00";select CURRENT_TIMESTAMP;"""letres1=try! conn.simpleQuery(query).wait()print("res1: ", res1)
// Second query doesn't work well.
letres2=try! conn.simpleQuery("select * from fluent where id = 0").wait()print("res2: ", res2)
simpleQuery returns only one result, so we need multiQuery if the decoder supports SERVER_MORE_RESULTS_EXISTS.
I don't know if there's someone who really needs multiple statements (We can split query with ; and execute one by one). So simply forbid using CLIENT_MULTI_STATEMENTS is an option.
The text was updated successfully, but these errors were encountered:
Recently I made PR to make
MySQLCapabilities
available (#170).Now we can use
CLIENT_MULTI_STATEMENTS
. However I foundMySQLPacketDecoder
doesn't support results of such queries.The result packet of multi statements query contains the status flag
SERVER_MORE_RESULTS_EXISTS
, but the decoder doesn't read more.So if we execute next query, it'll recieves invalid bytes previous query left.
Reproduction code.
simpleQuery
returns only one result, so we needmultiQuery
if the decoder supportsSERVER_MORE_RESULTS_EXISTS
.I don't know if there's someone who really needs multiple statements (We can split query with
;
and execute one by one). So simply forbid usingCLIENT_MULTI_STATEMENTS
is an option.The text was updated successfully, but these errors were encountered: