Reputation: 21817
I create sqlite db with Erlang:
sqlite3:open(user_db, [in_memory]),
TableInfo = [{user, text, [not_null]}, {password, text, [not_null]}, {domain, text, [not_null]}],
ok = sqlite3:create_table(user_db, users, TableInfo)
My table:
user password domain
shk qwerty localhost\
admin qwerty localhost\
I try select user whch name admin for example:
sqlite3:sql_exec(user_db, "SELECT user FROM users WHERE user = shk;")
I get error:
=ERROR REPORT==== 21-Feb-2011::22:38:51 === sqlite3 driver error: no such column: shk
But for example if i try:
sqlite3:sql_exec(user_db, "SELECT user FROM users WHERE password = qwerty;")
it's ok. What's wrong?
Thank you.
Upvotes: 3
Views: 3352
Reputation: 9676
The string values should be enclosed with parens as follows:
SELECT user FROM users WHERE user = 'spongebob';
Upvotes: 3