summaryrefslogtreecommitdiff
path: root/sql/protocol.h
diff options
context:
space:
mode:
authorSergey Petrunya <psergey@askmonty.org>2011-08-23 19:28:32 +0400
committerSergey Petrunya <psergey@askmonty.org>2011-08-23 19:28:32 +0400
commit7e66213444a5af73879b57ad0b5bd7476b5c6f4d (patch)
tree6939d6b4b4cea99971b19fd7ad97e8096ad26ebf /sql/protocol.h
parentd2206ad14920e85907c965256e1ce061633c36ee (diff)
downloadmariadb-git-7e66213444a5af73879b57ad0b5bd7476b5c6f4d.tar.gz
MWL#182: Explain running statements
First code - "Asynchronous procedure call" system - new THD::check_killed() that serves APC request is called from within most important loops - EXPLAIN code is now able to generate EXPLAIN output on-the-fly [incomplete] Parts that are still missing: - put THD::check_killed() call into every loop where we could spend significant amount of time - Make sure EXPLAIN code works for group-by queries that replace JOIN::join_tab with make_simple_join() and other such cases. - User interface: what error code to use, where to get timeout settings from, etc.
Diffstat (limited to 'sql/protocol.h')
-rw-r--r--sql/protocol.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/sql/protocol.h b/sql/protocol.h
index e07af5208db..7a882e8a10d 100644
--- a/sql/protocol.h
+++ b/sql/protocol.h
@@ -28,6 +28,7 @@ class Protocol
protected:
THD *thd;
String *packet;
+ /* Used by net_store_data() for charset conversions */
String *convert;
uint field_pos;
#ifndef DBUG_OFF
@@ -42,6 +43,10 @@ protected:
MYSQL_FIELD *next_mysql_field;
MEM_ROOT *alloc;
#endif
+ /*
+ The following two are low-level functions that are invoked from
+ higher-level store_xxx() funcs. The data is stored into this->packet.
+ */
bool net_store_data(const uchar *from, size_t length,
CHARSET_INFO *fromcs, CHARSET_INFO *tocs);
bool store_string_aux(const char *from, size_t length,
@@ -55,6 +60,20 @@ public:
enum { SEND_NUM_ROWS= 1, SEND_DEFAULTS= 2, SEND_EOF= 4 };
virtual bool send_fields(List<Item> *list, uint flags);
+ void get_packet(const char **start, size_t *length)
+ {
+ *start= packet->ptr();
+ *length= packet->length();
+ }
+ void set_packet(const char *start, size_t len)
+ {
+ packet->length(0);
+ packet->append(start, len);
+#ifndef DBUG_OFF
+ field_pos= field_count - 1;
+#endif
+ }
+
bool store(I_List<i_string> *str_list);
bool store(const char *from, CHARSET_INFO *cs);
String *storage_packet() { return packet; }