Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package lua-luadbi for openSUSE:Factory 
checked in at 2025-07-27 16:26:28
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/lua-luadbi (Old)
 and      /work/SRC/openSUSE:Factory/.lua-luadbi.new.13279 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "lua-luadbi"

Sun Jul 27 16:26:28 2025 rev:9 rq:1295835 version:0.7.4

Changes:
--------
--- /work/SRC/openSUSE:Factory/lua-luadbi/lua-luadbi.changes    2024-10-07 
21:49:33.803590427 +0200
+++ /work/SRC/openSUSE:Factory/.lua-luadbi.new.13279/lua-luadbi.changes 
2025-07-27 16:26:33.522469641 +0200
@@ -1,0 +2,10 @@
+Fri Jul 25 19:54:10 UTC 2025 - Matej Cepl <mc...@cepl.eu>
+
+- Upgrade to 0.7.4:
+  - Add missing braces around initializer
+  - Unbreak building against MariaDB 5.5
+  - Avoid incompatible pointer type error on x86 (32 bit)
+  - New driver for DuckDB. Largely untested and should be
+    considered expiremental at this time.
+
+-------------------------------------------------------------------

Old:
----
  luadbi-0.7.3.tar.gz

New:
----
  _scmsync.obsinfo
  build.specials.obscpio
  luadbi-0.7.4.tar.gz

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

Other differences:
------------------
++++++ lua-luadbi.spec ++++++
--- /var/tmp/diff_new_pack.B09FiZ/_old  2025-07-27 16:26:35.502551363 +0200
+++ /var/tmp/diff_new_pack.B09FiZ/_new  2025-07-27 16:26:35.510551693 +0200
@@ -18,7 +18,7 @@
 
 %define flavor @BUILD_FLAVOR@
 %define mod_name luadbi
-Version:        0.7.3
+Version:        0.7.4
 Release:        0
 Summary:        A database interface library for Lua
 License:        MIT
@@ -57,17 +57,18 @@
 %prep
 %autosetup -p1 -n luadbi-%{version}
 
-sed -i \
-    -e 's:-g -pedantic -Wall -O2:%{optflags} -fPIC -I%{lua_incdir}:g' \
-    Makefile
-
 %build
-%make_build LIBDIR=%{_libdir}
+# We have to list targets specifically, because openSUSE still
+# doesn’t have support for DuckDB
+%make_build LIBDIR=%{_libdir} LUA_INC="-I%{lua_incdir}" \
+    COMMON_CFLAGS="%{optflags} -fPIC" \
+    mysql psql sqlite3
 
 %install
 install -d %{buildroot}%{lua_archdir}
 install -d %{buildroot}%{lua_noarchdir}
-make install_free DESTDIR=%{buildroot} LUA_LDIR=%{lua_noarchdir} 
LUA_CDIR=%{lua_archdir}
+make install_lua install_mysql install_psql install_sqlite3 \
+    DESTDIR=%{buildroot} LUA_LDIR=%{lua_noarchdir} LUA_CDIR=%{lua_archdir}
 
 %check
 # run tests

++++++ _scmsync.obsinfo ++++++
mtime: 1753474170
commit: f5e8f92060de4cefe7255a88beeece8171b996dd6777eb0998cda0890c896c51
url: https://src.opensuse.org/lua/lua-luadbi.git
revision: f5e8f92060de4cefe7255a88beeece8171b996dd6777eb0998cda0890c896c51
projectscmsync: https://src.opensuse.org/lua/_ObsPrj.git

++++++ luadbi-0.7.3.tar.gz -> luadbi-0.7.4.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/luadbi-0.7.3/DBI.lua new/luadbi-0.7.4/DBI.lua
--- old/luadbi-0.7.3/DBI.lua    2024-03-04 23:01:25.000000000 +0100
+++ new/luadbi-0.7.4/DBI.lua    2024-10-03 18:37:41.000000000 +0200
@@ -9,7 +9,8 @@
     SQLite3 = 'dbd.sqlite3',
     DB2 = 'dbd.db2',
     Oracle = 'dbd.oracle',
-    ODBC = 'dbd.odbc'
+    ODBC = 'dbd.odbc',
+    DuckDB = 'dbd.duckdb'
 }
 
 local string = require('string')
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/luadbi-0.7.3/Makefile new/luadbi-0.7.4/Makefile
--- old/luadbi-0.7.3/Makefile   2024-03-04 23:01:25.000000000 +0100
+++ new/luadbi-0.7.4/Makefile   2024-10-03 18:37:41.000000000 +0200
@@ -6,15 +6,16 @@
 INSTALL                ?= install
 INSTALL_PROGRAM        ?= $(INSTALL)
 INSTALL_DATA   ?= $(INSTALL) -m 644
-LUA_V          ?= 5.1
+LUA_V          ?= 5.4
 LUA_LDIR       ?= /usr/share/lua/$(LUA_V)
 LUA_CDIR       ?= /usr/lib/lua/$(LUA_V)
 
-COMMON_CFLAGS   ?= -g -pedantic -Wall -O2 -shared -fPIC -DPIC -std=c99
+COMMON_CFLAGS  ?= -g -pedantic -Wall -O2 -shared -fPIC -DPIC -std=c99
 LUA_INC                ?= -I/usr/include/lua$(LUA_V)
 MYSQL_INC      ?= -I/usr/include/mysql
 PSQL_INC       ?= -I/usr/include/postgresql
 SQLITE3_INC    ?= -I/usr/include
+DUCKDB_INC     ?= -I/usr/include
 DB2_INC                ?= -I/opt/ibm/db2exc/V9.5/include
 ORACLE_INC     ?= 
-I/usr/lib/oracle/xe/app/oracle/product/10.2.0/client/rdbms/public
 CF              = $(LUA_INC) $(COMMON_CFLAGS) $(CFLAGS) -I.
@@ -23,6 +24,7 @@
 MYSQL_LDFLAGS  ?= -lmysqlclient
 PSQL_LDFLAGS   ?= -lpq
 SQLITE3_LDFLAGS        ?= -lsqlite3
+DUCKDB_LDFLAGS ?= -lduckdb
 DB2_LDFLAGS    ?= -L/opt/ibm/db2exc/V9.5/lib64 -L/opt/ibm/db2exc/V9.5/lib32 
-ldb2
 ORACLE_LDFLAGS ?= -L/usr/lib/oracle/xe/app/oracle/product/10.2.0/client/lib/ 
-locixe
 LF              = $(COMMON_LDFLAGS) $(LDFLAGS)
@@ -30,6 +32,7 @@
 MYSQL_FLAGS     = $(CF) $(LF) $(MYSQL_INC) $(MYSQL_LDFLAGS)
 PSQL_FLAGS      = $(CF) $(LF) $(PSQL_INC) $(PSQL_LDFLAGS)
 SQLITE3_FLAGS   = $(CF) $(LF) $(SQLITE3_INC) $(SQLITE3_LDFLAGS)
+DUCKDB_FLAGS   = $(CF) $(LF) $(DUCKDB_INC) $(DUCKDB_LDFLAGS)
 DB2_FLAGS       = $(CF) $(LF) $(DB2_INC) $(DB2_LDFLAGS)
 ORACLE_FLAGS    = $(CF) $(LF) $(ORACLE_INC) $(ORACLE_LDFLAGS) 
-DORA_ENABLE_PING -DORA_ENABLE_TAF
 
@@ -39,6 +42,7 @@
 DBDMYSQL        = dbd/mysql.so
 DBDPSQL                 = dbd/postgresql.so
 DBDSQLITE3      = dbd/sqlite3.so
+DBDDUCKDB       = dbd/duckdb.so
 DBDDB2          = dbd/db2.so
 DBDORACLE       = dbd/oracle.so
 
@@ -46,12 +50,13 @@
 MYSQL_OBJS      = $(OBJS) build/dbd_mysql_main.o build/dbd_mysql_connection.o 
build/dbd_mysql_statement.o
 PSQL_OBJS       = $(OBJS) build/dbd_postgresql_main.o 
build/dbd_postgresql_connection.o build/dbd_postgresql_statement.o
 SQLITE3_OBJS    = $(OBJS) build/dbd_sqlite3_main.o 
build/dbd_sqlite3_connection.o build/dbd_sqlite3_statement.o
+DUCKDB_OBJS     = $(OBJS) build/dbd_duckdb_main.o 
build/dbd_duckdb_connection.o build/dbd_duckdb_statement.o
 DB2_OBJS        = $(OBJS) build/dbd_db2_main.o build/dbd_db2_connection.o 
build/dbd_db2_statement.o
 ORACLE_OBJS     = $(OBJS) build/dbd_oracle_main.o 
build/dbd_oracle_connection.o build/dbd_oracle_statement.o
  
-free: mysql psql sqlite3
+free: mysql psql sqlite3 duckdb
 
-all:  mysql psql sqlite3 db2 oracle
+all:  mysql psql sqlite3 duckdb db2 oracle
 
 mysql: $(BUILDDIR) $(MYSQL_OBJS)
        $(CC) $(MYSQL_OBJS) -o $(DBDMYSQL) $(MYSQL_FLAGS)
@@ -62,6 +67,9 @@
 sqlite3: $(BUILDDIR) $(SQLITE3_OBJS)
        $(CC) $(SQLITE3_OBJS) -o $(DBDSQLITE3) $(SQLITE3_FLAGS)
 
+duckdb: $(BUILDDIR) $(DUCKDB_OBJS)
+       $(CC) $(DUCKDB_OBJS) -o $(DBDDUCKDB) $(DUCKDB_FLAGS)
+
 db2: $(BUILDDIR) $(DB2_OBJS)
        $(CC) $(DB2_OBJS) -o $(DBDDB2) $(DB2_FLAGS)
 
@@ -69,7 +77,7 @@
        $(CC) $(ORACLE_OBJS) -o $(DBDORACLE) $(ORACLE_FLAGS)
 
 clean:
-       $(RM) $(MYSQL_OBJS) $(PSQL_OBJS) $(SQLITE3_OBJS) $(DB2_OBJS) 
$(ORACLE_OBJS) $(DBDMYSQL) $(DBDPSQL) $(DBDSQLITE3) $(DBDDB2) $(DBDORACLE)
+       $(RM) $(MYSQL_OBJS) $(PSQL_OBJS) $(SQLITE3_OBJS) $(DB2_OBJS) 
$(ORACLE_OBJS) $(DBDMYSQL) $(DBDPSQL) $(DBDSQLITE3) $(DBDDB2) $(DBDORACLE) 
$(DUCKDB_OBJS)
 
 build/dbd_common.o: dbd/common.c dbd/common.h
        $(CC) -c -o $@ $< $(CF)
@@ -95,6 +103,13 @@
 build/dbd_sqlite3_statement.o: dbd/sqlite3/statement.c 
dbd/sqlite3/dbd_sqlite3.h dbd/common.h
        $(CC) -c -o $@ $< $(SQLITE3_FLAGS)
 
+build/dbd_duckdb_connection.o: dbd/duckdb/connection.c dbd/duckdb/dbd_duckdb.h 
dbd/common.h 
+       $(CC) -c -o $@ $< $(DUCKDB_FLAGS)
+build/dbd_duckdb_main.o: dbd/duckdb/main.c dbd/duckdb/dbd_duckdb.h dbd/common.h
+       $(CC) -c -o $@ $< $(DUCKDB_FLAGS)
+build/dbd_duckdb_statement.o: dbd/duckdb/statement.c dbd/duckdb/dbd_duckdb.h 
dbd/common.h
+       $(CC) -c -o $@ $< $(DUCKDB_FLAGS)
+       
 build/dbd_db2_connection.o: dbd/db2/connection.c dbd/db2/dbd_db2.h 
dbd/common.h 
        $(CC) -c -o $@ $< $(DB2_FLAGS)
 build/dbd_db2_main.o: dbd/db2/main.c dbd/db2/dbd_db2.h dbd/common.h
@@ -124,12 +139,15 @@
 install_sqlite3: sqlite3 install_lua
        $(INSTALL_PROGRAM) -D $(DBDSQLITE3) $(DESTDIR)$(LUA_CDIR)/$(DBDSQLITE3)
 
+install_duckdb: duckdb install_lua
+       $(INSTALL_PROGRAM) -D $(DBDDUCKDB) $(DESTDIR)$(LUA_CDIR)/$DBDDUCKDB)
+
 install_db2: db2 install_lua
        $(INSTALL_PROGRAM) -D $(DBDDB2) $(DESTDIR)$(LUA_CDIR)/$(DBDDB2)
 
 install_oracle: oracle install_lua
        $(INSTALL_PROGRAM) -D $(DBDORACLE) $(DESTDIR)$(LUA_CDIR)/$(DBDORACLE)
 
-install_free: install_lua install_mysql install_psql install_sqlite3
+install_free: install_lua install_mysql install_psql install_sqlite3 
install_duckdb
 
-install_all: install_lua install_mysql install_psql install_sqlite3 
install_db2 install_oracle
+install_all: install_lua install_mysql install_psql install_sqlite3 
install_duckdb install_db2 install_oracle
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/luadbi-0.7.3/dbd/duckdb/connection.c 
new/luadbi-0.7.4/dbd/duckdb/connection.c
--- old/luadbi-0.7.3/dbd/duckdb/connection.c    1970-01-01 01:00:00.000000000 
+0100
+++ new/luadbi-0.7.4/dbd/duckdb/connection.c    2024-10-03 18:37:41.000000000 
+0200
@@ -0,0 +1,220 @@
+#include "dbd_duckdb.h"
+
+
+int dbd_duckdb_statement_create(lua_State *L, connection_t *conn, const char 
*sql_query);
+
+
+/*
+ * connection,err = DBD.DuckDB.New(dbfile)
+ */
+static int connection_new(lua_State *L) {
+       int n = lua_gettop(L);
+
+       char *errmessage;
+       const char *db = NULL;
+       connection_t *conn = NULL;
+
+       switch(n) {
+       default:
+               /*
+                * db is the only parameter for now
+                */
+               db = luaL_checkstring(L, 1);
+       }
+
+       conn = (connection_t *)lua_newuserdata(L, sizeof(connection_t));
+       conn->autocommit = 1;
+       conn->in_transaction = 0;
+       
+       if (duckdb_open_ext( db, &(conn->db), NULL, &errmessage ) == 
DuckDBError) {
+               lua_pushnil(L);
+               lua_pushfstring(L, DBI_ERR_CONNECTION_FAILED, errmessage);
+               
+               duckdb_free(errmessage);
+               return 2;
+       }
+
+       if (duckdb_connect( conn->db, &(conn->conn) ) == DuckDBError) {
+               duckdb_close( &(conn->db) );
+               
+               lua_pushnil(L);
+               lua_pushfstring(L, DBI_ERR_CONNECTION_FAILED);
+               return 2;
+       }
+       
+       luaL_getmetatable(L, DBD_DUCKDB_CONNECTION);
+       lua_setmetatable(L, -2);
+
+       return 1;
+}
+
+
+static int connection_prepare(lua_State *L) {
+       connection_t *conn = (connection_t *)luaL_checkudata(L, 1, 
DBD_DUCKDB_CONNECTION);
+
+       if (conn->conn) {
+               return dbd_duckdb_statement_create(L, conn, luaL_checkstring(L, 
2));
+       }
+
+       lua_pushnil(L);
+       lua_pushstring(L, DBI_ERR_DB_UNAVAILABLE);
+       return 2;
+}
+
+
+static int connection_commit(lua_State *L) {
+       connection_t *conn = (connection_t *)luaL_checkudata(L, 1, 
DBD_DUCKDB_CONNECTION);
+       
+       if (duckdb_query(conn->conn, "COMMIT;", NULL) == DuckDBError) {
+               lua_pushboolean(L, 0);
+               return 0;
+       }
+       
+       conn->in_transaction = 0;
+       lua_pushboolean(L, 1);
+       return 1;
+}
+
+
+static int connection_rollback(lua_State *L) {
+       connection_t *conn = (connection_t *)luaL_checkudata(L, 1, 
DBD_DUCKDB_CONNECTION);
+       
+       if (duckdb_query(conn->conn, "ROLLBACK;", NULL) == DuckDBError) {
+               lua_pushboolean(L, 0);
+               return 0;
+       }
+       
+       conn->in_transaction = 0;
+       lua_pushboolean(L, 1);
+       return 1;
+}
+
+
+static int connection_autocommit(lua_State *L) {
+       connection_t *conn = (connection_t *)luaL_checkudata(L, 1, 
DBD_DUCKDB_CONNECTION);
+       bool mode = lua_toboolean(L, 1);
+       
+       // no change
+       if (conn->autocommit == mode) {
+               lua_pushboolean(L, 1);
+               return 1;
+       }
+       
+       // enable autocommit while in a transaction means commit it
+       if (conn->in_transaction) {
+               if (mode) {
+                       if (duckdb_query(conn->conn, "COMMIT;", NULL) == 
DuckDBError) {
+                               lua_pushboolean(L, 0);
+                               return 0;
+                       }
+                       
+                       conn->in_transaction = 0;
+               }
+       }
+
+       conn->autocommit = mode;
+       lua_pushboolean(L, 1);
+       return 1;
+}
+
+static int connection_ping(lua_State *L) {
+       connection_t *conn = (connection_t *)luaL_checkudata(L, 1, 
DBD_DUCKDB_CONNECTION);
+
+       int ok = 1;
+
+       if (!conn->db) {
+               ok = 0;
+       } else if (!conn->conn) {
+               ok = 0;
+       }
+
+       lua_pushboolean(L, ok);
+       return 1;
+}
+
+
+static int connection_close(lua_State *L) {
+       connection_t *conn = (connection_t *)luaL_checkudata(L, 1, 
DBD_DUCKDB_CONNECTION);
+       
+       duckdb_disconnect(&(conn->conn));
+       conn->conn = NULL;
+       
+       duckdb_close(&(conn->db));
+       conn->db = NULL;
+
+       lua_pushboolean(L, 1);
+       return 1;
+}
+
+
+/*
+ * last_id = connection:last_id()
+ */
+static int connection_lastid(lua_State *L) {
+       luaL_error(L, DBI_ERR_NOT_IMPLEMENTED, DBD_DUCKDB_CONNECTION, 
"last_id");
+       return 0;
+}
+
+
+/*
+ * num_rows = statement:rowcount()
+ */
+static int connection_quote(lua_State *L) {
+       luaL_error(L, DBI_ERR_NOT_IMPLEMENTED, DBD_DUCKDB_CONNECTION, "quote");
+       return 0;
+}
+
+
+/*
+ * __gc
+ */
+static int connection_gc(lua_State *L) {
+       /* always close the connection */
+       connection_close(L);
+
+       return 0;
+}
+
+
+/*
+ * __tostring
+ */
+static int connection_tostring(lua_State *L) {
+       connection_t *conn = (connection_t *)luaL_checkudata(L, 1, 
DBD_DUCKDB_CONNECTION);
+
+       lua_pushfstring(L, "%s: %p", DBD_DUCKDB_CONNECTION, conn);
+
+       return 1;
+}
+
+
+int dbd_duckdb_connection(lua_State *L) {
+       /*
+        * instance methods
+        */
+       static const luaL_Reg connection_methods[] = {
+               {"autocommit", connection_autocommit},
+               {"close", connection_close},
+               {"commit", connection_commit},
+               {"ping", connection_ping},
+               {"prepare", connection_prepare},
+               {"quote", connection_quote},
+               {"rollback", connection_rollback},
+               {"last_id", connection_lastid},
+               {NULL, NULL}
+       };
+       
+       /*
+        * class methods
+        */
+       static const luaL_Reg connection_class_methods[] = {
+               {"New", connection_new},
+               {NULL, NULL}
+       };
+       
+       dbd_register(L, DBD_DUCKDB_CONNECTION,
+               connection_methods, connection_class_methods,
+               connection_gc, connection_tostring);
+               
+       return 1;
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/luadbi-0.7.3/dbd/duckdb/dbd_duckdb.h 
new/luadbi-0.7.4/dbd/duckdb/dbd_duckdb.h
--- old/luadbi-0.7.3/dbd/duckdb/dbd_duckdb.h    1970-01-01 01:00:00.000000000 
+0100
+++ new/luadbi-0.7.4/dbd/duckdb/dbd_duckdb.h    2024-10-03 18:37:41.000000000 
+0200
@@ -0,0 +1,99 @@
+#include <duckdb.h>
+#include <dbd/common.h>
+
+#define DBD_DUCKDB_CONNECTION   "DBD.DuckDB.Connection"
+#define DBD_DUCKDB_STATEMENT    "DBD.DuckDB.Statement"
+
+/*
+ * connection object
+ */
+typedef struct _connection {
+       duckdb_database db;
+       duckdb_connection conn;
+       bool autocommit;
+       bool in_transaction;
+} connection_t;
+
+/*
+ * statement object
+ */
+typedef struct _statement {
+       connection_t *conn;
+       duckdb_prepared_statement stmt;
+       duckdb_result result;
+
+       duckdb_data_chunk cur_chunk;
+       int cur_row;
+       //duckdb_vector *cur_cols;
+
+       bool is_result;
+
+} statement_t;
+
+
+/*
+ * Modified versions of what's in common.h, because DuckDB does things
+ * differently.
+ */
+#define LDB_PUSH_ATTRIB_INT(v) \
+       lua_pushinteger(L, v); \
+       lua_rawset(L, -3);
+
+#define LDB_PUSH_ATTRIB_FLOAT(v) \
+       lua_pushnumber(L, v); \
+       lua_rawset(L, -3);
+
+#define LDB_PUSH_ATTRIB_STRING_BY_LENGTH(v, len) \
+       lua_pushlstring(L, v, len); \
+       lua_rawset(L, -3);
+
+#define LDB_PUSH_ATTRIB_STRING(v) \
+       if (duckdb_string_is_inlined(v)) {      \
+               lua_pushstring(L, v.value.inlined.inlined);     \
+               lua_rawset(L, -3);      \
+       } else {        \
+               lua_pushlstring(L, v.value.pointer.ptr, 
v.value.pointer.length);        \
+               lua_rawset(L, -3);      \
+       }
+
+#define LDB_PUSH_ATTRIB_BOOL(v) \
+       lua_pushboolean(L, v); \
+       lua_rawset(L, -3);
+
+#define LDB_PUSH_ATTRIB_NIL() \
+       lua_pushnil(L); \
+       lua_rawset(L, -3);
+
+
+
+#if LUA_VERSION_NUM > 502
+#define LDB_PUSH_ARRAY_INT(n, v) \
+       lua_pushinteger(L, v);  \
+       lua_rawseti(L, -2, n);
+#else
+#define LDB_PUSH_ARRAY_INT(n, v) \
+       lua_pushnumber(L, v);   \
+       lua_rawseti(L, -2, n);
+#endif
+
+#define LDB_PUSH_ARRAY_FLOAT(n, v) \
+       lua_pushnumber(L, v); \
+       lua_rawseti(L, -2, n);
+
+// DuckDB stores strings in two different ways, compensate for that here
+#define LDB_PUSH_ARRAY_STRING(n, v) \
+       if (duckdb_string_is_inlined(v)) {      \
+               lua_pushstring(L, v.value.inlined.inlined);     \
+               lua_rawseti(L, -2, n);  \
+       } else {        \
+               lua_pushlstring(L, v.value.pointer.ptr, 
v.value.pointer.length);        \
+               lua_rawseti(L, -2, n);  \
+       }
+
+#define LDB_PUSH_ARRAY_BOOL(n, v) \
+       lua_pushboolean(L, v); \
+       lua_rawseti(L, -2, n);
+
+#define LDB_PUSH_ARRAY_NIL(n) \
+       lua_pushnil(L); \
+       lua_rawseti(L, -2, n);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/luadbi-0.7.3/dbd/duckdb/main.c 
new/luadbi-0.7.4/dbd/duckdb/main.c
--- old/luadbi-0.7.3/dbd/duckdb/main.c  1970-01-01 01:00:00.000000000 +0100
+++ new/luadbi-0.7.4/dbd/duckdb/main.c  2024-10-03 18:37:41.000000000 +0200
@@ -0,0 +1,15 @@
+#include "dbd_duckdb.h"
+
+int dbd_duckdb_connection(lua_State *L);
+int dbd_duckdb_statement(lua_State *L);
+
+/*
+ * library entry point
+ */
+LUA_EXPORT int luaopen_dbd_duckdb(lua_State *L) {
+       dbd_duckdb_statement(L);
+       dbd_duckdb_connection(L);
+
+       return 1;
+}
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/luadbi-0.7.3/dbd/duckdb/statement.c 
new/luadbi-0.7.4/dbd/duckdb/statement.c
--- old/luadbi-0.7.3/dbd/duckdb/statement.c     1970-01-01 01:00:00.000000000 
+0100
+++ new/luadbi-0.7.4/dbd/duckdb/statement.c     2024-10-03 18:37:41.000000000 
+0200
@@ -0,0 +1,462 @@
+#include "dbd_duckdb.h"
+#include <stdio.h>
+
+
+int dbd_duckdb_statement_create(lua_State *L, connection_t *conn, const char 
*sql_query) {
+       statement_t *statement = NULL;
+
+       statement = (statement_t *)lua_newuserdata(L, sizeof(statement_t));
+       statement->conn = conn;
+       statement->stmt = NULL;
+       statement->is_result = 0;
+       statement->cur_chunk = NULL;
+       statement->cur_row = 0;
+
+       if (duckdb_prepare(conn->conn, sql_query, &(statement->stmt) ) != 
DuckDBSuccess) {      
+               lua_pushnil(L);
+               lua_pushfstring(L, DBI_ERR_PREP_STATEMENT, 
duckdb_prepare_error( statement->stmt ));
+               
+               duckdb_destroy_prepare( &(statement->stmt) );
+               statement->stmt = NULL;
+               return 2;       
+       }
+
+       luaL_getmetatable(L, DBD_DUCKDB_STATEMENT);
+       lua_setmetatable(L, -2);
+       return 1;
+}
+
+
+/*
+ * DuckDB API - the not-deprecated parts, anyway - are weird so this'll 
+ * be a fun one to implement.
+ */
+int statement_fetch_impl(lua_State *L, statement_t *statement, int 
named_columns) {
+       //statement_t *statement = (statement_t *)luaL_checkudata(L, 1, 
DBD_DUCKDB_STATEMENT);
+       idx_t cols, i;
+       
+       
+       if (!statement->stmt) {
+               luaL_error(L, DBI_ERR_INVALID_STATEMENT);
+               return 0;
+       }
+       
+       if (!statement->is_result) {
+               luaL_error(L, DBI_ERR_FETCH_NO_EXECUTE);
+               return 0;
+       }
+       
+       if (!statement->cur_chunk) {
+               statement->cur_chunk = duckdb_fetch_chunk( statement->result );
+               statement->cur_row = 0;
+               
+               // all data has been fetched.
+               if (!statement->cur_chunk) {
+                       duckdb_destroy_result( &(statement->result) );
+                       statement->is_result = 0;
+                       lua_pushnil(L);
+                       return 1;       
+               }
+       }
+
+       lua_newtable(L);
+       cols = duckdb_column_count(&(statement->result));
+       
+       for (i = 0; i < cols; ++i) {
+               duckdb_vector col1 = 
duckdb_data_chunk_get_vector(statement->cur_chunk, i);
+               
+               if (named_columns) {
+                       lua_pushstring(L, 
duckdb_column_name(&(statement->result), i));
+               }
+               
+               uint64_t *col1_validity = duckdb_vector_get_validity(col1);
+        if (duckdb_validity_row_is_valid(col1_validity, statement->cur_row)) {
+                       switch ( duckdb_column_type( &(statement->result), i ) 
) {
+  
+                               case DUCKDB_TYPE_TINYINT:
+                               case DUCKDB_TYPE_UTINYINT: {
+                                       int8_t *res = 
duckdb_vector_get_data(col1);
+                                       if (named_columns) {
+                                               LDB_PUSH_ATTRIB_INT( 
res[statement->cur_row] );
+                                       } else {
+                                               LDB_PUSH_ARRAY_INT(i + 1, 
res[statement->cur_row]);
+                                       }
+                               }
+                                       break;
+                               
+                               case DUCKDB_TYPE_SMALLINT:
+                               case DUCKDB_TYPE_USMALLINT: {
+                                       int16_t *res = 
duckdb_vector_get_data(col1);
+                                       if (named_columns) {
+                                               LDB_PUSH_ATTRIB_INT( 
res[statement->cur_row] );
+                                       } else {
+                                               LDB_PUSH_ARRAY_INT(i + 1, 
res[statement->cur_row]);
+                                       }
+                               }
+                                       break;
+                               
+                               case DUCKDB_TYPE_INTEGER:
+                               case DUCKDB_TYPE_UINTEGER: {
+                                       int32_t *res = 
duckdb_vector_get_data(col1);
+                                       if (named_columns) {
+                                               LDB_PUSH_ATTRIB_INT( 
res[statement->cur_row] );
+                                       } else {
+                                               LDB_PUSH_ARRAY_INT(i + 1, 
res[statement->cur_row]);
+                                       }
+                               }
+                                       break;
+                                       
+                                                               
+                               case DUCKDB_TYPE_BIGINT:
+                               case DUCKDB_TYPE_UBIGINT: {
+                                       int64_t *res = 
duckdb_vector_get_data(col1);
+                                       if (named_columns) {
+                                               LDB_PUSH_ATTRIB_INT( 
res[statement->cur_row] );
+                                       } else {
+                                               LDB_PUSH_ARRAY_INT(i + 1, 
res[statement->cur_row]);
+                                       }
+                               }
+                                       break;
+
+                               case DUCKDB_TYPE_FLOAT: {
+                               float *res = duckdb_vector_get_data(col1);      
+                                       if (named_columns) {
+                                               LDB_PUSH_ATTRIB_FLOAT( 
res[statement->cur_row] );
+                                       } else {
+                                               LDB_PUSH_ARRAY_FLOAT(i + 1, 
res[statement->cur_row]);
+                                       }
+                               }
+                                       break;                  
+                               
+                               case DUCKDB_TYPE_DOUBLE: {
+                               double *res = duckdb_vector_get_data(col1);     
                
+                                       if (named_columns) {
+                                               LDB_PUSH_ATTRIB_FLOAT( 
res[statement->cur_row] );
+                                       } else {
+                                               LDB_PUSH_ARRAY_FLOAT(i + 1, 
res[statement->cur_row]);
+                                       }
+                               }
+                                       break;
+  
+                               case DUCKDB_TYPE_BOOLEAN: {
+                                       bool *res = 
duckdb_vector_get_data(col1);
+                                       if (named_columns) {
+                                               LDB_PUSH_ATTRIB_BOOL( 
res[statement->cur_row] );
+                                       } else {
+                                               LDB_PUSH_ARRAY_BOOL(i + 1, 
res[statement->cur_row]);
+                                       }
+                               }
+                                       break;
+                                       
+                               case DUCKDB_TYPE_BLOB:
+                               case DUCKDB_TYPE_VARCHAR: {
+                                       duckdb_string_t *vector_data = 
(duckdb_string_t *) duckdb_vector_get_data(col1);
+                                       duckdb_string_t str = vector_data[ 
statement->cur_row ];
+                                       if (named_columns) {
+                                               LDB_PUSH_ATTRIB_STRING( str );
+                                       } else {
+                                               LDB_PUSH_ARRAY_STRING(i + 1, 
str);
+                                       }
+                               }
+                                       break;
+                                       
+                               default:
+                                       luaL_error(L, DBI_ERR_EXECUTE_FAILED, 
"unknown datatype to bind");
+                                       break;
+                       }
+               } else {
+                       // NULL value
+                       if (named_columns) {
+                               LDB_PUSH_ATTRIB_NIL();
+                       } else {
+                               LDB_PUSH_ARRAY_NIL( i + 1 );
+                       }
+               }
+       }
+
+       ++(statement->cur_row);
+       
+       if (statement->cur_row >= duckdb_data_chunk_get_size( 
statement->cur_chunk )) {
+               duckdb_destroy_data_chunk(&(statement->cur_chunk));
+               statement->cur_chunk = NULL;
+       }
+       
+       return 1;
+}
+
+
+static int next_iterator(lua_State *L) {
+       statement_t *statement = (statement_t *)luaL_checkudata(L, 
lua_upvalueindex(1), DBD_DUCKDB_STATEMENT);
+       int named_columns = lua_toboolean(L, lua_upvalueindex(2));
+
+       return statement_fetch_impl(L, statement, named_columns);
+}
+
+/*
+ * table = statement:fetch(named_indexes)
+ */
+static int statement_fetch(lua_State *L) {
+       statement_t *statement = (statement_t *)luaL_checkudata(L, 1, 
DBD_DUCKDB_STATEMENT);
+       int named_columns = lua_toboolean(L, 2);
+
+       return statement_fetch_impl(L, statement, named_columns);
+}
+
+/*
+ * iterfunc = statement:rows(named_indexes)
+ */
+static int statement_rows(lua_State *L) {
+       if (lua_gettop(L) == 1) {
+               lua_pushvalue(L, 1);
+               lua_pushboolean(L, 0);
+       } else {
+               lua_pushvalue(L, 1);
+               lua_pushboolean(L, lua_toboolean(L, 2));
+       }
+
+       lua_pushcclosure(L, next_iterator, 2);
+       return 1;
+}
+
+
+int statement_execute(lua_State *L) {
+       statement_t *statement = (statement_t *)luaL_checkudata(L, 1, 
DBD_DUCKDB_STATEMENT);
+       int n = lua_gettop(L);
+       int expected_params, p;
+       int num_bind_params = n - 1;
+       int errflag = 0;
+       const char *errstr = NULL;
+       
+       
+       /*
+        * Sanity checks
+        */
+       if (!statement->conn->conn) {
+               luaL_error(L, DBI_ERR_DB_UNAVAILABLE);
+       }
+
+       
+       /*
+        * Setup phase - Check arguments, clear handle
+        */
+       expected_params = duckdb_nparams( statement->stmt );
+       if (expected_params != num_bind_params) {
+               lua_pushboolean(L, 0);
+               lua_pushfstring(L, DBI_ERR_PARAM_MISCOUNT, expected_params, 
num_bind_params);
+               return 2;
+       }
+       
+       if (statement->is_result) {
+               duckdb_destroy_result( &(statement->result) );
+               statement->is_result = 0;
+       }
+       
+       
+       /*
+        * Bind Values
+        */
+       for (p = 2; p <= n; p++) {
+               int i = p - 1;
+               int type = lua_type(L, p);
+               char err[64];
+                               
+                               
+               switch(type) {
+               case LUA_TNIL:
+                       errflag = duckdb_bind_null( statement->stmt, i ) != 
DuckDBSuccess;
+                       break;
+                       
+               case LUA_TNUMBER:
+#if LUA_VERSION_NUM > 502
+                       if (lua_isinteger(L, p)) {
+                               errflag = duckdb_bind_int64(statement->stmt, i, 
lua_tointeger(L, p)) != DuckDBSuccess;
+                               break;
+                       }
+#endif
+                       errflag = duckdb_bind_double(statement->stmt, i, 
lua_tonumber(L, p)) != DuckDBSuccess;
+                       break;
+                                       
+               case LUA_TSTRING:
+                       errflag = duckdb_bind_varchar(statement->stmt, i, 
lua_tostring(L, p)) != DuckDBSuccess;
+                       break;
+               
+               case LUA_TBOOLEAN:
+                       errflag = duckdb_bind_boolean(statement->stmt, i, 
lua_toboolean(L, p)) != DuckDBSuccess;
+                       break;          
+               
+               default:
+                       /*
+                        * Unknown/unsupported value type
+                        */
+                       errflag = 1;
+                       snprintf(err, sizeof(err)-1, DBI_ERR_BINDING_TYPE_ERR, 
lua_typename(L, type));
+                       errstr = err;
+               }
+
+               if (errflag) {
+                       break;
+               }
+       }
+       
+       
+       /*
+        * Something went wrong, reset and return error
+        */
+       if (errflag) {
+               if (duckdb_clear_bindings( statement->stmt ) != DuckDBSuccess) {
+                       lua_pushnil(L);
+                       lua_pushstring(L, DBI_ERR_STATEMENT_BROKEN);
+                       return 2;
+               }
+               
+               lua_pushnil(L);
+               if (errstr) {
+                       lua_pushstring(L, errstr);
+               } else {
+                       lua_pushfstring(L, DBI_ERR_BINDING_PARAMS, 
duckdb_prepare_error( statement->stmt ));    
+               }
+               
+               return 2;
+       }
+       
+       
+       
+       /*
+        * Actual execute
+        */
+       if (duckdb_execute_prepared(statement->stmt, &(statement->result)) != 
DuckDBSuccess) {
+               // error case
+               lua_pushnil(L);
+               lua_pushfstring(L, DBI_ERR_EXECUTE_FAILED, duckdb_result_error( 
&(statement->result) ));
+               duckdb_destroy_result(&(statement->result));
+               return 2;
+       }
+                       
+       // success case
+       statement->is_result = 1;
+       lua_pushboolean(L, 1);
+       return 1;
+}
+
+
+
+/*
+ * success = statement:close()
+ */
+static int statement_close(lua_State *L) {
+       statement_t *statement = (statement_t *)luaL_checkudata(L, 1, 
DBD_DUCKDB_STATEMENT);
+       int ok = 0;
+       
+       if (statement->is_result) {
+               duckdb_destroy_result( &(statement->result) );
+               statement->is_result = 0;
+       }
+
+       if (statement->stmt) {
+               duckdb_destroy_prepare( &(statement->stmt) );
+               statement->stmt = NULL;
+               ok = 1;
+       }
+
+       lua_pushboolean(L, ok);
+       return 1;
+}
+
+
+/*
+ * column_names = statement:columns()
+ */
+static int statement_columns(lua_State *L) {
+       statement_t *statement = (statement_t *)luaL_checkudata(L, 1, 
DBD_DUCKDB_STATEMENT);
+
+       int i;
+       int num_columns;
+       int d = 1;
+
+       if (!statement->stmt) {
+               luaL_error(L, DBI_ERR_INVALID_STATEMENT);
+               return 0;
+       }
+       
+       if (!statement->is_result) {
+               luaL_error(L, DBI_ERR_FETCH_NO_EXECUTE);
+               return 0;
+       }
+
+       num_columns = duckdb_column_count(&(statement->result));
+       lua_newtable(L);
+       for (i = 0; i < num_columns; i++) {
+               const char *name = duckdb_column_name(&(statement->result), i);
+               LUA_PUSH_ARRAY_STRING(d, name);
+       }
+
+       return 1;
+}
+
+
+/*
+ * rows_changed = statement:affected()
+ */
+static int statement_affected(lua_State *L) {
+       statement_t *statement = (statement_t *)luaL_checkudata(L, 1, 
DBD_DUCKDB_STATEMENT);
+       lua_pushinteger( L, duckdb_rows_changed( &(statement->result) ) );
+       return 1;
+}
+
+/*
+ * num_rows = statement:rowcount()
+ */
+static int statement_rowcount(lua_State *L) {
+       /*
+        * This functionality exists in DuckDB's API but is marked deprecated 
+        * so not implementing it.
+        */
+       luaL_error(L, DBI_ERR_NOT_IMPLEMENTED, DBD_DUCKDB_STATEMENT, 
"rowcount");
+       return 0;
+}
+
+
+/*
+ * __gc
+ */
+static int statement_gc(lua_State *L) {
+       /* always free the handle */
+       statement_close(L);
+
+       return 0;
+}
+
+/*
+ * __tostring
+ */
+static int statement_tostring(lua_State *L) {
+       statement_t *statement = (statement_t *)luaL_checkudata(L, 1, 
DBD_DUCKDB_STATEMENT);
+
+       lua_pushfstring(L, "%s: %p", DBD_DUCKDB_STATEMENT, statement);
+
+       return 1;
+}
+
+
+int dbd_duckdb_statement(lua_State *L) {
+       static const luaL_Reg statement_methods[] = {
+               {"affected", statement_affected},
+               {"close", statement_close},
+               {"columns", statement_columns},
+               {"execute", statement_execute},
+               {"fetch", statement_fetch},
+               {"rows", statement_rows},
+               {"rowcount", statement_rowcount},
+               {NULL, NULL}
+       };
+
+       static const luaL_Reg statement_class_methods[] = {
+               {NULL, NULL}
+       };
+
+       dbd_register(L, DBD_DUCKDB_STATEMENT,
+                    statement_methods, statement_class_methods,
+                    statement_gc, statement_tostring);
+
+       return 1;
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/luadbi-0.7.3/dbd/mysql/dbd_mysql.h 
new/luadbi-0.7.4/dbd/mysql/dbd_mysql.h
--- old/luadbi-0.7.3/dbd/mysql/dbd_mysql.h      2024-03-04 23:01:25.000000000 
+0100
+++ new/luadbi-0.7.4/dbd/mysql/dbd_mysql.h      2024-10-03 18:37:41.000000000 
+0200
@@ -9,7 +9,7 @@
 #define DBD_MYSQL_CONNECTION    "DBD.MySQL.Connection"
 #define DBD_MYSQL_STATEMENT     "DBD.MySQL.Statement"
 
-#ifndef LIBMARIADB
+#if !defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 80001
 #define my_bool bool
 #endif
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/luadbi-0.7.3/dbd/mysql/statement.c 
new/luadbi-0.7.4/dbd/mysql/statement.c
--- old/luadbi-0.7.3/dbd/mysql/statement.c      2024-03-04 23:01:25.000000000 
+0100
+++ new/luadbi-0.7.4/dbd/mysql/statement.c      2024-10-03 18:37:41.000000000 
+0200
@@ -268,7 +268,7 @@
                        bind[i].buffer_type = MYSQL_TYPE_STRING;
                        bind[i].is_null = (my_bool*)0;
                        bind[i].buffer = (char *)str;
-                       bind[i].length = str_len;
+                       bind[i].length = (unsigned long *)str_len;
                        break;
 
                default:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/luadbi-0.7.3/dbd/sqlite3/connection.c 
new/luadbi-0.7.4/dbd/sqlite3/connection.c
--- old/luadbi-0.7.3/dbd/sqlite3/connection.c   2024-03-04 23:01:25.000000000 
+0100
+++ new/luadbi-0.7.4/dbd/sqlite3/connection.c   2024-10-03 18:37:41.000000000 
+0200
@@ -263,20 +263,20 @@
                const char *name;
                int value;
        } sqlite3_constants[] = {
-               "SQLITE_OPEN_READONLY",     SQLITE_OPEN_READONLY,
-               "SQLITE_OPEN_READWRITE",    SQLITE_OPEN_READWRITE,
-               "SQLITE_OPEN_CREATE",       SQLITE_OPEN_CREATE,
+               {"SQLITE_OPEN_READONLY",     SQLITE_OPEN_READONLY},
+               {"SQLITE_OPEN_READWRITE",    SQLITE_OPEN_READWRITE},
+               {"SQLITE_OPEN_CREATE",       SQLITE_OPEN_CREATE},
 #ifdef SQLITE_OPEN_URI
-               "SQLITE_OPEN_URI",          SQLITE_OPEN_URI,
+               {"SQLITE_OPEN_URI",          SQLITE_OPEN_URI},
 #endif
 #ifdef SQLITE_OPEN_MEMORY
-               "SQLITE_OPEN_MEMORY",       SQLITE_OPEN_MEMORY,
+               {"SQLITE_OPEN_MEMORY",       SQLITE_OPEN_MEMORY},
 #endif
-               "SQLITE_OPEN_NOMUTEX",      SQLITE_OPEN_NOMUTEX,
-               "SQLITE_OPEN_FULLMUTEX",    SQLITE_OPEN_FULLMUTEX,
-               "SQLITE_OPEN_SHAREDCACHE",  SQLITE_OPEN_SHAREDCACHE,
-               "SQLITE_OPEN_PRIVATECACHE", SQLITE_OPEN_PRIVATECACHE,
-               NULL, 0
+               {"SQLITE_OPEN_NOMUTEX",      SQLITE_OPEN_NOMUTEX},
+               {"SQLITE_OPEN_FULLMUTEX",    SQLITE_OPEN_FULLMUTEX},
+               {"SQLITE_OPEN_SHAREDCACHE",  SQLITE_OPEN_SHAREDCACHE},
+               {"SQLITE_OPEN_PRIVATECACHE", SQLITE_OPEN_PRIVATECACHE},
+               {NULL, 0}
        };
 
        int i = 0;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/luadbi-0.7.3/luadbi-duckdb-scm-0.rockspec 
new/luadbi-0.7.4/luadbi-duckdb-scm-0.rockspec
--- old/luadbi-0.7.3/luadbi-duckdb-scm-0.rockspec       1970-01-01 
01:00:00.000000000 +0100
+++ new/luadbi-0.7.4/luadbi-duckdb-scm-0.rockspec       2024-10-03 
18:37:41.000000000 +0200
@@ -0,0 +1,59 @@
+package = "luadbi-sqlite3"
+version = "scm-0"
+
+description = {
+    summary = "Database abstraction layer",
+    detailed = [[
+        LuaDBI is a database interface library for Lua. It is designed
+        to provide a RDBMS agnostic API for handling database
+        operations. LuaDBI also provides support for prepared statement
+        handles, placeholders and bind parameters for all database
+        operations.
+
+        This rock is the Sqlite3 DBD module. You will also need the
+        base DBI module to use this software.
+    ]],
+
+    license = "MIT/X11",
+    homepage = "https://github.com/mwild1/luadbi";
+}
+
+source = {
+    url = "git+https://github.com/mwild1/luadbi.git";,
+}
+
+dependencies = {
+    "lua >= 5.1",
+    "luadbi = scm"
+}
+
+external_dependencies = {
+    SQLITE = { header = "sqlite3.h" }
+}
+
+build = {
+    type = "builtin",
+    modules = {
+        ['dbd.sqlite3'] = {
+            sources = {
+                'dbd/common.c',
+                'dbd/sqlite3/main.c',
+                'dbd/sqlite3/statement.c',
+                'dbd/sqlite3/connection.c'
+            },
+
+            libraries = {
+                'sqlite3'
+            },
+
+            incdirs = {
+                "$(SQLITE_INCDIR)",
+                './'
+            },
+
+            libdirs = {
+                "$(SQLITE_LIBDIR)"
+            }
+        }
+    }
+}
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/luadbi-0.7.3/tests/run_tests.lua 
new/luadbi-0.7.4/tests/run_tests.lua
--- old/luadbi-0.7.3/tests/run_tests.lua        2024-03-04 23:01:25.000000000 
+0100
+++ new/luadbi-0.7.4/tests/run_tests.lua        2024-10-03 18:37:41.000000000 
+0200
@@ -403,7 +403,9 @@
        assert.is_nil(err)
        assert.is_true(success)
 
-       assert.is_equal(1, sth:rowcount())
+       if config.has_rowcount then
+               assert.is_equal(1, sth:rowcount())
+       end
 
 
        --
@@ -443,7 +445,9 @@
        assert.is_nil(err)
        assert.is_true(success)
 
-       assert.is_equal(1, sth:rowcount())
+       if config.has_rowcount then
+               assert.is_equal(1, sth:rowcount())
+       end
 
        --
        -- Grab it back, make sure it's all good
@@ -582,14 +586,15 @@
        sth:close()
 end
 
+
 local function test_postgres_statement_leak()
        for i = 1, 10 do
-               local sth = dbh:prepare("SELECT 1");
-               sth:execute();
+               local sth = dbh:prepare("SELECT 1")
+               sth:execute()
                for r in sth:rows() do
                        assert(r[1] == 1, "result should be 1")
                end
-               sth:close();
+               sth:close()
        end
 
        for i = 1, 5 do
@@ -606,6 +611,16 @@
 end
 
 
+local function test_must_execute_before_fetch()
+
+       sth = dbh:prepare("select 1;")
+       assert.has_error(function()
+               sth:fetch()
+       end)
+
+end
+
+
 describe("PostgreSQL #psql", function()
        db_type = "PostgreSQL"
        config = dofile("configs/" .. db_type .. ".lua")
@@ -625,6 +640,7 @@
        it( "Tests affected rows", test_update )
        it( "Tests for prepared statement leak", test_postgres_statement_leak )
        it( "Tests closing dbh doesn't segfault", test_db_close_doesnt_segfault 
)
+       it( "Tests must execute before fetch", test_must_execute_before_fetch )
        teardown(teardown_tests)
 end)
 
@@ -645,6 +661,7 @@
        it( "Tests no rowcount", test_no_rowcount )
        it( "Tests affected rows", test_update )
        it( "Tests closing dbh doesn't segfault", test_db_close_doesnt_segfault 
)
+       it( "Tests must execute before fetch", test_must_execute_before_fetch )
        teardown(teardown_tests)
 end)
 
@@ -666,5 +683,29 @@
        it( "Tests statement reuse", test_insert_multi )
        it( "Tests affected rows", test_update )
        it( "Tests closing dbh doesn't segfault", test_db_close_doesnt_segfault 
)
+       it( "Tests must execute before fetch", test_must_execute_before_fetch )
+       teardown(teardown_tests)
+end)
+
+describe("DuckDB #duckdb", function()
+       db_type = "DuckDB"
+       config = dofile("configs/" .. db_type .. ".lua")
+       -- luacheck: ignore DBI dbh
+       local DBI, dbh
+
+       setup(setup_tests)
+       it( "Tests syntax error", syntax_error )
+       it( "Tests value encoding", test_encoding )
+       it( "Tests simple selects", test_select )
+       it( "Tests selects with limit", test_select_limit )
+       it( "Tests multi-row selects", test_select_multi )
+       it( "Tests inserts", test_insert_returning )
+       it( "Tests inserts of NULL", test_insert_null_returning )
+       it( "Tests statement reuse", test_insert_multi )
+       it( "Tests affected rows", test_update )
+       it( "Tests no insert_id", test_no_insert_id )
+       it( "Tests closing dbh doesn't segfault", test_db_close_doesnt_segfault 
)
+       it( "Tests must execute before fetch", test_must_execute_before_fetch )
        teardown(teardown_tests)
 end)
+

Reply via email to