Debian Codegraph @

lib/dbd/null.scm

raw
1 ;;;
2 ;;; dbd.null - A database driver that does (almost) nothing
3 ;;;
4
5 (define-module dbd.null
6 (use dbi)
7 (export dbd-null-test-result-set!))
8 (select-module dbd.null)
9
10 ;; The null driver is mainly for testing dbi implementation.
11 ;; It just stores information passed via driver API, and the
12 ;; test routine will query it later to see infos are passed
13 ;; down to the driver correctly.
14
15 (define-class <null-driver> (<dbi-driver>)
16 ())
17
18 (define-class <null-connection> (<dbi-connection>)
19 ((attr-string :init-keyword :attr-string)
20 (attr-alist :init-keyword :attr-alist)
21 (options :init-keyword :options)
22 (open? :init-value #t)))
23
24 (define-method dbi-make-connection ((d <null-driver>)
25 attr-string attr-alist . options)
26 (make <null-connection>
27 :attr-string attr-string :attr-alist attr-alist
28 :options options))
29
30 (define-method dbi-execute-using-connection ((c <null-connection>) q p)
31 (list (apply (ref q 'prepared) p)))
32
33 (define-method dbi-open? ((c <null-connection>))
34 (ref c 'open?))
35
36 (define-method dbi-close ((c <null-connection>))
37 (set! (ref c 'open?) #f))