summaryrefslogtreecommitdiff
path: root/subprojects/boost-sqlite/doc/reference/value.adoc
diff options
context:
space:
mode:
authorJohn Turner <jturner.usa@gmail.com>2025-09-14 00:16:10 -0400
committerJohn Turner <jturner.usa@gmail.com>2025-09-14 00:16:10 -0400
commit13e0821fd783a1d5083d825af53cf20e8dcbfd76 (patch)
tree1ea363b0f13b3e87d177100e6ae6b9f30a2de1b8 /subprojects/boost-sqlite/doc/reference/value.adoc
parentaa55cb93036a89c64c08e08f4e1de4fa1fd5a775 (diff)
parentefcea3a80da7c4479d5fe168435ecc9fd06bdc72 (diff)
downloadsqlite-kv-bench-13e0821fd783a1d5083d825af53cf20e8dcbfd76.tar.gz
Merge commit 'efcea3a80da7c4479d5fe168435ecc9fd06bdc72' as 'subprojects/boost-sqlite'
Diffstat (limited to 'subprojects/boost-sqlite/doc/reference/value.adoc')
-rw-r--r--subprojects/boost-sqlite/doc/reference/value.adoc85
1 files changed, 85 insertions, 0 deletions
diff --git a/subprojects/boost-sqlite/doc/reference/value.adoc b/subprojects/boost-sqlite/doc/reference/value.adoc
new file mode 100644
index 0000000..f5cb3de
--- /dev/null
+++ b/subprojects/boost-sqlite/doc/reference/value.adoc
@@ -0,0 +1,85 @@
+== `sqlite/value.hpp`
+
+=== `value_type`
+
+The https://www.sqlite.org/datatype3.html)[type of a value].
+
+[source,cpp]
+----
+enum class value_type
+{
+ // An integral value
+ integer = SQLITE_INTEGER,
+ // A floating piont value
+ floating = SQLITE_FLOAT,
+ // A textual value
+ text = SQLITE_TEXT,
+ // A binary value
+ blob = SQLITE_BLOB,
+ // No value
+ null = SQLITE_NULL,
+};
+
+// Get the name as a string
+const char * value_type_name(value_type vt);
+----
+
+=== `value`
+
+A holder for a sqlite values used for internal APIs.
+
+[source,cpp]
+----
+
+struct value
+{
+ // The value for integers in the database
+ typedef sqlite3_int64 int64 ;
+
+ // The type of the value
+ value_type type() const;
+ // The subtype of the value.
+ int subtype() const;
+
+ // Is the held value null
+ bool is_null() const;
+ // Is the held value is not null
+ explicit operator bool () const;
+ // Returns the value as an `integer`.
+ int64 get_int() const;
+ // Returns the value as an `double`.
+ double get_double() const;
+ // Returns the value as text, i.e. a string_view. Note that this value may be invalidated`.
+ cstring_ref get_text() const;
+ // Returns the value as blob, i.e. raw memory. Note that this value may be invalidated`.
+ blob_view get_blob() const;
+
+ // Best numeric datatype of the value
+ value_type numeric_type() const;
+
+ // True if the column is unchanged in an UPDATE against a virtual table.
+ // requires sqlite 3.32
+ bool nochange() const;
+ // True if value originated from a bound parameter
+ // requires sqlite 3.31
+ bool from_bind() const;
+
+
+ // Construct value from a handle.
+ explicit value(sqlite3_value * value_) noexcept : value_(value_) {}
+
+ // The handle of the value.
+ using handle_type = sqlite3_value *;
+ // Returns the handle.
+ handle_type handle() const;
+ handle_type & handle();
+
+ // Get a value that was passed through the pointer interface.
+ // A value can be set as a pointer by binding/returning a unique_ptr.
+ // Rquires sqlite 3.20
+ template<typename T>
+ T * get_pointer();
+
+};
+----
+