1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-12 04:36:32 +02:00
Files
php-phpbb/phpBB/phpbb/db/tools/sqlite3.php
rxu 6a8140e82b [ticket/17232] Improve SQL error messages handling
PHP 7 changes how most errors are reported by PHP. Instead of reporting errors
through the traditional error reporting mechanism used by PHP 5, most errors
are now reported by throwing Error exceptions.
Use it to display meaningful SQL error messages instead of PHP fatal errors
for SQL errors.

PHPBB3-17232
2023-12-20 15:07:14 +07:00

40 lines
899 B
PHP

<?php
/**
*
* This file is part of the phpBB Forum Software package.
*
* @copyright (c) phpBB Limited <https://www.phpbb.com>
* @license GNU General Public License, version 2 (GPL-2.0)
*
* For full copyright and license information, please see
* the docs/CREDITS.txt file.
*
*/
namespace phpbb\db\tools;
/**
* Database Tools for handling cross-db actions such as altering columns, etc.
* Currently not supported is returning SQL for creating tables.
*/
class sqlite3 extends tools
{
/**
* {@inheritDoc}
*/
function sql_table_exists($table_name)
{
$this->db->sql_return_on_error(true);
$result = $this->db->sql_query("SELECT name FROM sqlite_master WHERE type='table' AND name='{$table_name}'");
$this->db->sql_return_on_error(false);
if (!empty($this->db->sql_fetchrowset($result)))
{
$this->db->sql_freeresult($result);
return true;
}
return false;
}
}