summaryrefslogtreecommitdiff
path: root/libopie2/opiepim/backend/otodoaccesssql.cpp
Side-by-side diff
Diffstat (limited to 'libopie2/opiepim/backend/otodoaccesssql.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiepim/backend/otodoaccesssql.cpp34
1 files changed, 22 insertions, 12 deletions
diff --git a/libopie2/opiepim/backend/otodoaccesssql.cpp b/libopie2/opiepim/backend/otodoaccesssql.cpp
index 2bcab29..70e40e4 100644
--- a/libopie2/opiepim/backend/otodoaccesssql.cpp
+++ b/libopie2/opiepim/backend/otodoaccesssql.cpp
@@ -292,47 +292,57 @@ namespace {
+ ",'"
+ it.data()
+ "');";
}
odebug << "add " << qu << "" << oendl;
return qu;
}
RemoveQuery::RemoveQuery(int uid )
: OSQLQuery(), m_uid( uid ) {}
+
RemoveQuery::~RemoveQuery() {}
+
QString RemoveQuery::query()const {
QString qu = "DELETE FROM todolist WHERE uid = " + QString::number(m_uid) + " ;";
- qu += "DELETE FROM custom_data WHERE uid = " + QString::number(m_uid);
+ qu += "DELETE FROM custom_data WHERE uid = " + QString::number(m_uid);
return qu;
}
ClearQuery::ClearQuery()
: OSQLQuery() {}
ClearQuery::~ClearQuery() {}
- QString ClearQuery::query()const {
- QString qu = "drop table todolist";
- return qu;
+ QString ClearQuery::query()const
+ {
+ QString qu = "drop table todolist";
+ return qu;
}
+
FindQuery::FindQuery(int uid)
- : OSQLQuery(), m_uid(uid ) {
+ : OSQLQuery(), m_uid(uid )
+ {
}
+
FindQuery::FindQuery(const QArray<int>& ints)
- : OSQLQuery(), m_uids(ints){
+ : OSQLQuery(), m_uids(ints)
+ {
}
- FindQuery::~FindQuery() {
+
+ FindQuery::~FindQuery()
+ {
}
+
QString FindQuery::query()const{
if (m_uids.count() == 0 )
return single();
else
return multi();
}
QString FindQuery::single()const{
QString qu = "select * from todolist where uid = " + QString::number(m_uid);
return qu;
}
QString FindQuery::multi()const {
QString qu = "select * from todolist where ";
@@ -439,28 +449,28 @@ bool OPimTodoAccessBackendSQL::reload(){
return load();
}
bool OPimTodoAccessBackendSQL::save(){
return m_driver->close(); // Shouldn't m_driver->sync be better than close ? (eilers)
}
QArray<int> OPimTodoAccessBackendSQL::allRecords()const {
if (m_dirty )
update();
return m_uids;
}
-QArray<int> OPimTodoAccessBackendSQL::queryByExample( const OPimTodo& , int, const QDateTime& ){
- QArray<int> ints(0);
- return ints;
-}
+// QArray<int> OPimTodoAccessBackendSQL::queryByExample( const UIDArray& uidlist, const OPimTodo& , int, const QDateTime& ){
+// QArray<int> ints(0);
+// return ints;
+// }
OPimTodo OPimTodoAccessBackendSQL::find(int uid ) const{
FindQuery query( uid );
return parseResultAndCache( uid, m_driver->query(&query) );
}
// Remember: uid is already in the list of uids, called ints !
OPimTodo OPimTodoAccessBackendSQL::find( int uid, const QArray<int>& ints,
uint cur, Frontend::CacheDirection dir ) const{
uint CACHE = readAhead();
odebug << "searching for " << uid << "" << oendl;
QArray<int> search( CACHE );
uint size =0;
@@ -610,25 +620,25 @@ QArray<int> OPimTodoAccessBackendSQL::sorted( bool asc, int sortOrder,
if ( !asc )
query += " DESC";
odebug << query << oendl;
OSQLRawQuery raw(query );
return uids( m_driver->query(&raw) );
}
#endif
bool OPimTodoAccessBackendSQL::date( QDate& da, const QString& str ) const{
- if ( str == "0-0-0" )
+ if ( str == "0000-00-00" )
return false;
else{
int day, year, month;
QStringList list = QStringList::split("-", str );
year = list[0].toInt();
month = list[1].toInt();
day = list[2].toInt();
da.setYMD( year, month, day );
return true;
}
}