← Back to team overview

uonedb-qt team mailing list archive

[Merge] lp:~kalikiana/u1db-qt/no.results into lp:u1db-qt

 

Christian Dywan has proposed merging lp:~kalikiana/u1db-qt/no.results into lp:u1db-qt.

Commit message:
Shuffle Index::setExpression to ensure Index is defined

Requested reviews:
  U1DB Qt developers (uonedb-qt)
Related bugs:
  Bug #1177357 in U1DB Qt/ QML: "Regression - no results when using an existing database"
  https://bugs.launchpad.net/u1db-qt/+bug/1177357

For more details, see:
https://code.launchpad.net/~kalikiana/u1db-qt/no.results/+merge/163335

Shuffle Index::setExpression to ensure Index is defined
-- 
https://code.launchpad.net/~kalikiana/u1db-qt/no.results/+merge/163335
Your team U1DB Qt developers is requested to review the proposed merge of lp:~kalikiana/u1db-qt/no.results into lp:u1db-qt.
=== modified file 'src/index.cpp'
--- src/index.cpp	2013-04-25 13:38:33 +0000
+++ src/index.cpp	2013-05-10 16:08:25 +0000
@@ -146,14 +146,14 @@
     if (m_expression == expression)
         return;
 
-    if (m_database)
-    {
-        m_database->putIndex(m_name, expression);
-        Q_EMIT dataInvalidated();
-    }
-
     m_expression = expression;
 
+    if (m_database)
+    {
+        m_database->putIndex(m_name, m_expression);
+        Q_EMIT dataInvalidated();
+    }
+   
     Q_EMIT expressionChanged(expression);
 }
 

=== modified file 'tests/tst_query.qml'
--- tests/tst_query.qml	2013-05-01 23:06:01 +0000
+++ tests/tst_query.qml	2013-05-10 16:08:25 +0000
@@ -26,6 +26,7 @@
 
     U1db.Database {
         id: gents
+        path: 'aDatabaseU'
     }
 
     U1db.Document {
@@ -131,12 +132,11 @@
     function workaroundQueryAndWait (buggyQuery) {
         var realQuery = buggyQuery.query;
         spyDocumentsChanged.target = buggyQuery
-        buggyQuery.query = '*'
-        buggyQuery.query = realQuery;
         spyDocumentsChanged.wait();
     }
 
     function test_0_wrongUse () {
+        workaroundQueryAndWait(wrongQuery)
         ignoreWarning('u1db: Unexpected type QVariantMap for query')
         wrongQuery.query = { 'name': 'Ivanka' }
         ignoreWarning('u1db: Unexpected type QObject* for query')


Follow ups