fix postgresql for new alien accessors

db4
Doug Coleman 2008-04-21 00:13:12 -05:00
parent b256e2f709
commit 4da64986f3
1 changed files with 4 additions and 4 deletions

View File

@ -4,8 +4,8 @@ USING: arrays continuations db io kernel math namespaces
quotations sequences db.postgresql.ffi alien alien.c-types quotations sequences db.postgresql.ffi alien alien.c-types
db.types tools.walker ascii splitting math.parser combinators db.types tools.walker ascii splitting math.parser combinators
libc shuffle calendar.format byte-arrays destructors prettyprint libc shuffle calendar.format byte-arrays destructors prettyprint
accessors strings serialize io.encodings.binary accessors strings serialize io.encodings.binary io.encodings.utf8
io.streams.byte-array inspector ; alien.strings io.streams.byte-array inspector ;
IN: db.postgresql.lib IN: db.postgresql.lib
: postgresql-result-error-message ( res -- str/f ) : postgresql-result-error-message ( res -- str/f )
@ -79,7 +79,7 @@ M: postgresql-result-null summary ( obj -- str )
{ BLOB [ dup [ malloc-byte-array/length ] [ 0 ] if ] } { BLOB [ dup [ malloc-byte-array/length ] [ 0 ] if ] }
[ [
drop number>string* dup [ drop number>string* dup [
malloc-char-string dup free-always utf8 malloc-string dup free-always
] when 0 ] when 0
] ]
} case 2array } case 2array
@ -111,7 +111,7 @@ M: postgresql-result-null summary ( obj -- str )
PQgetisnull 1 = ; PQgetisnull 1 = ;
: pq-get-string ( handle row column -- obj ) : pq-get-string ( handle row column -- obj )
3dup PQgetvalue alien>char-string 3dup PQgetvalue utf8 alien>string
dup empty? [ >r pq-get-is-null f r> ? ] [ 3nip ] if ; dup empty? [ >r pq-get-is-null f r> ? ] [ 3nip ] if ;
: pq-get-number ( handle row column -- obj ) : pq-get-number ( handle row column -- obj )