From 854206bc70ff470e688837b62015a0a6edb0714e Mon Sep 17 00:00:00 2001 From: Clemens Schwaighofer Date: Thu, 18 May 2023 15:08:45 +0900 Subject: [PATCH] Add better error reporting to DB\IO for query with params On error with query with params the query was sent to the server and if ther query itself is ok but there is a problem with the parameters a wrong error message ($1 not found) will be returned Add pg_last_error reporting to catch this too. Update both error reporting to return not string and prefix combined but prefix + error string in array In error return check that both strings are not equal, so we do not return the same error string twice. Also default set dbh variable in the PgSQL class to false so it will skip last error report if there is no dbh set yet. Bug fix for db query with params debug output. if there are more than 9 entries the $1 of eg $10 is replaced with $1 entry again. Changed to '#' instead '$' to avoid this. Other: ACL\Login: replace EOM with HTML config.master: replace list() with [] Add single DB tester where we can test single db calls without adding more to the general test run --- 4dev/tests/DB/CoreLibsDBIOTest.php | 48 +++++++++++++++--------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/4dev/tests/DB/CoreLibsDBIOTest.php b/4dev/tests/DB/CoreLibsDBIOTest.php index 0ee6e878..20e90fda 100644 --- a/4dev/tests/DB/CoreLibsDBIOTest.php +++ b/4dev/tests/DB/CoreLibsDBIOTest.php @@ -156,7 +156,7 @@ final class CoreLibsDBIOTest extends TestCase $db->dbExec("DROP TABLE test_meta"); } // uid is for internal reference tests - $base_table = <<dbExec( // primary key name is table + '_id' - <<dbExec( - <<dbExec( - << false, 'array dims' => 0, 'is enum' => false, - 'is base' => 1, + 'is base' => true, 'is composite' => false, - 'is pesudo' => false, 'description' => '', + 'is pseudo' => false ], 'row_2' => [ 'num' => 2, @@ -1355,10 +1355,10 @@ final class CoreLibsDBIOTest extends TestCase 'has default' => false, 'array dims' => 0, 'is enum' => false, - 'is base' => 1, + 'is base' => true, 'is composite' => false, - 'is pesudo' => false, 'description' => '', + 'is pseudo' => false ] ] ], @@ -1374,10 +1374,10 @@ final class CoreLibsDBIOTest extends TestCase 'has default' => false, 'array dims' => 0, 'is enum' => false, - 'is base' => 1, + 'is base' => true, 'is composite' => false, - 'is pesudo' => false, 'description' => '', + 'is pseudo' => false ], 'row_2' => [ 'num' => 2, @@ -1387,10 +1387,10 @@ final class CoreLibsDBIOTest extends TestCase 'has default' => false, 'array dims' => 0, 'is enum' => false, - 'is base' => 1, + 'is base' => true, 'is composite' => false, - 'is pesudo' => false, 'description' => '', + 'is pseudo' => false ] ] ], @@ -4425,16 +4425,16 @@ final class CoreLibsDBIOTest extends TestCase ] ] ], - // same but as EOM - 'single insert (PK), EOM string' => [ - << [ + << [ - << [ + <<