From 5294e38e4a763e800b3b10480c815e3e37eccb90 Mon Sep 17 00:00:00 2001 From: gibber9809 Date: Wed, 14 Feb 2024 21:05:38 +0000 Subject: [PATCH] Undo changes to clp database classes which are no longer necessary --- components/core/src/clp/MySQLDB.cpp | 9 --------- components/core/src/clp/MySQLDB.hpp | 7 ------- components/core/src/clp/MySQLParamBindings.cpp | 11 ----------- components/core/src/clp/MySQLParamBindings.hpp | 1 - components/core/src/clp/MySQLPreparedStatement.cpp | 9 --------- components/core/src/clp/MySQLPreparedStatement.hpp | 1 - 6 files changed, 38 deletions(-) diff --git a/components/core/src/clp/MySQLDB.cpp b/components/core/src/clp/MySQLDB.cpp index 9fefc54ab..cf474153a 100644 --- a/components/core/src/clp/MySQLDB.cpp +++ b/components/core/src/clp/MySQLDB.cpp @@ -150,15 +150,6 @@ bool MySQLDB::execute_query(string const& sql_query) { return true; } -bool MySQLDB::get_affected_rows(uint64_t& num_affected_rows) { - if (nullptr == m_db_handle) { - throw OperationFailed(ErrorCode_NotInit, __FILENAME__, __LINE__); - } - - num_affected_rows = mysql_affected_rows(m_db_handle); - return num_affected_rows != ~static_cast(0); -} - MySQLPreparedStatement MySQLDB::prepare_statement(char const* statement, size_t statement_length) { if (nullptr == m_db_handle) { throw OperationFailed(ErrorCode_NotInit, __FILENAME__, __LINE__); diff --git a/components/core/src/clp/MySQLDB.hpp b/components/core/src/clp/MySQLDB.hpp index 26577d70a..d60e84bce 100644 --- a/components/core/src/clp/MySQLDB.hpp +++ b/components/core/src/clp/MySQLDB.hpp @@ -109,13 +109,6 @@ class MySQLDB { * @return */ bool execute_query(std::string const& sql_query); - /** - * Get the number of rows affected by the previous SQL statement with the semantics of - * mysql_affected_rows returned by reference. - * @return true on success - * @return false on error - */ - bool get_affected_rows(uint64_t& num_affected_rows); /** * Prepares a statement on the database server * @param statement diff --git a/components/core/src/clp/MySQLParamBindings.cpp b/components/core/src/clp/MySQLParamBindings.cpp index 81d42889f..a61e8302a 100644 --- a/components/core/src/clp/MySQLParamBindings.cpp +++ b/components/core/src/clp/MySQLParamBindings.cpp @@ -20,17 +20,6 @@ void MySQLParamBindings::resize(size_t num_fields) { } } -void MySQLParamBindings::bind_int(size_t field_index, int& value) { - if (field_index >= m_statement_bindings.size()) { - throw OperationFailed(ErrorCode_OutOfBounds, __FILENAME__, __LINE__); - } - - auto& binding = m_statement_bindings[field_index]; - binding.buffer_type = MYSQL_TYPE_LONG; - binding.buffer = &value; - m_statement_binding_lengths[field_index] = sizeof(value); -} - void MySQLParamBindings::bind_int64(size_t field_index, int64_t& value) { if (field_index >= m_statement_bindings.size()) { throw OperationFailed(ErrorCode_OutOfBounds, __FILENAME__, __LINE__); diff --git a/components/core/src/clp/MySQLParamBindings.hpp b/components/core/src/clp/MySQLParamBindings.hpp index c8423b1b4..42a81e4eb 100644 --- a/components/core/src/clp/MySQLParamBindings.hpp +++ b/components/core/src/clp/MySQLParamBindings.hpp @@ -37,7 +37,6 @@ class MySQLParamBindings { */ void resize(size_t num_fields); - void bind_int(size_t field_index, int& value); void bind_int64(size_t field_index, int64_t& value); void bind_uint64(size_t field_index, uint64_t& value); void bind_varchar(size_t field_index, char const* value, size_t value_length); diff --git a/components/core/src/clp/MySQLPreparedStatement.cpp b/components/core/src/clp/MySQLPreparedStatement.cpp index 345bf419b..b7eebe4df 100644 --- a/components/core/src/clp/MySQLPreparedStatement.cpp +++ b/components/core/src/clp/MySQLPreparedStatement.cpp @@ -92,15 +92,6 @@ bool MySQLPreparedStatement::execute() { return true; } -bool MySQLPreparedStatement::get_affected_rows(uint64_t& num_affected_rows) { - if (nullptr == m_statement_handle) { - throw OperationFailed(ErrorCode_NotInit, __FILE__, __LINE__); - } - - num_affected_rows = mysql_affected_rows(m_db_handle); - return num_affected_rows != ~static_cast(0); -} - void MySQLPreparedStatement::close() { if (nullptr != m_statement_handle) { if (0 != mysql_stmt_close(m_statement_handle)) { diff --git a/components/core/src/clp/MySQLPreparedStatement.hpp b/components/core/src/clp/MySQLPreparedStatement.hpp index a1702074e..1abf3f828 100644 --- a/components/core/src/clp/MySQLPreparedStatement.hpp +++ b/components/core/src/clp/MySQLPreparedStatement.hpp @@ -43,7 +43,6 @@ class MySQLPreparedStatement { // Methods void set(char const* statement, size_t statement_length); bool execute(); - bool get_affected_rows(uint64_t& num_affected_rows); MySQLParamBindings& get_statement_bindings() { return m_statement_bindings; }