summaryrefslogtreecommitdiff
path: root/libopie2/opiedb
Side-by-side diff
Diffstat (limited to 'libopie2/opiedb') (more/less context) (show whitespace changes)
-rw-r--r--libopie2/opiedb/osqlitedriver.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/libopie2/opiedb/osqlitedriver.cpp b/libopie2/opiedb/osqlitedriver.cpp
index b9a491e..92f89cf 100644
--- a/libopie2/opiedb/osqlitedriver.cpp
+++ b/libopie2/opiedb/osqlitedriver.cpp
@@ -125,97 +125,97 @@ bool OSQLiteDriver::open() {
0,
&error );
/* failed to open */
if (m_sqlite == 0l ) {
// FIXME set the last error
owarn << "OSQLiteDriver::open: " << error << "" << oendl;
free( error );
return false;
}
if (sqlite_create_function(m_sqlite,"rlike",2,rlikeFunc,&sqreg) != 0)
odebug << "Unable to create user defined function!" << oendl;
if (sqlite_function_type(m_sqlite,"rlike",SQLITE_NUMERIC) != 0)
odebug << "Unable to set rlike function result type!" << oendl;
sqreg.regex_raw = NULL;
return true;
}
/* close the db
* sqlite closes them without
* telling failure or success
*/
bool OSQLiteDriver::close() {
if (m_sqlite )
sqlite_close( m_sqlite ), m_sqlite=0l;
if (sqreg.regex_raw != NULL){
odebug << "Freeing regex on close" << oendl;
free(sqreg.regex_raw);
sqreg.regex_raw=NULL;
regfree(&sqreg.regex_c);
}
return true;
}
/* Query */
OSQLResult OSQLiteDriver::query( OSQLQuery* qu) {
if ( !m_sqlite ) {
// FIXME set error code
OSQLResult result( OSQLResult::Failure );
return result;
}
Query query;
query.driver = this;
char *err;
/* SQLITE_OK 0 if return code > 0 == failure */
if ( sqlite_exec(m_sqlite, qu->query().utf8(),&call_back, &query, &err) > 0 ) {
- qWarning("OSQLiteDriver::query: Error while executing %s",err);
+ owarn << "OSQLiteDriver::query: Error while executing " << err << "" << oendl;
free(err );
// FixMe Errors
}
OSQLResult result(OSQLResult::Success,
query.items,
query.errors );
return result;
}
OSQLTable::ValueList OSQLiteDriver::tables() const {
}
OSQLError OSQLiteDriver::lastError() {
OSQLError error;
return error;
};
/* handle a callback add the row to the global
* OSQLResultItem
*/
int OSQLiteDriver::handleCallBack( int, char**, char** ) {
return 0;
}
/* callback_handler add the values to the list*/
int OSQLiteDriver::call_back( void* voi, int argc,
char** argv, char** columns) {
Query* qu = (Query*)voi;
//copy them over to a OSQLResultItem
QMap<QString, QString> tableString;
QMap<int, QString> tableInt;
for (int i = 0; i < argc; i++ ) {
tableInt.insert( i, QString::fromUtf8( argv[i] ) );
tableString.insert( QString::fromUtf8( columns[i] ),
QString::fromUtf8( argv[i] ) );
}
OSQLResultItem item( tableString, tableInt );
qu->items.append( item );
return ((Query*)voi)->driver->handleCallBack( argc,