From 97aae36202ca7ba0abec5cf0da95a56ac706805f Mon Sep 17 00:00:00 2001 From: Detlev Zundel Date: Mon, 4 Apr 2011 18:13:18 +0200 Subject: [PATCH 3/4] Fix interpretation of null pointers from the library --- sqlite3.scm | 10 +++++++--- 1 files changed, 7 insertions(+), 3 deletions(-) diff --git a/sqlite3.scm b/sqlite3.scm index 2492d15..9e48ff5 100644 --- a/sqlite3.scm +++ b/sqlite3.scm @@ -373,11 +373,15 @@ (value-double (stmt-pointer stmt) i)) ((3) ; SQLITE3_TEXT (let ((p (value-blob (stmt-pointer stmt) i))) - (utf8->string - (pointer->bytevector p (value-bytes (stmt-pointer stmt) i))))) + (if (eq? p %null-pointer) + "" + (utf8->string + (pointer->bytevector p (value-bytes (stmt-pointer stmt) i)))))) ((4) ; SQLITE_BLOB (let ((p (value-blob (stmt-pointer stmt) i))) - (pointer->bytevector p (value-bytes (stmt-pointer stmt) i)))) + (if (eq? p %null-pointer) + (make-bytevector 0) + (pointer->bytevector p (value-bytes (stmt-pointer stmt) i))))) ((5) ; SQLITE_NULL #f))))) -- 1.7.4.1