diff options
Diffstat (limited to 'sql/protocol.h')
-rw-r--r-- | sql/protocol.h | 43 |
1 files changed, 28 insertions, 15 deletions
diff --git a/sql/protocol.h b/sql/protocol.h index 0e00a7c21e0..e0672240e0e 100644 --- a/sql/protocol.h +++ b/sql/protocol.h @@ -58,6 +58,8 @@ public: String *storage_packet() { return packet; } inline void free() { packet->free(); } virtual bool write(); + inline bool store(int from) + { return store_long((longlong) from); } inline bool store(uint32 from) { return store_long((longlong) from); } inline bool store(longlong from) @@ -86,9 +88,9 @@ public: CHARSET_INFO *fromcs, CHARSET_INFO *tocs)=0; virtual bool store(float from, uint32 decimals, String *buffer)=0; virtual bool store(double from, uint32 decimals, String *buffer)=0; - virtual bool store(TIME *time)=0; - virtual bool store_date(TIME *time)=0; - virtual bool store_time(TIME *time)=0; + virtual bool store(MYSQL_TIME *time)=0; + virtual bool store_date(MYSQL_TIME *time)=0; + virtual bool store_time(MYSQL_TIME *time)=0; virtual bool store(Field *field)=0; #ifdef EMBEDDED_LIBRARY int begin_dataset(); @@ -96,16 +98,25 @@ public: #else void remove_last_row() {} #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. + */ + }; + virtual enum enum_protocol_type type()= 0; }; /* Class used for the old (MySQL 4.0 protocol) */ -class Protocol_simple :public Protocol +class Protocol_text :public Protocol { public: - Protocol_simple() {} - Protocol_simple(THD *thd_arg) :Protocol(thd_arg) {} + Protocol_text() {} + Protocol_text(THD *thd_arg) :Protocol(thd_arg) {} virtual void prepare_for_resend(); virtual bool store_null(); virtual bool store_tiny(longlong from); @@ -116,25 +127,26 @@ public: virtual bool store(const char *from, uint length, CHARSET_INFO *cs); virtual bool store(const char *from, uint length, CHARSET_INFO *fromcs, CHARSET_INFO *tocs); - virtual bool store(TIME *time); - virtual bool store_date(TIME *time); - virtual bool store_time(TIME *time); + virtual bool store(MYSQL_TIME *time); + virtual bool store_date(MYSQL_TIME *time); + virtual bool store_time(MYSQL_TIME *time); virtual bool store(float nr, uint32 decimals, String *buffer); virtual bool store(double from, uint32 decimals, String *buffer); virtual bool store(Field *field); #ifdef EMBEDDED_LIBRARY void remove_last_row(); #endif + virtual enum enum_protocol_type type() { return PROTOCOL_TEXT; }; }; -class Protocol_prep :public Protocol +class Protocol_binary :public Protocol { private: uint bit_fields; public: - Protocol_prep() {} - Protocol_prep(THD *thd_arg) :Protocol(thd_arg) {} + Protocol_binary() {} + Protocol_binary(THD *thd_arg) :Protocol(thd_arg) {} virtual bool prepare_for_send(List<Item> *item_list); virtual void prepare_for_resend(); #ifdef EMBEDDED_LIBRARY @@ -150,12 +162,13 @@ public: virtual bool store(const char *from,uint length, CHARSET_INFO *cs); virtual bool store(const char *from, uint length, CHARSET_INFO *fromcs, CHARSET_INFO *tocs); - virtual bool store(TIME *time); - virtual bool store_date(TIME *time); - virtual bool store_time(TIME *time); + virtual bool store(MYSQL_TIME *time); + virtual bool store_date(MYSQL_TIME *time); + virtual bool store_time(MYSQL_TIME *time); virtual bool store(float nr, uint32 decimals, String *buffer); virtual bool store(double from, uint32 decimals, String *buffer); virtual bool store(Field *field); + virtual enum enum_protocol_type type() { return PROTOCOL_BINARY; }; }; void send_warning(THD *thd, uint sql_errno, const char *err=0); |