[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Problems with guile-sqlite3
From: |
Detlev Zundel |
Subject: |
Re: Problems with guile-sqlite3 |
Date: |
Thu, 31 Mar 2011 18:18:55 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) |
Hi Andy,
>> Indeed, there's no null-termination on this string. I guess we need to
>> copy into a bytevector that is longer and provide a NUL byte. Want to
>> patch that one too?
The attached patches work for me.
As a followup I'd really like to put a few statments into tests below
test/. Can anyone point me to what functions (i.e. assert,...) I should
use in such tests?
Thanks
Detlev
--
The proprietary-Unix players proved so ponderous, so blind, and so inept at
marketing that Microsoft was able to grab away a large part of their market
with the shockingly inferior technology of its Windows operating system.
-- "A Brief History of Hackerdom" by Eric Steven Raymond
>From bf3993bbb3800cc6b0e353e1b59928d78ddab125 Mon Sep 17 00:00:00 2001
From: Detlev Zundel <address@hidden>
Date: Thu, 31 Mar 2011 18:14:06 +0200
Subject: [PATCH 1/2] Export SQLITE_* constants.
Signed-off-by: Detlev Zundel <address@hidden>
---
sqlite3.scm | 19 ++++++++++++++++++-
1 files changed, 18 insertions(+), 1 deletions(-)
diff --git a/sqlite3.scm b/sqlite3.scm
index c326da4..711fd26 100644
--- a/sqlite3.scm
+++ b/sqlite3.scm
@@ -38,7 +38,24 @@
sqlite-fold
sqlite-map
sqlite-reset
- sqlite-finalize))
+ sqlite-finalize
+
+ SQLITE_OPEN_READONLY
+ SQLITE_OPEN_READWRITE
+ SQLITE_OPEN_CREATE
+ SQLITE_OPEN_DELETEONCLOSE
+ SQLITE_OPEN_EXCLUSIVE
+ SQLITE_OPEN_MAIN_DB
+ SQLITE_OPEN_TEMP_DB
+ SQLITE_OPEN_TRANSIENT_DB
+ SQLITE_OPEN_MAIN_JOURNAL
+ SQLITE_OPEN_TEMP_JOURNAL
+ SQLITE_OPEN_SUBJOURNAL
+ SQLITE_OPEN_MASTER_JOURNAL
+ SQLITE_OPEN_NOMUTEX
+ SQLITE_OPEN_FULLMUTEX
+ SQLITE_OPEN_SHAREDCACHE
+ SQLITE_OPEN_PRIVATECACHE))
;;
;; Utils
--
1.7.4.1
>From 565070537b435f4cc597d304b02dfff0aa7daaa4 Mon Sep 17 00:00:00 2001
From: Detlev Zundel <address@hidden>
Date: Thu, 31 Mar 2011 18:15:12 +0200
Subject: [PATCH 2/2] Correctly null terminate strings that we pass out.
Signed-off-by: Detlev Zundel <address@hidden>
---
sqlite3.scm | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/sqlite3.scm b/sqlite3.scm
index 711fd26..76ba4b5 100644
--- a/sqlite3.scm
+++ b/sqlite3.scm
@@ -61,7 +61,11 @@
;; Utils
;;
(define (string->utf8-pointer s)
- (bytevector->pointer (string->utf8 s)))
+ (let* ((len (string-length s))
+ (bv (make-bytevector (+ len 1))))
+ (bytevector-copy! (string->utf8 s) 0 bv 0 len)
+ (array-set! bv 0 len)
+ (bytevector->pointer bv)))
(define strlen
(pointer->procedure size_t
--
1.7.4.1