odbc: use cleanup in odbc-query to prevent resource leaks on errors
parent
6c91db786a
commit
a38b9cff93
|
@ -1,8 +1,9 @@
|
||||||
! Copyright (C) 2007 Chris Double.
|
! Copyright (C) 2007 Chris Double.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: accessors alien alien.c-types alien.data alien.libraries
|
USING: accessors alien alien.c-types alien.data alien.libraries
|
||||||
alien.strings alien.syntax combinators io.encodings.ascii kernel
|
alien.strings alien.syntax combinators continuations
|
||||||
locals make math sequences strings threads ;
|
io.encodings.ascii kernel locals make math sequences strings
|
||||||
|
threads ;
|
||||||
FROM: alien.c-types => float short ;
|
FROM: alien.c-types => float short ;
|
||||||
IN: odbc
|
IN: odbc
|
||||||
|
|
||||||
|
@ -259,8 +260,10 @@ C: <field> field
|
||||||
|
|
||||||
: odbc-query ( string dsn -- result )
|
: odbc-query ( string dsn -- result )
|
||||||
odbc-init swap odbc-connect [
|
odbc-init swap odbc-connect [
|
||||||
swap odbc-prepare
|
[
|
||||||
dup odbc-execute
|
swap odbc-prepare
|
||||||
dup odbc-get-all-rows
|
dup odbc-execute
|
||||||
swap odbc-free-statement
|
dup odbc-get-all-rows
|
||||||
] keep odbc-disconnect ;
|
swap odbc-free-statement
|
||||||
|
] keep
|
||||||
|
] [ odbc-disconnect ] [ ] cleanup ;
|
||||||
|
|
Loading…
Reference in New Issue