mirror of
https://github.com/cuberite/SQLiteCpp.git
synced 2025-08-04 17:56:13 -04:00
Merge pull request #51 from portwaypoint/master
Added support for extension loading
This commit is contained in:
commit
e8af4f6738
@ -336,6 +336,25 @@ public:
|
|||||||
apApp, apFunc, apStep, apFinal, apDestroy);
|
apApp, apFunc, apStep, apFinal, apDestroy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Load a module into the current sqlite database instance.
|
||||||
|
*
|
||||||
|
* This is the equivalent of the sqlite3_load_extension call, but additionally enables
|
||||||
|
* module loading support prior to loading the requested module.
|
||||||
|
*
|
||||||
|
* @see http://www.sqlite.org/c3ref/load_extension.html
|
||||||
|
*
|
||||||
|
* @note UTF-8 text encoding assumed.
|
||||||
|
*
|
||||||
|
* @param[in] apExtensionName Name of the shared library containing extension
|
||||||
|
* @param[in] apEntryPointName Name of the entry point (NULL to let sqlite work it out)
|
||||||
|
*
|
||||||
|
* @throw SQLite::Exception in case of error
|
||||||
|
*/
|
||||||
|
void loadExtension(const char* apExtensionName,
|
||||||
|
const char *apEntryPointName);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// @{ Database must be non-copyable
|
/// @{ Database must be non-copyable
|
||||||
Database(const Database&);
|
Database(const Database&);
|
||||||
|
@ -151,5 +151,18 @@ void Database::createFunction(const char* apFuncName,
|
|||||||
check(ret);
|
check(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Load an extension into the sqlite database. Only affects the current connection.
|
||||||
|
// Parameter details can be found here: http://www.sqlite.org/c3ref/load_extension.html
|
||||||
|
void Database::loadExtension(const char* apExtensionName,
|
||||||
|
const char *apEntryPointName)
|
||||||
|
{
|
||||||
|
int ret = sqlite3_enable_load_extension(mpSQLite, 1);
|
||||||
|
|
||||||
|
check(ret);
|
||||||
|
|
||||||
|
ret = sqlite3_load_extension(mpSQLite, apExtensionName, apEntryPointName, 0);
|
||||||
|
|
||||||
|
check(ret);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace SQLite
|
} // namespace SQLite
|
||||||
|
Loading…
x
Reference in New Issue
Block a user