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/osqlbackendmanager.cpp12
-rw-r--r--libopie2/opiedb/osqlitedriver.cpp6
2 files changed, 12 insertions, 6 deletions
diff --git a/libopie2/opiedb/osqlbackendmanager.cpp b/libopie2/opiedb/osqlbackendmanager.cpp
index fc18e07..bbfbf3d 100644
--- a/libopie2/opiedb/osqlbackendmanager.cpp
+++ b/libopie2/opiedb/osqlbackendmanager.cpp
@@ -1,16 +1,22 @@
+
+#include "osqlbackendmanager.h"
+
+/* OPIE */
+#include <opie2/odebug.h>
+
+/* QT */
#include <qdir.h>
#include <qmap.h>
-#include "osqlbackendmanager.h"
/**
* \todo FIXME CONFIG!!!
*/
namespace {
class Config {
typedef QMap<QString, QString> List;
public:
Config( const QString& fileName );
/**
* Quite simple layout in nature
@@ -29,25 +35,25 @@ namespace {
bool Config::load() {
if (!QFile::exists( m_fileName ) )
return false;
QFile file( m_fileName );
if (!file.open(IO_ReadOnly ) )
return false;
QStringList list = QStringList::split( '\n', file.readAll() );
QStringList::Iterator it;
QString line;
for (it = list.begin(); it != list.end(); ++it ) {
line = (*it).stripWhiteSpace();
- qWarning("Anonymous::Config:" + line );
+ owarn << "Anonymous::Config:" + line << oendl;
QStringList test = QStringList::split(' ', line );
m_list.insert( test[0], test[2] );
}
return true;
}
QString Config::value( const QString& key ) {
return m_list[key];
}
};
using namespace Opie::DB;
@@ -83,24 +89,24 @@ OSQLBackEnd::ValueList OSQLBackEndManager::scanDir( const QString& dirName ) {
for ( it = files.begin(); it != files.end(); ++it ) {
list.append( file2backend( (*it) ) );
}
}
return list;
}
/**
* read a config file and convert it to a OSQLBackEnd
*/
OSQLBackEnd OSQLBackEndManager::file2backend( const QString& file ) {
OSQLBackEnd end;
- qWarning("fileName: " + file );
+ owarn << "fileName: " + file << oendl;
Config cfg( file );
if (cfg.load() ) {
end.setName( cfg.value( "Name") );
end.setVendor( cfg.value("Vendor") );
end.setLicense( cfg.value("License") );
end.setLibrary( cfg.value("Library").local8Bit() );
end.setDefault( cfg.value("Default").toInt() );
end.setPreference( cfg.value("Preference").toInt() );
}
return end;
}
diff --git a/libopie2/opiedb/osqlitedriver.cpp b/libopie2/opiedb/osqlitedriver.cpp
index 588fc8f..69eddfe 100644
--- a/libopie2/opiedb/osqlitedriver.cpp
+++ b/libopie2/opiedb/osqlitedriver.cpp
@@ -115,33 +115,33 @@ void rlikeFunc(sqlite_func *context, int arg, const char **argv){
sqlite_set_result_int(context,
sqliteRlikeCompare((const char*)argv[0],
(const char*)argv[1], (sqregex *)sqlite_user_data(context) ));
}
/*
* try to open a db specified via setUrl
* and options
*/
bool OSQLiteDriver::open() {
char *error;
- qDebug("OSQLiteDriver::open: about to open");
+ odebug << "OSQLiteDriver::open: about to open" << oendl;
m_sqlite = sqlite_open(m_url.local8Bit(),
0,
&error );
/* failed to open */
if (m_sqlite == 0l ) {
// FIXME set the last error
- qWarning("OSQLiteDriver::open: %s", 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;
}
@@ -165,25 +165,25 @@ bool OSQLiteDriver::close() {
/* 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(),&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 {