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:
parent
1e6ed3f0f5
commit
e8afa29013
@ -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}
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user