[MLton-commit] r5231

Wesley Terpstra wesley at mlton.org
Sat Feb 17 06:43:01 PST 2007


move prepared query reporting method into the extension/implementation detail substructure
----------------------------------------------------------------------

U   mltonlib/trunk/ca/terpstra/sqlite3/demo.sml
U   mltonlib/trunk/ca/terpstra/sqlite3/sql.sig
U   mltonlib/trunk/ca/terpstra/sqlite3/sql.sml

----------------------------------------------------------------------

Modified: mltonlib/trunk/ca/terpstra/sqlite3/demo.sml
===================================================================
--- mltonlib/trunk/ca/terpstra/sqlite3/demo.sml	2007-02-17 14:42:20 UTC (rev 5230)
+++ mltonlib/trunk/ca/terpstra/sqlite3/demo.sml	2007-02-17 14:43:00 UTC (rev 5231)
@@ -41,8 +41,11 @@
 val () = SQL.app dumpP Q1 (4 & "hi") handle SQL.Error x => die x
 val () = SQL.app dumpV Q2 ()         handle SQL.Error x => die x
 
-val () = print ("Prepared queries: " ^ Int.toString (SQL.preparedQueries db) ^ "\n")
+val pq = SQL.SQLite.preparedQueries
+val () = print ("Prepared queries: " ^ Int.toString (pq db) ^ "\n")
+val () = print "Running garbage collector... "
 val () = MLton.GC.collect ()
-val () = print ("Prepared queries: " ^ Int.toString (SQL.preparedQueries db) ^ "\n")
+val () = print "done\n"
+val () = print ("Prepared queries: " ^ Int.toString (pq db) ^ "\n")
 
 val () = SQL.closeDB db              handle SQL.Error x => die x

Modified: mltonlib/trunk/ca/terpstra/sqlite3/sql.sig
===================================================================
--- mltonlib/trunk/ca/terpstra/sqlite3/sql.sig	2007-02-17 14:42:20 UTC (rev 5230)
+++ mltonlib/trunk/ca/terpstra/sqlite3/sql.sig	2007-02-17 14:43:00 UTC (rev 5231)
@@ -26,9 +26,6 @@
       val openDB: string -> db
       val closeDB: db -> unit
       
-      (* How many prepared queries are there *)
-      val preparedQueries: db -> int
-      
       (* You should ignore the type information here. It's confusing & useless.
        * Use this structure as follows:
        * local
@@ -205,6 +202,9 @@
             val totalChanges: db -> int
             val transactionActive: db -> bool
             
+            (* Number of prepared queries not yet garbage collected *)
+            val preparedQueries: db -> int
+            
             datatype access = ALLOW | DENY | IGNORE
             datatype request =
                CREATE_INDEX of { index: string, table: string, db: string, temporary: bool }

Modified: mltonlib/trunk/ca/terpstra/sqlite3/sql.sml
===================================================================
--- mltonlib/trunk/ca/terpstra/sqlite3/sql.sml	2007-02-17 14:42:20 UTC (rev 5230)
+++ mltonlib/trunk/ca/terpstra/sqlite3/sql.sml	2007-02-17 14:43:00 UTC (rev 5231)
@@ -43,9 +43,6 @@
             else raise Error "Database in use"
          end
       
-      fun preparedQueries dbl =
-         Ring.fold (fn (_, x) => x + 1) ~1 dbl
-      
       fun columns q = Query.peek (q, Prim.columns)
       fun columnsMeta q = Query.peek (q, Prim.meta)
       
@@ -145,6 +142,9 @@
             val totalChanges = Prim.totalChanges o getDB
             val transactionActive = not o Prim.getAutocommit o getDB
             
+            fun preparedQueries dbl =
+               Ring.fold (fn (_, x) => x + 1) ~1 dbl
+            
             datatype access = datatype Prim.access
             datatype request = datatype Prim.request
             fun setAuthorizer (db, f) = Prim.setAuthorizer (getDB db, f)




More information about the MLton-commit mailing list