Commits

Robert Clipsham committed 8326cb7

Fixed a bug when iterating over an incomplete Result.

Comments (0)

Files changed (2)

serenity/Database.d

             size_t i = 0;
             while (!complete)
             {
-                i++;
                 if (auto result = dg(i, receiveResult()))
                 {
                     return result;
                 }
+                i++;
             }
             return 0;
         }

serenity/database/Sqlite.d

         cols ~= Test.tupleof[i].stringof[7..$];
     }
     auto results = db.execute!(Test)(db.getPrinter().getQueryString(query), (Bind[]).init, cols);
-    assert(results.length == 1);
 
-    foreach (result; results)
+    foreach (i, result; results)
     {
+        assert(i == 0); // Should only be one result
         assert(result.boolVal == true);
         assert(result.byteVal == -1);
         assert(result.ubyteVal == 1);