80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
str))
(define sdb:qry
(let ((sdb #f)
(scache (make-hash-table))
(icache (make-hash-table)))
(lambda (cmd var)
(case cmd
((init) (set! sdb (sdb:open)))
((finalize!) (sqlite3:finalize! sdb))
((getid) (let ((id (sdb:string->id sdb scache var)))
(if id
id
(begin
(sdb:register-string sdb var)
(sdb:string->id sdb scache var)))))
((getstr) (sdb:id->string sdb icache var))
(else #f)))))
|
>
|
|
>
>
|
>
>
|
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
|
str))
(define sdb:qry
(let ((sdb #f)
(scache (make-hash-table))
(icache (make-hash-table)))
(lambda (cmd var)
(if (not sdb)(set! sdb (sdb:open)))
(case cmd
((init) (if (not sdb)(set! sdb (sdb:open))))
((finalize!) (if sdb (sqlite3:finalize! sdb)))
((getid) (let ((id (sdb:string->id sdb scache var)))
(if id
id
(begin
(sdb:register-string sdb var)
(sdb:string->id sdb scache var)))))
((getstr) (if (or (number? var)
(string->number var))
(sdb:id->string sdb icache var)
var))
(else #f)))))
|