diff options
author | unknown <pem@mysql.telia.com> | 2003-10-10 16:57:21 +0200 |
---|---|---|
committer | unknown <pem@mysql.telia.com> | 2003-10-10 16:57:21 +0200 |
commit | 04c6b9b8d8c10fd83ab80f1a3e2d6bd58b34b825 (patch) | |
tree | 502f5a108855c24da25af7d42aa635d0a3c5103b /sql/protocol_cursor.cc | |
parent | 4379cbcf3056a33f41ddf489828203a6c03e793f (diff) | |
download | mariadb-git-04c6b9b8d8c10fd83ab80f1a3e2d6bd58b34b825.tar.gz |
WL#962: Added simple, read-only, non-scrolling, asensitive cursors in SPs, using the
(updated) Protocol_cursor class.
Also did some bug fixes.
Docs/sp-imp-spec.txt:
Added CURSOR docs (and fixed typos)
Docs/sp-implemented.txt:
Updated for CURSORs
include/mysqld_error.h:
New error codes/messages for CURSORs
libmysqld/Makefile.am:
SP cursors now needs this.
mysql-test/r/sp-error.result:
New tests for cursors.
mysql-test/r/sp.result:
New tests for cursors.
mysql-test/t/sp-error.test:
New tests for cursors.
mysql-test/t/sp.test:
New tests for cursors.
sql/protocol.cc:
We now always have Protocol_cursor (SPs use it)
sql/protocol.h:
Fixed bugs in Protocol_cursor (for SPs)
sql/protocol_cursor.cc:
Fixed bugs in Protocol_cursor (for SPs)
sql/share/czech/errmsg.txt:
New error codes/messages for CURSORs
sql/share/danish/errmsg.txt:
New error codes/messages for CURSORs
sql/share/dutch/errmsg.txt:
New error codes/messages for CURSORs
sql/share/english/errmsg.txt:
New error codes/messages for CURSORs
sql/share/estonian/errmsg.txt:
New error codes/messages for CURSORs
sql/share/french/errmsg.txt:
New error codes/messages for CURSORs
sql/share/german/errmsg.txt:
New error codes/messages for CURSORs
sql/share/greek/errmsg.txt:
New error codes/messages for CURSORs
sql/share/hungarian/errmsg.txt:
New error codes/messages for CURSORs
sql/share/italian/errmsg.txt:
New error codes/messages for CURSORs
sql/share/japanese/errmsg.txt:
New error codes/messages for CURSORs
sql/share/korean/errmsg.txt:
New error codes/messages for CURSORs
sql/share/norwegian-ny/errmsg.txt:
New error codes/messages for CURSORs
sql/share/norwegian/errmsg.txt:
New error codes/messages for CURSORs
sql/share/polish/errmsg.txt:
New error codes/messages for CURSORs
sql/share/portuguese/errmsg.txt:
New error codes/messages for CURSORs
sql/share/romanian/errmsg.txt:
New error codes/messages for CURSORs
sql/share/russian/errmsg.txt:
New error codes/messages for CURSORs
sql/share/serbian/errmsg.txt:
New error codes/messages for CURSORs
sql/share/slovak/errmsg.txt:
New error codes/messages for CURSORs
sql/share/spanish/errmsg.txt:
New error codes/messages for CURSORs
sql/share/swedish/errmsg.txt:
New error codes/messages for CURSORs
sql/share/ukrainian/errmsg.txt:
New error codes/messages for CURSORs
sql/sp_head.cc:
Added cursor support.
Also fixed problems with item_lists, where pointers and ref_pointer_arrays.
sql/sp_head.h:
Added cursor support
sql/sp_pcontext.cc:
Added cursor support
sql/sp_pcontext.h:
Added cursor support
sql/sp_rcontext.cc:
Added cursor support, in particular the new sp_cursor class.
sql/sp_rcontext.h:
Added cursor support, in particular the new sp_cursor class.
sql/sql_lex.h:
We sometimes need to copy item_lists in LEX when executing substatements in SPs
sql/sql_yacc.yy:
Added minimal cursor support (not the full syntax yet).
Diffstat (limited to 'sql/protocol_cursor.cc')
-rw-r--r-- | sql/protocol_cursor.cc | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/sql/protocol_cursor.cc b/sql/protocol_cursor.cc index 19e3bb06d74..abb391fbd67 100644 --- a/sql/protocol_cursor.cc +++ b/sql/protocol_cursor.cc @@ -51,6 +51,7 @@ bool Protocol_cursor::send_fields(List<Item> *list, uint flag) client_field->name= strdup_root(alloc, server_field.col_name); client_field->org_table= strdup_root(alloc, server_field.org_table_name); client_field->org_name= strdup_root(alloc, server_field.org_col_name); + client_field->catalog= strdup_root(alloc, ""); client_field->length= server_field.length; client_field->type= server_field.type; client_field->flags= server_field.flags; @@ -60,6 +61,7 @@ bool Protocol_cursor::send_fields(List<Item> *list, uint flag) client_field->name_length= strlen(client_field->name); client_field->org_name_length= strlen(client_field->org_name); client_field->org_table_length= strlen(client_field->org_table); + client_field->catalog_length= 0; client_field->charsetnr= server_field.charsetnr; if (INTERNAL_NUM_FIELD(client_field)) @@ -100,17 +102,17 @@ bool Protocol_cursor::write() byte *to; new_record= (MYSQL_ROWS *)alloc_root(alloc, - sizeof(MYSQL_ROWS) + (field_count + 1)*sizeof(char *) + packet->length()); + sizeof(MYSQL_ROWS) + (field_count + 1)*sizeof(char *) + packet->length()); if (!new_record) goto err; data= (byte **)(new_record + 1); new_record->data= (char **)data; - to= (byte *)(fields + field_count + 1); + to= (byte *)data + (field_count + 1)*sizeof(char *); for (; cur_field < fields_end; ++cur_field, ++data) { - if ((len=net_field_length((uchar **)&cp))) + if ((len= net_field_length((uchar **)&cp)) == 0) { *data= 0; } @@ -121,6 +123,7 @@ bool Protocol_cursor::write() // TODO error signal send_error(thd, CR_MALFORMED_PACKET); return TRUE; } + *data= to; memcpy(to,(char*) cp,len); to[len]=0; to+=len+1; @@ -129,6 +132,7 @@ bool Protocol_cursor::write() cur_field->max_length=len; } } + *data= 0; *prev_record= new_record; prev_record= &new_record->next; @@ -139,5 +143,3 @@ bool Protocol_cursor::write() // TODO error signal send_error(thd, ER_OUT_OF_RESOURCES); return TRUE; } - - |