1
0
mirror of https://github.com/MariaDB/server.git synced 2025-06-13 13:01:51 +03:00
libmysql/libmysql.c:
  code to fix #3772
  counting of field->max_length moved to mysql_store_stmt_result so
  it will work in libmysqld also
libmysqld/lib_sql.cc:
  to fix #3771 and #3775
  stmt->affected_rows specifying added
  code getting default values changed so it will add terminating /0 to
  values
sql/sql_parse.cc:
  to fix #3773
  silly mistake here :\
sql/sql_prepare.cc:
  to fix #3774 and #3776
  special function for datetime values in embedded server added
  unsigned flag now specified for values in embedded server
tests/client_test.c:
  this test fails if privilege-checking pars are disabled
  (it's the default for libmysqld)
This commit is contained in:
unknown
2004-05-15 17:07:44 +05:00
parent ae95f38200
commit 05cd698f54
5 changed files with 97 additions and 27 deletions

View File

@ -3729,28 +3729,6 @@ int cli_read_binary_rows(MYSQL_STMT *stmt)
mysql= mysql->last_used_con;
if (stmt->update_max_length && !stmt->bind_result_done)
{
/*
We must initalize the bind structure to be able to calculate
max_length
*/
MYSQL_BIND *bind, *end;
MYSQL_FIELD *field;
bzero((char*) stmt->bind, sizeof(*stmt->bind)* stmt->field_count);
for (bind= stmt->bind, end= bind + stmt->field_count, field= stmt->fields;
bind < end ;
bind++, field++)
{
bind->buffer_type= field->type;
bind->buffer_length=1;
}
mysql_stmt_bind_result(stmt, stmt->bind);
stmt->bind_result_done= 0; /* No normal bind done */
}
while ((pkt_len= net_safe_read(mysql)) != packet_error)
{
cp= net->read_pos;
@ -3768,8 +3746,6 @@ int cli_read_binary_rows(MYSQL_STMT *stmt)
memcpy((char *) cur->data, (char *) cp+1, pkt_len-1);
cur->length= pkt_len; /* To allow us to do sanity checks */
result->rows++;
if (stmt->update_max_length)
stmt_update_metadata(stmt, cur);
}
else
{
@ -3814,6 +3790,29 @@ int STDCALL mysql_stmt_store_result(MYSQL_STMT *stmt)
result->rows= 0;
stmt->data_cursor= NULL;
}
if (stmt->update_max_length && !stmt->bind_result_done)
{
/*
We must initalize the bind structure to be able to calculate
max_length
*/
MYSQL_BIND *bind, *end;
MYSQL_FIELD *field;
bzero((char*) stmt->bind, sizeof(*stmt->bind)* stmt->field_count);
for (bind= stmt->bind, end= bind + stmt->field_count, field= stmt->fields;
bind < end ;
bind++, field++)
{
bind->buffer_type= field->type;
bind->buffer_length=1;
}
mysql_stmt_bind_result(stmt, stmt->bind);
stmt->bind_result_done= 0; /* No normal bind done */
}
if ((*mysql->methods->read_binary_rows)(stmt))
{
free_root(&result->alloc, MYF(MY_KEEP_PREALLOC));
@ -3822,6 +3821,13 @@ int STDCALL mysql_stmt_store_result(MYSQL_STMT *stmt)
DBUG_RETURN(1);
}
if (stmt->update_max_length)
{
MYSQL_ROWS *cur= result->data;
for(; cur; cur=cur->next)
stmt_update_metadata(stmt, cur);
}
stmt->data_cursor= result->data;
mysql->affected_rows= stmt->affected_rows= result->rows;
stmt->read_row_func= stmt_read_row_buffered;