drv->exec("ROLLBACK"); } catch (\Throwable $e) { } parent::tearDown(); } public static function tearDownAfterClass(): void { if (static::$interface) { static::dbRaze(static::$interface); @pg_close(static::$interface); static::$interface = null; } parent::tearDownAfterClass(); } protected function exec($q): bool { $q = (!is_array($q)) ? [$q] : $q; foreach ($q as $query) { set_error_handler(function($code, $msg) { throw new \Exception($msg); }); try { pg_query(static::$interface, $query); } finally { restore_error_handler(); } } return true; } protected function query(string $q) { if ($r = pg_query_params(static::$interface, $q, [])) { return pg_fetch_result($r, 0, 0); } else { return; } } }