61 lines
2.3 KiB
Groff
61 lines
2.3 KiB
Groff
.Dd March 11, 2017
|
|
.Dt SQLITE3_LOAD_EXTENSION 3
|
|
.Os
|
|
.Sh NAME
|
|
.Nm sqlite3_load_extension
|
|
.Nd Load An Extension
|
|
.Sh SYNOPSIS
|
|
.Ft int
|
|
.Fo sqlite3_load_extension
|
|
.Fa "sqlite3 *db"
|
|
.Fa "const char *zFile"
|
|
.Fa "const char *zProc"
|
|
.Fa "char **pzErrMsg "
|
|
.Fc
|
|
.Sh DESCRIPTION
|
|
This interface loads an SQLite extension library from the named file.
|
|
.Pp
|
|
The sqlite3_load_extension() interface attempts to load an SQLite extension
|
|
library contained in the file zFile.
|
|
If the file cannot be loaded directly, attempts are made to load with
|
|
various operating-system specific extensions added.
|
|
So for example, if "samplelib" cannot be loaded, then names like "samplelib.so"
|
|
or "samplelib.dylib" or "samplelib.dll" might be tried also.
|
|
.Pp
|
|
The entry point is zProc.
|
|
zProc may be 0, in which case SQLite will try to come up with an entry
|
|
point name on its own.
|
|
It first tries "sqlite3_extension_init".
|
|
If that does not work, it constructs a name "sqlite3_X_init" where
|
|
the X is consists of the lower-case equivalent of all ASCII alphabetic
|
|
characters in the filename from the last "/" to the first following
|
|
"." and omitting any initial "lib".
|
|
The sqlite3_load_extension() interface returns SQLITE_OK on
|
|
success and SQLITE_ERROR if something goes wrong.
|
|
If an error occurs and pzErrMsg is not 0, then the sqlite3_load_extension()
|
|
interface shall attempt to fill *pzErrMsg with error message text stored
|
|
in memory obtained from sqlite3_malloc().
|
|
The calling function should free this memory by calling sqlite3_free().
|
|
.Pp
|
|
Extension loading must be enabled using sqlite3_enable_load_extension()
|
|
or sqlite3_db_config(db,SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION,1,NULL)
|
|
prior to calling this API, otherwise an error will be returned.
|
|
.Pp
|
|
\fBSecurity warning:\fP It is recommended that the SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION
|
|
method be used to enable only this interface.
|
|
The use of the sqlite3_enable_load_extension()
|
|
interface should be avoided.
|
|
This will keep the SQL function load_extension() disabled
|
|
and prevent SQL injections from giving attackers access to extension
|
|
loading capabilities.
|
|
.Pp
|
|
See also the load_extension() SQL function.
|
|
.Sh SEE ALSO
|
|
.Xr sqlite3_db_config 3 ,
|
|
.Xr sqlite3_enable_load_extension 3 ,
|
|
.Xr sqlite3_malloc 3 ,
|
|
.Xr sqlite3_load_extension 3 ,
|
|
.Xr sqlite3_malloc 3 ,
|
|
.Xr SQLITE_DBCONFIG_MAINDBNAME 3 ,
|
|
.Xr SQLITE_OK 3
|