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

Commit

Permalink
Renamed everything related to former 'storage impl' to 'db object'
Browse files Browse the repository at this point in the history
  • Loading branch information
trueqbit committed Jun 5, 2022
1 parent f5fa534 commit 9726e82
Show file tree
Hide file tree
Showing 55 changed files with 915 additions and 906 deletions.
228 changes: 114 additions & 114 deletions dev/column_result.h

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dev/conditions.h
Original file line number Diff line number Diff line change
Expand Up @@ -1212,7 +1212,7 @@ namespace sqlite_orm {
* }
*/
template<class S>
internal::dynamic_order_by_t<internal::serializer_context<typename S::schema_objects_type>>
internal::dynamic_order_by_t<internal::serializer_context<typename S::db_objects_type>>
dynamic_order_by(const S& storage) {
internal::serializer_context_builder<S> builder(storage);
return builder();
Expand Down
4 changes: 2 additions & 2 deletions dev/default_value_extractor.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ namespace sqlite_orm {
*/
template<class T>
std::string serialize_default_value(const default_t<T>& dft) {
schema_objects<> impl;
serializer_context<schema_objects<>> context{impl};
db_objects_tuple<> dbObjects;
serializer_context<db_objects_tuple<>> context{dbObjects};
return serialize(dft.value, context);
}

Expand Down
2 changes: 1 addition & 1 deletion dev/implementations/column_definitions.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/** @file Mainly existing to disentangle implementation details from circular and cross dependencies
* (e.g. column_t -> default_value_extractor -> serializer_context -> schema_objects -> table_t -> column_t)
* (e.g. column_t -> default_value_extractor -> serializer_context -> db_objects_tuple -> table_t -> column_t)
* this file is also used to provide definitions of interface methods 'hitting the database'.
*/
#pragma once
Expand Down
15 changes: 7 additions & 8 deletions dev/implementations/storage_definitions.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@
namespace sqlite_orm {
namespace internal {

template<class... Ts>
template<class T, bool WithoutRowId, class... Args>
sync_schema_result
storage_t<Ts...>::sync_table(const table_t<T, WithoutRowId, Args...>& table, sqlite3* db, bool preserve) {
template<class... DBO>
template<class Table, satisfies<is_table, Table>>
sync_schema_result storage_t<DBO...>::sync_table(const Table& table, sqlite3* db, bool preserve) {
#ifdef SQLITE_ENABLE_DBSTAT_VTAB
if(std::is_same<T, dbstat>::value) {
return sync_schema_result::already_in_sync;
Expand Down Expand Up @@ -107,13 +106,13 @@ namespace sqlite_orm {
return res;
}

template<class... Ts>
template<class I>
void storage_t<Ts...>::copy_table(
template<class... DBO>
template<class Table>
void storage_t<DBO...>::copy_table(
sqlite3* db,
const std::string& sourceTableName,
const std::string& destinationTableName,
const I& table,
const Table& table,
const std::vector<const table_xinfo*>& columnsToIgnore) const { // must ignore generated columns
std::vector<std::reference_wrapper<const std::string>> columnNames;
columnNames.reserve(table.count_columns_amount());
Expand Down
2 changes: 1 addition & 1 deletion dev/implementations/table_definitions.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/** @file Mainly existing to disentangle implementation details from circular and cross dependencies
* (e.g. column_t -> default_value_extractor -> serializer_context -> schema_objects -> table_t -> column_t)
* (e.g. column_t -> default_value_extractor -> serializer_context -> db_objects_tuple -> table_t -> column_t)
* this file is also used to provide definitions of interface methods 'hitting the database'.
*/
#pragma once
Expand Down
2 changes: 1 addition & 1 deletion dev/interface_definitions.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/** @file Mainly existing to disentangle implementation details from circular and cross dependencies
* (e.g. column_t -> default_value_extractor -> serializer_context -> schema_objects -> table_t -> column_t)
* (e.g. column_t -> default_value_extractor -> serializer_context -> db_objects_tuple -> table_t -> column_t)
* this file is also used to provide definitions of interface methods 'hitting the database'.
*/
#pragma once
Expand Down
4 changes: 2 additions & 2 deletions dev/iterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ namespace sqlite_orm {
std::shared_ptr<value_type> current;

void extract_value() {
auto& impl = obtain_schema_objects(this->view->storage);
auto& dbObjects = obtain_db_objects(this->view->storage);
this->current = std::make_shared<value_type>();
object_from_column_builder<value_type> builder{*this->current, this->stmt.get()};
pick_table<value_type>(impl).for_each_column(builder);
pick_table<value_type>(dbObjects).for_each_column(builder);
}

void next() {
Expand Down
6 changes: 3 additions & 3 deletions dev/order_by_serializer.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ namespace sqlite_orm {
}
};

template<class S>
struct order_by_serializer<dynamic_order_by_t<S>, void> {
using statement_type = dynamic_order_by_t<S>;
template<class C>
struct order_by_serializer<dynamic_order_by_t<C>, void> {
using statement_type = dynamic_order_by_t<C>;

template<class Ctx>
std::string operator()(const statement_type& orderBy, const Ctx&) const {
Expand Down
16 changes: 8 additions & 8 deletions dev/serializer_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,24 @@ namespace sqlite_orm {
bool use_parentheses = true;
};

template<class I>
template<class DBOs>
struct serializer_context : serializer_context_base {
using schema_objects_type = I;
using db_objects_type = DBOs;

const schema_objects_type& impl;
const db_objects_type& db_objects;

serializer_context(const schema_objects_type& impl_) : impl(impl_) {}
serializer_context(const db_objects_type& dbObjects) : db_objects{dbObjects} {}
};

template<class S>
struct serializer_context_builder {
using storage_type = S;
using schema_objects_type = typename storage_type::schema_objects_type;
using db_objects_type = typename storage_type::db_objects_type;

serializer_context_builder(const storage_type& storage_) : storage(storage_) {}
serializer_context_builder(const storage_type& storage_) : storage{storage_} {}

serializer_context<schema_objects_type> operator()() const {
return {obtain_schema_objects(this->storage)};
serializer_context<db_objects_type> operator()() const {
return {obtain_db_objects(this->storage)};
}

const storage_type& storage;
Expand Down
4 changes: 2 additions & 2 deletions dev/serializing_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ namespace sqlite_orm {
auto& context = get<3>(tpl);
auto& object = get<4>(tpl);
using object_type = polyfill::remove_cvref_t<decltype(object)>;
auto& table = pick_table<object_type>(context.impl);
auto& table = pick_table<object_type>(context.db_objects);

table.template for_each_column_excluding<check_if_excluded>(call_as_template_base<column_field>(
[&ss, &excluded, &context, &object, first = true](auto& column) mutable {
Expand All @@ -360,7 +360,7 @@ namespace sqlite_orm {
auto& context = get<2>(tpl);

iterate_tuple(columns, [&ss, &context, first = true](auto& colRef) mutable {
const std::string* columnName = find_column_name(context.impl, colRef);
const std::string* columnName = find_column_name(context.db_objects, colRef);
if(!columnName) {
throw std::system_error{orm_error_code::column_not_found};
}
Expand Down
Loading

0 comments on commit 9726e82

Please sign in to comment.