diff options
author | John Turner <jturner.usa@gmail.com> | 2025-09-14 00:16:10 -0400 |
---|---|---|
committer | John Turner <jturner.usa@gmail.com> | 2025-09-14 00:16:10 -0400 |
commit | 13e0821fd783a1d5083d825af53cf20e8dcbfd76 (patch) | |
tree | 1ea363b0f13b3e87d177100e6ae6b9f30a2de1b8 /subprojects/boost-sqlite/doc/reference/extension.adoc | |
parent | aa55cb93036a89c64c08e08f4e1de4fa1fd5a775 (diff) | |
parent | efcea3a80da7c4479d5fe168435ecc9fd06bdc72 (diff) | |
download | sqlite-kv-bench-13e0821fd783a1d5083d825af53cf20e8dcbfd76.tar.gz |
Merge commit 'efcea3a80da7c4479d5fe168435ecc9fd06bdc72' as 'subprojects/boost-sqlite'
Diffstat (limited to 'subprojects/boost-sqlite/doc/reference/extension.adoc')
-rw-r--r-- | subprojects/boost-sqlite/doc/reference/extension.adoc | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/subprojects/boost-sqlite/doc/reference/extension.adoc b/subprojects/boost-sqlite/doc/reference/extension.adoc new file mode 100644 index 0000000..7ee2500 --- /dev/null +++ b/subprojects/boost-sqlite/doc/reference/extension.adoc @@ -0,0 +1,36 @@ +== `sqlite/extension.hpp` + +=== `BOOST_SQLITE_EXTENSION` + + This macro can be used to create an sqlite extension. + +.Definition +[source,cpp] +---- +#define BOOST_SQLITE_EXTENSION(Name, Conn) +---- + +Name:: The name of the module. +Conn:: The parameter name of the connection. + + +NOTE: When defining BOOST_SQLITE_COMPILE_EXTENSION (was is done in extension.hpp) +sqlite will use an inline namespace to avoid symbol clashes. + +You must link against `Boost::sqlite_ext` and not `Boost::sqlite` and should not mix both in the same binary. + +.Example +[source,cpp] +---- +BOOST_SQLITE_EXTENSION(extension, conn) +{ + create_scalar_function( + conn, "assert", + [](boost::sqlite::context<>, boost::span<boost::sqlite::value, 1u> sp) + { + if (sp.front().get_int() == 0) + throw std::logic_error("assertion failed"); + }); +} +---- + |