Skip to content
Snippets Groups Projects
Commit db567ad0 authored by Steven Murray's avatar Steven Murray
Browse files

Simplified the public interface of SqliteConn

parent 9c2de5ab
No related branches found
No related tags found
No related merge requests found
......@@ -85,7 +85,7 @@ DbStmt *SqliteConn::createStmt(const std::string &sql) {
//------------------------------------------------------------------------------
void SqliteConn::createCatalogueDatabaseSchema() {
try {
enableForeignKeys();
execMultiLineNonQuery("PRAGMA foreign_keys = ON;");
const RdbmsCatalogueSchema schema;
execMultiLineNonQuery(schema.sql);
} catch(exception::Exception &ex) {
......@@ -93,17 +93,6 @@ void SqliteConn::createCatalogueDatabaseSchema() {
}
}
//------------------------------------------------------------------------------
// enableForeignKeys
//------------------------------------------------------------------------------
void SqliteConn::enableForeignKeys() {
try {
execMultiLineNonQuery("PRAGMA foreign_keys = ON;");
} catch(exception::Exception &ex) {
throw exception::Exception(std::string(__FUNCTION__) + " failed: " + ex.getMessage().str());
}
}
//------------------------------------------------------------------------------
// executeMultiLineNonQuery
//------------------------------------------------------------------------------
......
......@@ -69,19 +69,6 @@ public:
*/
void createCatalogueDatabaseSchema();
/**
* This is an SqliteConn specific method that enables foreign key constraints.
*/
void enableForeignKeys();
/**
* This is an SqliteConn specific method that executes the specified
* multi-line non-query SQL statement.
*
* @param sql The SQL statement.
*/
void execMultiLineNonQuery(const std::string &sql);
/**
* This ia an SqliteConn specific method that prints the database schema to
* the specified output stream.
......@@ -105,6 +92,14 @@ private:
*/
sqlite3 *m_conn;
/**
* This is an SqliteConn specific method that executes the specified
* multi-line non-query SQL statement.
*
* @param sql The SQL statement.
*/
void execMultiLineNonQuery(const std::string &sql);
}; // class SqliteConn
} // namespace catalogue
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment