From the specs of Prepare()
I thought I can use an sql
query with Prepare() like this:
st, err := db.Prepare("SELECT name FROM pet WHERE name=?", "Fluffy")
But I get this error:
# command-line-arguments
.\dbtest2.go:25: too many arguments in call to db.Prepare
This is the only example I could find using Prepare()
but he does not use queries with parameters. How do I use Prepare()?
Look further down the example script that you linked to, and you find this...
st, err := db.Prepare("INSERT INTO document (title) VALUES (?)")
if err != nil{
fmt.Print( err );
os.Exit(1)
}
st.Exec("Hello Again")
st.Close()