Add try / catch block for DB tests

This commit is contained in:
cliphouse committed 2026-10-07 10:42:29 +09:00
1 parent 68ea44964f
commit b759ba70f3
1 file changed
+6
+6
View File
@@ -683,6 +683,7 @@ echo "<hr>";
// NOTE: try to replacate connection still exists if script is run a second time // NOTE: try to replacate connection still exists if script is run a second time
// open pg bouncer connection // open pg bouncer connection
try {
$db_pgb = new CoreLibs\DB\IO($DB_CONFIG['test_pgbouncer'] ?? [], $log); $db_pgb = new CoreLibs\DB\IO($DB_CONFIG['test_pgbouncer'] ?? [], $log);
print "[PGB] DBINFO: " . $db_pgb->dbInfo() . "<br>"; print "[PGB] DBINFO: " . $db_pgb->dbInfo() . "<br>";
if ($db->dbPrepare('pgb_sel_test_foo', $q_prep) === false) { if ($db->dbPrepare('pgb_sel_test_foo', $q_prep) === false) {
@@ -719,6 +720,11 @@ $stm_status = $db->dbPreparedCursorStatus('pgb_sel_test_foo', "SELECT * FROM tes
print "[PGB] prepared exists and query not match status: $stm_status<br>"; print "[PGB] prepared exists and query not match status: $stm_status<br>";
$db_pgb->dbClose(); $db_pgb->dbClose();
} catch (\Exception $e) {
print "<font color='red'>";
print "[PGB] Exception caught: " . $e->getMessage() . "<br>";
print "</font>";
}
# db write class test # db write class test
$table = 'test_foo'; $table = 'test_foo';