1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-01-17 14:18:24 +01:00

[ticket/16740] Implement sql_table_exists for psql w/out debug spam

Failed pg_query() results in PHP notices now ...

PHPBB3-16740
This commit is contained in:
Marc Alexander 2021-03-28 11:16:11 +02:00
parent 1e6ed3f0f5
commit e8afa29013
No known key found for this signature in database
GPG Key ID: 50E0D2423696F995

View File

@ -96,6 +96,24 @@ class postgres extends tools
return $tables;
}
/**
* {@inheritDoc}
*/
function sql_table_exists($table_name)
{
$sql = "SELECT CAST(EXISTS(
SELECT FROM information_schema.tables
WHERE table_schema = 'public'
AND table_name = '" . $this->db->sql_escape($table_name) . "'
) AS INTEGER)";
$result = $this->db->sql_query_limit($sql, 1);
$row = $this->db->sql_fetchrow($result);
$table_exists = (booL) $row['exists'];
$this->db->sql_freeresult($result);
return $table_exists;
}
/**
* {@inheritDoc}
*/