ignore reset result, reset on error
Reset result is from last step; looking at it was probably causing spurious failures and busy-timeouts. Transaction completion relies on statements being reset reliably.
This commit is contained in:
parent
67c6da058b
commit
46fb05e6ee
|
@ -62,8 +62,8 @@
|
||||||
(when delenda
|
(when delenda
|
||||||
(for ([pst (in-hash-values delenda)])
|
(for ([pst (in-hash-values delenda)])
|
||||||
(send pst finalize #f)))
|
(send pst finalize #f)))
|
||||||
(HANDLE fsym (sqlite3_reset stmt))
|
(void (sqlite3_reset stmt))
|
||||||
(HANDLE fsym (sqlite3_clear_bindings stmt))
|
(void (sqlite3_clear_bindings stmt))
|
||||||
(for ([i (in-naturals 1)]
|
(for ([i (in-naturals 1)]
|
||||||
[param (in-list params)])
|
[param (in-list params)])
|
||||||
(load-param fsym db stmt i param))
|
(load-param fsym db stmt i param))
|
||||||
|
@ -126,16 +126,22 @@
|
||||||
(error/internal* fsym "bad parameter value" '("value" value) param)])))
|
(error/internal* fsym "bad parameter value" '("value" value) param)])))
|
||||||
|
|
||||||
(define/private (step* fsym db stmt end-box fetch-limit)
|
(define/private (step* fsym db stmt end-box fetch-limit)
|
||||||
|
(with-handlers ([exn:fail?
|
||||||
|
(lambda (e)
|
||||||
|
(void (sqlite3_reset stmt))
|
||||||
|
(void (sqlite3_clear_bindings stmt))
|
||||||
|
(raise e))])
|
||||||
|
(let loop ([fetch-limit fetch-limit])
|
||||||
(if (zero? fetch-limit)
|
(if (zero? fetch-limit)
|
||||||
null
|
null
|
||||||
(let ([c (step fsym db stmt)])
|
(let ([c (step fsym db stmt)])
|
||||||
(cond [c
|
(cond [c
|
||||||
(cons c (step* fsym db stmt end-box (sub1 fetch-limit)))]
|
(cons c (loop (sub1 fetch-limit)))]
|
||||||
[else
|
[else
|
||||||
(HANDLE fsym (sqlite3_reset stmt))
|
(void (sqlite3_reset stmt))
|
||||||
(HANDLE fsym (sqlite3_clear_bindings stmt))
|
(void (sqlite3_clear_bindings stmt))
|
||||||
(when end-box (set-box! end-box #t))
|
(when end-box (set-box! end-box #t))
|
||||||
null]))))
|
null]))))))
|
||||||
|
|
||||||
(define/private (step fsym db stmt)
|
(define/private (step fsym db stmt)
|
||||||
(let ([s (HANDLE fsym (sqlite3_step stmt))])
|
(let ([s (HANDLE fsym (sqlite3_step stmt))])
|
||||||
|
|
Loading…
Reference in New Issue
Block a user