Commits

Robert Clipsham  committed dfaf7e9

Renamed lazyExecute() to bgExecute() to better reflect what it does.

  • Participants
  • Parent commits f7d286d

Comments (0)

Files changed (4)

File example/models/Home.d

            .from("blog")
            .limit(limit)
            .offset(offset);
-        //return doc.lazyExecute!(Post)();
         return doc.execute!(Post)();
     }
 }

File serenity/Database.d

         }
     }
 
-    public static Result!(T) execute(T)(SqlQuery query, bool lazy_=false)
+    public static Result!(T) execute(T)(SqlQuery query, bool bg=false)
     {
         char[] dbExec(char[][] names...)
         {
             foreach (name; names)
             {
                 ret ~= `case "serenity.database.` ~ name ~ `.` ~ name ~ `Database":
-                            if (lazy_)
+                            if (bg)
                             {
                                 return (cast(` ~ name ~ `Database)db)
-                                        .lazyExecute!(T)(queryStr, query.getBoundParameters(), query.getColumns());
+                                        .bgExecute!(T)(queryStr, query.getBoundParameters(), query.getColumns());
                             }
                             else
                             {

File serenity/SqlQuery.d

          return this;
      }
 
-    public Result!(T) lazyExecute(T)()
+    public Result!(T) bgExecute(T)()
     {
         return execute!(T)(true);
     }
 
-    public Result!(T) execute(T)(bool lazy_=false)
+    public Result!(T) execute(T)(bool bg=false)
     {
         if (mQt == QueryType.Select && mColumns.length == 1 && mColumns[0] == "*")
         {
                 mColumns ~= T.tupleof[i].stringof[T.stringof.length+3..$] ;
             }
         }
-        return Database.execute!(T)(this, lazy_);
+        return Database.execute!(T)(this, bg);
     }
 }

File serenity/database/Sqlite.d

     }
 
     /**
-     * Lazily execute a SQL query
+     * Execute a SQL query in the background
      *
      * Params:
      *  query = The query to execute
      *  params = A list of parameters to bind
      *  columns = The names of the columns being operated on
      */
-    public Result!(T) lazyExecute(T)(char[] query, Bind[] params, char[][] columns)
+    public Result!(T) bgExecute(T)(char[] query, Bind[] params, char[][] columns)
     {
         auto res = new Result!(T);
         Serenity.poolAppend((Result!(T) result, SqliteDatabase db, char[] query, Bind[] params, char[][] columns)
         {
-            db.execute!(T)(query, params, columns, true, result);
+            db.execute!(T)(query, params, columns, result);
         }, res, this, query, params, columns);
         return res;
     }
      * Execute a SQL query
      *
      * Params:
-     *  query = The query to execute
-     *  params = A list of parameters to bind
+     *  query   = The query to execute
+     *  params  = A list of parameters to bind
      *  columns = The names of the columns being operated on
-     *  lazy_ = Used internally for lazy evaluation, use lazyExecute() instead
+     *  result  = result to append the results to, used for bgExecute()
      */
-    public Result!(T) execute(T)(char[] query, Bind[] params, char[][] columns, bool lazy_=false, Result!(T) result=new Result!(T))
+    public Result!(T) execute(T)(char[] query, Bind[] params, char[][] columns, Result!(T) result=new Result!(T))
     {
         sqlite3_stmt* statement;
         // TODO Deal with tail