[rygel] core: delegate exec in special cases



commit 27ac6a4e8760ab37edad1fc479f4821b983fd45f
Author: Jens Georg <mail jensge org>
Date:   Wed Sep 30 13:04:51 2009 +0200

    core: delegate exec in special cases
    
    if there's nothing to bind and noone to callback, just forward to SQLite

 src/rygel/rygel-database.vala |   17 +++++++++++------
 1 files changed, 11 insertions(+), 6 deletions(-)
---
diff --git a/src/rygel/rygel-database.vala b/src/rygel/rygel-database.vala
index 706b97f..5483a46 100644
--- a/src/rygel/rygel-database.vala
+++ b/src/rygel/rygel-database.vala
@@ -51,12 +51,17 @@ internal class Rygel.Database : Object {
                      RowCallback?  callback = null) throws DatabaseError {
         var t = new Timer ();
         int rc;
-        var statement = prepare_statement (sql, values);
-        while ((rc = statement.step ()) == Sqlite.ROW) {
-            if (callback != null) {
-                if (!callback (statement)) {
-                    rc = Sqlite.DONE;
-                    break;
+
+        if (values == null && callback == null) {
+            rc = this.db.exec (sql);
+        } else {
+            var statement = prepare_statement (sql, values);
+            while ((rc = statement.step ()) == Sqlite.ROW) {
+                if (callback != null) {
+                    if (!callback (statement)) {
+                        rc = Sqlite.DONE;
+                        break;
+                    }
                 }
             }
         }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]