Not possible to use e.g. uint64 as an output parameter
package main
import (
"database/sql"
"fmt"
_ "modernc.org/ql/driver"
)
func main() {
db, _ := sql.Open("ql", "memory://demo")
tx, _ := db.Begin()
tx.Exec(`CREATE TABLE t (u uint64)`)
tx.Commit()
var u uint64
for i, f := range []func(tx *sql.Tx) error{
func(tx *sql.Tx) error { _, e := tx.Exec(`INSERT INTO t (u) VALUES (123)`); return e },
func(tx *sql.Tx) error { _, e := tx.Exec(`INSERT INTO t (u) VALUES ($1)`, u); return e },
func(tx *sql.Tx) error { _, e := tx.Exec(`INSERT INTO t (u) VALUES ($1)`, &u); return e },
} {
tx, _ = db.Begin()
fmt.Printf("%d: err=%v\n", i+1, u, f(tx))
tx.Rollback()
}
}
1: err=<nil>
2: err=cannot use 123 (type int64) in assignment to, or comparison with, column u (type uint64)
3: err=cannot use 123 (type int64) in assignment to, or comparison with, column u (type uint64)
This should be possible...
Edited by Peter Bourgon