Fixed bug (related to ticket #12): Only the last search term is used.
authorPhilipp Spitzer <philipp@spitzer.priv.at>
Sun, 10 Jul 2011 19:37:00 +0000 (19:37 +0000)
committerPhilipp Spitzer <philipp@spitzer.priv.at>
Sun, 10 Jul 2011 19:37:00 +0000 (19:37 +0000)
src/sql/sqlengine.cpp

index a5aa192db40771205cd38c22ba2865545a9521c6..419b3e05823ff8f83693c0e33d579ab68d5923a6 100644 (file)
@@ -317,7 +317,7 @@ int SqlEngine::searchEvent(int aConferenceId, const QHash<QString,QString> &aCol
     foreach (QString table, aColumns.uniqueKeys()){
         foreach (QString column, aColumns.values(table)){
             for (int i=0; i < searchKeywords.count(); i++){
     foreach (QString table, aColumns.uniqueKeys()){
         foreach (QString column, aColumns.values(table)){
             for (int i=0; i < searchKeywords.count(); i++){
-                 sql += QString("%1.%2 LIKE '\%' || :%1%2 || '\%' OR ").arg( table, column );
+                 sql += QString("%1.%2 LIKE '\%' || :%1%2%3 || '\%' OR ").arg(table).arg(column).arg(i);
             }
         }
     }
             }
         }
     }
@@ -328,8 +328,9 @@ int SqlEngine::searchEvent(int aConferenceId, const QHash<QString,QString> &aCol
     query.prepare(sql);
     foreach (QString table, aColumns.uniqueKeys()){
         foreach (QString column, aColumns.values(table)){
     query.prepare(sql);
     foreach (QString table, aColumns.uniqueKeys()){
         foreach (QString column, aColumns.values(table)){
-            foreach (QString keyword, searchKeywords){
-                query.bindValue(QString(":%1%2").arg(table, column), keyword );
+            for (int i = 0; i != searchKeywords.size(); ++i) {
+                QString keyword = searchKeywords[i];
+                query.bindValue(QString(":%1%2%3").arg(table).arg(column).arg(i), keyword );
             }
         }
     }
             }
         }
     }