`forum` example not working
dawkot opened this issue · comments
/home/dk/.nimble/pkgs/ormin-0.1.0/ormin/ormin_sqlite.nim(24) prepareStmt
/home/dk/.nimble/pkgs/ormin-0.1.0/ormin/ormin_sqlite.nim(20) dbError
Error: unhandled exception: no such column: a1.answer [DbError]
I have no clue how to interpret this message.
The problem may be here:
let something = query:
select antibot(answer & answer, (if ip == "hi": 0 else: 1))
where ip == ?ip and answer =~ "%things%"
orderby desc(ip)
limit 1
The generated SQL is:
select a1.answer || a1.answer, (
case
when a1.ip = 'hi' then
0
else
1
end)
from antibot as a1
where a1.ip = ? and a1.answer like '%things%'
order by a1.ip desc
limit 1
It runs without error in sqlite client after set the ip condition. Don't know why it goes wrong while preparing sql, it throws exception: DbError: no such column: a1.answer. Who can help!