Changed the code to pass through the prep-status to the outer HANDLE so
error reporting is uniformly handled and any SQL_BUSY errors are properly identified.
This commit is contained in:
parent
ed481865cf
commit
113049607a
|
@ -208,22 +208,20 @@
|
|||
(let*-values ([(db) (get-db fsym)]
|
||||
[(prep-status stmt)
|
||||
(HANDLE fsym
|
||||
;; Do not allow break/kill between prepare and
|
||||
;; entry of stmt in table.
|
||||
(A (let-values ([(prep-status stmt tail?)
|
||||
(sqlite3_prepare_v2 db sql)])
|
||||
(cond
|
||||
[(not (= 0 prep-status))
|
||||
(when stmt (sqlite3_finalize stmt))
|
||||
(error* fsym (get-error-message)
|
||||
'("given" value) sql)]
|
||||
[else
|
||||
(when tail?
|
||||
(when stmt (sqlite3_finalize stmt))
|
||||
(error* fsym "multiple statements given"
|
||||
'("given" value) sql))])
|
||||
(when stmt (hash-set! stmt-table stmt #t))
|
||||
(values prep-status stmt))))])
|
||||
;; Do not allow break/kill between prepare and
|
||||
;; entry of stmt in table.
|
||||
(A (let-values ([(prep-status stmt tail?)
|
||||
(sqlite3_prepare_v2 db sql)])
|
||||
(cond [(not (zero? prep-status))
|
||||
(when stmt (sqlite3_finalize stmt))
|
||||
(values prep-status #f)]
|
||||
[tail?
|
||||
(when stmt (sqlite3_finalize stmt))
|
||||
(error* fsym "multiple statements given"
|
||||
'("given" value) sql)]
|
||||
[else
|
||||
(when stmt (hash-set! stmt-table stmt #t))
|
||||
(values prep-status stmt)]))))])
|
||||
(when DEBUG?
|
||||
(dprintf " << prepared statement #x~x\n" (cast stmt _pointer _uintptr)))
|
||||
(unless stmt (error* fsym "SQL syntax error" '("given" value) sql))
|
||||
|
|
Loading…
Reference in New Issue
Block a user