Araq / ormin

Ormin -- An ORM for Nim.
MIT License
153 stars 18 forks source link

"cannot infer the type of the placeholder" #56

Open dawkot opened 4 years ago

dawkot commented 4 years ago

Basically this code errors at compile-time, and I don't know why:

let categoryName = "Cars"

let s = query:
  select product(name, img, price)
  join prod_cat(prod, cat) on product.id == prod_cat.prod
  join category(name) on category.id == prod_cat.cat
  where category.name == ?categoryName # cannot infer the type of the placeholder

This is the sqlite model:

create table product(
  id integer primary key,
  name varchar not null,
  img varchar not null,
  price integer not null,
  views integer not null default 0,
  created timestamp not null default (DATETIME('now')),
  modified timestamp not null default (DATETIME('now')));

create table category(
  id integer primary key,
  name varchar not null,
  img varchar not null);

create table prod_cat(
  prod integer not null references product(id),
  cat integer not null references category(id));