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

Where col = null #8

Open
lightuponcloud opened this issue Dec 1, 2022 · 3 comments
Open

Where col = null #8

lightuponcloud opened this issue Dec 1, 2022 · 3 comments

Comments

@lightuponcloud
Copy link

Hello

Sqlite3 expects the following syntax when when checking for NULL:

SELECT 1 FROM items WHERE col is NULL;

The query where "col = NULL" ( with equal sign ) is used, returns no records.

@prefiks
Copy link
Member

prefiks commented Dec 1, 2022

Hello,

Do we have query like that somewhere, or are you asking about adding code that will replace queries like this with is null?

@lightuponcloud
Copy link
Author

For example:

sqlite3_lib:read_sql(Tbl, Key, Value) ->
["SELECT * FROM ", to_iolist(Tbl), " WHERE ", to_iolist(Key),
" = ", value_to_sql(Value), ";"].

if Value is null, an equal sign will be used in SQL query, when it seems sqlite3 expects "is" operator.

@prefiks
Copy link
Member

prefiks commented Dec 1, 2022

Ok, i see. Those functions are just for convenience, we expect that for more complex stuff you will need to use sql directly, but i may be able to add handling for this case.

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