author | eilers <eilers> | 2004-05-04 18:49:04 (UTC) |
---|---|---|
committer | eilers <eilers> | 2004-05-04 18:49:04 (UTC) |
commit | f1a3fc696787ae946464469b3f252aa425dbe51b (patch) (side-by-side diff) | |
tree | f06602aae8935b3a0d186c921cbdde61c045bcf1 | |
parent | 04a7f91591987c01d312fbcaf6554ec6d728554d (diff) | |
download | opie-f1a3fc696787ae946464469b3f252aa425dbe51b.zip opie-f1a3fc696787ae946464469b3f252aa425dbe51b.tar.gz opie-f1a3fc696787ae946464469b3f252aa425dbe51b.tar.bz2 |
Minor modification in debug output
-rw-r--r-- | libopie2/opiepim/backend/odatebookaccessbackend_sql.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/libopie2/opiepim/backend/odatebookaccessbackend_sql.cpp b/libopie2/opiepim/backend/odatebookaccessbackend_sql.cpp index 495a8dd..6c32b40 100644 --- a/libopie2/opiepim/backend/odatebookaccessbackend_sql.cpp +++ b/libopie2/opiepim/backend/odatebookaccessbackend_sql.cpp @@ -197,84 +197,86 @@ bool ODateBookAccessBackend_SQL::reload() bool ODateBookAccessBackend_SQL::save() { return m_driver->close(); // Shouldn't m_driver->sync be better than close ? (eilers) } QArray<int> ODateBookAccessBackend_SQL::allRecords()const { return m_uids; } QArray<int> ODateBookAccessBackend_SQL::queryByExample(const OPimEvent&, int, const QDateTime& ) { return QArray<int>(); } void ODateBookAccessBackend_SQL::clear() { QString qu = "drop table datebook;"; qu += "drop table custom_data;"; OSQLRawQuery raw( qu ); OSQLResult res = m_driver->query( &raw ); reload(); } OPimEvent ODateBookAccessBackend_SQL::find( int uid ) const{ qDebug( "ODateBookAccessBackend_SQL::find( %d )", uid ); QString qu = "select *"; qu += "from datebook where uid = " + QString::number(uid); + qDebug( "Query: %s", qu.latin1() ); + OSQLRawQuery raw( qu ); OSQLResult res = m_driver->query( &raw ); OSQLResultItem resItem = res.first(); // Create Map for date event and insert UID QMap<int,QString> dateEventMap; dateEventMap.insert( OPimEvent::FUid, QString::number( uid ) ); // Now insert the data out of the columns into the map. QMapConstIterator<int, QString> it; for ( it = ++m_fieldMap.begin(); it != m_fieldMap.end(); ++it ){ dateEventMap.insert( m_reverseFieldMap[*it], resItem.data( *it ) ); } // Last step: Put map into date event, add custom map and return it OPimEvent retDate( dateEventMap ); retDate.setExtraMap( requestCustom( uid ) ); - qDebug( "ODateBookAccessBackend_SQL::find() end", uid ); + qDebug( "ODateBookAccessBackend_SQL::find( %d ) end", uid ); return retDate; } // FIXME: Speed up update of uid's.. bool ODateBookAccessBackend_SQL::add( const OPimEvent& ev ) { QMap<int,QString> eventMap = ev.toMap(); QString qu = "insert into datebook VALUES( " + QString::number( ev.uid() ); QMap<int, QString>::Iterator it; for ( it = ++m_fieldMap.begin(); it != m_fieldMap.end(); ++it ){ if ( !eventMap[it.key()].isEmpty() ) qu += QString( ",\"%1\"" ).arg( eventMap[it.key()] ); else qu += QString( ",\"\"" ); } qu += " );"; // Add custom entries int id = 0; QMap<QString, QString> customMap = ev.toExtraMap(); for( QMap<QString, QString>::Iterator it = customMap.begin(); it != customMap.end(); ++it ){ qu += "insert into custom_data VALUES(" + QString::number( ev.uid() ) + "," + QString::number( id++ ) + ",'" + it.key() //.latin1() + "'," + "0" // Priority for future enhancements + ",'" |