Reapplying patch

Check for NULLs only if we don't replace column results,
  get real results after all checks.
  (see bug #14254: func_crypt.test fails on FreeBSD with --ps-protocol).

Remove two FIXME's
parent 32f6ece3
...@@ -3043,8 +3043,6 @@ static void append_stmt_result(DYNAMIC_STRING *ds, MYSQL_STMT* stmt, ...@@ -3043,8 +3043,6 @@ static void append_stmt_result(DYNAMIC_STRING *ds, MYSQL_STMT* stmt,
my_bool *is_null; my_bool *is_null;
ulong *length; ulong *length;
ulonglong num_rows; ulonglong num_rows;
/* FIXME we don't handle vertical display ..... */
uint col_idx, row_idx; uint col_idx, row_idx;
/* Allocate array with bind structs, lengths and NULL flags */ /* Allocate array with bind structs, lengths and NULL flags */
...@@ -3088,19 +3086,23 @@ static void append_stmt_result(DYNAMIC_STRING *ds, MYSQL_STMT* stmt, ...@@ -3088,19 +3086,23 @@ static void append_stmt_result(DYNAMIC_STRING *ds, MYSQL_STMT* stmt,
/* Read result from each column */ /* Read result from each column */
for (col_idx= 0; col_idx < num_fields; col_idx++) for (col_idx= 0; col_idx < num_fields; col_idx++)
{ {
/* FIXME is string terminated? */ const char *val;
const char *val= (const char *)bind[col_idx].buffer; ulonglong len;
ulonglong len= *bind[col_idx].length;
if (col_idx < max_replace_column && replace_column[col_idx]) if (col_idx < max_replace_column && replace_column[col_idx])
{ {
val= replace_column[col_idx]; val= replace_column[col_idx];
len= strlen(val); len= strlen(val);
} }
if (*bind[col_idx].is_null) else if (*bind[col_idx].is_null)
{ {
val= "NULL"; val= "NULL";
len= 4; len= 4;
} }
else
{
val= (const char *) bind[col_idx].buffer;
len= *bind[col_idx].length;
}
if (!display_result_vertically) if (!display_result_vertically)
{ {
if (col_idx) /* No tab before first col */ if (col_idx) /* No tab before first col */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment