diff options
author | unknown <hf@deer.(none)> | 2004-05-15 17:07:44 +0500 |
---|---|---|
committer | unknown <hf@deer.(none)> | 2004-05-15 17:07:44 +0500 |
commit | 05cd698f542f295b4fcd28d4704bce0f37e534ca (patch) | |
tree | 925a39dedaa9aafde9d5be890ca8a898aeb7f4bc /libmysql/libmysql.c | |
parent | ae95f38200b226191a290cf840e0d06b17304f82 (diff) | |
download | mariadb-git-05cd698f542f295b4fcd28d4704bce0f37e534ca.tar.gz |
Fixes for #3371, #3372, #3374, #3375, #3376
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)
Diffstat (limited to 'libmysql/libmysql.c')
-rw-r--r-- | libmysql/libmysql.c | 54 |
1 files changed, 30 insertions, 24 deletions
diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index a467b7fc9fd..2214ca68c81 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -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; |