mirror of
https://github.com/phpbb/phpbb.git
synced 2025-05-29 18:50:25 +02:00
any_char and one_char being public
added comment to firebird class for obtaining version removed the use of prepared statements, the implementation is buggy and non-functional (types are missing) git-svn-id: file:///svn/phpbb/trunk@9265 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
8db4022604
commit
6bfa84bb74
@ -186,12 +186,12 @@ abstract class phpbb_dbal
|
|||||||
/**
|
/**
|
||||||
* @var string Wildcard for matching any (%) character within LIKE expressions
|
* @var string Wildcard for matching any (%) character within LIKE expressions
|
||||||
*/
|
*/
|
||||||
protected $any_char;
|
public $any_char;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string Wildcard for matching exactly one (_) character within LIKE expressions
|
* @var string Wildcard for matching exactly one (_) character within LIKE expressions
|
||||||
*/
|
*/
|
||||||
protected $one_char;
|
public $one_char;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var array Storing cached result rowset
|
* @var array Storing cached result rowset
|
||||||
|
@ -75,7 +75,84 @@ class dbal_firebird extends dbal
|
|||||||
{
|
{
|
||||||
return @ibase_server_info($this->service_handle, IBASE_SVC_SERVER_VERSION);
|
return @ibase_server_info($this->service_handle, IBASE_SVC_SERVER_VERSION);
|
||||||
}
|
}
|
||||||
|
/* // check the version of FB, use some hackery if we can't get access to the server info
|
||||||
|
if ($db->service_handle !== false && strtolower($dbuser) == 'sysdba')
|
||||||
|
{
|
||||||
|
$val = @ibase_server_info($db->service_handle, IBASE_SVC_SERVER_VERSION);
|
||||||
|
preg_match('#V([\d.]+)#', $val, $match);
|
||||||
|
if ($match[1] < 2)
|
||||||
|
{
|
||||||
|
$error[] = $lang['INST_ERR_DB_NO_FIREBIRD'];
|
||||||
|
}
|
||||||
|
$db_info = @ibase_db_info($db->service_handle, $dbname, IBASE_STS_HDR_PAGES);
|
||||||
|
|
||||||
|
preg_match('/^\\s*Page size\\s*(\\d+)/m', $db_info, $regs);
|
||||||
|
$page_size = intval($regs[1]);
|
||||||
|
if ($page_size < 8192)
|
||||||
|
{
|
||||||
|
$error[] = $lang['INST_ERR_DB_NO_FIREBIRD_PS'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$sql = "SELECT *
|
||||||
|
FROM RDB$FUNCTIONS
|
||||||
|
WHERE RDB$SYSTEM_FLAG IS NULL
|
||||||
|
AND RDB$FUNCTION_NAME = 'CHAR_LENGTH'";
|
||||||
|
$result = $db->sql_query($sql);
|
||||||
|
$row = $db->sql_fetchrow($result);
|
||||||
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
|
// if its a UDF, its too old
|
||||||
|
if ($row)
|
||||||
|
{
|
||||||
|
$error[] = $lang['INST_ERR_DB_NO_FIREBIRD'];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$sql = "SELECT FIRST 0 char_length('')
|
||||||
|
FROM RDB\$DATABASE";
|
||||||
|
$result = $db->sql_query($sql);
|
||||||
|
if (!$result) // This can only fail if char_length is not defined
|
||||||
|
{
|
||||||
|
$error[] = $lang['INST_ERR_DB_NO_FIREBIRD'];
|
||||||
|
}
|
||||||
|
$db->sql_freeresult($result);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Setup the stuff for our random table
|
||||||
|
$char_array = array_merge(range('A', 'Z'), range('0', '9'));
|
||||||
|
$char_len = mt_rand(7, 9);
|
||||||
|
$char_array_len = sizeof($char_array) - 1;
|
||||||
|
|
||||||
|
$final = '';
|
||||||
|
|
||||||
|
for ($i = 0; $i < $char_len; $i++)
|
||||||
|
{
|
||||||
|
$final .= $char_array[mt_rand(0, $char_array_len)];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create some random table
|
||||||
|
$sql = 'CREATE TABLE ' . $final . " (
|
||||||
|
FIELD1 VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE,
|
||||||
|
FIELD2 INTEGER DEFAULT 0 NOT NULL);";
|
||||||
|
$db->sql_query($sql);
|
||||||
|
|
||||||
|
// Create an index that should fail if the page size is less than 8192
|
||||||
|
$sql = 'CREATE INDEX ' . $final . ' ON ' . $final . '(FIELD1, FIELD2);';
|
||||||
|
$db->sql_query($sql);
|
||||||
|
|
||||||
|
if (ibase_errmsg() !== false)
|
||||||
|
{
|
||||||
|
$error[] = $lang['INST_ERR_DB_NO_FIREBIRD_PS'];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Kill the old table
|
||||||
|
$db->sql_query('DROP TABLE ' . $final . ';');
|
||||||
|
|
||||||
|
unset($final);
|
||||||
|
}
|
||||||
|
*/
|
||||||
return ($raw) ? '2.0' : 'Firebird/Interbase';
|
return ($raw) ? '2.0' : 'Firebird/Interbase';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ class phpbb_dbal_mysqli extends phpbb_dbal
|
|||||||
$row = @mysqli_fetch_assoc($result);
|
$row = @mysqli_fetch_assoc($result);
|
||||||
@mysqli_free_result($result);
|
@mysqli_free_result($result);
|
||||||
|
|
||||||
$this->sql_server_version = $row['version'];
|
$this->sql_server_version = trim($row['version']);
|
||||||
|
|
||||||
if (phpbb::registered('acm'))
|
if (phpbb::registered('acm'))
|
||||||
{
|
{
|
||||||
@ -225,6 +225,7 @@ class phpbb_dbal_mysqli extends phpbb_dbal
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle data by using prepared statements. See {@link phpbb_dbal::sql_handle_data() sql_handle_data()} for details.
|
* Handle data by using prepared statements. See {@link phpbb_dbal::sql_handle_data() sql_handle_data()} for details.
|
||||||
|
* @todo implement correctly by using types. ;)
|
||||||
*/
|
*/
|
||||||
public function sql_handle_data($type, $table, $data, $where = '')
|
public function sql_handle_data($type, $table, $data, $where = '')
|
||||||
{
|
{
|
||||||
@ -245,7 +246,7 @@ class phpbb_dbal_mysqli extends phpbb_dbal
|
|||||||
|
|
||||||
if ($where !== '')
|
if ($where !== '')
|
||||||
{
|
{
|
||||||
$query .= $where;
|
$query .= ' WHERE ' . $where;
|
||||||
}
|
}
|
||||||
|
|
||||||
$stmt = mysqli_prepare($this->db_connect_id, $query);
|
$stmt = mysqli_prepare($this->db_connect_id, $query);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user