Minor fixes to comments and an API

This commit is contained in:
Sébastien Rombauts 2015-05-03 20:23:59 +02:00
parent 8797f16d12
commit 31dbcda9ad
4 changed files with 11 additions and 15 deletions

View File

@ -62,7 +62,7 @@ public:
// they copy the Statement::Ptr which in turn increments the reference counter. // they copy the Statement::Ptr which in turn increments the reference counter.
/** /**
* @brief Return a pointer to the named assigned to a result column (potentially aliased) * @brief Return a pointer to the named assigned to this result column (potentially aliased)
* *
* @see getOriginName() to get original column name (not aliased) * @see getOriginName() to get original column name (not aliased)
*/ */

View File

@ -102,7 +102,7 @@ public:
* *
* @throw SQLite::Exception in case of error * @throw SQLite::Exception in case of error
*/ */
void setBusyTimeout(int aTimeoutMs) noexcept; // nothrow void setBusyTimeout(const int aTimeoutMs) noexcept; // nothrow
/** /**
* @brief Shortcut to execute one or multiple statements without results. * @brief Shortcut to execute one or multiple statements without results.
@ -337,7 +337,13 @@ private:
/** /**
* @brief Check if aRet equal SQLITE_OK, else throw a SQLite::Exception with the SQLite error message * @brief Check if aRet equal SQLITE_OK, else throw a SQLite::Exception with the SQLite error message
*/ */
void check(const int aRet) const; inline void Database::check(const int aRet) const
{
if (SQLITE_OK != aRet)
{
throw SQLite::Exception(sqlite3_errmsg(mpSQLite));
}
}
private: private:
sqlite3* mpSQLite; //!< Pointer to SQLite Database Connection Handle sqlite3* mpSQLite; //!< Pointer to SQLite Database Connection Handle

View File

@ -74,7 +74,7 @@ Database::~Database() noexcept // nothrow
* *
* @throw SQLite::Exception in case of error * @throw SQLite::Exception in case of error
*/ */
void Database::setBusyTimeout(int aTimeoutMs) noexcept // nothrow void Database::setBusyTimeout(const int aTimeoutMs) noexcept // nothrow
{ {
const int ret = sqlite3_busy_timeout(mpSQLite, aTimeoutMs); const int ret = sqlite3_busy_timeout(mpSQLite, aTimeoutMs);
check(ret); check(ret);
@ -113,15 +113,6 @@ bool Database::tableExists(const char* apTableName)
return (1 == Nb); return (1 == Nb);
} }
// Check if aRet equal SQLITE_OK, else throw a SQLite::Exception with the SQLite error message
void Database::check(const int aRet) const
{
if (SQLITE_OK != aRet)
{
throw SQLite::Exception(sqlite3_errmsg(mpSQLite));
}
}
// Attach a custom function to your sqlite database. Assumes UTF8 text representation. // Attach a custom function to your sqlite database. Assumes UTF8 text representation.
// Parameter details can be found here: http://www.sqlite.org/c3ref/create_function.html // Parameter details can be found here: http://www.sqlite.org/c3ref/create_function.html
void Database::createFunction(const char* apFuncName, void Database::createFunction(const char* apFuncName,
@ -140,7 +131,6 @@ void Database::createFunction(const char* apFuncName,
} }
const int ret = sqlite3_create_function_v2(mpSQLite, apFuncName, aNbArg, TextRep, const int ret = sqlite3_create_function_v2(mpSQLite, apFuncName, aNbArg, TextRep,
apApp, apFunc, apStep, apFinal, apDestroy); apApp, apFunc, apStep, apFinal, apDestroy);
check(ret); check(ret);
} }

View File

@ -53,7 +53,7 @@ void Transaction::commit()
} }
else else
{ {
throw SQLite::Exception("Transaction already commited"); throw SQLite::Exception("Transaction already commited.");
} }
} }