Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Erlang and sqlite

Tags:

sql

sqlite

erlang

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.

like image 577
0xAX Avatar asked Sep 14 '26 01:09

0xAX


1 Answers

The string values should be enclosed with parens as follows:

SELECT user FROM users WHERE user = 'spongebob';
like image 137
YasirA Avatar answered Sep 16 '26 22:09

YasirA