[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: |
Fri, 01 Apr 2011 16:33:02 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) |
Hi Andy,
> On Thu 31 Mar 2011 18:18, Detlev Zundel <address@hidden> writes:
>
>> 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.
>
> Thanks. Please detabify the first one.
Sure, no problem.
> Can you resubmit the second one also using the string->pointer
> encoding argument that I just pushed to Guile? Thanks :-)
Ah, that makes the code a lot easier ;)
>> 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?
>
> Sigh, it's a good question. Guile has "(test-suite lib)" internally,
> which is quite nice, but not public. Externally there are many things
> but none as nice.
>
> I guess I would say to just add some test scripts using the normal
> automake mechanism, and make them (exit 1) if there is an error. You
> won't get a nice summary but it's better than nothing.
Ok, I needed to read up on the "normal automake mechanism", but I think
I understand. The third patch prepares for real test cases ;)
Thanks
Detlev
--
1. What is the best thing about Unix?
A: The community.
2. What is the worst thing about Unix?
A: That there are so many communities. (Rob Pike)
>From 5eef5b889a1e00b05a424fa27618b76a66a576fe Mon Sep 17 00:00:00 2001
From: Detlev Zundel <address@hidden>
Date: Thu, 31 Mar 2011 18:14:06 +0200
Subject: [PATCH 1/3] 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..8a1e6f1 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 2be1beddc9d52664482d9d3e7f57e0a976baf5de Mon Sep 17 00:00:00 2001
From: Detlev Zundel <address@hidden>
Date: Thu, 31 Mar 2011 18:15:12 +0200
Subject: [PATCH 2/3] Fix and simplify foreign string conversions
Use the versions of string->pointer and pointer->string that accept an
encoding parameter.
The previous version of string->utf8-pointer missed the null termination
of the string.
Signed-off-by: Detlev Zundel <address@hidden>
---
sqlite3.scm | 9 ++-------
1 files changed, 2 insertions(+), 7 deletions(-)
diff --git a/sqlite3.scm b/sqlite3.scm
index 8a1e6f1..3369e02 100644
--- a/sqlite3.scm
+++ b/sqlite3.scm
@@ -61,15 +61,10 @@
;; Utils
;;
(define (string->utf8-pointer s)
- (bytevector->pointer (string->utf8 s)))
-
-(define strlen
- (pointer->procedure size_t
- (dynamic-pointer "strlen" (dynamic-link))
- '(*)))
+ (string->pointer s "utf-8"))
(define (utf8-pointer->string p)
- (utf8->string (pointer->bytevector p (strlen p))))
+ (pointer->string p -1 "utf-8"))
;;
--
1.7.4.1
>From 00c4543c9844ac584929a16e4d2d44b577b6dea1 Mon Sep 17 00:00:00 2001
From: Detlev Zundel <address@hidden>
Date: Fri, 1 Apr 2011 16:30:44 +0200
Subject: [PATCH 3/3] Fix command line parameter for test execution
Signed-off-by: Detlev Zundel <address@hidden>
---
Makefile.am | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index 509d1be..ae9a6a6 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -24,6 +24,6 @@ SUFFIXES = .scm .go
TESTS = \
tests/basic.test
-TESTS_ENVIRONMENT = $(abs_top_builddir)/env $(GUILE) --no-autocompile
+TESTS_ENVIRONMENT = $(abs_top_builddir)/env $(GUILE) --no-auto-compile
EXTRA_DIST = $(SOURCES) $(NOCOMP_SOURCES) $(TESTS)
--
1.7.4.1
Re: Problems with guile-sqlite3, Andy Wingo, 2011/04/01
- Re: Problems with guile-sqlite3,
Detlev Zundel <=