fix circularity in db
parent
c6d3c91ad6
commit
a1f3e5695b
|
@ -5,14 +5,14 @@ namespaces sequences classes.tuple words strings
|
||||||
tools.walker accessors combinators fry db.errors ;
|
tools.walker accessors combinators fry db.errors ;
|
||||||
IN: db
|
IN: db
|
||||||
|
|
||||||
<PRIVATE
|
|
||||||
|
|
||||||
TUPLE: db-connection
|
TUPLE: db-connection
|
||||||
handle
|
handle
|
||||||
insert-statements
|
insert-statements
|
||||||
update-statements
|
update-statements
|
||||||
delete-statements ;
|
delete-statements ;
|
||||||
|
|
||||||
|
<PRIVATE
|
||||||
|
|
||||||
: new-db-connection ( class -- obj )
|
: new-db-connection ( class -- obj )
|
||||||
new
|
new
|
||||||
H{ } clone >>insert-statements
|
H{ } clone >>insert-statements
|
||||||
|
@ -23,6 +23,7 @@ PRIVATE>
|
||||||
|
|
||||||
GENERIC: db-open ( db -- db-connection )
|
GENERIC: db-open ( db -- db-connection )
|
||||||
HOOK: db-close db-connection ( handle -- )
|
HOOK: db-close db-connection ( handle -- )
|
||||||
|
HOOK: parse-db-error db-connection ( error -- error' )
|
||||||
|
|
||||||
: dispose-statements ( assoc -- ) values dispose-each ;
|
: dispose-statements ( assoc -- ) values dispose-each ;
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
! Copyright (C) 2008 Doug Coleman.
|
! Copyright (C) 2008 Doug Coleman.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: kernel db.private ;
|
USING: kernel ;
|
||||||
IN: db.errors
|
IN: db.errors
|
||||||
|
|
||||||
HOOK: parse-db-error db-connection ( error -- error' )
|
|
||||||
|
|
||||||
ERROR: db-error ;
|
ERROR: db-error ;
|
||||||
ERROR: sql-error ;
|
ERROR: sql-error ;
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,3 @@
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: ;
|
USING: ;
|
||||||
IN: db.errors.postgresql
|
IN: db.errors.postgresql
|
||||||
|
|
||||||
M: postgresql-db-connection parse-db-error
|
|
||||||
;
|
|
|
@ -1,7 +1,7 @@
|
||||||
! Copyright (C) 2009 Doug Coleman.
|
! Copyright (C) 2009 Doug Coleman.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: accessors combinators db.errors db.sqlite.private kernel
|
USING: accessors combinators db kernel sequences peg.ebnf
|
||||||
sequences peg.ebnf strings ;
|
strings db.errors ;
|
||||||
IN: db.errors.sqlite
|
IN: db.errors.sqlite
|
||||||
|
|
||||||
ERROR: unparsed-sqlite-error error ;
|
ERROR: unparsed-sqlite-error error ;
|
||||||
|
@ -23,9 +23,3 @@ SqliteError =
|
||||||
| "no such table: " .+:table
|
| "no such table: " .+:table
|
||||||
=> [[ table >string <sql-table-missing> ]]
|
=> [[ table >string <sql-table-missing> ]]
|
||||||
;EBNF
|
;EBNF
|
||||||
|
|
||||||
M: sqlite-db-connection parse-db-error
|
|
||||||
dup n>> {
|
|
||||||
{ 1 [ string>> parse-sqlite-sql-error ] }
|
|
||||||
[ drop ]
|
|
||||||
} case ;
|
|
|
@ -5,8 +5,8 @@ kernel math math.parser namespaces make prettyprint quotations
|
||||||
sequences debugger db db.postgresql.lib db.postgresql.ffi
|
sequences debugger db db.postgresql.lib db.postgresql.ffi
|
||||||
db.tuples db.types tools.annotations math.ranges
|
db.tuples db.types tools.annotations math.ranges
|
||||||
combinators classes locals words tools.walker db.private
|
combinators classes locals words tools.walker db.private
|
||||||
nmake accessors random db.queries destructors db.tuples.private ;
|
nmake accessors random db.queries destructors db.tuples.private
|
||||||
USE: tools.walker
|
db.postgresql ;
|
||||||
IN: db.postgresql
|
IN: db.postgresql
|
||||||
|
|
||||||
TUPLE: postgresql-db host port pgopts pgtty database username password ;
|
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 ] }
|
{ "references" [ >reference-string ] }
|
||||||
[ drop no-compound-found ]
|
[ drop no-compound-found ]
|
||||||
} case ;
|
} case ;
|
||||||
|
|
||||||
|
M: postgresql-db-connection parse-db-error
|
||||||
|
;
|
||||||
|
|
|
@ -6,7 +6,8 @@ sequences strings classes.tuple alien.c-types continuations
|
||||||
db.sqlite.lib db.sqlite.ffi db.tuples words db.types combinators
|
db.sqlite.lib db.sqlite.ffi db.tuples words db.types combinators
|
||||||
math.intervals io nmake accessors vectors math.ranges random
|
math.intervals io nmake accessors vectors math.ranges random
|
||||||
math.bitwise db.queries destructors db.tuples.private interpolate
|
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
|
IN: db.sqlite
|
||||||
|
|
||||||
TUPLE: sqlite-db path ;
|
TUPLE: sqlite-db path ;
|
||||||
|
@ -347,3 +348,9 @@ M: sqlite-db-connection compound ( string seq -- new-string )
|
||||||
{ "references" [ >reference-string ] }
|
{ "references" [ >reference-string ] }
|
||||||
[ 2drop ]
|
[ 2drop ]
|
||||||
} case ;
|
} case ;
|
||||||
|
|
||||||
|
M: sqlite-db-connection parse-db-error
|
||||||
|
dup n>> {
|
||||||
|
{ 1 [ string>> parse-sqlite-sql-error ] }
|
||||||
|
[ drop ]
|
||||||
|
} case ;
|
||||||
|
|
Loading…
Reference in New Issue