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 | efcea3a80da7c4479d5fe168435ecc9fd06bdc72 (patch) | |
tree | 5cb0177e17b1b00a177f2e830e809f606334571b /doc/reference/field.adoc | |
download | sqlite-kv-bench-efcea3a80da7c4479d5fe168435ecc9fd06bdc72.tar.gz |
Squashed 'subprojects/boost-sqlite/' content from commit 3378e35
git-subtree-dir: subprojects/boost-sqlite
git-subtree-split: 3378e353705271e569cf4ba15c467b840a39798c
Diffstat (limited to 'doc/reference/field.adoc')
-rw-r--r-- | doc/reference/field.adoc | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/doc/reference/field.adoc b/doc/reference/field.adoc new file mode 100644 index 0000000..572719d --- /dev/null +++ b/doc/reference/field.adoc @@ -0,0 +1,42 @@ +== `sqlite/field.hpp` + +A `field` is a type representing a <<value>> in a database. or as a result from a query. + +.Definition +[source,cpp] +---- + +struct field +{ + typedef sqlite_int64 int64; + + // The type of the value + value_type type() 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 `int64`. + 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; + // Returns the field as a value. + value get_value() const; + // Returns the name of the column. + cstring_ref column_name() const; + // Returns the name of the table. + cstring_ref table_name() const; + // Returns the name of the original data source. + cstring_ref column_origin_name() const; +} +---- + +NOTE: The view types can be invalidated when the database changes or the next row is read by the query. + +WARNING: The `field` type does not own the statement/query it was produced by. It is a merely a view into the `resultset`. +Reading the next row will change the values returned. + |