]> gitweb.factorcode.org Git - factor.git/commitdiff
fix circularity in db
authorsheeple <sheeple@oberon.local>
Sat, 21 Feb 2009 04:59:01 +0000 (22:59 -0600)
committersheeple <sheeple@oberon.local>
Sat, 21 Feb 2009 04:59:01 +0000 (22:59 -0600)
basis/db/db.factor
basis/db/errors/errors.factor
basis/db/errors/postgresql/postgresql.factor
basis/db/errors/sqlite/sqlite.factor
basis/db/postgresql/postgresql.factor
basis/db/sqlite/sqlite.factor

index eb06f0c8944af4f30214be99ed0889f2f7ecf802..96b72b8865a224f563345dbbbe218c4e1bd4f5ae 100644 (file)
@@ -5,14 +5,14 @@ namespaces sequences classes.tuple words strings
 tools.walker accessors combinators fry db.errors ;
 IN: db
 
-<PRIVATE
-
 TUPLE: db-connection
     handle
     insert-statements
     update-statements
     delete-statements ;
 
+<PRIVATE
+
 : new-db-connection ( class -- obj )
     new
         H{ } clone >>insert-statements
@@ -23,6 +23,7 @@ PRIVATE>
 
 GENERIC: db-open ( db -- db-connection )
 HOOK: db-close db-connection ( handle -- )
+HOOK: parse-db-error db-connection ( error -- error' )
 
 : dispose-statements ( assoc -- ) values dispose-each ;
 
index 1d48012cf9fdda6bda585b2763ee8f1ea95194d5..9420dbbfc4c00f2892d34fde171326c9b1ce3147 100644 (file)
@@ -1,10 +1,8 @@
 ! Copyright (C) 2008 Doug Coleman.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: kernel db.private ;
+USING: kernel ;
 IN: db.errors
 
-HOOK: parse-db-error db-connection ( error -- error' )
-
 ERROR: db-error ;
 ERROR: sql-error ;
 
index 9d88c96cb10a6d763ccd59131a0df38e96099319..e45ff092e8d9549899c81b6b7cf5a7f7a2dcb246 100644 (file)
@@ -2,6 +2,3 @@
 ! See http://factorcode.org/license.txt for BSD license.
 USING: ;
 IN: db.errors.postgresql
-
-M: postgresql-db-connection parse-db-error
-    ;
\ No newline at end of file
index 770a12b2a1fa5e566d759a171b7292f82863aacb..c247a36257b20032a4bb1c385c1e27e41c908213 100644 (file)
@@ -1,7 +1,7 @@
 ! Copyright (C) 2009 Doug Coleman.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors combinators db.errors db.sqlite.private kernel
-sequences peg.ebnf strings ;
+USING: accessors combinators db kernel sequences peg.ebnf
+strings db.errors ;
 IN: db.errors.sqlite
 
 ERROR: unparsed-sqlite-error error ;
@@ -23,9 +23,3 @@ SqliteError =
     | "no such table: " .+:table
       => [[ table >string <sql-table-missing> ]]
 ;EBNF
-
-M: sqlite-db-connection parse-db-error
-    dup n>> {
-        { 1 [ string>> parse-sqlite-sql-error ] }
-        [ drop ]
-    } case ;
\ No newline at end of file
index 1f55dcf769669e587993cb6a8345d4f28be32552..1c39166071e686c9f687d71acdb53b2f2ff1d9b3 100644 (file)
@@ -5,8 +5,8 @@ kernel math math.parser namespaces make prettyprint quotations
 sequences debugger db db.postgresql.lib db.postgresql.ffi
 db.tuples db.types tools.annotations math.ranges
 combinators classes locals words tools.walker db.private
-nmake accessors random db.queries destructors db.tuples.private ;
-USE: tools.walker
+nmake accessors random db.queries destructors db.tuples.private
+db.postgresql ;
 IN: db.postgresql
 
 TUPLE: postgresql-db host port pgopts pgtty database username password ;
@@ -280,3 +280,6 @@ M: postgresql-db-connection compound ( string object -- string' )
         { "references" [ >reference-string ] }
         [ drop no-compound-found ]
     } case ;
+
+M: postgresql-db-connection parse-db-error
+    ;
index a4adba3473d67ec7b39e08adfbc3d0813b1d2577..5b658f36c982cfd25eef3dd1f21ad46d7a835f1a 100755 (executable)
@@ -6,7 +6,8 @@ sequences strings classes.tuple alien.c-types continuations
 db.sqlite.lib db.sqlite.ffi db.tuples words db.types combinators
 math.intervals io nmake accessors vectors math.ranges random
 math.bitwise db.queries destructors db.tuples.private interpolate
-io.streams.string multiline make db.private sequences.deep ;
+io.streams.string multiline make db.private sequences.deep
+db.errors.sqlite ;
 IN: db.sqlite
 
 TUPLE: sqlite-db path ;
@@ -347,3 +348,9 @@ M: sqlite-db-connection compound ( string seq -- new-string )
         { "references" [ >reference-string ] }
         [ 2drop ]
     } case ;
+
+M: sqlite-db-connection parse-db-error
+    dup n>> {
+        { 1 [ string>> parse-sqlite-sql-error ] }
+        [ drop ]
+    } case ;