Skip to content

Commit

Permalink
fix for sqlite
Browse files Browse the repository at this point in the history
  • Loading branch information
qicosmos committed Feb 10, 2024
1 parent 083123b commit 9f70a82
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
3 changes: 0 additions & 3 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,3 @@ DisableFormat: true
# Ignore json file
Language: Json
DisableFormat: true

Language: Proto
DisableFormat: true
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,5 @@
#
.idea
*build*
.vscode
.vscode
.cache
2 changes: 1 addition & 1 deletion cmake/platform.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
if (MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++latest")
else ()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread -std=c++17")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread -ldl -std=c++17")
endif ()
8 changes: 5 additions & 3 deletions ormpp/sqlite.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,19 @@ class sqlite {

std::string get_last_error() const { return last_error_; }

template <typename... Args>
bool connect(Args &&...args) {
template <typename Arg, typename... Args>
bool connect(Arg &&arg, Args &&...) {
reset_error();
auto r = sqlite3_open(std::forward<Args>(args)..., &handle_);
auto r = sqlite3_open(std::forward<Arg>(arg), &handle_);
if (r != SQLITE_OK) {
set_last_error(sqlite3_errmsg(handle_));
return false;
}
return true;
}

bool ping() { return true; }

template <typename... Args>
bool disconnect(Args &&...args) {
if (handle_ != nullptr) {
Expand Down

0 comments on commit 9f70a82

Please sign in to comment.