From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id 0E241BB83 for ; Thu, 20 Jul 2006 11:08:54 +0200 (CEST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by nez-perce.inria.fr (8.13.6/8.13.6) with ESMTP id k6K98p6n005253 for ; Thu, 20 Jul 2006 11:08:51 +0200 Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id LAA32043 for ; Thu, 20 Jul 2006 11:08:51 +0200 (MET DST) Received: from ciao.gmane.org (main.gmane.org [80.91.229.2]) by nez-perce.inria.fr (8.13.6/8.13.6) with ESMTP id k6K98oUp005240 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NO) for ; Thu, 20 Jul 2006 11:08:51 +0200 Received: from list by ciao.gmane.org with local (Exim 4.43) id 1G3UWI-0002oJ-Cs for caml-list@inria.fr; Thu, 20 Jul 2006 11:08:34 +0200 Received: from 60-234-130-144.bitstream.orcon.net.nz ([60.234.130.144]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 20 Jul 2006 11:08:34 +0200 Received: from toby by 60-234-130-144.bitstream.orcon.net.nz with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 20 Jul 2006 11:08:34 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: caml-list@inria.fr From: Toby Allsopp Subject: Re: sqlite3 bindings Date: Thu, 20 Jul 2006 20:45:34 +1200 Message-ID: <87lkqowtox.fsf@candyboy.here> References: <2a1a1a0c0607141646r52dee721uf9c2350fb20a812c@mail.gmail.com> <87psg29d0r.fsf@candyboy.here> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Complaints-To: usenet@sea.gmane.org Cc: "Mike Lin" X-Gmane-NNTP-Posting-Host: 60-234-130-144.bitstream.orcon.net.nz User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) Cancel-Lock: sha1:M/fK6U4FQ7CC7vzXeYjFpWxeUGk= Sender: news X-j-chkmail-Score: MSGID : 44BF4823.000 on nez-perce : j-chkmail score : X : 0/20 1 X-j-chkmail-Score: MSGID : 44BF4822.000 on nez-perce : j-chkmail score : X : 0/20 1 X-Miltered: at nez-perce with ID 44BF4823.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at nez-perce with ID 44BF4822.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; bindings:01 ocaml:01 bindings:01 ocaml:01 bug:01 writes:01 minor:01 namely:02 patch:08 patch:08 causes:08 although:08 recall:10 versions:10 i've:12 X-Attachments: type="text/x-patch" name="ocaml-sqlite3.patch" X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.3 --=-=-= Toby Allsopp writes: > Mike Lin writes: > >> Hi, does anyone know how (if) the available ocaml sqlite bindings work with >> recent versions of sqlite (namely 3.x.x)? > > http://metamatix.org/~ocaml/ocaml_sqlite3.html > > I've used this and it works fine, although there is a minor bug that > causes seg faults in certain situations that I can't currently > recall. I have a patch that I will send next week from work. Here's the patch that I've been using to great effect. Toby. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=ocaml-sqlite3.patch Index: sqlite3_stubs.c =================================================================== --- sqlite3_stubs.c (.../ocaml-sqlite3-0.2.0) (revision 2276) +++ sqlite3_stubs.c (.../T-mtc-120_06) (revision 2276) @@ -517,8 +517,8 @@ const char *str = sqlite3_bind_parameter_name(stmt,i); if( str ) { + tmp = copy_string(str); /* tmp is needed to make GC happy! */ result = alloc_small(1,0); - tmp = copy_string(str); /* tmp is needed to make GC happy! */ Field(result,0) = tmp; CAMLreturn(result); } else { @@ -745,13 +745,13 @@ switch(sqlite3_column_type(stmt,i)) { /* WARNING : we need the tmp variable to make GC happy! */ case SQLITE_INTEGER: + tmp = copy_int64(sqlite3_column_int64(stmt,i)); result = alloc_small(1,0); - tmp = copy_int64(sqlite3_column_int64(stmt,i)); Field(result,0)=tmp; break; case SQLITE_FLOAT: + tmp = copy_double(sqlite3_column_double(stmt,i)); result = alloc_small(1,1); - tmp = copy_double(sqlite3_column_double(stmt,i)); Field(result,0)=tmp; break; case SQLITE3_TEXT: --=-=-=--