Hello community,

here is the log from the commit of package guile-sqlite3 for openSUSE:Factory 
checked in at 2020-07-27 17:44:39
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/guile-sqlite3 (Old)
 and      /work/SRC/openSUSE:Factory/.guile-sqlite3.new.3592 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "guile-sqlite3"

Mon Jul 27 17:44:39 2020 rev:6 rq:822881 version:0.1.2

Changes:
--------
--- /work/SRC/openSUSE:Factory/guile-sqlite3/guile-sqlite3.changes      
2020-01-14 21:13:58.562948076 +0100
+++ /work/SRC/openSUSE:Factory/.guile-sqlite3.new.3592/guile-sqlite3.changes    
2020-07-27 17:46:33.299346526 +0200
@@ -1,0 +2,9 @@
+Sun Jul 19 20:40:54 UTC 2020 - Jonathan Brielmaier <jbrielma...@opensuse.org>
+
+- Update to 0.1.2:
+  * Allow builds with Guile 3.0.
+  * Various smaller additions and bug fixes.
+- Remove patch:
+  * enable-guile-3.0.patch: included in release
+
+-------------------------------------------------------------------

Old:
----
  enable-guile-3.0.patch
  v0.1.0.tar.gz

New:
----
  v0.1.2.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ guile-sqlite3.spec ++++++
--- /var/tmp/diff_new_pack.D2ZJCO/_old  2020-07-27 17:46:50.107362306 +0200
+++ /var/tmp/diff_new_pack.D2ZJCO/_new  2020-07-27 17:46:50.107362306 +0200
@@ -17,15 +17,13 @@
 
 
 Name:           guile-sqlite3
-Version:        0.1.0
+Version:        0.1.2
 Release:        0
 Summary:        SQLite3 database access from Guile
 License:        GPL-3.0-or-later AND LGPL-3.0-or-later
 Group:          Development/Libraries/Other
 URL:            https://notabug.org/guile-sqlite3/guile-sqlite3
 Source0:        
https://notabug.org/guile-sqlite3/%{name}/archive/v%{version}.tar.gz
-# PATCH-FEATURE-UPSTREAM: enable-guile-3.0.patch -- 103fa4973b
-Patch0:         enable-guile-3.0.patch
 BuildRequires:  automake
 BuildRequires:  guile-devel >= 2.0.10
 BuildRequires:  pkg-config
@@ -39,7 +37,6 @@
 
 %prep
 %setup -q -n %{name}
-%patch0 -p1
 
 %build
 autoreconf -vfi

++++++ v0.1.0.tar.gz -> v0.1.2.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/guile-sqlite3/build-aux/guile.am 
new/guile-sqlite3/build-aux/guile.am
--- old/guile-sqlite3/build-aux/guile.am        2018-06-27 09:44:03.000000000 
+0200
+++ new/guile-sqlite3/build-aux/guile.am        2020-06-13 17:01:59.000000000 
+0200
@@ -16,4 +16,4 @@
 GUILE_WARNINGS = -Wunbound-variable -Warity-mismatch -Wformat
 SUFFIXES = .scm .go
 .scm.go:
-       $(AM_V_GEN)$(top_builddir)/env $(GUILE_TOOLS) compile $(GUILE_WARNINGS) 
-o "$@" "$<"
+       $(AM_V_GEN)$(top_builddir)/env $(GUILE_TOOLS) compile $(GUILE_TARGET) 
$(GUILE_WARNINGS) -o "$@" "$<"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/guile-sqlite3/configure.ac 
new/guile-sqlite3/configure.ac
--- old/guile-sqlite3/configure.ac      2018-06-27 09:44:03.000000000 +0200
+++ new/guile-sqlite3/configure.ac      2020-06-13 17:01:59.000000000 +0200
@@ -14,22 +14,27 @@
 m4_pattern_forbid([PKG_CHECK_MODULES])
 m4_pattern_forbid([GUILE_PKG])
 
-GUILE_PKG([2.2 2.0])
+GUILE_PKG([3.0 2.2 2.0])
 GUILE_PROGS
 
 PKG_CHECK_MODULES([SQLITE], [sqlite3])
 SQLITE_LIBDIR="`"$PKG_CONFIG" sqlite3 --variable libdir`"
 AC_SUBST([SQLITE_LIBDIR])
 
-AC_MSG_CHECKING([whether '$SQLITE_LIBDIR/libsqlite3' is usable])
-GUILE_CHECK([retval],
-  [(dynamic-func \"sqlite3_open_v2\"
+if test "$cross_compiling" = "no"; then
+   AC_MSG_CHECKING([whether '$SQLITE_LIBDIR/libsqlite3' is usable])
+   GUILE_CHECK([retval],
+   [(dynamic-func \"sqlite3_open_v2\"
                  (dynamic-link \"$SQLITE_LIBDIR/libsqlite3\"))])
-if test "$retval" != 0; then
-  AC_MSG_RESULT([no])
-  AC_MSG_ERROR([failed to load '$SQLITE_LIBDIR/libsqlite3'])
+   if test "$retval" != 0; then
+      AC_MSG_RESULT([no])
+      AC_MSG_ERROR([failed to load '$SQLITE_LIBDIR/libsqlite3'])
+   else
+      AC_MSG_RESULT([yes])
+   fi
 else
-  AC_MSG_RESULT([yes])
+   GUILE_TARGET="--target=$host_alias"
+   AC_SUBST([GUILE_TARGET])
 fi
 
 AC_CONFIG_FILES([Makefile sqlite3.scm])
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/guile-sqlite3/sqlite3.scm.in 
new/guile-sqlite3/sqlite3.scm.in
--- old/guile-sqlite3/sqlite3.scm.in    2018-06-27 09:44:03.000000000 +0200
+++ new/guile-sqlite3/sqlite3.scm.in    2020-06-13 17:01:59.000000000 +0200
@@ -67,6 +67,7 @@
             SQLITE_OPEN_FULLMUTEX
             SQLITE_OPEN_SHAREDCACHE
             SQLITE_OPEN_PRIVATECACHE
+            SQLITE_OPEN_URI
 
             SQLITE_CONSTRAINT
             SQLITE_CONSTRAINT_PRIMARYKEY
@@ -104,6 +105,7 @@
 (define SQLITE_OPEN_FULLMUTEX        #x00010000) ;; Ok for sqlite3_open_v2()
 (define SQLITE_OPEN_SHAREDCACHE      #x00020000) ;; Ok for sqlite3_open_v2()
 (define SQLITE_OPEN_PRIVATECACHE     #x00040000) ;; Ok for sqlite3_open_v2()
+(define SQLITE_OPEN_URI              #x00000040) ;; Ok for sqlite3_open_v2()
 
 (define SQLITE_CONSTRAINT 19)
 (define SQLITE_CONSTRAINT_PRIMARYKEY
@@ -208,7 +210,9 @@
             (dynamic-func "sqlite3_open_v2" libsqlite3)
             (list '* '* int '*))))
     (lambda* (filename #:optional
-                       (flags (logior SQLITE_OPEN_READWRITE 
SQLITE_OPEN_CREATE))
+                       (flags (logior SQLITE_OPEN_READWRITE 
+                                      SQLITE_OPEN_CREATE
+                                      SQLITE_OPEN_URI))
                        (vfs #f))
       (let* ((out-db (bytevector->pointer (make-bytevector (sizeof '*) 0)))
              (ret (f (string->utf8-pointer filename)
@@ -270,15 +274,40 @@
             (dynamic-func "sqlite3_finalize" libsqlite3)
             (list '*))))
     (lambda (stmt)
-      ;; Note: When STMT is cached, this is a no-op.  This ensures caching
-      ;; actually works while still separating concerns: users can turn
-      ;; caching on and off without having to change the rest of their code.
-      (when (and (stmt-live? stmt)
-                 (not (stmt-cached? stmt)))
-        (let ((p (stmt-pointer stmt)))
-          (sqlite-remove-statement! (stmt->db stmt) stmt)
-          (set-stmt-live?! stmt #f)
-          (f p))))))
+      ;; Note: When STMT is cached, this merely resets.  This ensures caching
+      ;; actually works while still separating concerns: users can turn caching
+      ;; on and off without having to change the rest of their code.
+      (when (stmt-live? stmt)
+        (if (stmt-cached? stmt)
+            ;; It's necessary to reset cached statements due to the following:
+            ;;
+            ;; "An implicit transaction (a transaction that is started
+            ;; automatically, not a transaction started by BEGIN) is committed
+            ;; automatically when the last active statement finishes.  A 
statement
+            ;; finishes when its last cursor closes, which is guaranteed to 
happen
+            ;; when the prepared statement is reset or finalized.  Some 
statements
+            ;; might "finish" for the purpose of transaction control prior to
+            ;; being reset or finalized, but there is no guarantee of this."
+            ;;
+            ;; (see https://www.sqlite.org/lang_transaction.html)
+            ;;
+            ;; Thus, it's possible for an implicitly-started transaction to 
hang
+            ;; around until sqlite-reset is called when the cached statement is
+            ;; next used.  Because the transaction is committed automatically 
only
+            ;; when the *last active statement* finishes, the 
implicitly-started
+            ;; transaction may later be upgraded to a write transaction (!) and
+            ;; this non-reset statement will still be keeping the transaction 
from
+            ;; committing until it is next used or the database connection is
+            ;; closed.  This has the potential to make (exclusive) write 
access to
+            ;; the database necessary for much longer than it should be.
+            ;;
+            ;; So it's necessary to preserve the statement-finishing behavior 
of
+            ;; sqlite_finalize here, which we do by calling sqlite-reset.
+            (sqlite-reset stmt)
+            (let ((p (stmt-pointer stmt)))
+              (sqlite-remove-statement! (stmt->db stmt) stmt)
+              (set-stmt-live?! stmt #f)
+              (f p)))))))
 
 (define *stmt-map* (make-weak-key-hash-table))
 (define (stmt->db stmt)
@@ -493,24 +522,26 @@
           (list '* int))))
     (lambda (stmt i)
       (assert-live-stmt! stmt)
-      (case (value-type (stmt-pointer stmt) i)
-        ((1) ; SQLITE_INTEGER
-         (value-int (stmt-pointer stmt) i))
-        ((2) ; SQLITE_FLOAT
-         (value-double (stmt-pointer stmt) i))
-        ((3) ; SQLITE3_TEXT
-         (let ((p (value-blob (stmt-pointer stmt) i)))
-           (if (null-pointer? p)
-               ""
-               (utf8->string
-                (pointer->bytevector p (value-bytes (stmt-pointer stmt) i))))))
-        ((4) ; SQLITE_BLOB
-         (let ((p (value-blob (stmt-pointer stmt) i)))
-           (if (null-pointer? p)
-               (make-bytevector 0)
-               (pointer->bytevector p (value-bytes (stmt-pointer stmt) i)))))
-        ((5) ; SQLITE_NULL
-         #f)))))
+      (let ((nbytes (value-bytes (stmt-pointer stmt) i)))
+       (case (value-type (stmt-pointer stmt) i)
+         ((1) ; SQLITE_INTEGER
+          (value-int (stmt-pointer stmt) i))
+         ((2) ; SQLITE_FLOAT
+          (value-double (stmt-pointer stmt) i))
+         ((3) ; SQLITE3_TEXT
+          (let ((p (value-blob (stmt-pointer stmt) i)))
+            (if (null-pointer? p)
+                ""
+                (utf8->string
+                 (pointer->bytevector p nbytes)))))
+         ((4) ; SQLITE_BLOB
+          (let ((p (value-blob (stmt-pointer stmt) i)))
+            (if (null-pointer? p)
+                (make-bytevector 0)
+                (bytevector-copy
+                 (pointer->bytevector p nbytes)))))
+         ((5) ; SQLITE_NULL
+          #f))))))
 
 (define (sqlite-column-names stmt)
   (let ((v (make-vector (sqlite-column-count stmt))))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/guile-sqlite3/tests/basic.scm 
new/guile-sqlite3/tests/basic.scm
--- old/guile-sqlite3/tests/basic.scm   2018-06-27 09:44:03.000000000 +0200
+++ new/guile-sqlite3/tests/basic.scm   2020-06-13 17:01:59.000000000 +0200
@@ -20,12 +20,15 @@
 (define-module (tests basic-test)
   #:use-module (srfi srfi-64)
   #:use-module (ice-9 format)
+  #:use-module (rnrs bytevectors)
   #:use-module (sqlite3))
 
 (define (sqlite-exec* db sql key value)
   (let ((stmt (sqlite-prepare db sql)))
     (sqlite-bind stmt key value)
-    (sqlite-map display stmt)))
+    (sqlite-map display stmt)
+    (sqlite-finalize stmt)
+    #t))
 
 ;; Cleanup database so we can check creation
 (define db-name "tests/simple.db")
@@ -73,6 +76,7 @@
   (let* ((stmt   (sqlite-prepare db "select * from project"))
          (result (sqlite-map identity stmt)))
     (sqlite-finalize stmt)
+    (sqlite-finalize stmt) ; no-op
     result))
 
 (test-assert "select with named parameters"
@@ -87,14 +91,37 @@
     (let ((stmt (sqlite-prepare db "INSERT INTO foos(name) VALUES(?)")))
       (sqlite-bind stmt 1 "myfoo")
       (sqlite-step stmt)
-      (sqlite-finalize stmt))))
+      (sqlite-finalize stmt)
+      #t)))
 
 (test-assert "drop"
   (sqlite-exec db "DROP TABLE IF EXISTS foos"))
 
-(test-assert "close"
-  (sqlite-close db))
+(define bv
+  (let* ((n 1023)
+        (v (make-bytevector n)))
+    (do ((i 0 (1+ i)))
+       ((>= i n))
+      (bytevector-u8-set! v i (random 256)))
+    v))
+
+(test-assert "insert blob"
+  (begin
+    (sqlite-exec db "CREATE TABLE cow (biggie blob)")
+    (let ((stmt (sqlite-prepare db "INSERT INTO cow (biggie) VALUES(?)")))
+      (sqlite-bind stmt 1 bv)
+      (sqlite-step stmt)
+      (sqlite-finalize stmt)
+      #t)))
+
+(test-assert "select blob"
+  (let* ((stmt (sqlite-prepare db "SELECT biggie from cow"))
+        (res (vector-ref (car (sqlite-map identity stmt)) 0)))
+;    (display res)(newline)
+;    (display bv)(newline)
+    (bytevector=? res bv)))
 
+(sqlite-close db)
 (delete-file db-name)
 
 (test-end "basic")


Reply via email to