author | zecke <zecke> | 2004-08-30 13:31:01 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-08-30 13:31:01 (UTC) |
commit | dc30b84bb9c3759bcfee5e6d162395cad9873465 (patch) (side-by-side diff) | |
tree | ca70ec6c942d078367c81d47a04ad7cda52cd9a1 | |
parent | ba35591e04701ec0a4a9111ab754b98674ee3d29 (diff) | |
download | opie-dc30b84bb9c3759bcfee5e6d162395cad9873465.zip opie-dc30b84bb9c3759bcfee5e6d162395cad9873465.tar.gz opie-dc30b84bb9c3759bcfee5e6d162395cad9873465.tar.bz2 |
Fix warnings, add sanity check, new default argument to fix warning...
-rw-r--r-- | libopie2/opiedb/osqlbackend.cpp | 0 | ||||
-rw-r--r-- | libopie2/opiedb/osqlitedriver.cpp | 4 | ||||
-rw-r--r-- | libopie2/opiedb/osqlresult.cpp | 2 | ||||
-rw-r--r-- | libopie2/opiedb/osqltable.h | 2 |
4 files changed, 5 insertions, 3 deletions
diff --git a/libopie2/opiedb/osqlbackend.cpp b/libopie2/opiedb/osqlbackend.cpp index aede7c1..5c37480 100644 --- a/libopie2/opiedb/osqlbackend.cpp +++ b/libopie2/opiedb/osqlbackend.cpp diff --git a/libopie2/opiedb/osqlitedriver.cpp b/libopie2/opiedb/osqlitedriver.cpp index 92f89cf..c8b560f 100644 --- a/libopie2/opiedb/osqlitedriver.cpp +++ b/libopie2/opiedb/osqlitedriver.cpp @@ -83,49 +83,49 @@ void OSQLiteDriver::setOptions( const QStringList& ) { * Functions to patch a regex search into sqlite */ int sqliteRlikeCompare(const char *zPattern, const char *zString, sqregex *reg){ int res; if (reg->regex_raw == NULL || (strcmp (zPattern, reg->regex_raw) != 0)){ if (reg->regex_raw != NULL) { free(reg->regex_raw); regfree(®->regex_c); } reg->regex_raw = (char *)malloc(strlen(zPattern)+1); strncpy(reg->regex_raw, zPattern, strlen(zPattern)+1); res = regcomp(®->regex_c, zPattern, REG_EXTENDED); if ( res != 0 ) { printf("Regcomp failed with code %u on string %s\n",res,zPattern); free(reg->regex_raw); reg->regex_raw=NULL; return 0; } } res = (regexec(®->regex_c, zString, 0, NULL, 0)==0); return res; } void rlikeFunc(sqlite_func *context, int arg, const char **argv){ - if( argv[0]==0 || argv[1]==0 ){ + if( arg < 2 || argv[0]==0 || argv[1]==0 ){ printf("One of arguments Null!!\n"); return; } 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; 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 owarn << "OSQLiteDriver::open: " << error << "" << oendl; @@ -162,49 +162,49 @@ bool OSQLiteDriver::close() { 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 ) { 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 { - + return OSQLTable::ValueList(); } 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; diff --git a/libopie2/opiedb/osqlresult.cpp b/libopie2/opiedb/osqlresult.cpp index 268ac8e..a34ab2f 100644 --- a/libopie2/opiedb/osqlresult.cpp +++ b/libopie2/opiedb/osqlresult.cpp @@ -50,52 +50,54 @@ QString OSQLResultItem::data( int column, bool *ok ) const { return QString::null; } } /* * DateFormat is 'YYYY-MM-DD' */ QDate OSQLResultItem::dataToDate( const QString& column, bool *ok ) { QDate date = QDate::currentDate(); QString str = data( column, ok ); if (!str.isEmpty() ) { ;// convert } return date; } QDate OSQLResultItem::dataToDate( int column, bool *ok ) { QDate date = QDate::currentDate(); QString str = data( column, ok ); if (!str.isEmpty() ) { ;// convert } return date; } QDateTime OSQLResultItem::dataToDateTime( const QString& column, bool *ok ) { +// #FIXME xxx QDateTime time = QDateTime::currentDateTime(); return time; } QDateTime OSQLResultItem::dataToDateTime( int column, bool *ok ) { +// #FIXME xxx QDateTime time = QDateTime::currentDateTime(); return time; } OSQLResult::OSQLResult( enum State state, const OSQLResultItem::ValueList& list, const OSQLError::ValueList& error ) : m_state( state ), m_list( list ), m_error( error ) { } OSQLResult::~OSQLResult() { } OSQLResult::State OSQLResult::state()const { return m_state; } void OSQLResult::setState( OSQLResult::State state ) { m_state = state; } OSQLError::ValueList OSQLResult::errors()const { return m_error; } void OSQLResult::setErrors( const OSQLError::ValueList& err ) { diff --git a/libopie2/opiedb/osqltable.h b/libopie2/opiedb/osqltable.h index 86c30dd..8dd786f 100644 --- a/libopie2/opiedb/osqltable.h +++ b/libopie2/opiedb/osqltable.h @@ -49,49 +49,49 @@ public: /** * the field Type */ Type type() const; QVariant more() const; private: class OSQLTableItemPrivate; OSQLTableItemPrivate* d; Type m_type; QString m_field; QVariant m_var; }; /** * A OSQLTable consists of OSQLTableItems */ class OSQLTable { public: typedef QValueList<OSQLTable> ValueList; /** * @param tableName the Name of the Table */ - OSQLTable(const QString& tableName); + OSQLTable(const QString& tableName = QString::null); /** * d'tor */ ~OSQLTable(); /** * setColumns sets the Columns of the Table */ void setColumns( const OSQLTableItem::ValueList& ); /** * returns all columns of the table */ OSQLTableItem::ValueList columns() const; QString tableName()const; private: QString m_table; OSQLTableItem::ValueList m_list; class Private; Private *d; }; |