diff options
author | Konstantin Osipov <kostja@sun.com> | 2009-10-22 00:02:06 +0400 |
---|---|---|
committer | Konstantin Osipov <kostja@sun.com> | 2009-10-22 00:02:06 +0400 |
commit | d4632dff5aea3eacfe3c6a126c6b8ca9c839b5ec (patch) | |
tree | 5a3482665c78a3698f529755e2407524f79327d9 /sql/protocol.h | |
parent | 2b91a639cc767928ca063a466b4058e22f8fb7ff (diff) | |
download | mariadb-git-d4632dff5aea3eacfe3c6a126c6b8ca9c839b5ec.tar.gz |
Backport of revno 2630.28.10, 2630.28.31, 2630.28.26, 2630.33.1,
2630.39.1, 2630.28.29, 2630.34.3, 2630.34.2, 2630.34.1, 2630.29.29,
2630.29.28, 2630.31.1, 2630.28.13, 2630.28.10, 2617.23.14 and
some other minor revisions.
This patch implements:
WL#4264 "Backup: Stabilize Service Interface" -- all the
server prerequisites except si_objects.{h,cc} themselves (they can
be just copied over, when needed).
WL#4435: Support OUT-parameters in prepared statements.
(and all issues in the initial patches for these two
tasks, that were discovered in pushbuild and during testing).
Bug#39519: mysql_stmt_close() should flush all data
associated with the statement.
After execution of a prepared statement, send OUT parameters of the invoked
stored procedure, if any, to the client.
When using the binary protocol, send the parameters in an additional result
set over the wire. When using the text protocol, assign out parameters to
the user variables from the CALL(@var1, @var2, ...) specification.
The following refactoring has been made:
- Protocol::send_fields() was renamed to Protocol::send_result_set_metadata();
- A new Protocol::send_result_set_row() was introduced to incapsulate
common functionality for sending row data.
- Signature of Protocol::prepare_for_send() was changed: this operation
does not need a list of items, the number of items is fully sufficient.
The following backward incompatible changes have been made:
- CLIENT_MULTI_RESULTS is now enabled by default in the client;
- CLIENT_PS_MULTI_RESUTLS is now enabled by default in the client.
Diffstat (limited to 'sql/protocol.h')
-rw-r--r-- | sql/protocol.h | 36 |
1 files changed, 28 insertions, 8 deletions
diff --git a/sql/protocol.h b/sql/protocol.h index 3b6a3bdb863..4ba874594c3 100644 --- a/sql/protocol.h +++ b/sql/protocol.h @@ -21,6 +21,7 @@ class i_string; class THD; +class Item_param; typedef struct st_mysql_field MYSQL_FIELD; typedef struct st_mysql_rows MYSQL_ROWS; @@ -47,6 +48,16 @@ protected: CHARSET_INFO *fromcs, CHARSET_INFO *tocs); bool store_string_aux(const char *from, size_t length, CHARSET_INFO *fromcs, CHARSET_INFO *tocs); + + virtual bool send_ok(uint server_status, uint statement_warn_count, + ulonglong affected_rows, ulonglong last_insert_id, + const char *message); + + virtual bool send_eof(uint server_status, uint statement_warn_count); + + virtual bool send_error(uint sql_errno, const char *err_msg, + const char *sql_state); + public: Protocol() {} Protocol(THD *thd_arg) { init(thd_arg); } @@ -54,7 +65,8 @@ public: void init(THD* thd_arg); enum { SEND_NUM_ROWS= 1, SEND_DEFAULTS= 2, SEND_EOF= 4 }; - virtual bool send_fields(List<Item> *list, uint flags); + virtual bool send_result_set_metadata(List<Item> *list, uint flags); + bool send_result_set_row(List<Item> *row_items); bool store(I_List<i_string> *str_list); bool store(const char *from, CHARSET_INFO *cs); @@ -72,9 +84,9 @@ public: inline bool store(String *str) { return store((char*) str->ptr(), str->length(), str->charset()); } - virtual bool prepare_for_send(List<Item> *item_list) + virtual bool prepare_for_send(uint num_columns) { - field_count=item_list->elements; + field_count= num_columns; return 0; } virtual bool flush(); @@ -96,6 +108,8 @@ public: virtual bool store_date(MYSQL_TIME *time)=0; virtual bool store_time(MYSQL_TIME *time)=0; virtual bool store(Field *field)=0; + + virtual bool send_out_parameters(List<Item_param> *sp_params)=0; #ifdef EMBEDDED_LIBRARY int begin_dataset(); virtual void remove_last_row() {} @@ -104,13 +118,15 @@ public: #endif enum enum_protocol_type { - PROTOCOL_TEXT= 0, PROTOCOL_BINARY= 1 /* - before adding here or change the values, consider that it is cast to a - bit in sql_cache.cc. + Before adding a new type, please make sure + there is enough storage for it in Query_cache_query_flags. */ + PROTOCOL_TEXT= 0, PROTOCOL_BINARY= 1, PROTOCOL_LOCAL= 2 }; virtual enum enum_protocol_type type()= 0; + + void end_statement(); }; @@ -137,6 +153,8 @@ public: virtual bool store(float nr, uint32 decimals, String *buffer); virtual bool store(double from, uint32 decimals, String *buffer); virtual bool store(Field *field); + + virtual bool send_out_parameters(List<Item_param> *sp_params); #ifdef EMBEDDED_LIBRARY void remove_last_row(); #endif @@ -151,7 +169,7 @@ private: public: Protocol_binary() {} Protocol_binary(THD *thd_arg) :Protocol(thd_arg) {} - virtual bool prepare_for_send(List<Item> *item_list); + virtual bool prepare_for_send(uint num_columns); virtual void prepare_for_resend(); #ifdef EMBEDDED_LIBRARY virtual bool write(); @@ -172,13 +190,15 @@ public: virtual bool store(float nr, uint32 decimals, String *buffer); virtual bool store(double from, uint32 decimals, String *buffer); virtual bool store(Field *field); + + virtual bool send_out_parameters(List<Item_param> *sp_params); + virtual enum enum_protocol_type type() { return PROTOCOL_BINARY; }; }; void send_warning(THD *thd, uint sql_errno, const char *err=0); bool net_send_error(THD *thd, uint sql_errno, const char *err, const char* sqlstate); -void net_end_statement(THD *thd); bool send_old_password_request(THD *thd); uchar *net_store_data(uchar *to,const uchar *from, size_t length); uchar *net_store_data(uchar *to,int32 from); |