23 #ifndef _GNC_DBISQLCONNECTION_HPP_ 24 #define _GNC_DBISQLCONNECTION_HPP_ 29 #include <gnc-sql-connection.hpp> 30 #include "gnc-backend-dbi.hpp" 31 #include "gnc-dbisqlresult.hpp" 32 #include "gnc-dbiprovider.hpp" 35 using StrVec = std::vector<std::string>;
51 GncSqlStatementPtr create_statement_from_sql (
const std::string&)
52 const noexcept
override;
57 bool create_table (
const std::string&,
const ColVec&)
const noexcept
override;
58 bool create_index (
const std::string&,
const std::string&,
const EntryVec&)
59 const noexcept
override;
61 const noexcept
override;
62 std::string quote_string (
const std::string&)
const noexcept
override;
64 return dbi_conn_error(m_conn,
nullptr); }
65 QofBackend* qbe () const noexcept {
return m_qbe; }
66 dbi_conn conn() const noexcept {
return m_conn; }
68 bool retry) noexcept
override 71 m_error_repeat = repeat;
74 inline void init_error() noexcept
76 set_error(ERR_BACKEND_NO_ERR, 0,
false);
81 bool verify() noexcept override;
82 bool retry_connection(const
char* msg) noexcept override;
85 std::
string add_columns_ddl(const
std::
string& table_name,
86 const ColVec& info_vec) const noexcept;
87 bool drop_indexes() noexcept;
104 unsigned int m_error_repeat;
110 unsigned int m_sql_savepoint;
112 bool lock_database(
bool break_lock);
113 void unlock_database();
114 bool rename_table(const
std::
string& old_name, const
std::
string& new_name);
115 bool drop_table(const
std::
string&
table);
116 bool merge_tables(const
std::
string&
table, const
std::
string& other);
117 bool check_and_rollback_failed_save();
120 #endif //_GNC_DBISQLCONNECTION_HPP_ load and save data to SQL via libdbi
bool verify() noexcept override
Check if the dbi connection is valid.
bool does_table_exist(const std::string &) const noexcept override
Returns true if successful.
QofBackendError
The errors that can be reported to the GUI & other front-end users.
bool table_operation(TableOpType op) noexcept
Perform a specified SQL operation on every table in a database.
bool commit_transaction() noexcept override
Returns TRUE if successful, FALSE if error.
bool create_index(const std::string &, const std::string &, const EntryVec &) const noexcept override
Returns TRUE if successful, FALSE if error.
bool begin_transaction() noexcept override
Returns TRUE if successful, false if error.
Encapsulate a libdbi dbi_conn connection.
int dberror() const noexcept override
Get the connection error value.
SessionOpenMode
Mode for opening sessions.
bool add_columns_to_table(const std::string &, const ColVec &) const noexcept override
Returns TRUE if successful, FALSE if error.
Encapsulate the connection to the database.
Pure virtual class to iterate over a query result set.
bool create_table(const std::string &, const ColVec &) const noexcept override
Returns TRUE if successful, FALSE if error.
bool rollback_transaction() noexcept override
Returns TRUE if successful, FALSE if error.
int execute_nonselect_statement(const GncSqlStatementPtr &) noexcept override
Returns false if error.