From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Detlev Zundel Newsgroups: gmane.lisp.guile.devel Subject: Re: Problems with guile-sqlite3 Date: Thu, 31 Mar 2011 16:03:13 +0200 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1301580227 23416 80.91.229.12 (31 Mar 2011 14:03:47 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 31 Mar 2011 14:03:47 +0000 (UTC) Cc: guile-devel@gnu.org To: Andy Wingo Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Thu Mar 31 16:03:42 2011 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Q5ITO-0001HZ-FP for guile-devel@m.gmane.org; Thu, 31 Mar 2011 16:03:42 +0200 Original-Received: from localhost ([127.0.0.1]:55057 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q5ITN-00028L-KN for guile-devel@m.gmane.org; Thu, 31 Mar 2011 10:03:41 -0400 Original-Received: from [140.186.70.92] (port=54908 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q5IT6-00025h-OZ for guile-devel@gnu.org; Thu, 31 Mar 2011 10:03:29 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q5IT1-00059v-2U for guile-devel@gnu.org; Thu, 31 Mar 2011 10:03:24 -0400 Original-Received: from mail-out.m-online.net ([212.18.0.9]:34294) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q5IT0-00058g-QN for guile-devel@gnu.org; Thu, 31 Mar 2011 10:03:19 -0400 Original-Received: from frontend1.mail.m-online.net (unknown [192.168.8.180]) by mail-out.m-online.net (Postfix) with ESMTP id 2EC711C08E0C; Thu, 31 Mar 2011 16:03:14 +0200 (CEST) X-Auth-Info: stoTJR99fRV2b7A9BLY9owmg2IVaDzfLiesA49F6jR8= Original-Received: from mail.denx.de (host-82-135-33-74.customer.m-online.net [82.135.33.74]) by smtp-auth.mnet-online.de (Postfix) with ESMTPA id 0E63B1C0011B; Thu, 31 Mar 2011 16:03:14 +0200 (CEST) Original-Received: from ohwell.denx.de (ohwell [10.0.40.4]) by mail.denx.de (Postfix) with ESMTP id E0BCB4BC1522; Thu, 31 Mar 2011 16:03:13 +0200 (CEST) Original-Received: from dzu by ohwell.denx.de with local (Exim 4.72) (envelope-from ) id 1Q5ISv-0000Ui-OY; Thu, 31 Mar 2011 16:03:13 +0200 In-Reply-To: (Andy Wingo's message of "Thu, 31 Mar 2011 12:25:18 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Received-From: 212.18.0.9 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:12115 Archived-At: Hi Andy, > On Thu 31 Mar 2011 00:52, Detlev Zundel writes: > >> | scheme@(guile-user)> (sqlite-open "mydb" SQLITE_OPEN_READONLY) >> | ;;; :2:0: warning: possibly unbound variable `SQLITE_OPEN_READONLY' >> | :1:0: In procedure #:2:0 ()>: >> | :1:0: In procedure module-lookup: Unbound variable: SQLITE_OPEN_READONLY >> `---- >> >> Hm ok, so the constants seem not to be exported, right? > > Hah, it appears not. Want to fix it? Fork the project on github and > send me a merge request :) Ok, I'll see what I can do without asking for more help. >> ,---- >> | scheme@(guile-user)> (define db (sqlite-open "mydb" 1)) >> | :0:0: In procedure #:1:0 ()>: >> | :0:0: Throw to key `sqlite-error' with args >> | (sqlite-open 14 "Unable to open the database file")'. >> `---- >> >> But that is strange, I'm sure I have this file. So lets do an "strace >> -e open guile" and see what guile accesses: >> >> ,---- >> | .... >> | open("/usr/local/lib/guile/2.0/ccache/language/bytecode/spec.go", O_RDONLY) = 91 >> | open("/opt/src/git/guile-sqlite3/tests/mydb\315\201", >> | O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory) >> | :0:0: In procedure #:1:0 ()>: >> | :0:0: Throw to key `sqlite-error' with args >> | (sqlite-open 14 "Unable to open the database file")'. >> `---- >> >> Huh, what are those characters after "mydb"? Funnily enough, if I use >> filenames longer than 4 characters it works. Can someone hit me with a >> clue-stick please? > > Interesting. It seems that the string->pointer code is doing the wrong thing: > > (define (string->utf8-pointer s) > (bytevector->pointer (string->utf8 s))) > > 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? Ok, I will at least try ;) Thanks Detlev -- Modern methods of production have given us the possibility of ease and security for all; we have chosen, instead, to have overwork for some and starvation for others. -- Bertrand Russell