SQLite Forum

How to execute .load

How to execute .load

(1) By anonymous on 2021-02-15 14:59:46 [link] [source]

I am writing some code and want to load the shared library Voodoo.

If tried this:
rc = sqlite3_exec(DB, "Voodoo", NULL, 0, &ErrMessage);

Well, that didn't do the job. Who has a idea to achieve this?

(2) By anonymous on 2021-02-15 15:19:21 in reply to 1 [link] [source]

You mean:
rc = sqlite3_exec(DB,".load ./Voodoo", NULL, 0, &ErrMessage);

Which returns 1 which is not SQLite_OK and that it failed.

(4) By Larry Brasfield (larrybr) on 2021-02-15 15:27:01 in reply to 2 [link] [source]

sqlite3_exec() expects SQL, not the CLI shell's metacommands.

(3) By Larry Brasfield (larrybr) on 2021-02-15 15:25:54 in reply to 1 [link] [source]

I suppose the load_extension() function is what you seek. s/Voodoo/load_extension('myVoodoExtLib')/

You may also need to enable extension loading from SQL.

Or, you could use the sqlite3_load_extension API.

BTW, the word "Extension" appears in the Permutated Index, a lot.

(5) By anonymous on 2021-02-16 04:37:08 in reply to 3 [source]

Thank you for the information.

I overlooked this page.