mirror of
https://github.com/cuberite/SQLiteCpp.git
synced 2025-08-04 09:46:02 -04:00
Example now print SQLite version
This commit is contained in:
parent
f5e0cafa72
commit
b9322fb0ab
@ -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
|
||||||
|
@ -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)
|
||||||
{
|
{
|
||||||
|
@ -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());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user