Skip to content
This repository has been archived by the owner on Jan 3, 2024. It is now read-only.

Commit

Permalink
Disentangle implementation relevant dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
trueqbit committed Mar 21, 2022
1 parent 7ddeeba commit 4c005d6
Show file tree
Hide file tree
Showing 12 changed files with 877 additions and 785 deletions.
11 changes: 1 addition & 10 deletions dev/column.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

#include "type_is_nullable.h"
#include "tuple_helper/tuple_helper.h"
#include "default_value_extractor.h"
#include "constraints.h"
#include "member_traits/member_traits.h"

Expand Down Expand Up @@ -83,15 +82,7 @@ namespace sqlite_orm {
* Simplified interface for `DEFAULT` constraint
* @return string representation of default value if it exists otherwise nullptr
*/
std::unique_ptr<std::string> default_value() const {
std::unique_ptr<std::string> res;
iterate_tuple(this->constraints, [&res](auto& v) {
if(auto dft = default_value_extractor()(v)) {
res = std::move(dft);
}
});
return res;
}
std::unique_ptr<std::string> default_value() const;

bool is_generated() const {
#if SQLITE_VERSION_NUMBER >= 3031000
Expand Down
17 changes: 17 additions & 0 deletions dev/dbstat.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

#include <string> // std::string

#include "column.h"
#include "table.h"

namespace sqlite_orm {
#ifdef SQLITE_ENABLE_DBSTAT_VTAB
struct dbstat {
Expand All @@ -16,5 +19,19 @@ namespace sqlite_orm {
int pgoffset = 0;
int pgsize = 0;
};

inline auto make_dbstat_table() {
return make_table("dbstat",
make_column("name", &dbstat::name),
make_column("path", &dbstat::path),
make_column("pageno", &dbstat::pageno),
make_column("pagetype", &dbstat::pagetype),
make_column("ncell", &dbstat::ncell),
make_column("payload", &dbstat::payload),
make_column("unused", &dbstat::unused),
make_column("mx_payload", &dbstat::mx_payload),
make_column("pgoffset", &dbstat::pgoffset),
make_column("pgsize", &dbstat::pgsize));
}
#endif // SQLITE_ENABLE_DBSTAT_VTAB
}
4 changes: 3 additions & 1 deletion dev/default_value_extractor.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

#include <memory> // std::unique_ptr
#include <string> // std::string
#include <sstream> // std::stringstream

#include "constraints.h"
#include "serializator_context.h"
Expand All @@ -12,6 +11,9 @@ namespace sqlite_orm {

namespace internal {

template<class T, class I>
std::string serialize(const T& t, const serializator_context<I>& context);

/**
* This class is used in tuple iteration to know whether tuple constains `default_value_t`
* constraint class and what it's value if it is
Expand Down
Loading

0 comments on commit 4c005d6

Please sign in to comment.