Handbook
Glossary
db-connection
Vocabulary
db
Word description
The
db-connection
class is the superclass of all other database classes. It stores a
handle
to the database as well as insert, update, and delete queries. Stores the current database object as a dynamic variable.
Definition
USING:
destructors
;
IN:
db
TUPLE:
db-connection
<
disposable
handle insert-statements update-statements delete-statements
;
Methods
USING:
accessors
classes
db
db.queries
db.tuples
kernel
nmake
;
M:
db-connection
<count-statement>
[
tuple>>
dup
class-of
]
keep
[
[
"select count(*) from "
0%
0%
where-clause
]
query-make
]
dip
make-query*
;
USING:
db
db.queries
db.tuples
nmake
;
M:
db-connection
<delete-tuples-statement>
[
"delete from "
0%
0%
where-clause
]
query-make
;
USING:
accessors
db
db.queries
db.tuples
db.types
kernel
nmake
sequences
;
M:
db-connection
<select-by-slots-statement>
[
"select "
0%
[
dupd
filter-ignores
]
dip
over
empty?
[
all-slots-ignored
]
when
over
[
", "
0%
]
[
dup
column-name>>
0%
2,
]
interleave
" from "
0%
0%
where-clause
]
query-make
;
USING:
accessors
db
db.queries
db.tuples
db.types
kernel
nmake
sequences
;
M:
db-connection
<update-tuple-statement>
[
"update "
0%
0%
" set "
0%
dup
remove-id
[
", "
0%
]
[
dup
column-name>>
0%
" = "
0%
bind%
]
interleave
where-primary-key%
]
query-make
;
USING:
db
;
M:
db-connection
begin-transaction
"BEGIN"
sql-command
;
USING:
db
;
M:
db-connection
commit-transaction
"COMMIT"
sql-command
;
USING:
accessors
db
destructors
kernel
namespaces
;
M:
db-connection
dispose*
dup
db-connection
[
[
dispose-statements
H{
}
clone
]
change-insert-statements
[
dispose-statements
H{
}
clone
]
change-update-statements
[
dispose-statements
H{
}
clone
]
change-delete-statements
[
db-close
f
]
change-handle
drop
]
with-variable
;
USING:
accessors
classes
db
db.queries
db.tuples
kernel
;
M:
db-connection
query>statement
[
tuple>>
dup
class-of
]
keep
[
<select-by-slots-statement>
]
dip
make-query*
;
USING:
db
;
M:
db-connection
rollback-transaction
"ROLLBACK"
sql-command
;