mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-31 22:10:45 +02:00
This should end some issues we have been having regarding the proper binary encoding of stuff. :D
Acyd Burn: quit breaking the schema :P git-svn-id: file:///svn/phpbb/trunk@6238 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
@@ -2949,78 +2949,10 @@ pagination_sep = \'{PAGINATION_SEP}\'
|
||||
unset($cfg_data);
|
||||
}
|
||||
|
||||
$query = '';
|
||||
|
||||
switch (SQL_LAYER)
|
||||
{
|
||||
case 'mssql':
|
||||
case 'mssql_odbc':
|
||||
$fields = array();
|
||||
foreach ($sql_ary as $key => $var)
|
||||
{
|
||||
$fields[] = $key;
|
||||
|
||||
if (is_null($var))
|
||||
{
|
||||
$values[] = 'NULL';
|
||||
}
|
||||
else if (is_string($var))
|
||||
{
|
||||
if ($key !== 'bbcode_bitfield')
|
||||
{
|
||||
$values[] = "'" . $db->sql_escape($var) . "'";
|
||||
}
|
||||
else
|
||||
{
|
||||
$values[] = "CAST('" . $var . "' AS varbinary)";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$values[] = (is_bool($var)) ? intval($var) : $var;
|
||||
}
|
||||
}
|
||||
$query = ' (' . implode(', ', $fields) . ') VALUES (' . implode(', ', $values) . ')';
|
||||
break;
|
||||
|
||||
case 'sqlite':
|
||||
$fields = array();
|
||||
foreach ($sql_ary as $key => $var)
|
||||
{
|
||||
$fields[] = $key;
|
||||
|
||||
if (is_null($var))
|
||||
{
|
||||
$values[] = 'NULL';
|
||||
}
|
||||
else if (is_string($var))
|
||||
{
|
||||
if ($key !== 'bbcode_bitfield')
|
||||
{
|
||||
$values[] = "'" . $db->sql_escape($var) . "'";
|
||||
}
|
||||
else
|
||||
{
|
||||
$values[] = "'" . sqlite_udf_encode_binary($var) . "'";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$values[] = (is_bool($var)) ? intval($var) : $var;
|
||||
}
|
||||
}
|
||||
$query = ' (' . implode(', ', $fields) . ') VALUES (' . implode(', ', $values) . ')';
|
||||
break;
|
||||
|
||||
default:
|
||||
$query = $db->sql_build_array('INSERT', $sql_ary);
|
||||
break;
|
||||
}
|
||||
|
||||
$db->sql_transaction('begin');
|
||||
|
||||
$sql = "INSERT INTO $sql_from
|
||||
" . $query;
|
||||
" . $db->sql_build_array('INSERT', $sql_ary);
|
||||
$db->sql_query($sql);
|
||||
|
||||
$id = $db->sql_nextid();
|
||||
|
Reference in New Issue
Block a user