unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* guile-sqlite3 - patch
@ 2012-01-20 16:57 David Pirotte
  0 siblings, 0 replies; 3+ messages in thread
From: David Pirotte @ 2012-01-20 16:57 UTC (permalink / raw)
  To: guile-devel

[-- Attachment #1: Type: text/plain, Size: 97 bytes --]

Hello,

Attached is a patch which defines and export sqlite3_enable_load_extension

Cheers,
David

[-- Attachment #2: 0001-sqlite3_enable_load_extension-added.patch --]
[-- Type: text/x-patch, Size: 1147 bytes --]

From 866e578beaf1eb89b1bb80b9c6347f62e8ee5c60 Mon Sep 17 00:00:00 2001
From: David Pirotte <david@altosw.be>
Date: Fri, 20 Jan 2012 14:38:13 -0200
Subject: [PATCH] sqlite3_enable_load_extension, added

Extension loading while evaluating user-entered SQL is disabled per default.
This API can be used to turn the sqlite3_load_extension() mechanism on and off.
---
 sqlite3.scm |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/sqlite3.scm b/sqlite3.scm
index 2ac2f4b..f3c16ae 100644
--- a/sqlite3.scm
+++ b/sqlite3.scm
@@ -31,6 +31,7 @@
   #:export (sqlite-open
             sqlite-close
 
+	    sqlite-enable-load-extension
             sqlite-prepare
             sqlite-bind
             sqlite-column-names
@@ -180,6 +181,14 @@
               db)
             (sqlite-error #f 'sqlite-open ret (static-errcode->errmsg ret)))))))
 
+(define sqlite-enable-load-extension
+  (let ((ele (pointer->procedure
+	      int
+	      (dynamic-func "sqlite3_enable_load_extension" libsqlite3)
+	      (list '* int))))
+    (lambda (db onoff)
+      (ele (db-pointer db) onoff))))
+
 ;;;
 ;;; SQL statements
 ;;;
-- 
1.7.8.3


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* guile-sqlite3 - patch
@ 2012-01-20 18:11 David Pirotte
  2012-01-23 15:22 ` Andy Wingo
  0 siblings, 1 reply; 3+ messages in thread
From: David Pirotte @ 2012-01-20 18:11 UTC (permalink / raw)
  To: guile-devel

[-- Attachment #1: Type: text/plain, Size: 380 bytes --]

Hello,

Attached is a patch which changes the sqlite-open default optional flags argument
value.  If I am not misunderstanding the API doc and the intention behind the union
of both sqlite3_open and sqlite3_open_v2 into a single sqlite-open procedure with
optional arguments, then the default value should indeed be (logior
SQLITE_OPEN_READWRITE SQLITE_OPEN_CREATE)

Cheers,
David

[-- Attachment #2: 0002-sqlite-open-reviewed.patch --]
[-- Type: text/x-patch, Size: 1103 bytes --]

From a6cd637757a3923d228d07e8a986ac097d4e2bb3 Mon Sep 17 00:00:00 2001
From: David Pirotte <david@altosw.be>
Date: Fri, 20 Jan 2012 16:03:01 -0200
Subject: [PATCH 2/2] sqlite-open, reviewed

This patch modifies the default optional flags value from 0 to
SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE.  The API documentation says:
"... This is the behavior that is always used for sqlite3_open() ... The
sqlite3_open_v2() interface works like sqlite3_open() ..."
---
 sqlite3.scm |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/sqlite3.scm b/sqlite3.scm
index f3c16ae..726b3ca 100644
--- a/sqlite3.scm
+++ b/sqlite3.scm
@@ -169,7 +169,7 @@
             int
             (dynamic-func "sqlite3_open_v2" libsqlite3)
             (list '* '* int '*))))
-    (lambda* (filename #:optional (flags 0) (vfs #f))
+    (lambda* (filename #:optional (flags (logior SQLITE_OPEN_READWRITE SQLITE_OPEN_CREATE)) (vfs #f))
       (let* ((out-db (bytevector->pointer (make-bytevector (sizeof '*) 0)))
              (ret (f (string->utf8-pointer filename)
                      out-db
-- 
1.7.8.3


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: guile-sqlite3 - patch
  2012-01-20 18:11 guile-sqlite3 - patch David Pirotte
@ 2012-01-23 15:22 ` Andy Wingo
  0 siblings, 0 replies; 3+ messages in thread
From: Andy Wingo @ 2012-01-23 15:22 UTC (permalink / raw)
  To: David Pirotte; +Cc: guile-devel

Pushed both of these patches; thanks!

Andy
-- 
http://wingolog.org/



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-01-23 15:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-20 18:11 guile-sqlite3 - patch David Pirotte
2012-01-23 15:22 ` Andy Wingo
  -- strict thread matches above, loose matches on Subject: below --
2012-01-20 16:57 David Pirotte

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).