diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2024-01-24 19:01:19 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2024-01-24 19:01:19 +0300 |
commit | e5d0186db99492a139237067bab841a5b83463af (patch) | |
tree | 61719595e998314e58383c5081da16d7457a63e7 /libodb-sqlite/odb/sqlite/text.hxx | |
parent | c53136bd7d266fccaca679d0471dd8ac0ce91373 (diff) |
Turn libodb-sqlite repository into package for muti-package repositorylibodb-sqlite
Diffstat (limited to 'libodb-sqlite/odb/sqlite/text.hxx')
-rw-r--r-- | libodb-sqlite/odb/sqlite/text.hxx | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/libodb-sqlite/odb/sqlite/text.hxx b/libodb-sqlite/odb/sqlite/text.hxx new file mode 100644 index 0000000..3f681fb --- /dev/null +++ b/libodb-sqlite/odb/sqlite/text.hxx @@ -0,0 +1,69 @@ +// file : odb/sqlite/text.hxx +// license : GNU GPL v2; see accompanying LICENSE file + +#ifndef ODB_SQLITE_TEXT_HXX +#define ODB_SQLITE_TEXT_HXX + +#include <odb/pre.hxx> + +#include <string> +#include <cstddef> // std::size_t + +// Carefully allow this header to be included into the ODB compilation. +// +#ifndef ODB_COMPILER +# include <odb/sqlite/forward.hxx> +# include <odb/sqlite/details/export.hxx> +#endif + +namespace odb +{ + namespace sqlite + { +#ifdef ODB_COMPILER + #pragma db sqlite:type("TEXT STREAM") + class text +#else + class text +#endif + { + public: + // TEXT size to provision for. Set before calling persist() or update(). + // + explicit + text (std::size_t size = 0): size_ (size) {} + + std::size_t size () const {return size_;} + void size (std::size_t s) {size_ = s;} + + const std::string& db () const {return db_;} + const std::string& table () const {return table_;} + const std::string& column () const {return column_;} + long long rowid () const {return rowid_;} + + void + clear () + { + size_ = 0; + db_.clear (); + table_.clear (); + column_.clear (); + rowid_ = 0; + } + + private: +#ifndef ODB_COMPILER + friend struct default_value_traits<text, id_text_stream>; +#endif + std::size_t size_; + mutable std::string db_; + mutable std::string table_; + mutable std::string column_; + mutable long long rowid_; + }; + } +} + +#include <odb/post.hxx> + +#endif // ODB_SQLITE_TEXT_HXX |