Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

forum example not working #22

Open
dawkot opened this issue Dec 27, 2019 · 1 comment
Open

forum example not working #22

dawkot opened this issue Dec 27, 2019 · 1 comment

Comments

@dawkot
Copy link

dawkot commented Dec 27, 2019

/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.

@huaxk
Copy link
Collaborator

huaxk commented Feb 27, 2020

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants