mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-08 04:18:52 +00: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
1 changed files with 18 additions and 0 deletions
|
@ -96,6 +96,24 @@ class postgres extends tools
|
||||||
return $tables;
|
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}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Add table
Reference in a new issue