SQLite Forum

Feature request: Dynamically execute SQL from shell
Login
Hi Keith, is there an easy way to make extensions available to the shell? Ages ago you showed me how to make them available to my c code by adding a core_init function to bottom of the sqlite3.c amalgamation file and adding the wanted extensions.

#include "eval.c"
#include "carray.c"
#include "btreeinfo.c"

int core_init(const char* dummy)
{
	int nErr = 0;
	nErr += sqlite3_auto_extension((void(*)())sqlite3_eval_init);
#ifndef SQLITE_OMIT_VIRTUALTABLE
	nErr += sqlite3_auto_extension((void(*)())sqlite3_carray_init);
	nErr += sqlite3_auto_extension((void(*)())sqlite3_btreeinfo_init);
#endif
	return nErr ? SQLITE_ERROR : SQLITE_OK;
}