Merge branch 'master' of github.com:jedmccaleb/NewCoin

This commit is contained in:
Arthur Britto
2013-02-03 17:04:20 -08:00

View File

@@ -27,7 +27,7 @@ void SqliteDatabase::connect()
int rc = sqlite3_open(mHost.c_str(), &mConnection);
if (rc)
{
cLog(lsFATAL) << "Can't open database: " << mHost << " " << rc;
cLog(lsFATAL) << "Can't open " << mHost << " " << rc;
sqlite3_close(mConnection);
assert((rc != SQLITE_BUSY) && (rc != SQLITE_LOCKED));
}
@@ -51,7 +51,7 @@ bool SqliteDatabase::executeSQL(const char* sql, bool fail_ok)
if (!fail_ok)
{
#ifdef DEBUG
cLog(lsWARNING) << "SQL Perror:" << rc;
cLog(lsWARNING) << "Perror:" << mHost << ": " << rc;
cLog(lsWARNING) << "Statement: " << sql;
cLog(lsWARNING) << "Error: " << sqlite3_errmsg(mConnection);
#endif
@@ -69,13 +69,18 @@ bool SqliteDatabase::executeSQL(const char* sql, bool fail_ok)
}
else
{
assert((rc != SQLITE_BUSY) && (rc != SQLITE_LOCKED));
if ((rc != SQLITE_BUSY) && (rc != SQLITE_LOCKED))
{
cLog(lsFATAL) << << mHost << " returns error " << rc
<< ": " << sqlite3_errmsg(mConnection);
assert(false);
}
mMoreRows = false;
if (!fail_ok)
{
#ifdef DEBUG
cLog(lsWARNING) << "SQL Serror:" << rc;
cLog(lsWARNING) << "SQL Serror:" << mHost << ": " << rc;
cLog(lsWARNING) << "Statement: " << sql;
cLog(lsWARNING) << "Error: " << sqlite3_errmsg(mConnection);
#endif
@@ -135,7 +140,7 @@ bool SqliteDatabase::getNextRow()
else
{
assert((rc != SQLITE_BUSY) && (rc != SQLITE_LOCKED));
cLog(lsWARNING) << "SQL Rerror:" << rc;
cLog(lsWARNING) << "Rerror: " << mHost << ": " << rc;
return(false);
}
}
@@ -244,7 +249,7 @@ void SqliteDatabase::runWal()
int ret = sqlite3_wal_checkpoint_v2(mConnection, db.c_str(), SQLITE_CHECKPOINT_PASSIVE, &log, &ckpt);
if (ret != SQLITE_OK)
{
cLog((ret == SQLITE_LOCKED) ? lsDEBUG : lsWARNING) << "WAL "
cLog((ret == SQLITE_LOCKED) ? lsDEBUG : lsWARNING) << "WAL " << mHost << ": " <<
<< sqlite3_db_filename(mConnection, "main") << " / " << db << " errror " << ret;
}
}