New shell command ".load" and the sqlite3_load_extension() API allow

new SQL functions and collating sequences to be loaded at run-time from
a DLL or shared library. (CVS 3207)

FossilOrigin-Name: 4ca932d3ae9bb97b819b5baf6fd3e1cebda9e0e2
This commit is contained in:
drh
2006-06-08 15:28:43 +00:00
parent 2705912804
commit 1e397f8fb4
8 changed files with 616 additions and 14 deletions
+41 -1
View File
@@ -12,7 +12,7 @@
** This header file defines the interface that the SQLite library
** presents to client programs.
**
** @(#) $Id: sqlite.h.in,v 1.165 2006/04/04 01:54:55 drh Exp $
** @(#) $Id: sqlite.h.in,v 1.166 2006/06/08 15:28:44 drh Exp $
*/
#ifndef _SQLITE3_H_
#define _SQLITE3_H_
@@ -1468,6 +1468,46 @@ int sqlite3_table_column_metadata(
int *pAutoinc /* OUTPUT: True if colums is auto-increment */
);
/*
****** EXPERIMENTAL - subject to change without notice **************
**
** Attempt to load an SQLite extension library contained in the file
** zFile. The entry point is zProc. zProc may be 0 in which case the
** name of the entry point is derived from the filename.
**
** Return SQLITE_OK on success and SQLITE_ERROR if something goes wrong.
**
** If an error occurs and pzErrMsg is not 0, then fill *pzErrMsg with
** error message text. The calling function should free this memory
** by calling sqlite3_free().
**
** The entry point name is derived from the filename according to the
** following steps:
**
** * Convert the name to lower case
** * Remove the path prefix from the name
** * Remove the first "." and all following characters from the name
** * If the name begins with "lib" remove the first 3 characters
** * Remove all characters that are not US-ASCII alphanumerics
** or underscores
** * Remove any leading digits and underscores from the name
** * Append "_init" to the name
**
** So, for example, if the input filename is "/home/drh/libtest1.52.so"
** then the entry point would be computed as "test1_init".
**
** The derived entry point name is limited to a reasonable number of
** characters (currently 200).
**
****** EXPERIMENTAL - subject to change without notice **************
*/
int sqlite3_load_extension(
sqlite3 *db, /* Load the extension into this database connection */
const char *zFile, /* Name of the shared library containing extension */
const char *zProc, /* Entry point. Derived from zFile if 0 */
char **pzErrMsg /* Put error message here if not 0 */
);
/*
** Undo the hack that converts floating point types to integer for
** builds on processors without floating point support.