opencensus-integrations/ocsql

Rebind does not appear to be supported

groob opened this issue · 5 comments

groob commented

Using tx.Rebind(deleteStmt)
With ocsql:

DELETE FROM "table" WHERE ("column" = ?)

With "postgres":

DELETE FROM "table" WHERE ("column" = $1)
groob commented

Ah,sorry, i'm running into this with sqlx. I blindly assumed this is a database/sql helper.
https://github.com/jmoiron/sqlx/blob/master/bind.go#L44

groob commented

sqlx relies on driver name to call the helper. https://github.com/jmoiron/sqlx/blob/82935fac6c1a317907c8f43ed3f7f85ea844a78b/sqlx.go#L398

I could refactor every call to use an explicit bind type

groob commented

Yeah, this fixes an issue. A note in the readme might help someone though. I'll see if I can PR it.

Hi @groob... is there anything wrong with the explanation as found in the readme?

See: https://github.com/opencensus-integrations/ocsql#jmoironsqlx

It deals with sqlx and shows how to bootstrap ocsql to not run into these kind of problems.

groob commented

No this all user error. Sorry for the bother.