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
Using prepared statement exec delete from xxx where id in (....) do not work
Using prepared statement exec delete from xxx where id in (?, ?, ?, ?...) do not work, but after I change the code to delete form xxx where id = ?, and invoke the sql again and again, the prepared statement work successed.
The failed code
paramArr:= []int{1,2,3}
tx,_:=performanceDb.Begin();
stmt,_:= tx.Prepare('deletefromxxxwhereidin (?,?,?)')
result, _:=stmt.Exec(paramArr...)
affectedRowSize, _:=result.RowsAffected() // the affectedRowSize always be 0!!!
The successed code
paramArr:= []int{1,2,3}
tx,_:=performanceDb.Begin();
stmt,_:= tx.Prepare('deletefromxxxwhereid= ?')
for _, p:=rangeparamArr {
result, _:=stmt.Exec(p) // the delete sql will successed!
}
Error log
There is no error log!!!
Configuration
Go version: go version go1.9.2 darwin/amd64
Server version: 5.6.24-log MySQL Community Server (GPL)
Running Server OS: Linux e93f19544.em21 2.6.32-358.23.2.ali1195.el6.x86_64 #1 SMP Wed Oct 29 20:23:37 CST 2014 x86_64 x86_64 x86_64 GNU/Linux
Building Server OS: Darwin localhost 16.3.0 Darwin Kernel Version 16.3.0: Thu Nov 17 20:23:58 PST 2016; root:xnu-3789.31.2~1/RELEASE_X86_64 x86_64
The text was updated successfully, but these errors were encountered:
Using prepared statement exec
delete from xxx where id in (....)
do not workUsing prepared statement exec
delete from xxx where id in (?, ?, ?, ?...)
do not work, but after I change the code todelete form xxx where id = ?
, and invoke the sql again and again, the prepared statement work successed.The failed code
The successed code
Error log
There is no error log!!!
Configuration
Go version: go version go1.9.2 darwin/amd64
Server version: 5.6.24-log MySQL Community Server (GPL)
Running Server OS: Linux e93f19544.em21 2.6.32-358.23.2.ali1195.el6.x86_64 #1 SMP Wed Oct 29 20:23:37 CST 2014 x86_64 x86_64 x86_64 GNU/Linux
Building Server OS: Darwin localhost 16.3.0 Darwin Kernel Version 16.3.0: Thu Nov 17 20:23:58 PST 2016; root:xnu-3789.31.2~1/RELEASE_X86_64 x86_64
The text was updated successfully, but these errors were encountered: