Skip to content
Playground(another site)

bynk.d1.sql_param_count

Error A literal D1 statement uses a different number of bound parameters (?N) than the list literal passed with it holds.

D1 refuses a statement bound to a different number of values than it has parameters, so Bynk counts them at compile time by SQLite's rule: the highest ?N, with a bare ? taking the next number. It checks a list written out in place, or a name let-bound to one. Pass one SqlValue for each parameter, or change the SQL.

Example

let _ <- Orders.all("SELECT id FROM orders WHERE id = ?1 AND total > ?2", [Text(id)]) // ✗ two parameters, one value
let _ <- Orders.all("SELECT id FROM orders WHERE id = ?1 AND total > ?2", [Text(id), Integer(100)]) // ✓

In the Book

See also

  • Every code in its category, Other, on the diagnostic index.
  • bynk explain bynk.d1.sql_param_count shows the same from the installed toolchain, without a network.