updated build system

This commit is contained in:
2024-10-18 11:46:59 -05:00
parent c216df9b73
commit 09cb5d8f19
14 changed files with 68 additions and 95 deletions

View File

@ -27,7 +27,7 @@
#include "utils/error.hpp"
namespace repertory::utils::db::sqlite {
void sqlite3_deleter::operator()(sqlite3 *db3) const {
void sqlite_deleter::operator()(sqlite3 *db3) const {
REPERTORY_USES_FUNCTION_NAME();
if (db3 == nullptr) {
@ -35,10 +35,6 @@ void sqlite3_deleter::operator()(sqlite3 *db3) const {
}
utils::error::handle_error(function_name, "closing database handle");
sqlite3_db_cacheflush(db3);
std::string err_msg;
execute_sql(*db3, "PRAGMA wal_checkpoint(full);", err_msg);
if (not utils::retry_action(
[&db3]() -> bool {
@ -57,7 +53,8 @@ void sqlite3_deleter::operator()(sqlite3 *db3) const {
return false;
},
60U)) {
utils::error::handle_error(function_name, "failed to close database");
repertory::utils::error::handle_error(function_name,
"failed to close database");
}
}

View File

@ -19,15 +19,12 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#include "utils/db/sqlite/db_delete.hpp"
#if defined(PROJECT_ENABLE_SQLITE)
#include "utils/db/sqlite/db_delete.hpp"
namespace repertory::utils::db::sqlite {
void db_delete::context::clear() {
// stmt.reset();
where_data.reset();
}
void db_delete::context::clear() { where_data.reset(); }
auto db_delete::context::db_delete_op_t::dump() const -> std::string {
return db_delete{ctx}.dump();

View File

@ -19,18 +19,15 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#include "utils/db/sqlite/db_insert.hpp"
#if defined(PROJECT_ENABLE_SQLITE)
namespace repertory::utils::db::sqlite {
void db_insert::context::clear() {
// stmt.reset();
values.clear();
}
#include "utils/db/sqlite/db_insert.hpp"
auto db_insert::column_value(std::string column_name, db_types_t value)
-> db_insert & {
namespace repertory::utils::db::sqlite {
void db_insert::context::clear() { values.clear(); }
auto db_insert::column_value(std::string column_name,
db_types_t value) -> db_insert & {
ctx_->values[column_name] = value;
return *this;
}

View File

@ -19,10 +19,10 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#include "utils/db/sqlite/db_select.hpp"
#if defined(PROJECT_ENABLE_SQLITE)
#include "utils/db/sqlite/db_select.hpp"
namespace repertory::utils::db::sqlite {
void db_select::context::clear() {
columns.clear();
@ -31,7 +31,6 @@ void db_select::context::clear() {
limit.reset();
offset.reset();
order_by.reset();
// stmt.reset();
where_data.reset();
}
@ -73,8 +72,8 @@ auto db_select::column(std::string column_name) -> db_select & {
return *this;
}
auto db_select::count(std::string column_name, std::string as_column_name)
-> db_select & {
auto db_select::count(std::string column_name,
std::string as_column_name) -> db_select & {
ctx_->count_columns[column_name] = as_column_name;
return *this;
}
@ -210,8 +209,8 @@ auto db_select::offset(std::int32_t value) -> db_select & {
return *this;
}
auto db_select::order_by(std::string column_name, bool ascending)
-> db_select & {
auto db_select::order_by(std::string column_name,
bool ascending) -> db_select & {
ctx_->order_by = {column_name, ascending};
return *this;
}

View File

@ -19,16 +19,15 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#include "utils/db/sqlite/db_update.hpp"
#if defined(PROJECT_ENABLE_SQLITE)
#include "utils/db/sqlite/db_update.hpp"
namespace repertory::utils::db::sqlite {
void db_update::context::clear() {
column_values.clear();
limit.reset();
order_by.reset();
// stmt.reset();
where_data.reset();
}
@ -53,8 +52,8 @@ auto db_update::context::db_update_op_t::order_by(std::string column_name,
return *this;
}
auto db_update::column_value(std::string column_name, db_types_t value)
-> db_update & {
auto db_update::column_value(std::string column_name,
db_types_t value) -> db_update & {
ctx_->column_values[column_name] = value;
return *this;
}
@ -174,8 +173,8 @@ auto db_update::limit(std::int32_t value) -> db_update & {
return *this;
}
auto db_update::order_by(std::string column_name, bool ascending)
-> db_update & {
auto db_update::order_by(std::string column_name,
bool ascending) -> db_update & {
ctx_->order_by = {column_name, ascending};
return *this;
}

View File

@ -19,6 +19,8 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#if defined(PROJECT_ENABLE_LIBSODIUM) && defined(PROJECT_ENABLE_BOOST)
#include "utils/encrypting_reader.hpp"
#include "utils/collection.hpp"
@ -29,8 +31,6 @@
#include "utils/unix.hpp"
#include "utils/windows.hpp"
#if defined(PROJECT_ENABLE_LIBSODIUM) && defined(PROJECT_ENABLE_BOOST)
#if !defined(CURL_READFUNC_ABORT)
#define CURL_READFUNC_ABORT (-1)
#endif // !defined(CURL_READFUNC_ABORT)

View File

@ -19,13 +19,13 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#if defined(PROJECT_ENABLE_LIBSODIUM) && defined(PROJECT_ENABLE_BOOST)
#include "utils/encryption.hpp"
#include "utils/collection.hpp"
#include "utils/encrypting_reader.hpp"
#if defined(PROJECT_ENABLE_LIBSODIUM) && defined(PROJECT_ENABLE_BOOST)
namespace repertory::utils::encryption {
auto decrypt_file_path(std::string_view encryption_token,
std::string &file_path) -> bool {

View File

@ -27,8 +27,13 @@ std::atomic<const i_exception_handler *> exception_handler{
auto create_error_message(std::vector<std::string_view> items) -> std::string {
std::stringstream stream{};
for (auto &&item : items) {
stream << '|' << item;
stream << function_name;
for (std::size_t idx = 0U; idx < items.size(); ++idx) {
if (idx > 0) {
stream << '|';
}
stream << item;
}
return stream.str();

View File

@ -161,7 +161,7 @@ auto directory::create_directory(std::string_view path) const
std::string{abs_path} + '|' +
std::to_string(res));
}
#else // !defined(_WIN32)
#else // !defined(_WIN32)
auto ret{true};
auto paths =
utils::string::split(abs_path, utils::path::directory_seperator, false);

View File

@ -25,7 +25,6 @@
#include "utils/common.hpp"
#include "utils/error.hpp"
#include "utils/path.hpp"
#include <utils/config.hpp>
namespace {
[[nodiscard]] auto get_file_size(std::string_view path,
@ -398,8 +397,6 @@ auto file::sha256() -> std::optional<std::string> {
#endif // defined(PROJECT_ENABLE_LIBSODIUM)
auto file::remove() -> bool {
REPERTORY_USES_FUNCTION_NAME();
close();
return utils::retry_action([this]() -> bool {

View File

@ -19,10 +19,10 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#include "utils/hash.hpp"
#if defined(PROJECT_ENABLE_LIBSODIUM)
#include "utils/hash.hpp"
namespace repertory::utils::encryption {
auto create_hash_blake2b_256(std::string_view data) -> hash_256_t {
return create_hash_blake2b_t<hash_256_t>(

View File

@ -20,6 +20,7 @@
SOFTWARE.
*/
#if defined(_WIN32)
#include "utils/windows.hpp"
#include "utils/com_init_wrapper.hpp"
@ -27,7 +28,7 @@
namespace repertory::utils {
void create_console() {
if (AllocConsole() == 0) {
if (::AllocConsole() == 0) {
return;
}
@ -56,7 +57,7 @@ void create_console() {
}
void free_console() {
FreeConsole();
::FreeConsole();
}
auto get_last_error_code() -> DWORD { return ::GetLastError(); }