summaryrefslogtreecommitdiff
path: root/dev-lua/luadbi/files
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2024-01-06 00:53:39 +0000
committerV3n3RiX <venerix@koprulu.sector>2024-01-06 00:53:39 +0000
commit5f153476311b368e80c57c4d1051c8106a724118 (patch)
tree830e9a7198df466eb4568e5a790d99b4cd1a6143 /dev-lua/luadbi/files
parent17ad5d72e60411f0ed843a9dbeb450d89f63d62c (diff)
gentoo auto-resync : 06:01:2024 - 00:53:38
Diffstat (limited to 'dev-lua/luadbi/files')
-rw-r--r--dev-lua/luadbi/files/luadbi-0.7.2-incompatible-pointer-type.patch163
-rw-r--r--dev-lua/luadbi/files/luadbi-0.7.2-incompatible-pointer-type2.patch29
2 files changed, 192 insertions, 0 deletions
diff --git a/dev-lua/luadbi/files/luadbi-0.7.2-incompatible-pointer-type.patch b/dev-lua/luadbi/files/luadbi-0.7.2-incompatible-pointer-type.patch
new file mode 100644
index 000000000000..dfe3db4b030d
--- /dev/null
+++ b/dev-lua/luadbi/files/luadbi-0.7.2-incompatible-pointer-type.patch
@@ -0,0 +1,163 @@
+From 7f9c10e753325e3cc00d4955bf9d6a77a896bdcb Mon Sep 17 00:00:00 2001
+From: Matthew Wild <mwild1@gmail.com>
+Date: Thu, 5 Sep 2019 14:25:20 +0100
+Subject: [PATCH 1/3] MySQL: Don't set (unused) field is_null to nonsense
+ value, fixes #56
+
+---
+ dbd/mysql/statement.c | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/dbd/mysql/statement.c b/dbd/mysql/statement.c
+index aca865a..dd01c1e 100644
+--- a/dbd/mysql/statement.c
++++ b/dbd/mysql/statement.c
+@@ -218,7 +218,6 @@ static int statement_execute(lua_State *L) {
+ switch(type) {
+ case LUA_TNIL:
+ bind[i].buffer_type = MYSQL_TYPE_NULL;
+- bind[i].is_null = (int*)1;
+ break;
+
+ case LUA_TBOOLEAN:
+
+From 83954fe0ba8c83fbe9351937e0d30b9c842dadb1 Mon Sep 17 00:00:00 2001
+From: Matthew Wild <mwild1@gmail.com>
+Date: Thu, 5 Sep 2019 14:26:04 +0100
+Subject: [PATCH 2/3] Add test for handling of NULL values
+
+---
+ tests/run_tests.lua | 48 +++++++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 48 insertions(+)
+
+diff --git a/tests/run_tests.lua b/tests/run_tests.lua
+index 0dd9f72..80526b6 100755
+--- a/tests/run_tests.lua
++++ b/tests/run_tests.lua
+@@ -301,6 +301,51 @@ local function test_insert_multi()
+
+ end
+
++local function test_insert_null()
++
++ local sth, sth2, err, success
++ local stringy = os.date()
++
++
++ sth, err = dbh:prepare(code('insert'))
++
++ assert.is_nil(err)
++ assert.is_not_nil(sth)
++
++ success, err = sth:execute(nil)
++
++ assert.is_true(success)
++ assert.is_nil(err)
++
++ assert.is_equal(1, sth:affected())
++
++ --
++ -- Grab it back, make sure it's all good
++ --
++
++ local id = dbh:last_id()
++ assert.is_not_nil(id)
++ sth:close()
++
++ sth2, err = dbh:prepare(code('insert_select'))
++
++ assert.is_nil(err)
++ assert.is_not_nil(sth)
++
++ success, err = sth2:execute(id)
++
++ assert.is_true(success)
++ assert.is_nil(err)
++
++ local row = sth2:rows(false)()
++ assert.is_not_nil(row)
++ assert.are_equal(id, row[1])
++ assert.is_nil(row[2])
++
++ sth:close()
++ sth2:close()
++
++end
+
+ local function test_insert_returning()
+
+@@ -494,6 +539,7 @@ describe("PostgreSQL #psql", function()
+ it( "Tests a simple select", test_select )
+ it( "Tests multi-row selects", test_select_multi )
+ it( "Tests inserts", test_insert_returning )
++ it( "Tests inserts of NULL", test_insert_null )
+ it( "Tests statement reuse", test_insert_multi )
+ it( "Tests no insert_id", test_no_insert_id )
+ it( "Tests affected rows", test_update )
+@@ -514,6 +560,7 @@ describe("SQLite3 #sqlite3", function()
+ it( "Tests simple selects", test_select )
+ it( "Tests multi-row selects", test_select_multi )
+ it( "Tests inserts", test_insert )
++ it( "Tests inserts of NULL", test_insert_null )
+ it( "Tests statement reuse", test_insert_multi )
+ it( "Tests no rowcount", test_no_rowcount )
+ it( "Tests affected rows", test_update )
+@@ -534,6 +581,7 @@ describe("MySQL #mysql", function()
+ it( "Tests simple selects", test_select )
+ it( "Tests multi-row selects", test_select_multi )
+ it( "Tests inserts", test_insert )
++ it( "Tests inserts of NULL", test_insert_null )
+ 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 )
+
+From 4555eb0a63945e829ffba635cac87b9e22155ffc Mon Sep 17 00:00:00 2001
+From: Matthew Wild <mwild1@gmail.com>
+Date: Thu, 5 Sep 2019 14:35:52 +0100
+Subject: [PATCH 3/3] tests/schemas: allow null inserts for testing
+
+---
+ tests/schemas/mysql.sql | 2 +-
+ tests/schemas/postgresql.sql | 2 +-
+ tests/schemas/sqlite3.sql | 2 +-
+ 3 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/tests/schemas/mysql.sql b/tests/schemas/mysql.sql
+index 1134e64..2948075 100644
+--- a/tests/schemas/mysql.sql
++++ b/tests/schemas/mysql.sql
+@@ -46,7 +46,7 @@ drop table if exists insert_tests;
+ create table insert_tests
+ (
+ id int not null primary key auto_increment,
+- val varchar(255) not null
++ val varchar(255)
+ );
+
+ grant insert, select on insert_tests to 'luadbi'@'%';
+diff --git a/tests/schemas/postgresql.sql b/tests/schemas/postgresql.sql
+index f430516..efe23f3 100644
+--- a/tests/schemas/postgresql.sql
++++ b/tests/schemas/postgresql.sql
+@@ -47,7 +47,7 @@ drop table if exists insert_tests cascade;
+ create table insert_tests
+ (
+ id serial primary key,
+- val varchar(255) not null
++ val varchar(255)
+ );
+
+ grant insert, select on insert_tests to luadbi;
+diff --git a/tests/schemas/sqlite3.sql b/tests/schemas/sqlite3.sql
+index d3ba4bc..3bf0eb0 100644
+--- a/tests/schemas/sqlite3.sql
++++ b/tests/schemas/sqlite3.sql
+@@ -44,7 +44,7 @@ drop table if exists insert_tests;
+ create table insert_tests
+ (
+ id integer primary key,
+- val varchar(255) not null
++ val varchar(255)
+ );
+
+ drop table if exists update_tests;
diff --git a/dev-lua/luadbi/files/luadbi-0.7.2-incompatible-pointer-type2.patch b/dev-lua/luadbi/files/luadbi-0.7.2-incompatible-pointer-type2.patch
new file mode 100644
index 000000000000..22a6e7c7e881
--- /dev/null
+++ b/dev-lua/luadbi/files/luadbi-0.7.2-incompatible-pointer-type2.patch
@@ -0,0 +1,29 @@
+--- a/dbd/mysql/statement.c
++++ b/dbd/mysql/statement.c
+@@ -226,7 +226,7 @@
+ *boolean = lua_toboolean(L, p);
+
+ bind[i].buffer_type = MYSQL_TYPE_LONG;
+- bind[i].is_null = (int*)0;
++ bind[i].is_null = false;
+ bind[i].buffer = (char *)boolean;
+ bind[i].length = 0;
+ break;
+@@ -241,7 +241,7 @@
+ *num = lua_tonumber(L, p);
+
+ bind[i].buffer_type = MYSQL_TYPE_DOUBLE;
+- bind[i].is_null = (int*)0;
++ bind[i].is_null = false;
+ bind[i].buffer = (char *)num;
+ bind[i].length = 0;
+ break;
+@@ -252,7 +252,7 @@
+ str = lua_tolstring(L, p, str_len);
+
+ bind[i].buffer_type = MYSQL_TYPE_STRING;
+- bind[i].is_null = (int*)0;
++ bind[i].is_null = false;
+ bind[i].buffer = (char *)str;
+ bind[i].length = str_len;
+ break;