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

Use a function (readfile) inside values - SQLite #88

Closed
hubisan opened this issue Jan 22, 2022 · 1 comment
Closed

Use a function (readfile) inside values - SQLite #88

hubisan opened this issue Jan 22, 2022 · 1 comment

Comments

@hubisan
Copy link

hubisan commented Jan 22, 2022

Can this somehow be achieved? Using a function inside VALUES as follows:

INSERT INTO images(name,type,img) VALUES('icon', 'jpeg', readfile('icon.jpg'));

Example is from https://sqlite.org/cli.html#file_i_o_functions

Tried this, but the funcall inside values doesn't seem to work:

(emacsql-flatten-sql [:insert :into images :values [icon jpeg (funcall readfile icon.jpg)]])
;; "INSERT INTO images VALUES ('icon', 'jpeg', '(funcall readfile icon\\.jpg)');"

And thanks for making and maintaining this package.

@hubisan
Copy link
Author

hubisan commented Jan 23, 2022

Closing this. I noticed that I can use a raw string for the SQL statement instead. In addition the extension is not available with the sqlite version from emacsql.

@hubisan hubisan closed this as completed Jan 23, 2022
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

1 participant