Memsql throws error MemSQL does not support server-side prepared statements
Clash Royale CLAN TAG#URR8PPP
Memsql throws error MemSQL does not support server-side prepared statements
I am trying to execute query in memsql with golang. But i keep getting error.
"MemSQL does not support server-side prepared statements."
I am even using "interpolateParams=true" but still the same error.
var Dbmysql, err = sql.Open("mysql", "root:@/memsql?interpolateParams=true")
tx,err := Dbmysql.Begin()
fmt.Println(err)
stmt, err := tx.Prepare("INSERT INTO squareNum VALUES( ?, ? )") // ? = placeholder
fmt.Println(err)
for i:=0;i<1e6;i++
_,err = stmt.Exec("test",1)
log.Println(tx.Rollback())
fmt.Println(err)
err = tx.Commit()
fmt.Println(err)
Prepare
I know, whats the solution ? just use db.Query?
– tony
Aug 6 at 17:01
1 Answer
1
In Go's driver, the interpolateParams=true option only applies to things like Exec("INSERT INTO squareNum VALUES( ?, ? )", 1, 2)
- it doesn't apply to Prepare()
. So you'll have to stick with the former - just don't use explicit Prepare()
Exec("INSERT INTO squareNum VALUES( ?, ? )", 1, 2)
Prepare()
Prepare()
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
That error message seems pretty clear to me.
Prepare
is not supported for MemSQL.– Peter
Aug 6 at 16:54