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
When using the same prepared statement in different transactions, it seems like the prepared statement will always use the first values given to it in every subsequent call from within any transaction.
If you run the prepared statement outside of a transaction then it'll sort of "shake it loose", fixing the issue temporarily.
Rough pseudo-code example:
localmydb=mysqloo.connect("foo", "bar", "baz", ... )
mydb:connect()
localpreparedStatements= {}
functionmydb:onConnection()
preparedStatements.newUser=mydb:prepare( "SELECT * FROM users WHERE steam_id = ? FOR UPDATE" )
endlocalfirstRun=true-- Assume this is never called with the same player for this examplefunctionplayerInitialSpawn( ply )
localtransaction=mydb:createTransaction()
localuserExists=preparedStatements.newUseruserExists:setString( 1, ply:SteamID64() )
transaction:addQuery( userExists )
transaction:addQuery( otherStuffToo )
transaction.onSuccess=function()
localuserExistsData=userExists:getData()
ifnotfirstRunthenassert( userExistsData[1]["*"].steam_id~=ply:SteamID64() )
elsefirstRun=falseendendtransaction:start()
end
We've found that, after the first player spawns, all subsequent player spawns will actually use the first player's SteamID for the preparedStatements.newUser call. However, if we called preparedStatements.newUser directly, outside of a transaction, it would work just fine!
Are we using prepared statements / transactions incorrectly? Is MySQLOO misbehaving?
I noticed this in the latest beta changelog:
Fixed not being able to add prepared query to transactions more than once
Does that address our issue, too?
Because of the 64bit requirement, I can't easily test if it fixes our problem right now.
Info:
OS: Ubuntu 16.04 LTS MySQL:mysql Ver 14.14 Distrib 5.7.31, for Linux (x86_64) using EditLine wrapper MySQLOO:v9.6.1 GMod: Sandbox, running on the main branch
The text was updated successfully, but these errors were encountered:
When using the same prepared statement in different transactions, it seems like the prepared statement will always use the first values given to it in every subsequent call from within any transaction.
If you run the prepared statement outside of a transaction then it'll sort of "shake it loose", fixing the issue temporarily.
Rough pseudo-code example:
We've found that, after the first player spawns, all subsequent player spawns will actually use the first player's SteamID for the
preparedStatements.newUser
call. However, if we calledpreparedStatements.newUser
directly, outside of a transaction, it would work just fine!Are we using prepared statements / transactions incorrectly? Is MySQLOO misbehaving?
I noticed this in the latest beta changelog:
Does that address our issue, too?
Because of the 64bit requirement, I can't easily test if it fixes our problem right now.
Info:
OS: Ubuntu 16.04 LTS
MySQL:
mysql Ver 14.14 Distrib 5.7.31, for Linux (x86_64) using EditLine wrapper
MySQLOO:
v9.6.1
GMod: Sandbox, running on the main branch
The text was updated successfully, but these errors were encountered: