Example now print SQLite version

This commit is contained in:
Sébastien Rombauts 2015-05-03 21:43:10 +02:00
parent f5e0cafa72
commit b9322fb0ab
3 changed files with 6 additions and 3 deletions

View File

@ -83,6 +83,9 @@ private:
int main () int main ()
{ {
std::cout << "SQlite3 version " << SQLITE_VERSION << std::endl;
std::cout << "SQliteC++ version " << SQLITECPP_VERSION << std::endl;
//////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////
// Very basic first example (1/7) : // Very basic first example (1/7) :
try try

View File

@ -337,7 +337,7 @@ 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
*/ */
inline void Database::check(const int aRet) const inline void check(const int aRet) const
{ {
if (SQLITE_OK != aRet) if (SQLITE_OK != aRet)
{ {

View File

@ -21,7 +21,7 @@ namespace SQLite
/// definition of the assertion handler enabled when SQLITECPP_ENABLE_ASSERT_HANDLER is defined in the project (CMakeList.txt) /// definition of the assertion handler enabled when SQLITECPP_ENABLE_ASSERT_HANDLER is defined in the project (CMakeList.txt)
void assertion_failed(const char* apFile, const long apLine, const char* apFunc, const char* apExpr, const char* apMsg) void assertion_failed(const char* apFile, const long apLine, const char* apFunc, const char* apExpr, const char* apMsg)
{ {
// TODO test that this assertion callback get called // TODO: test that this assertion callback get called
std::cout << "assertion_failed(" << apFile << ", " << apLine << ", " << apFunc << ", " << apExpr << ", " << apMsg << ")\n"; std::cout << "assertion_failed(" << apFile << ", " << apLine << ", " << apFunc << ", " << apExpr << ", " << apMsg << ")\n";
} }
} }
@ -215,7 +215,7 @@ TEST(Database, execException) {
// exception with SQL error: "No row to get a column from" // exception with SQL error: "No row to get a column from"
EXPECT_THROW(db.execAndGet("SELECT weight FROM test WHERE value=\"second\""), SQLite::Exception); EXPECT_THROW(db.execAndGet("SELECT weight FROM test WHERE value=\"second\""), SQLite::Exception);
// Add a row with more values than columns in the table: "table test has 3 columns but 4 values were supplied" // Add a row with more values than columns in the table: "table test has 3 columns but 4 values were supplied"
EXPECT_THROW(db.exec("INSERT INTO test VALUES (NULL, \"first\", 123, 0.123)"), SQLite::Exception); EXPECT_THROW(db.exec("INSERT INTO test VALUES (NULL, \"first\", 123, 0.123)"), SQLite::Exception);
EXPECT_EQ(SQLITE_ERROR, db.getErrorCode()); EXPECT_EQ(SQLITE_ERROR, db.getErrorCode());
EXPECT_EQ(SQLITE_ERROR, db.getExtendedErrorCode()); EXPECT_EQ(SQLITE_ERROR, db.getExtendedErrorCode());