summaryrefslogtreecommitdiff
path: root/database/database.cpp
diff options
context:
space:
mode:
authorDenis Loh <denis.loh@gmail.com>2009-11-19 12:21:55 +0100
committerDenis Loh <denis.loh@gmail.com>2009-11-19 12:21:55 +0100
commit2d245fcabb385347359759de8e6c40ce16e43cab (patch)
treeee6d718e2be089c50a1f0f6ca6fb89cc3c3161b0 /database/database.cpp
parent4510b4d123a4f62c49c55fa517f15df4fa90ebec (diff)
downloadvdr-plugin-upnp-2d245fcabb385347359759de8e6c40ce16e43cab.tar.gz
vdr-plugin-upnp-2d245fcabb385347359759de8e6c40ce16e43cab.tar.bz2
Added options for verbosity level and auto detect settings
Diffstat (limited to 'database/database.cpp')
-rw-r--r--database/database.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/database/database.cpp b/database/database.cpp
index b3d11b2..e47dcbf 100644
--- a/database/database.cpp
+++ b/database/database.cpp
@@ -46,9 +46,7 @@ int cSQLiteDatabase::exec(const char* Statement){
return -1;
}
this->mRows = new cRows;
-#ifdef SQLITE_PRINT_STATEMENTS
- MESSAGE("SQLite: %s", Statement);
-#endif
+ MESSAGE(VERBOSE_SQL_STATEMENTS,"SQLite: %s", Statement);
if(sqlite3_exec(this->mDatabase, Statement, cSQLiteDatabase::getResultRow, (cSQLiteDatabase*)this, &Error)!=SQLITE_OK){
ERROR("Database error: %s", Error);
ERROR("Statement was: %s", Statement);
@@ -143,13 +141,12 @@ bool cRow::fetchColumn(cString* Column, cString* Value){
return ret;
}
+
bool cRow::fetchColumn(char** Column, char** Value){
if(currentCol>=this->ColCount){
return false;
}
- #ifdef SQLITE_PRINT_FETCHES
- MESSAGE("Fetching column %s='%s' (%d/%d)", this->Columns[currentCol], this->Values[currentCol], currentCol+1, this->ColCount);
- #endif
+ MESSAGE(VERBOSE_SQL_FETCHES,"Fetching column %s='%s' (%d/%d)", this->Columns[currentCol], this->Values[currentCol], currentCol+1, this->ColCount);
*Column = strdup0(this->Columns[currentCol]);
if(this->Values[currentCol]){
*Value = strcasecmp(this->Values[currentCol],"NULL")?strdup(this->Values[currentCol]):NULL;
@@ -169,7 +166,7 @@ int cSQLiteDatabase::initialize(){
sqlite3_close(this->mDatabase);
return -1;
}
- MESSAGE("Database file %s opened.", *File);
+ MESSAGE(VERBOSE_SDK,"Database file %s opened.", *File);
if(this->initializeTables()){
ERROR("Error while creating tables");
return -1;
@@ -191,17 +188,19 @@ void cSQLiteDatabase::startTransaction(){
}
}
this->execStatement("BEGIN TRANSACTION");
- MESSAGE("Start new transaction");
+ MESSAGE(VERBOSE_SQL,"Start new transaction");
this->mActiveTransaction = true;
}
void cSQLiteDatabase::commitTransaction(){
this->execStatement("COMMIT TRANSACTION");
+ MESSAGE(VERBOSE_SQL,"Commited transaction");
this->mActiveTransaction = false;
}
void cSQLiteDatabase::rollbackTransaction(){
this->execStatement("ROLLBACK TRANSACTION");
+ MESSAGE(VERBOSE_SQL,"Rolled back transaction");
this->mActiveTransaction = false;
}