diff options
author | unknown <konstantin@mysql.com> | 2004-10-21 18:44:40 +0400 |
---|---|---|
committer | unknown <konstantin@mysql.com> | 2004-10-21 18:44:40 +0400 |
commit | c8ad5215eae17b892c2de145136539f0bf0492c5 (patch) | |
tree | 3c06a9f4e06fd4a071292b3d409c2140d5aa0654 /sql/sql_class.h | |
parent | 0da47eae2491b53af11f0e06226de3d0052fc28a (diff) | |
parent | 506f648b3a104bf107ebe7a49bcf6b044682a7b8 (diff) | |
download | mariadb-git-c8ad5215eae17b892c2de145136539f0bf0492c5.tar.gz |
Manual merge.
sql/sql_class.h:
Auto merged
sql/sql_prepare.cc:
Auto merged
tests/client_test.c:
Manual merge
Diffstat (limited to 'sql/sql_class.h')
-rw-r--r-- | sql/sql_class.h | 45 |
1 files changed, 28 insertions, 17 deletions
diff --git a/sql/sql_class.h b/sql/sql_class.h index c30e1c321b0..8e3a0b59940 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -1112,6 +1112,13 @@ public: unit= u; return 0; } + /* + Because of peculiarities of prepared statements protocol + we need to know number of columns in the result set (if + there is a result set) apart from sending columns metadata. + */ + virtual uint field_count(List<Item> &fields) const + { return fields.elements; } virtual bool send_fields(List<Item> &list,uint flag)=0; virtual bool send_data(List<Item> &items)=0; virtual bool initialize_tables (JOIN *join=0) { return 0; } @@ -1126,6 +1133,20 @@ public: }; +/* + Base class for select_result descendands which intercept and + transform result set rows. As the rows are not sent to the client, + sending of result set metadata should be suppressed as well. +*/ + +class select_result_interceptor: public select_result +{ +public: + uint field_count(List<Item> &fields) const { return 0; } + bool send_fields(List<Item> &fields, uint flag) { return FALSE; } +}; + + class select_send :public select_result { public: select_send() {} @@ -1135,7 +1156,7 @@ public: }; -class select_to_file :public select_result { +class select_to_file :public select_result_interceptor { protected: sql_exchange *exchange; File file; @@ -1147,7 +1168,6 @@ public: select_to_file(sql_exchange *ex) :exchange(ex), file(-1),row_count(0L) { path[0]=0; } ~select_to_file(); - bool send_fields(List<Item> &list, uint flag) { return 0; } void send_error(uint errcode,const char *err); bool send_eof(); void cleanup(); @@ -1174,7 +1194,7 @@ public: }; -class select_insert :public select_result { +class select_insert :public select_result_interceptor { public: TABLE *table; List<Item> *fields; @@ -1190,8 +1210,6 @@ class select_insert :public select_result { } ~select_insert(); int prepare(List<Item> &list, SELECT_LEX_UNIT *u); - bool send_fields(List<Item> &list, uint flag) - { return 0; } bool send_data(List<Item> &items); void send_error(uint errcode,const char *err); bool send_eof(); @@ -1274,7 +1292,7 @@ public: } }; -class select_union :public select_result { +class select_union :public select_result_interceptor { public: TABLE *table; COPY_INFO info; @@ -1283,8 +1301,6 @@ class select_union :public select_result { select_union(TABLE *table_par); ~select_union(); int prepare(List<Item> &list, SELECT_LEX_UNIT *u); - bool send_fields(List<Item> &list, uint flag) - { return 0; } bool send_data(List<Item> &items); bool send_eof(); bool flush(); @@ -1292,13 +1308,12 @@ class select_union :public select_result { }; /* Base subselect interface class */ -class select_subselect :public select_result +class select_subselect :public select_result_interceptor { protected: Item_subselect *item; public: select_subselect(Item_subselect *item); - bool send_fields(List<Item> &list, uint flag) { return 0; }; bool send_data(List<Item> &items)=0; bool send_eof() { return 0; }; }; @@ -1435,7 +1450,7 @@ public: }; -class multi_delete :public select_result +class multi_delete :public select_result_interceptor { TABLE_LIST *delete_tables, *table_being_deleted; Unique **tempfiles; @@ -1448,8 +1463,6 @@ public: multi_delete(THD *thd, TABLE_LIST *dt, uint num_of_tables); ~multi_delete(); int prepare(List<Item> &list, SELECT_LEX_UNIT *u); - bool send_fields(List<Item> &list, - uint flag) { return 0; } bool send_data(List<Item> &items); bool initialize_tables (JOIN *join); void send_error(uint errcode,const char *err); @@ -1458,7 +1471,7 @@ public: }; -class multi_update :public select_result +class multi_update :public select_result_interceptor { TABLE_LIST *all_tables, *update_tables, *table_being_updated; THD *thd; @@ -1477,7 +1490,6 @@ public: List<Item> *values, enum_duplicates handle_duplicates); ~multi_update(); int prepare(List<Item> &list, SELECT_LEX_UNIT *u); - bool send_fields(List<Item> &list, uint flag) { return 0; } bool send_data(List<Item> &items); bool initialize_tables (JOIN *join); void send_error(uint errcode,const char *err); @@ -1486,7 +1498,7 @@ public: }; -class select_dumpvar :public select_result { +class select_dumpvar :public select_result_interceptor { ha_rows row_count; public: List<LEX_STRING> var_list; @@ -1494,7 +1506,6 @@ public: select_dumpvar(void) { var_list.empty(); vars.empty(); row_count=0;} ~select_dumpvar() {} int prepare(List<Item> &list, SELECT_LEX_UNIT *u); - bool send_fields(List<Item> &list, uint flag) {return 0;} bool send_data(List<Item> &items); bool send_eof(); void cleanup(); |