Can someone please explain me what is the difference between using
$1
query, err := b.Db.Prepare("SELECT id, name, owner, coordinates, reason_froggy FROM Business WHERE name ilike $1")
if err != nil {
return business_list, err
}
rows, err := query.Query("%" + business + "%")
if err != nil {
return business_list, err
}
and
?
query, err := b.Db.Prepare("SELECT id, name, owner, coordinates, reason_froggy FROM Business WHERE name ilike ?")
if err != nil {
return business_list, err
}
rows, err := query.Query("%" + business + "%")
if err != nil {
return business_list, err
}
are they're supposed to work the same way as an anon param, or they're different?
Also the other thing is that with the $1 param the query runs perfect, but with the ? param the query returns a pg error in syntax.