You need to see if you have the extensions compiled into the sqlite library.
Run the fillowing:
nm libsqlite3.so.0.8.6 | grep extension
Output should be similar too:
0000000000024a40 T sqlite3_auto_extension
00000000000249d0 T sqlite3_enable_load_extension
0000000000024680 T sqlite3_load_extension
0000000000024af0 T sqlite3_reset_auto_extension
If you dont see the line with sqlite3_load_extension then you need to rebuild
sqlite (I suggest building from the amalgamation).
(there is no such thing as a .load command)...
sqlite> .load half.so
This is correct: except you need to provide the FULL path name!
SELECT load_extension('half.so');
dark0s dark0s <[EMAIL PROTECTED]> wrote: I created half.c program, the output
is:
bash-3.1# gcc -shared half.c -o half.so
bash-3.1# sqlite3
SQLite version 3.5.7
Enter ".help" for instructions
sqlite> .load half.so
unknown command or invalid arguments: "load". Enter ".help" for help
sqlite> select load_extension('half.so');
SQL error: no such function: load_extension
sqlite> SELECT load_extension('half.so');
SQL error: no such function: load_extension
sqlite>
half.c program is below:
#include <sqlite3ext.h>
SQLITE_EXTENSION_INIT1
/*
** The half() SQL function returns half of its input value.
*/
static void halfFunc(
sqlite3_context *context,
int argc,
sqlite3_value **argv
){
sqlite3_result_double(context, 0.5*sqlite3_value_double(argv[0]));
}
/* SQLite invokes this routine once when it loads the extension.
** Create new functions, collating sequences, and virtual table
** modules here. This is usually the only exported symbol in
** the shared library.
*/
int sqlite3_extension_init(
sqlite3 *db,
char **pzErrMsg,
const sqlite3_api_routines *pApi
){
SQLITE_EXTENSION_INIT2(pApi)
sqlite3_create_function(db, "half", 1, SQLITE_ANY, 0, halfFunc, 0, 0);
return 0;
}
What is the problem? I am desperated.
---------------------------------
Inviato da Yahoo! Mail.
La casella di posta intelligente.
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users