mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-07 02:31:40 +09:00
Issue 2291: Mysqli prepared statements - LONGTEXT columns always come back empty
git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.3.2@11083 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
4859bc8bd9
commit
c326a5bfbb
1 changed files with 15 additions and 2 deletions
|
|
@ -217,8 +217,14 @@
|
|||
$stmt = $result;
|
||||
$meta = mysqli_stmt_result_metadata($stmt);
|
||||
$fields = mysqli_fetch_fields($meta);
|
||||
|
||||
foreach($fields as $field)
|
||||
|
||||
/**
|
||||
* Mysqli has a bug that causes LONGTEXT columns not to get loaded
|
||||
* Unless store_result is called before
|
||||
* MYSQLI_TYPE for longtext is 252
|
||||
*/
|
||||
$longtext_exists = false;
|
||||
foreach($fields as $field)
|
||||
{
|
||||
if(isset($resultArray[$field->name])) // When joined tables are used and the same column name appears twice, we should add it separately, otherwise bind_result fails
|
||||
$field->name = 'repeat_' . $field->name;
|
||||
|
|
@ -226,9 +232,16 @@
|
|||
// Array passed needs to contain references, not values
|
||||
$row[$field->name] = "";
|
||||
$resultArray[$field->name] = &$row[$field->name];
|
||||
|
||||
if($field->type == 252) $longtext_exists = true;
|
||||
}
|
||||
$resultArray = array_merge(array($stmt), $resultArray);
|
||||
|
||||
if($longtext_exists)
|
||||
{
|
||||
mysqli_stmt_store_result($stmt);
|
||||
}
|
||||
|
||||
call_user_func_array('mysqli_stmt_bind_result', $resultArray);
|
||||
|
||||
$rows = array();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue