* sqlite3 bindings
@ 2006-07-14 23:46 Mike Lin
2006-07-15 2:05 ` [Caml-list] " Ted Kremenek
2006-07-15 2:19 ` Toby Allsopp
0 siblings, 2 replies; 4+ messages in thread
From: Mike Lin @ 2006-07-14 23:46 UTC (permalink / raw)
To: caml-list
[-- Attachment #1: Type: text/plain, Size: 118 bytes --]
Hi, does anyone know how (if) the available ocaml sqlite bindings work with
recent versions of sqlite (namely 3.x.x)?
[-- Attachment #2: Type: text/html, Size: 129 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Caml-list] sqlite3 bindings
2006-07-14 23:46 sqlite3 bindings Mike Lin
@ 2006-07-15 2:05 ` Ted Kremenek
2006-07-15 2:19 ` Toby Allsopp
1 sibling, 0 replies; 4+ messages in thread
From: Ted Kremenek @ 2006-07-15 2:05 UTC (permalink / raw)
To: Mike Lin; +Cc: caml-list
Hi Mike,
i think there are more than one available SQLite bindings for OCaml,
including some that are just for versions of SQLite before the API
was changed in version 3 and others engineered directly for SQLite3.
I am using Bárður Árantsson's bindings that are available at:
http://www.imada.sdu.dk/~bardur/personal/45-programs/
These particular OCaml bindings in many ways directly mirror the
SQLite3 C API; they are not a DBI-like interfaces, but work well if
you are familiar with SQLite3.
I have modified the bindings slightly for my own needs by adding a
few methods and fixing a few bugs (any fixes of which I plan to
eventually contribute back to Bárður), but it works very well with
the latest version of SQLite3. I am using it just fine with version
3.3.6 of SQLite. I have successfully used it to create database
files of several gigabytes (populated with marshaled OCaml objects
using Sqlite3's blob type).
Ted
On Jul 14, 2006, at 4:46 PM, Mike Lin wrote:
> Hi, does anyone know how (if) the available ocaml sqlite bindings
> work with recent versions of sqlite (namely 3.x.x)?
> _______________________________________________
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: sqlite3 bindings
2006-07-14 23:46 sqlite3 bindings Mike Lin
2006-07-15 2:05 ` [Caml-list] " Ted Kremenek
@ 2006-07-15 2:19 ` Toby Allsopp
2006-07-20 8:45 ` Toby Allsopp
1 sibling, 1 reply; 4+ messages in thread
From: Toby Allsopp @ 2006-07-15 2:19 UTC (permalink / raw)
To: caml-list
"Mike Lin" <mikelin@mit.edu> 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.
Toby.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: sqlite3 bindings
2006-07-15 2:19 ` Toby Allsopp
@ 2006-07-20 8:45 ` Toby Allsopp
0 siblings, 0 replies; 4+ messages in thread
From: Toby Allsopp @ 2006-07-20 8:45 UTC (permalink / raw)
To: caml-list; +Cc: Mike Lin
[-- Attachment #1: Type: text/plain, Size: 484 bytes --]
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.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: ocaml-sqlite3.patch --]
[-- Type: text/x-patch, Size: 1169 bytes --]
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:
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2006-07-20 9:08 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-07-14 23:46 sqlite3 bindings Mike Lin
2006-07-15 2:05 ` [Caml-list] " Ted Kremenek
2006-07-15 2:19 ` Toby Allsopp
2006-07-20 8:45 ` Toby Allsopp
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox