Package: ocaml-sqlite3 Severity: normal Tags: patch
This simple patch allows to enable/disable the load_extension functionality in sqlite3. :) p -- System Information: Debian Release: lenny/sid APT prefers unstable APT policy: (500, 'unstable') Architecture: amd64 (x86_64) Kernel: Linux 2.6.18-6-xen-amd64 (SMP w/2 CPU cores) Locale: LANG=en_GB, LC_CTYPE=en_GB (charmap=ANSI_X3.4-1968) (ignored: LC_ALL set to C) Shell: /bin/sh linked to /bin/bash
diff -r -u ocaml-sqlite3-1.2.0/sqlite3.ml ocaml-sqlite3-1.2.1/sqlite3.ml --- ocaml-sqlite3-1.2.0/sqlite3.ml 2008-05-12 04:40:40.000000000 +0200 +++ ocaml-sqlite3-1.2.1/sqlite3.ml 2008-11-10 16:39:21.000000000 +0100 @@ -135,6 +135,7 @@ external db_open : string -> db = "caml_sqlite3_open" external db_close : db -> bool = "caml_sqlite3_close" +external load_extension : db -> bool -> bool = "caml_sqlite3_enable_load_extension" external errcode : db -> Rc.t = "caml_sqlite3_errcode" external errmsg : db -> string = "caml_sqlite3_errmsg" diff -r -u ocaml-sqlite3-1.2.0/sqlite3.mli ocaml-sqlite3-1.2.1/sqlite3.mli --- ocaml-sqlite3-1.2.0/sqlite3.mli 2008-05-12 04:40:40.000000000 +0200 +++ ocaml-sqlite3-1.2.1/sqlite3.mli 2008-11-10 16:39:31.000000000 +0100 @@ -168,6 +168,12 @@ @raise SqliteError if an invalid database handle is passed. *) +external load_extension : db -> bool -> bool = "caml_sqlite3_enable_load_extension" +(** [db_load_extension db onoff] enable/disable the sqlite3 load extension. + @return [false] if the operation fails, [true] otherwise. + @param onoff enable / disable the extension. +*) + external errcode : db -> Rc.t = "caml_sqlite3_errcode" (** [errcode db] @return the error code of the last operation on database [db]. diff -r -u ocaml-sqlite3-1.2.0/sqlite3_stubs.c ocaml-sqlite3-1.2.1/sqlite3_stubs.c --- ocaml-sqlite3-1.2.0/sqlite3_stubs.c 2008-05-12 04:40:40.000000000 +0200 +++ ocaml-sqlite3-1.2.1/sqlite3_stubs.c 2008-11-10 17:04:44.000000000 +0100 @@ -344,6 +344,13 @@ return Val_bool(not_busy); } +CAMLprim value caml_sqlite3_enable_load_extension(value v_db, value v_onoff) +{ + int ret; + db_wrap *dbw = Sqlite3_val(v_db); + ret = sqlite3_enable_load_extension(dbw->db, Bool_val(v_onoff)); + return Val_bool(ret); +} /* Informational functions */