Erlang and sqlite

I am creating 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 am trying to select user whch name admin, for example:

sqlite3:sql_exec(user_db, "SELECT user FROM users WHERE user = shk;")

I get an error:

= REPORT ERROR ==== 21-Feb-2011 :: 22: 38: 51 === sqlite3 driver error: there is no such column: shk

But, for example, if I try:

sqlite3:sql_exec(user_db, "SELECT user FROM users WHERE password = qwerty;")

this is normal. What's wrong?

Thank.

+3
source share
1 answer

String values ​​should be enclosed in parens as follows:

SELECT user FROM users WHERE user = 'spongebob';
+3
source

Source: https://habr.com/ru/post/1793643/


All Articles