diff options
author | drh <drh@noemail.net> | 2010-09-17 22:39:07 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2010-09-17 22:39:07 +0000 |
commit | ff1290fc1928bffc47b48a85e60284f034e02f9f (patch) | |
tree | cb7181213d064b4f1eeec3cfc6b109ee8df1a889 /src | |
parent | 17cbfae98c6640a257b448a6a5ad191278a85a4c (diff) | |
download | sqlite-ff1290fc1928bffc47b48a85e60284f034e02f9f.tar.gz sqlite-ff1290fc1928bffc47b48a85e60284f034e02f9f.zip |
Clarifications to the sqlite3_auto_extension() documentation.
FossilOrigin-Name: ca96e0df29cad4a9c7395a0acf623d8a19cb4725
Diffstat (limited to 'src')
-rw-r--r-- | src/sqlite.h.in | 51 |
1 files changed, 32 insertions, 19 deletions
diff --git a/src/sqlite.h.in b/src/sqlite.h.in index 7944a0d60..d54f9743b 100644 --- a/src/sqlite.h.in +++ b/src/sqlite.h.in @@ -4358,34 +4358,47 @@ int sqlite3_load_extension( int sqlite3_enable_load_extension(sqlite3 *db, int onoff); /* -** CAPI3REF: Automatically Load An Extensions +** CAPI3REF: Automatically Load Statically Linked Extensions ** -** ^This API can be invoked at program startup in order to register -** one or more statically linked extensions that will be available -** to all new [database connections]. +** ^This interface causes the xEntryPoint() function to be invoked for +** each new [database connection] that is created. The idea here is that +** xEntryPoint() is the entry point for a statically linked SQLite extension +** that is to be automatically loaded into all new database connections. ** -** ^(This routine stores a pointer to the extension entry point -** in an array that is obtained from [sqlite3_malloc()]. That memory -** is deallocated by [sqlite3_reset_auto_extension()].)^ +** ^(Even though the function prototype shows that xEntryPoint() takes +** no arguments and returns void, SQLite invokes xEntryPoint() with three +** arguments and expects and integer result as if the signature of the +** entry point where as follows: ** -** ^This function registers an extension entry point that is -** automatically invoked whenever a new [database connection] -** is opened using [sqlite3_open()], [sqlite3_open16()], -** or [sqlite3_open_v2()]. -** ^Duplicate extensions are detected so calling this routine -** multiple times with the same extension is harmless. -** ^Automatic extensions apply across all threads. +** <blockquote><pre> +** int xEntryPoint( +** sqlite3 *db, +** const char **pzErrMsg, +** const struct sqlite3_api_routines *pThunk +** ); +** </pre></blockquote>)^ +** +** If the xEntryPoint routine encounters an error, it should make *pzErrMsg +** point to an appropriate error message (obtained from [sqlite3_mprintf()]) +** and return an appropriate [error code]. ^SQLite ensures that *pzErrMsg +** is NULL before calling the xEntryPoint(). ^SQLite will invoke +** [sqlite3_free()] on *pzErrMsg after xEntryPoint() returns. ^If any +** xEntryPoint() returns an error, the [sqlite3_open()], [sqlite3_open16()], +** or [sqlite3_open_v2()] call that provoked the xEntryPoint() will fail. +** +** ^Calling sqlite3_auto_extension(X) with an entry point X that is already +** on the list of automatic extensions is a harmless no-op. ^No entry point +** will be called more than once for each database connection that is opened. +** +** See also: [sqlite3_reset_auto_extension()]. */ int sqlite3_auto_extension(void (*xEntryPoint)(void)); /* ** CAPI3REF: Reset Automatic Extension Loading ** -** ^(This function disables all previously registered automatic -** extensions. It undoes the effect of all prior -** [sqlite3_auto_extension()] calls.)^ -** -** ^This function disables automatic extensions in all threads. +** ^This interface disables all automatic extensions previously +** registered using [sqlite3_auto_extension()]. */ void sqlite3_reset_auto_extension(void); |