Skip to content

Commit

Permalink
Merge pull request #1125 from fnc12/dev
Browse files Browse the repository at this point in the history
1.8.1
  • Loading branch information
fnc12 committed Jan 25, 2023
2 parents 4861e40 + f4b8000 commit 68ec248
Show file tree
Hide file tree
Showing 160 changed files with 554 additions and 370 deletions.
3 changes: 2 additions & 1 deletion .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: true
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: false
Expand Down Expand Up @@ -94,6 +94,7 @@ PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Left
ReflowComments: false
SortIncludes: false
SortUsingDeclarations: true
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/clang-format-lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ jobs:
steps:
- uses: actions/checkout@v1
- name: clang-format lint
uses: DoozyX/clang-format-lint-action@v0.12
uses: DoozyX/clang-format-lint-action@v0.15
with:
clangFormatVersion: 12
clangFormatVersion: 15
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ set(CMAKE_CXX_EXTENSIONS OFF)

set(CMAKE_VERBOSE_MAKEFILE ON)

message(STATUS "Configuring ${CMAKE_PROJECT_NAME} ${sqlite_orm_VERSION}")
message(STATUS "Configuring ${PROJECT_NAME} ${sqlite_orm_VERSION}")

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")

Expand Down
29 changes: 19 additions & 10 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ environment:
SQLITE_ORM_CXX_STANDARD: "-DSQLITE_ORM_ENABLE_CXX_14=ON"

# Representative for C++14
- job_name: Visual Studio 2015 Update 3, x64, C++14
appveyor_build_worker_image: Visual Studio 2015
- job_name: Visual Studio 2022, x64, C++14
appveyor_build_worker_image: Visual Studio 2022
platform: x64
SQLITE_ORM_CXX_STANDARD: ""

Expand Down Expand Up @@ -96,13 +96,18 @@ for:
if "%appveyor_build_worker_image%"=="Visual Studio 2015" (set generator="Visual Studio 14 2015" %architecture%)
install:
- |-
cd C:\Tools\vcpkg
git fetch --tags && git checkout 2023.01.09
cd %APPVEYOR_BUILD_FOLDER%
C:\Tools\vcpkg\bootstrap-vcpkg.bat -disableMetrics
C:\Tools\vcpkg\vcpkg integrate install
vcpkg install sqlite3:%platform%-windows
set VCPKG_DEFAULT_TRIPLET=%platform%-windows
vcpkg install sqlite3 catch2
before_build:
- |-
mkdir compile
cd compile
cmake %SQLITE_ORM_CXX_STANDARD% -DSqliteOrm_BuildTests=ON .. -G %generator% -DCMAKE_TOOLCHAIN_FILE=C:/Tools/vcpkg/scripts/buildsystems/vcpkg.cmake
cmake %SQLITE_ORM_CXX_STANDARD% .. -G %generator% -DCMAKE_TOOLCHAIN_FILE=C:/Tools/vcpkg/scripts/buildsystems/vcpkg.cmake
# build examples, and run tests (ie make & make test)
build_script:
- |-
Expand All @@ -121,13 +126,17 @@ for:
# using custom vcpkg triplets for building and linking dynamic dependent libraries
install:
- |-
pushd $HOME/vcpkg
git fetch --tags && git checkout 2023.01.09
popd
$HOME/vcpkg/bootstrap-vcpkg.sh -disableMetrics
$HOME/vcpkg/vcpkg integrate install --overlay-triplets=vcpkg/triplets
vcpkg install sqlite3 --overlay-triplets=vcpkg/triplets
vcpkg install sqlite3 catch2 --overlay-triplets=vcpkg/triplets
before_build:
- |-
mkdir compile
cd compile
cmake $SQLITE_ORM_CXX_STANDARD -DSqliteOrm_BuildTests=ON .. -DCMAKE_TOOLCHAIN_FILE=$HOME/vcpkg/scripts/buildsystems/vcpkg.cmake
cmake $SQLITE_ORM_CXX_STANDARD .. -DCMAKE_TOOLCHAIN_FILE=$HOME/vcpkg/scripts/buildsystems/vcpkg.cmake
# build examples, and run tests (ie make & make test)
build_script:
- |-
Expand All @@ -145,15 +154,15 @@ for:
# using custom vcpkg triplets for building and linking dynamic dependent libraries
install:
- |-
git clone --depth 1 --branch 2022.05.10 https://github.com/microsoft/vcpkg.git $HOME/vcpkg
$HOME/vcpkg/booststrap.sh
git clone --depth 1 --branch 2023.01.09 https://github.com/microsoft/vcpkg.git $HOME/vcpkg
$HOME/vcpkg/bootstrap-vcpkg.sh -disableMetrics
$HOME/vcpkg/vcpkg integrate install --overlay-triplets=vcpkg/triplets
vcpkg install sqlite3 --overlay-triplets=vcpkg/triplets
vcpkg install sqlite3 catch2 --overlay-triplets=vcpkg/triplets
before_build:
- |-
mkdir compile
cd compile
cmake $SQLITE_ORM_CXX_STANDARD -DSqliteOrm_BuildTests=ON .. -DCMAKE_TOOLCHAIN_FILE=$HOME/vcpkg/scripts/buildsystems/vcpkg.cmake
cmake $SQLITE_ORM_CXX_STANDARD .. -DCMAKE_TOOLCHAIN_FILE=$HOME/vcpkg/scripts/buildsystems/vcpkg.cmake
# build examples, and run tests (ie make & make test)
build_script:
- |-
Expand Down
10 changes: 4 additions & 6 deletions dependencies/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@ include(FetchContent)

if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND BUILD_TESTING)
FetchContent_Declare(
catch2
Catch2
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
GIT_TAG v2.13.2
GIT_TAG v3.2.1
)
endif()

if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND BUILD_TESTING)
add_subdirectory(catch2)
endif()
add_subdirectory(sqlite3)

add_subdirectory(sqlite3)
2 changes: 1 addition & 1 deletion dependencies/catch2/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
FetchContent_MakeAvailable(catch2)
FetchContent_MakeAvailable(Catch2)
2 changes: 1 addition & 1 deletion dependencies/sqlite3/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# find_package exposes targets only globally, but caches them. So call find_package again in the directory of usage
find_package(SQLite3 REQUIRED)
find_package(SQLite3 REQUIRED)
22 changes: 11 additions & 11 deletions dev/arg_values.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace sqlite_orm {

arg_value() : arg_value(nullptr) {}

arg_value(sqlite3_value *value_) : value(value_) {}
arg_value(sqlite3_value* value_) : value(value_) {}

template<class T>
T get() const {
Expand Down Expand Up @@ -47,18 +47,18 @@ namespace sqlite_orm {
}

private:
sqlite3_value *value = nullptr;
sqlite3_value* value = nullptr;
};

struct arg_values {

struct iterator {

iterator(const arg_values &container_, int index_) :
iterator(const arg_values& container_, int index_) :
container(container_), index(index_),
currentValue(index_ < int(container_.size()) ? container_[index_] : arg_value()) {}

iterator &operator++() {
iterator& operator++() {
++this->index;
if(this->index < int(this->container.size())) {
this->currentValue = this->container[this->index];
Expand Down Expand Up @@ -87,27 +87,27 @@ namespace sqlite_orm {
}
}

arg_value *operator->() const {
arg_value* operator->() const {
return &this->currentValue;
}

bool operator==(const iterator &other) const {
bool operator==(const iterator& other) const {
return &other.container == &this->container && other.index == this->index;
}

bool operator!=(const iterator &other) const {
bool operator!=(const iterator& other) const {
return !(*this == other);
}

private:
const arg_values &container;
const arg_values& container;
int index = 0;
mutable arg_value currentValue;
};

arg_values() : arg_values(0, nullptr) {}

arg_values(int argsCount_, sqlite3_value **values_) : argsCount(argsCount_), values(values_) {}
arg_values(int argsCount_, sqlite3_value** values_) : argsCount(argsCount_), values(values_) {}

size_t size() const {
return this->argsCount;
Expand All @@ -119,7 +119,7 @@ namespace sqlite_orm {

arg_value operator[](int index) const {
if(index < this->argsCount && index >= 0) {
sqlite3_value *value = this->values[index];
sqlite3_value* value = this->values[index];
return {value};
} else {
throw std::system_error{orm_error_code::index_is_out_of_bounds};
Expand All @@ -140,6 +140,6 @@ namespace sqlite_orm {

private:
int argsCount = 0;
sqlite3_value **values = nullptr;
sqlite3_value** values = nullptr;
};
}
10 changes: 5 additions & 5 deletions dev/function.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ namespace sqlite_orm {

struct user_defined_function_base {
using func_call = std::function<
void(sqlite3_context *context, void *functionPointer, int argsCount, sqlite3_value **values)>;
using final_call = std::function<void(sqlite3_context *context, void *functionPointer)>;
void(sqlite3_context* context, void* functionPointer, int argsCount, sqlite3_value** values)>;
using final_call = std::function<void(sqlite3_context* context, void* functionPointer)>;

std::string name;
int argumentsCount = 0;
std::function<int *()> create;
void (*destroy)(int *) = nullptr;
std::function<int*()> create;
void (*destroy)(int*) = nullptr;

#ifndef SQLITE_ORM_AGGREGATE_NSDMI_SUPPORTED
user_defined_function_base(decltype(name) name_,
Expand Down Expand Up @@ -162,7 +162,7 @@ namespace sqlite_orm {
constexpr bool is_same_pvt_v<I, PointerArg, nullptr_t, polyfill::void_t<typename PointerArg::tag>> = true;

#if __cplusplus >= 201703L // using C++17 or higher
template<size_t I, const char *PointerArg, const char *Binding>
template<size_t I, const char* PointerArg, const char* Binding>
SQLITE_ORM_CONSTEVAL bool assert_same_pointer_type() {
constexpr bool valid = Binding == PointerArg;
static_assert(valid, "Pointer value types of I-th argument do not match");
Expand Down
2 changes: 1 addition & 1 deletion dev/statement_serializer.h
Original file line number Diff line number Diff line change
Expand Up @@ -788,7 +788,7 @@ namespace sqlite_orm {
using statement_type = conflict_clause_t;

template<class Ctx>
std::string operator()(const statement_type& statement, const Ctx& context) const {
std::string operator()(const statement_type& statement, const Ctx&) const {
switch(statement) {
case conflict_clause_t::rollback:
return "ROLLBACK";
Expand Down
2 changes: 1 addition & 1 deletion dev/storage.h
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,7 @@ namespace sqlite_orm {
static_assert(is_preparable_v<self, Ex>, "Expression must be a high-level statement");

decltype(auto) e2 = static_if<is_select_v<Ex>>(
[](auto expression) -> auto {
[](auto expression) -> auto{
expression.highest_level = true;
return expression;
},
Expand Down
22 changes: 11 additions & 11 deletions dev/table_name_collector.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace sqlite_orm {

struct table_name_collector {
using table_name_set = std::set<std::pair<std::string, std::string>>;
using find_table_name_t = std::function<std::string(const std::type_index &)>;
using find_table_name_t = std::function<std::string(const std::type_index&)>;

find_table_name_t find_table_name;
mutable table_name_set table_names;
Expand All @@ -27,7 +27,7 @@ namespace sqlite_orm {
table_name_collector(find_table_name_t find_table_name) : find_table_name{move(find_table_name)} {}

template<class T>
table_name_set operator()(const T &) const {
table_name_set operator()(const T&) const {
return {};
}

Expand All @@ -37,30 +37,30 @@ namespace sqlite_orm {
}

template<class T, class F>
void operator()(const column_pointer<T, F> &) const {
void operator()(const column_pointer<T, F>&) const {
table_names.emplace(this->find_table_name(typeid(T)), "");
}

template<class T, class C>
void operator()(const alias_column_t<T, C> &a) const {
void operator()(const alias_column_t<T, C>& a) const {
(*this)(a.column, alias_extractor<T>::get());
}

template<class T>
void operator()(const count_asterisk_t<T> &) const {
void operator()(const count_asterisk_t<T>&) const {
auto tableName = this->find_table_name(typeid(T));
if(!tableName.empty()) {
table_names.emplace(move(tableName), "");
}
}

template<class T, satisfies_not<std::is_base_of, alias_tag, T> = true>
void operator()(const asterisk_t<T> &) const {
void operator()(const asterisk_t<T>&) const {
table_names.emplace(this->find_table_name(typeid(T)), "");
}

template<class T, satisfies<std::is_base_of, alias_tag, T> = true>
void operator()(const asterisk_t<T> &) const {
void operator()(const asterisk_t<T>&) const {
// note: not all alias classes have a nested A::type
static_assert(polyfill::is_detected_v<type_t, T>,
"alias<O> must have a nested alias<O>::type typename");
Expand All @@ -69,22 +69,22 @@ namespace sqlite_orm {
}

template<class T>
void operator()(const object_t<T> &) const {
void operator()(const object_t<T>&) const {
table_names.emplace(this->find_table_name(typeid(T)), "");
}

template<class T>
void operator()(const table_rowid_t<T> &) const {
void operator()(const table_rowid_t<T>&) const {
table_names.emplace(this->find_table_name(typeid(T)), "");
}

template<class T>
void operator()(const table_oid_t<T> &) const {
void operator()(const table_oid_t<T>&) const {
table_names.emplace(this->find_table_name(typeid(T)), "");
}

template<class T>
void operator()(const table__rowid_t<T> &) const {
void operator()(const table__rowid_t<T>&) const {
table_names.emplace(this->find_table_name(typeid(T)), "");
}
};
Expand Down
4 changes: 2 additions & 2 deletions dev/transaction_guard.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ namespace sqlite_orm {
connection(std::move(connection_)),
commit_func(move(commit_func_)), rollback_func(move(rollback_func_)) {}

transaction_guard_t(transaction_guard_t &&other) :
transaction_guard_t(transaction_guard_t&& other) :
commit_on_destroy(other.commit_on_destroy), connection(std::move(other.connection)),
commit_func(move(other.commit_func)), rollback_func(move(other.rollback_func)),
gotta_fire(other.gotta_fire) {
Expand All @@ -48,7 +48,7 @@ namespace sqlite_orm {
}
}

transaction_guard_t &operator=(transaction_guard_t &&) = delete;
transaction_guard_t& operator=(transaction_guard_t&&) = delete;

/**
* Call `COMMIT` explicitly. After this call
Expand Down
6 changes: 3 additions & 3 deletions dev/triggers.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ namespace sqlite_orm {
partial_trigger_t(T trigger_base, S... statements) :
base{std::move(trigger_base)}, statements{std::make_tuple<S...>(std::forward<S>(statements)...)} {}

partial_trigger_t &end() {
partial_trigger_t& end() {
return *this;
}
};
Expand Down Expand Up @@ -109,7 +109,7 @@ namespace sqlite_orm {

trigger_base_t(trigger_type_base type_base_) : type_base(std::move(type_base_)) {}

trigger_base_t &for_each_row() {
trigger_base_t& for_each_row() {
this->do_for_each_row = true;
return *this;
}
Expand Down Expand Up @@ -270,7 +270,7 @@ namespace sqlite_orm {
}

template<class T, class... S>
internal::trigger_t<T, S...> make_trigger(std::string name, const internal::partial_trigger_t<T, S...> &part) {
internal::trigger_t<T, S...> make_trigger(std::string name, const internal::partial_trigger_t<T, S...>& part) {
SQLITE_ORM_CLANG_SUPPRESS_MISSING_BRACES(return {move(name), std::move(part.base), std::move(part.statements)});
}

Expand Down

0 comments on commit 68ec248

Please sign in to comment.