diff options
author | unknown <dlenev@mysql.com> | 2006-02-27 20:00:03 +0300 |
---|---|---|
committer | unknown <dlenev@mysql.com> | 2006-02-27 20:00:03 +0300 |
commit | 6e7d47e243ee6fef13392fba7d3995c58d16fd87 (patch) | |
tree | a889c7ecad09d0d8e0c342201479d0fecdbbce12 /sql | |
parent | ac24b2b7282d1fb3575cf1db842a60e7892bd9ef (diff) | |
parent | a431e91279b53652f50f2a2ccab0e5ea62db4cc9 (diff) | |
download | mariadb-git-6e7d47e243ee6fef13392fba7d3995c58d16fd87.tar.gz |
Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into mysql.com:/home/dlenev/src/mysql-5.0-bg13525
sql/field.cc:
Auto merged
sql/sql_base.cc:
Auto merged
sql/sql_parse.cc:
Auto merged
sql/sql_table.cc:
Auto merged
sql/sql_select.h:
Manual merge.
Diffstat (limited to 'sql')
-rw-r--r-- | sql/field.cc | 2 | ||||
-rw-r--r-- | sql/ha_myisammrg.cc | 22 | ||||
-rw-r--r-- | sql/handler.h | 2 | ||||
-rw-r--r-- | sql/item.cc | 3 | ||||
-rw-r--r-- | sql/item.h | 5 | ||||
-rw-r--r-- | sql/item_cmpfunc.h | 17 | ||||
-rw-r--r-- | sql/log_event.h | 1 | ||||
-rw-r--r-- | sql/mysql_priv.h | 7 | ||||
-rw-r--r-- | sql/mysqld.cc | 2 | ||||
-rw-r--r-- | sql/opt_range.cc | 10 | ||||
-rw-r--r-- | sql/parse_file.h | 3 | ||||
-rw-r--r-- | sql/protocol.cc | 82 | ||||
-rw-r--r-- | sql/protocol.h | 9 | ||||
-rw-r--r-- | sql/sp_rcontext.h | 1 | ||||
-rw-r--r-- | sql/spatial.h | 16 | ||||
-rw-r--r-- | sql/sql_base.cc | 13 | ||||
-rw-r--r-- | sql/sql_cache.h | 6 | ||||
-rw-r--r-- | sql/sql_class.cc | 3 | ||||
-rw-r--r-- | sql/sql_class.h | 18 | ||||
-rw-r--r-- | sql/sql_cursor.cc | 1 | ||||
-rw-r--r-- | sql/sql_db.cc | 8 | ||||
-rw-r--r-- | sql/sql_parse.cc | 40 | ||||
-rw-r--r-- | sql/sql_prepare.cc | 11 | ||||
-rw-r--r-- | sql/sql_select.h | 2 | ||||
-rw-r--r-- | sql/sql_table.cc | 4 | ||||
-rw-r--r-- | sql/sql_update.cc | 2 | ||||
-rw-r--r-- | sql/table.h | 4 | ||||
-rw-r--r-- | sql/tztime.cc | 2 | ||||
-rw-r--r-- | sql/tztime.h | 1 |
29 files changed, 198 insertions, 99 deletions
diff --git a/sql/field.cc b/sql/field.cc index 35312caf313..eab62cd1958 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -5262,7 +5262,7 @@ int Field_date::store(longlong nr, bool unsigned_val) } if (nr >= 19000000000000.0 && nr <= 99991231235959.0) - nr=floor(nr/1000000.0); // Timestamp to date + nr= (longlong) floor(nr/1000000.0); // Timestamp to date if (error) set_datetime_warning(MYSQL_ERROR::WARN_LEVEL_WARN, diff --git a/sql/ha_myisammrg.cc b/sql/ha_myisammrg.cc index da4136def68..9780f163634 100644 --- a/sql/ha_myisammrg.cc +++ b/sql/ha_myisammrg.cc @@ -288,7 +288,27 @@ void ha_myisammrg::info(uint flag) table->s->db_options_in_use= info.options; table->s->is_view= 1; mean_rec_length= info.reclength; - block_size=0; + + /* + The handler::block_size is used all over the code in index scan cost + calculations. It is used to get number of disk seeks required to + retrieve a number of index tuples. + If the merge table has N underlying tables, then (assuming underlying + tables have equal size, the only "simple" approach we can use) + retrieving X index records from a merge table will require N times more + disk seeks compared to doing the same on a MyISAM table with equal + number of records. + In the edge case (file_tables > myisam_block_size) we'll get + block_size==0, and index calculation code will act as if we need one + disk seek to retrieve one index tuple. + + TODO: In 5.2 index scan cost calculation will be factored out into a + virtual function in class handler and we'll be able to remove this hack. + */ + block_size= 0; + if (file->tables) + block_size= myisam_block_size / file->tables; + update_time=0; #if SIZEOF_OFF_T > 4 ref_length=6; // Should be big enough diff --git a/sql/handler.h b/sql/handler.h index 24cb9646d36..977bd77a54e 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -231,6 +231,7 @@ struct xid_t { long bqual_length; char data[XIDDATASIZE]; // not \0-terminated ! + xid_t() {} /* Remove gcc warning */ bool eq(struct xid_t *xid) { return eq(xid->gtrid_length, xid->bqual_length, xid->data); } bool eq(long g, long b, const char *d) @@ -463,6 +464,7 @@ typedef class Item COND; typedef struct st_ha_check_opt { + st_ha_check_opt() {} /* Remove gcc warning */ ulong sort_buffer_size; uint flags; /* isam layer flags (e.g. for myisamchk) */ uint sql_flags; /* sql layer flags - for something myisamchk cannot do */ diff --git a/sql/item.cc b/sql/item.cc index 367452444d2..3d454969c1d 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -375,9 +375,6 @@ void Item::print_item_w_name(String *str) void Item::cleanup() { DBUG_ENTER("Item::cleanup"); - DBUG_PRINT("info", ("Item: 0x%lx, Type: %d, name %s, original name %s", - this, (int)type(), name ? name : "(null)", - orig_name ? orig_name : "null")); fixed=0; marker= 0; if (orig_name) diff --git a/sql/item.h b/sql/item.h index 8feba903bb2..2029658d476 100644 --- a/sql/item.h +++ b/sql/item.h @@ -164,7 +164,8 @@ struct Hybrid_type_traits virtual my_decimal *val_decimal(Hybrid_type *val, my_decimal *buf) const; virtual String *val_str(Hybrid_type *val, String *buf, uint8 decimals) const; static const Hybrid_type_traits *instance(); - Hybrid_type_traits() {}; + Hybrid_type_traits() {} + virtual ~Hybrid_type_traits() {} }; @@ -339,6 +340,7 @@ private: bool save_resolve_in_select_list; public: + Name_resolution_context_state() {} /* Remove gcc warning */ TABLE_LIST *save_next_local; public: @@ -1015,6 +1017,7 @@ bool agg_item_charsets(DTCollation &c, const char *name, class Item_num: public Item { public: + Item_num() {} /* Remove gcc warning */ virtual Item_num *neg()= 0; Item *safe_charset_converter(CHARSET_INFO *tocs); }; diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h index 15aebd2492c..89aafa5721e 100644 --- a/sql/item_cmpfunc.h +++ b/sql/item_cmpfunc.h @@ -128,6 +128,8 @@ public: class Comp_creator { public: + Comp_creator() {} /* Remove gcc warning */ + virtual ~Comp_creator() {} /* Remove gcc warning */ virtual Item_bool_func2* create(Item *a, Item *b) const = 0; virtual const char* symbol(bool invert) const = 0; virtual bool eqne_op() const = 0; @@ -137,6 +139,8 @@ public: class Eq_creator :public Comp_creator { public: + Eq_creator() {} /* Remove gcc warning */ + virtual ~Eq_creator() {} /* Remove gcc warning */ virtual Item_bool_func2* create(Item *a, Item *b) const; virtual const char* symbol(bool invert) const { return invert? "<>" : "="; } virtual bool eqne_op() const { return 1; } @@ -146,6 +150,8 @@ public: class Ne_creator :public Comp_creator { public: + Ne_creator() {} /* Remove gcc warning */ + virtual ~Ne_creator() {} /* Remove gcc warning */ virtual Item_bool_func2* create(Item *a, Item *b) const; virtual const char* symbol(bool invert) const { return invert? "=" : "<>"; } virtual bool eqne_op() const { return 1; } @@ -155,6 +161,8 @@ public: class Gt_creator :public Comp_creator { public: + Gt_creator() {} /* Remove gcc warning */ + virtual ~Gt_creator() {} /* Remove gcc warning */ virtual Item_bool_func2* create(Item *a, Item *b) const; virtual const char* symbol(bool invert) const { return invert? "<=" : ">"; } virtual bool eqne_op() const { return 0; } @@ -164,6 +172,8 @@ public: class Lt_creator :public Comp_creator { public: + Lt_creator() {} /* Remove gcc warning */ + virtual ~Lt_creator() {} /* Remove gcc warning */ virtual Item_bool_func2* create(Item *a, Item *b) const; virtual const char* symbol(bool invert) const { return invert? ">=" : "<"; } virtual bool eqne_op() const { return 0; } @@ -173,6 +183,8 @@ public: class Ge_creator :public Comp_creator { public: + Ge_creator() {} /* Remove gcc warning */ + virtual ~Ge_creator() {} /* Remove gcc warning */ virtual Item_bool_func2* create(Item *a, Item *b) const; virtual const char* symbol(bool invert) const { return invert? "<" : ">="; } virtual bool eqne_op() const { return 0; } @@ -182,6 +194,8 @@ public: class Le_creator :public Comp_creator { public: + Le_creator() {} /* Remove gcc warning */ + virtual ~Le_creator() {} /* Remove gcc warning */ virtual Item_bool_func2* create(Item *a, Item *b) const; virtual const char* symbol(bool invert) const { return invert? ">" : "<="; } virtual bool eqne_op() const { return 0; } @@ -739,6 +753,7 @@ class cmp_item_int :public cmp_item { longlong value; public: + cmp_item_int() {} /* Remove gcc warning */ void store_value(Item *item) { value= item->val_int(); @@ -759,6 +774,7 @@ class cmp_item_real :public cmp_item { double value; public: + cmp_item_real() {} /* Remove gcc warning */ void store_value(Item *item) { value= item->val_real(); @@ -780,6 +796,7 @@ class cmp_item_decimal :public cmp_item { my_decimal value; public: + cmp_item_decimal() {} /* Remove gcc warning */ void store_value(Item *item); int cmp(Item *arg); int compare(cmp_item *c); diff --git a/sql/log_event.h b/sql/log_event.h index 7783a97f03f..0e1eb7cd13c 100644 --- a/sql/log_event.h +++ b/sql/log_event.h @@ -121,6 +121,7 @@ struct old_sql_ex ****************************************************************************/ struct sql_ex_info { + sql_ex_info() {} /* Remove gcc warning */ char* field_term; char* enclosed; char* line_term; diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index 6908f2b9049..2c817ae54c2 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -432,6 +432,7 @@ typedef struct st_sql_list { byte *first; byte **next; + st_sql_list() {} /* Remove gcc warning */ inline void empty() { elements=0; @@ -983,7 +984,7 @@ bool close_thread_table(THD *thd, TABLE **table_ptr); void close_temporary_tables(THD *thd); void close_tables_for_reopen(THD *thd, TABLE_LIST **tables); TABLE_LIST *find_table_in_list(TABLE_LIST *table, - uint offset_to_list, + st_table_list *TABLE_LIST::*link, const char *db_name, const char *table_name); TABLE_LIST *unique_table(THD *thd, TABLE_LIST *table, TABLE_LIST *table_list); @@ -1024,7 +1025,7 @@ inline TABLE_LIST *find_table_in_global_list(TABLE_LIST *table, const char *db_name, const char *table_name) { - return find_table_in_list(table, offsetof(TABLE_LIST, next_global), + return find_table_in_list(table, &TABLE_LIST::next_global, db_name, table_name); } @@ -1032,7 +1033,7 @@ inline TABLE_LIST *find_table_in_local_list(TABLE_LIST *table, const char *db_name, const char *table_name) { - return find_table_in_list(table, offsetof(TABLE_LIST, next_local), + return find_table_in_list(table, &TABLE_LIST::next_local, db_name, table_name); } diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 00ddde46127..37a135fa063 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -2387,9 +2387,7 @@ static int my_message_sql(uint error, const char *str, myf MyFlags) { NET *net= &thd->net; net->report_error= 1; -#ifndef EMBEDDED_LIBRARY /* TODO query cache in embedded library*/ query_cache_abort(net); -#endif if (!net->last_error[0]) // Return only first message { strmake(net->last_error, str, sizeof(net->last_error)-1); diff --git a/sql/opt_range.cc b/sql/opt_range.cc index 1b712700b18..04cc0baa0aa 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -1495,6 +1495,8 @@ public: { return (void*) alloc_root(mem_root, (uint) size); } static void operator delete(void *ptr,size_t size) { TRASH(ptr, size); } static void operator delete(void *ptr, MEM_ROOT *mem_root) { /* Never called */ } + virtual ~TABLE_READ_PLAN() {} /* Remove gcc warning */ + }; class TRP_ROR_INTERSECT; @@ -1518,6 +1520,7 @@ public: TRP_RANGE(SEL_ARG *key_arg, uint idx_arg) : key(key_arg), key_idx(idx_arg) {} + virtual ~TRP_RANGE() {} /* Remove gcc warning */ QUICK_SELECT_I *make_quick(PARAM *param, bool retrieve_full_rows, MEM_ROOT *parent_alloc) @@ -1539,6 +1542,8 @@ public: class TRP_ROR_INTERSECT : public TABLE_READ_PLAN { public: + TRP_ROR_INTERSECT() {} /* Remove gcc warning */ + virtual ~TRP_ROR_INTERSECT() {} /* Remove gcc warning */ QUICK_SELECT_I *make_quick(PARAM *param, bool retrieve_full_rows, MEM_ROOT *parent_alloc); @@ -1560,6 +1565,8 @@ public: class TRP_ROR_UNION : public TABLE_READ_PLAN { public: + TRP_ROR_UNION() {} /* Remove gcc warning */ + virtual ~TRP_ROR_UNION() {} /* Remove gcc warning */ QUICK_SELECT_I *make_quick(PARAM *param, bool retrieve_full_rows, MEM_ROOT *parent_alloc); TABLE_READ_PLAN **first_ror; /* array of ptrs to plans for merged scans */ @@ -1576,6 +1583,8 @@ public: class TRP_INDEX_MERGE : public TABLE_READ_PLAN { public: + TRP_INDEX_MERGE() {} /* Remove gcc warning */ + virtual ~TRP_INDEX_MERGE() {} /* Remove gcc warning */ QUICK_SELECT_I *make_quick(PARAM *param, bool retrieve_full_rows, MEM_ROOT *parent_alloc); TRP_RANGE **range_scans; /* array of ptrs to plans of merged scans */ @@ -1625,6 +1634,7 @@ public: if (key_infix_len) memcpy(this->key_infix, key_infix_arg, key_infix_len); } + virtual ~TRP_GROUP_MIN_MAX() {} /* Remove gcc warning */ QUICK_SELECT_I *make_quick(PARAM *param, bool retrieve_full_rows, MEM_ROOT *parent_alloc); diff --git a/sql/parse_file.h b/sql/parse_file.h index afa88da2ead..0d5a215fe1a 100644 --- a/sql/parse_file.h +++ b/sql/parse_file.h @@ -49,6 +49,8 @@ struct File_option class Unknown_key_hook { public: + Unknown_key_hook() {} /* Remove gcc warning */ + virtual ~Unknown_key_hook() {} /* Remove gcc warning */ virtual bool process_unknown_string(char *&unknown_key, gptr base, MEM_ROOT *mem_root, char *end)= 0; }; @@ -59,6 +61,7 @@ public: class File_parser_dummy_hook: public Unknown_key_hook { public: + File_parser_dummy_hook() {} /* Remove gcc warning */ virtual bool process_unknown_string(char *&unknown_key, gptr base, MEM_ROOT *mem_root, char *end); }; diff --git a/sql/protocol.cc b/sql/protocol.cc index 15f7049ec2f..650bd8fc58f 100644 --- a/sql/protocol.cc +++ b/sql/protocol.cc @@ -29,6 +29,7 @@ static const unsigned int PACKET_BUFFER_EXTRA_ALLOC= 1024; static void write_eof_packet(THD *thd, NET *net); +void net_send_error_packet(THD *thd, uint sql_errno, const char *err); #ifndef EMBEDDED_LIBRARY bool Protocol::net_store_data(const char *from, uint length) @@ -56,10 +57,6 @@ bool Protocol_prep::net_store_data(const char *from, uint length) void net_send_error(THD *thd, uint sql_errno, const char *err) { -#ifndef EMBEDDED_LIBRARY - uint length; - char buff[MYSQL_ERRMSG_SIZE+2], *pos; -#endif NET *net= &thd->net; bool generate_warning= thd->killed != THD::KILL_CONNECTION; DBUG_ENTER("net_send_error"); @@ -106,42 +103,8 @@ void net_send_error(THD *thd, uint sql_errno, const char *err) push_warning(thd, MYSQL_ERROR::WARN_LEVEL_ERROR, sql_errno, err); } -#ifdef EMBEDDED_LIBRARY - net->last_errno= sql_errno; - strmake(net->last_error, err, sizeof(net->last_error)-1); - strmov(net->sqlstate, mysql_errno_to_sqlstate(sql_errno)); -#else - - if (net->vio == 0) - { - if (thd->bootstrap) - { - /* In bootstrap it's ok to print on stderr */ - fprintf(stderr,"ERROR: %d %s\n",sql_errno,err); - } - DBUG_VOID_RETURN; - } + net_send_error_packet(thd, sql_errno, err); - if (net->return_errno) - { // new client code; Add errno before message - int2store(buff,sql_errno); - pos= buff+2; - if (thd->client_capabilities & CLIENT_PROTOCOL_41) - { - /* The first # is to make the protocol backward compatible */ - buff[2]= '#'; - pos= strmov(buff+3, mysql_errno_to_sqlstate(sql_errno)); - } - length= (uint) (strmake(pos, err, MYSQL_ERRMSG_SIZE-1) - buff); - err=buff; - } - else - { - length=(uint) strlen(err); - set_if_smaller(length,MYSQL_ERRMSG_SIZE-1); - } - VOID(net_write_command(net,(uchar) 255, "", 0, (char*) err,length)); -#endif /* EMBEDDED_LIBRARY*/ thd->is_fatal_error=0; // Error message is given thd->net.report_error= 0; @@ -430,6 +393,47 @@ bool send_old_password_request(THD *thd) return my_net_write(net, eof_buff, 1) || net_flush(net); } + +void net_send_error_packet(THD *thd, uint sql_errno, const char *err) +{ + NET *net= &thd->net; + uint length; + char buff[MYSQL_ERRMSG_SIZE+2], *pos; + + DBUG_ENTER("send_error_packet"); + + if (net->vio == 0) + { + if (thd->bootstrap) + { + /* In bootstrap it's ok to print on stderr */ + fprintf(stderr,"ERROR: %d %s\n",sql_errno,err); + } + DBUG_VOID_RETURN; + } + + if (net->return_errno) + { // new client code; Add errno before message + int2store(buff,sql_errno); + pos= buff+2; + if (thd->client_capabilities & CLIENT_PROTOCOL_41) + { + /* The first # is to make the protocol backward compatible */ + buff[2]= '#'; + pos= strmov(buff+3, mysql_errno_to_sqlstate(sql_errno)); + } + length= (uint) (strmake(pos, err, MYSQL_ERRMSG_SIZE-1) - buff); + err=buff; + } + else + { + length=(uint) strlen(err); + set_if_smaller(length,MYSQL_ERRMSG_SIZE-1); + } + VOID(net_write_command(net,(uchar) 255, "", 0, (char*) err,length)); + DBUG_VOID_RETURN; +} + #endif /* EMBEDDED_LIBRARY */ /* diff --git a/sql/protocol.h b/sql/protocol.h index 8d9da5774b2..85c22724b74 100644 --- a/sql/protocol.h +++ b/sql/protocol.h @@ -91,6 +91,12 @@ public: virtual bool store_date(TIME *time)=0; virtual bool store_time(TIME *time)=0; virtual bool store(Field *field)=0; +#ifdef EMBEDDED_LIBRARY + int begin_dataset(); + virtual void remove_last_row() {} +#else + void remove_last_row() {} +#endif }; @@ -117,6 +123,9 @@ public: 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 }; diff --git a/sql/sp_rcontext.h b/sql/sp_rcontext.h index c3c05228eef..e7393902e72 100644 --- a/sql/sp_rcontext.h +++ b/sql/sp_rcontext.h @@ -268,6 +268,7 @@ class Select_fetch_into_spvars: public select_result_interceptor List<struct sp_pvar> *spvar_list; uint field_count; public: + Select_fetch_into_spvars() {} /* Remove gcc warning */ uint get_field_count() { return field_count; } void set_spvar_list(List<struct sp_pvar> *vars) { spvar_list= vars; } diff --git a/sql/spatial.h b/sql/spatial.h index 527dc750bdc..a6f74a1ada0 100644 --- a/sql/spatial.h +++ b/sql/spatial.h @@ -165,6 +165,8 @@ struct Geometry_buffer; class Geometry { public: + Geometry() {} /* Remove gcc warning */ + virtual ~Geometry() {} /* Remove gcc warning */ static void *operator new(size_t size, void *buffer) { return buffer; @@ -302,6 +304,8 @@ protected: class Gis_point: public Geometry { public: + Gis_point() {} /* Remove gcc warning */ + virtual ~Gis_point() {} /* Remove gcc warning */ uint32 get_data_size() const; bool init_from_wkt(Gis_read_stream *trs, String *wkb); uint init_from_wkb(const char *wkb, uint len, wkbByteOrder bo, String *res); @@ -349,6 +353,8 @@ public: class Gis_line_string: public Geometry { public: + Gis_line_string() {} /* Remove gcc warning */ + virtual ~Gis_line_string() {} /* Remove gcc warning */ uint32 get_data_size() const; bool init_from_wkt(Gis_read_stream *trs, String *wkb); uint init_from_wkb(const char *wkb, uint len, wkbByteOrder bo, String *res); @@ -375,6 +381,8 @@ public: class Gis_polygon: public Geometry { public: + Gis_polygon() {} /* Remove gcc warning */ + virtual ~Gis_polygon() {} /* Remove gcc warning */ uint32 get_data_size() const; bool init_from_wkt(Gis_read_stream *trs, String *wkb); uint init_from_wkb(const char *wkb, uint len, wkbByteOrder bo, String *res); @@ -401,6 +409,8 @@ public: class Gis_multi_point: public Geometry { public: + Gis_multi_point() {} /* Remove gcc warning */ + virtual ~Gis_multi_point() {} /* Remove gcc warning */ uint32 get_data_size() const; bool init_from_wkt(Gis_read_stream *trs, String *wkb); uint init_from_wkb(const char *wkb, uint len, wkbByteOrder bo, String *res); @@ -423,6 +433,8 @@ public: class Gis_multi_line_string: public Geometry { public: + Gis_multi_line_string() {} /* Remove gcc warning */ + virtual ~Gis_multi_line_string() {} /* Remove gcc warning */ uint32 get_data_size() const; bool init_from_wkt(Gis_read_stream *trs, String *wkb); uint init_from_wkb(const char *wkb, uint len, wkbByteOrder bo, String *res); @@ -447,6 +459,8 @@ public: class Gis_multi_polygon: public Geometry { public: + Gis_multi_polygon() {} /* Remove gcc warning */ + virtual ~Gis_multi_polygon() {} /* Remove gcc warning */ uint32 get_data_size() const; bool init_from_wkt(Gis_read_stream *trs, String *wkb); uint init_from_wkb(const char *wkb, uint len, wkbByteOrder bo, String *res); @@ -471,6 +485,8 @@ public: class Gis_geometry_collection: public Geometry { public: + Gis_geometry_collection() {} /* Remove gcc warning */ + virtual ~Gis_geometry_collection() {} /* Remove gcc warning */ uint32 get_data_size() const; bool init_from_wkt(Gis_read_stream *trs, String *wkb); uint init_from_wkb(const char *wkb, uint len, wkbByteOrder bo, String *res); diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 4415bb501f8..2226ab926d1 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -368,6 +368,15 @@ bool close_cached_tables(THD *thd, bool if_wait_for_refresh, DESCRIPTION Marks all tables in the list which were used by current substatement (they are marked by its query_id) as free for reuse. + + NOTE + The reason we reset query_id is that it's not enough to just test + if table->query_id != thd->query_id to know if a table is in use. + + For example + SELECT f1_that_uses_t1() FROM t1; + In f1_that_uses_t1() we will see one instance of t1 where query_id is + set to query_id of original query. */ static void mark_used_tables_as_free_for_reuse(THD *thd, TABLE *table) @@ -678,11 +687,11 @@ void close_temporary_tables(THD *thd) */ TABLE_LIST *find_table_in_list(TABLE_LIST *table, - uint offset, + st_table_list *TABLE_LIST::*link, const char *db_name, const char *table_name) { - for (; table; table= *(TABLE_LIST **) ((char*) table + offset)) + for (; table; table= table->*link ) { if ((table->table == 0 || table->table->s->tmp_table == NO_TMP_TABLE) && strcmp(table->db, db_name) == 0 && diff --git a/sql/sql_cache.h b/sql/sql_cache.h index 69a0d6cd05d..29d314d3c44 100644 --- a/sql/sql_cache.h +++ b/sql/sql_cache.h @@ -69,6 +69,7 @@ class Query_cache; struct Query_cache_block_table { + Query_cache_block_table() {} /* Remove gcc warning */ TABLE_COUNTER_TYPE n; // numbr in table (from 0) Query_cache_block_table *next, *prev; Query_cache_table *parent; @@ -78,6 +79,7 @@ struct Query_cache_block_table struct Query_cache_block { + Query_cache_block() {} /* Remove gcc warning */ enum block_type {FREE, QUERY, RESULT, RES_CONT, RES_BEG, RES_INCOMPLETE, TABLE, INCOMPLETE}; @@ -143,6 +145,7 @@ struct Query_cache_query struct Query_cache_table { + Query_cache_table() {} /* Remove gcc warning */ char *tbl; uint32 key_len; uint8 table_type; @@ -171,6 +174,7 @@ struct Query_cache_table struct Query_cache_result { + Query_cache_result() {} /* Remove gcc warning */ Query_cache_block *query; inline gptr data() @@ -197,6 +201,7 @@ extern "C" void query_cache_invalidate_by_MyISAM_filename(const char* filename); struct Query_cache_memory_bin { + Query_cache_memory_bin() {} /* Remove gcc warning */ #ifndef DBUG_OFF ulong size; #endif @@ -215,6 +220,7 @@ struct Query_cache_memory_bin struct Query_cache_memory_bin_step { + Query_cache_memory_bin_step() {} /* Remove gcc warning */ ulong size; ulong increment; uint idx; diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 2125201026a..59391a333c3 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -950,6 +950,7 @@ bool select_send::send_data(List<Item> &items) DBUG_RETURN(0); if (!thd->net.report_error) DBUG_RETURN(protocol->write()); + protocol->remove_last_row(); DBUG_RETURN(1); } @@ -1981,10 +1982,8 @@ void THD::reset_sub_statement_state(Sub_statement_state *backup, cuted_fields= 0; transaction.savepoints= 0; -#ifndef EMBEDDED_LIBRARY /* Surpress OK packets in case if we will execute statements */ net.no_send_ok= TRUE; -#endif } diff --git a/sql/sql_class.h b/sql/sql_class.h index 1672a5ea811..048a0a49618 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -69,7 +69,8 @@ class TC_LOG class TC_LOG_DUMMY: public TC_LOG // use it to disable the logging { - public: +public: + TC_LOG_DUMMY() {} /* Remove gcc warning */ int open(const char *opt_name) { return 0; } void close() { } int log(THD *thd, my_xid xid) { return 1; } @@ -930,6 +931,7 @@ void xid_cache_delete(XID_STATE *xid_state); class Security_context { public: + Security_context() {} /* Remove gcc warning */ /* host - host of the client user - user of the client, set to NULL until the user has been read from @@ -1102,13 +1104,16 @@ public: #ifdef EMBEDDED_LIBRARY struct st_mysql *mysql; - struct st_mysql_data *data; unsigned long client_stmt_id; unsigned long client_param_count; struct st_mysql_bind *client_params; char *extra_data; ulong extra_length; - String query_rest; + struct st_mysql_data *cur_data; + struct st_mysql_data *first_data; + struct st_mysql_data **data_tail; + void clear_data_list(); + struct st_mysql_data *alloc_new_dataset(); #endif NET net; // client connection descriptor MEM_ROOT warn_root; // For warnings and errors @@ -1659,6 +1664,11 @@ public: */ virtual void cleanup(); void set_thd(THD *thd_arg) { thd= thd_arg; } +#ifdef EMBEDDED_LIBRARY + virtual void begin_dataset() {} +#else + void begin_dataset() {} +#endif }; @@ -1671,6 +1681,7 @@ public: class select_result_interceptor: public select_result { public: + select_result_interceptor() {} /* Remove gcc warning */ uint field_count(List<Item> &fields) const { return 0; } bool send_fields(List<Item> &fields, uint flag) { return FALSE; } }; @@ -1958,6 +1969,7 @@ class Table_ident :public Sql_alloc class user_var_entry { public: + user_var_entry() {} /* Remove gcc warning */ LEX_STRING name; char *value; ulong length; diff --git a/sql/sql_cursor.cc b/sql/sql_cursor.cc index 89c160cd70a..33ad27b9d14 100644 --- a/sql/sql_cursor.cc +++ b/sql/sql_cursor.cc @@ -603,6 +603,7 @@ void Materialized_cursor::fetch(ulong num_rows) THD *thd= table->in_use; int res= 0; + result->begin_dataset(); for (fetch_limit+= num_rows; fetch_count < fetch_limit; fetch_count++) { if ((res= table->file->rnd_next(table->record[0]))) diff --git a/sql/sql_db.cc b/sql/sql_db.cc index 357d2d5a21f..344a6887ebb 100644 --- a/sql/sql_db.cc +++ b/sql/sql_db.cc @@ -1105,10 +1105,13 @@ bool mysql_change_db(THD *thd, const char *name, bool no_access_check) #ifndef NO_EMBEDDED_ACCESS_CHECKS ulong db_access; Security_context *sctx= thd->security_ctx; + LINT_INIT(db_access); #endif DBUG_ENTER("mysql_change_db"); DBUG_PRINT("enter",("name: '%s'",name)); + LINT_INIT(db_length); + /* dbname can only be NULL if malloc failed */ if (!dbname || !(db_length= strlen(dbname))) { @@ -1126,7 +1129,7 @@ bool mysql_change_db(THD *thd, const char *name, bool no_access_check) if (check_db_name(dbname)) { my_error(ER_WRONG_DB_NAME, MYF(0), dbname); - x_free(dbname); + my_free(dbname, MYF(0)); DBUG_RETURN(1); } DBUG_PRINT("info",("Use database: %s", dbname)); @@ -1176,8 +1179,7 @@ end: x_free(thd->db); if (dbname && dbname[0] == 0) { - if (!(thd->slave_thread)) - x_free(dbname); + my_free(dbname, MYF(0)); thd->db= NULL; thd->db_length= 0; } diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 978cab704c0..b2066953cf5 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -1724,13 +1724,10 @@ bool dispatch_command(enum enum_server_command command, THD *thd, net->no_send_error= 0; /* Multiple queries exits, execute them individually - in embedded server - just store them to be executed later */ -#ifndef EMBEDDED_LIBRARY if (thd->lock || thd->open_tables || thd->derived_tables || thd->prelocked_mode) close_thread_tables(thd); -#endif ulong length= (ulong)(packet_end-packet); log_slow_statement(thd); @@ -1748,25 +1745,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd, thd->set_time(); /* Reset the query start time. */ /* TODO: set thd->lex->sql_command to SQLCOM_END here */ VOID(pthread_mutex_unlock(&LOCK_thread_count)); -#ifndef EMBEDDED_LIBRARY mysql_parse(thd, packet, length); -#else - /* - 'packet' can point inside the query_rest's buffer - so we have to do memmove here - */ - if (thd->query_rest.length() > length) - { - memmove(thd->query_rest.c_ptr(), packet, length); - thd->query_rest.length(length); - } - else - thd->query_rest.copy(packet, length, thd->query_rest.charset()); - - thd->server_status&= ~ (SERVER_QUERY_NO_INDEX_USED | - SERVER_QUERY_NO_GOOD_INDEX_USED); - break; -#endif /*EMBEDDED_LIBRARY*/ } if (!(specialflag & SPECIAL_NO_PRIOR)) @@ -4273,10 +4252,8 @@ end_with_restore_list: goto error; } -#ifndef EMBEDDED_LIBRARY my_bool nsok= thd->net.no_send_ok; thd->net.no_send_ok= TRUE; -#endif if (sp->m_flags & sp_head::MULTI_RESULTS) { if (! (thd->client_capabilities & CLIENT_MULTI_RESULTS)) @@ -4286,9 +4263,7 @@ end_with_restore_list: back */ my_error(ER_SP_BADSELECT, MYF(0), sp->m_qname.str); -#ifndef EMBEDDED_LIBRARY thd->net.no_send_ok= nsok; -#endif goto error; } /* @@ -4305,18 +4280,14 @@ end_with_restore_list: sp->m_db.str, sp->m_name.str, TRUE, 0) || sp_change_security_context(thd, sp, &save_ctx)) { -#ifndef EMBEDDED_LIBRARY thd->net.no_send_ok= nsok; -#endif goto error; } if (save_ctx && check_routine_access(thd, EXECUTE_ACL, sp->m_db.str, sp->m_name.str, TRUE, 0)) { -#ifndef EMBEDDED_LIBRARY thd->net.no_send_ok= nsok; -#endif sp_restore_security_context(thd, save_ctx); goto error; } @@ -4348,9 +4319,7 @@ end_with_restore_list: sp_restore_security_context(thd, save_ctx); #endif -#ifndef EMBEDDED_LIBRARY thd->net.no_send_ok= nsok; -#endif thd->server_status&= ~bits_to_be_cleared; if (!res) @@ -4846,7 +4815,9 @@ end_with_restore_list: res= mysql_xa_recover(thd); break; default: +#ifndef EMBEDDED_LIBRARY DBUG_ASSERT(0); /* Impossible */ +#endif send_ok(thd); break; } @@ -6008,10 +5979,11 @@ TABLE_LIST *st_select_lex::add_table_to_list(THD *thd, /* table_list.next points to the last inserted TABLE_LIST->next_local' element + We don't use the offsetof() macro here to avoid warnings from gcc */ - previous_table_ref= (TABLE_LIST*) (table_list.next - - offsetof(TABLE_LIST, next_local)); - DBUG_ASSERT(previous_table_ref); + previous_table_ref= (TABLE_LIST*) ((char*) table_list.next - + ((char*) &(ptr->next_local) - + (char*) ptr)); /* Set next_name_resolution_table of the previous table reference to point to the current table reference. In effect the list diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index 5746e2a6f1a..332f699200e 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -92,6 +92,12 @@ public: virtual bool send_fields(List<Item> &list, uint flags); virtual bool send_data(List<Item> &items); virtual bool send_eof(); +#ifdef EMBEDDED_LIBRARY + void begin_dataset() + { + protocol.begin_dataset(); + } +#endif }; /****************************************************************************** @@ -524,9 +530,10 @@ void set_param_time(Item_param *param, uchar **pos, ulong len) void set_param_datetime(Item_param *param, uchar **pos, ulong len) { - MYSQL_TIME *to= (MYSQL_TIME*)*pos; + MYSQL_TIME tm= *((MYSQL_TIME*)*pos); + tm.neg= 0; - param->set_time(to, MYSQL_TIMESTAMP_DATETIME, + param->set_time(&tm, MYSQL_TIMESTAMP_DATETIME, MAX_DATETIME_WIDTH * MY_CHARSET_BIN_MB_MAXLEN); } diff --git a/sql/sql_select.h b/sql/sql_select.h index 95a71142426..01ed8048e4a 100644 --- a/sql/sql_select.h +++ b/sql/sql_select.h @@ -104,6 +104,7 @@ typedef int (*Read_record_func)(struct st_join_table *tab); Next_select_func setup_end_select_func(JOIN *join); typedef struct st_join_table { + st_join_table() {} /* Remove gcc warning */ TABLE *table; KEYUSE *keyuse; /* pointer to first used key */ SQL_SELECT *select; @@ -288,7 +289,6 @@ public: init(thd_arg, fields_arg, select_options_arg, result_arg); } - void init(THD *thd_arg, List<Item> &fields_arg, ulonglong select_options_arg, select_result *result_arg) { diff --git a/sql/sql_table.cc b/sql/sql_table.cc index b70bad40c4e..0bae714d7dc 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -1305,7 +1305,9 @@ static int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info, } if (length > file->max_key_part_length() && key->type != Key::FULLTEXT) { - length=file->max_key_part_length(); + length= file->max_key_part_length(); + /* Align key length to multibyte char boundary */ + length-= length % sql_field->charset->mbmaxlen; if (key->type == Key::MULTIPLE) { /* not a critical problem */ diff --git a/sql/sql_update.cc b/sql/sql_update.cc index f6bc1461842..bfdd986f576 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -1303,7 +1303,7 @@ bool multi_update::send_data(List<Item> ¬_used_values) memcpy((char*) tmp_table->field[0]->ptr, (char*) table->file->ref, table->file->ref_length); /* Write row, ignoring duplicated updates to a row */ - if (error= tmp_table->file->write_row(tmp_table->record[0])) + if ((error= tmp_table->file->write_row(tmp_table->record[0]))) { if (error != HA_ERR_FOUND_DUPP_KEY && error != HA_ERR_FOUND_DUPP_UNIQUE && diff --git a/sql/table.h b/sql/table.h index 78a942ef301..cd511e7b5ee 100644 --- a/sql/table.h +++ b/sql/table.h @@ -187,6 +187,8 @@ typedef struct st_table_share /* Information for one open table */ struct st_table { + st_table() {} /* Remove gcc warning */ + TABLE_SHARE *s; handler *file; #ifdef NOT_YET @@ -444,6 +446,7 @@ public: typedef struct st_table_list { + st_table_list() {} /* Remove gcc warning */ /* List of tables local to a subquery (used by SQL_LIST). Considers views as leaves (unlike 'next_leaf' below). Created at parse time @@ -675,6 +678,7 @@ class Item; class Field_iterator: public Sql_alloc { public: + Field_iterator() {} /* Remove gcc warning */ virtual ~Field_iterator() {} virtual void set(TABLE_LIST *)= 0; virtual void next()= 0; diff --git a/sql/tztime.cc b/sql/tztime.cc index 3a9d9a60aed..b86c9a44561 100644 --- a/sql/tztime.cc +++ b/sql/tztime.cc @@ -961,6 +961,7 @@ static const String tz_SYSTEM_name("SYSTEM", 6, &my_charset_latin1); class Time_zone_system : public Time_zone { public: + Time_zone_system() {} /* Remove gcc warning */ virtual my_time_t TIME_to_gmt_sec(const TIME *t, my_bool *in_dst_time_gap) const; virtual void gmt_sec_to_TIME(TIME *tmp, my_time_t t) const; @@ -1054,6 +1055,7 @@ Time_zone_system::get_name() const class Time_zone_utc : public Time_zone { public: + Time_zone_utc() {} /* Remove gcc warning */ virtual my_time_t TIME_to_gmt_sec(const TIME *t, my_bool *in_dst_time_gap) const; virtual void gmt_sec_to_TIME(TIME *tmp, my_time_t t) const; diff --git a/sql/tztime.h b/sql/tztime.h index a168fe4fb73..23460a8e739 100644 --- a/sql/tztime.h +++ b/sql/tztime.h @@ -30,6 +30,7 @@ class Time_zone: public Sql_alloc { public: + Time_zone() {} /* Remove gcc warning */ /* Converts local time in broken down TIME representation to my_time_t (UTC seconds since Epoch) represenation. |