Commit 8f093d0f authored by monty@mysql.com's avatar monty@mysql.com

Portability fixes

parent b0491594
...@@ -335,55 +335,55 @@ insert into t2 values (1),(2); ...@@ -335,55 +335,55 @@ insert into t2 values (1),(2);
insert into t3 values (1,1),(2,2); insert into t3 values (1,1),(2,2);
show table status; show table status;
Name Type Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Name Type Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 HEAP Fixed 2 5 39904 249415 42 0 NULL NULL NULL NULL latin1_swedish_ci NULL t1 HEAP Fixed 2 5 # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
t2 HEAP Fixed 2 5 39904 249415 39904 0 NULL NULL NULL NULL latin1_swedish_ci NULL t2 HEAP Fixed 2 5 # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
t3 HEAP Fixed 2 9 33072 248103 22090 0 NULL NULL NULL NULL latin1_swedish_ci NULL t3 HEAP Fixed 2 9 # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
insert into t1 values (3),(4); insert into t1 values (3),(4);
insert into t2 values (3),(4); insert into t2 values (3),(4);
insert into t3 values (3,3),(4,4); insert into t3 values (3,3),(4,4);
show table status; show table status;
Name Type Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Name Type Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 HEAP Fixed 4 5 39904 249415 84 0 NULL NULL NULL NULL latin1_swedish_ci NULL t1 HEAP Fixed 4 5 # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
t2 HEAP Fixed 4 5 39904 249415 39904 0 NULL NULL NULL NULL latin1_swedish_ci NULL t2 HEAP Fixed 4 5 # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
t3 HEAP Fixed 4 9 33072 248103 22132 0 NULL NULL NULL NULL latin1_swedish_ci NULL t3 HEAP Fixed 4 9 # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
insert into t1 values (5); insert into t1 values (5);
insert into t2 values (5); insert into t2 values (5);
insert into t3 values (5,5); insert into t3 values (5,5);
show table status; show table status;
Name Type Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Name Type Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 HEAP Fixed 5 5 39904 249415 105 0 NULL NULL NULL NULL latin1_swedish_ci NULL t1 HEAP Fixed 5 5 # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
t2 HEAP Fixed 5 5 39904 249415 39904 0 NULL NULL NULL NULL latin1_swedish_ci NULL t2 HEAP Fixed 5 5 # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
t3 HEAP Fixed 5 9 33072 248103 22153 0 NULL NULL NULL NULL latin1_swedish_ci NULL t3 HEAP Fixed 5 9 # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
delete from t1 where a=3; delete from t1 where a=3;
delete from t2 where b=3; delete from t2 where b=3;
delete from t3 where a=3; delete from t3 where a=3;
show table status; show table status;
Name Type Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Name Type Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 HEAP Fixed 4 5 39904 249415 89 5 NULL NULL NULL NULL latin1_swedish_ci NULL t1 HEAP Fixed 4 5 # # # 5 NULL NULL NULL NULL latin1_swedish_ci NULL
t2 HEAP Fixed 4 5 39904 249415 39904 5 NULL NULL NULL NULL latin1_swedish_ci NULL t2 HEAP Fixed 4 5 # # # 5 NULL NULL NULL NULL latin1_swedish_ci NULL
t3 HEAP Fixed 4 9 33072 248103 22137 9 NULL NULL NULL NULL latin1_swedish_ci NULL t3 HEAP Fixed 4 9 # # # 9 NULL NULL NULL NULL latin1_swedish_ci NULL
delete from t1; delete from t1;
delete from t2; delete from t2;
delete from t3; delete from t3;
show table status; show table status;
Name Type Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Name Type Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 HEAP Fixed 0 5 0 249415 0 0 NULL NULL NULL NULL latin1_swedish_ci NULL t1 HEAP Fixed 0 5 # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
t2 HEAP Fixed 0 5 0 249415 0 0 NULL NULL NULL NULL latin1_swedish_ci NULL t2 HEAP Fixed 0 5 # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
t3 HEAP Fixed 0 9 0 248103 0 0 NULL NULL NULL NULL latin1_swedish_ci NULL t3 HEAP Fixed 0 9 # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
insert into t1 values (5); insert into t1 values (5);
insert into t2 values (5); insert into t2 values (5);
insert into t3 values (5,5); insert into t3 values (5,5);
show table status; show table status;
Name Type Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Name Type Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 HEAP Fixed 1 5 39904 249415 21 0 NULL NULL NULL NULL latin1_swedish_ci NULL t1 HEAP Fixed 1 5 # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
t2 HEAP Fixed 1 5 39904 249415 39904 0 NULL NULL NULL NULL latin1_swedish_ci NULL t2 HEAP Fixed 1 5 # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
t3 HEAP Fixed 1 9 33072 248103 22069 0 NULL NULL NULL NULL latin1_swedish_ci NULL t3 HEAP Fixed 1 9 # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
delete from t1 where a=5; delete from t1 where a=5;
delete from t2 where b=5; delete from t2 where b=5;
delete from t3 where a=5; delete from t3 where a=5;
show table status; show table status;
Name Type Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Name Type Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 HEAP Fixed 0 5 39904 249415 5 5 NULL NULL NULL NULL latin1_swedish_ci NULL t1 HEAP Fixed 0 5 # # # 5 NULL NULL NULL NULL latin1_swedish_ci NULL
t2 HEAP Fixed 0 5 39904 249415 39904 5 NULL NULL NULL NULL latin1_swedish_ci NULL t2 HEAP Fixed 0 5 # # # 5 NULL NULL NULL NULL latin1_swedish_ci NULL
t3 HEAP Fixed 0 9 33072 248103 22053 9 NULL NULL NULL NULL latin1_swedish_ci NULL t3 HEAP Fixed 0 9 # # # 9 NULL NULL NULL NULL latin1_swedish_ci NULL
drop table t1, t2, t3; drop table t1, t2, t3;
...@@ -209,30 +209,37 @@ CREATE TABLE t3 ( ...@@ -209,30 +209,37 @@ CREATE TABLE t3 (
insert into t1 values (1),(2); insert into t1 values (1),(2);
insert into t2 values (1),(2); insert into t2 values (1),(2);
insert into t3 values (1,1),(2,2); insert into t3 values (1,1),(2,2);
--replace_column 6 # 7 # 8 #
show table status; show table status;
insert into t1 values (3),(4); insert into t1 values (3),(4);
insert into t2 values (3),(4); insert into t2 values (3),(4);
insert into t3 values (3,3),(4,4); insert into t3 values (3,3),(4,4);
--replace_column 6 # 7 # 8 #
show table status; show table status;
insert into t1 values (5); insert into t1 values (5);
insert into t2 values (5); insert into t2 values (5);
insert into t3 values (5,5); insert into t3 values (5,5);
--replace_column 6 # 7 # 8 #
show table status; show table status;
delete from t1 where a=3; delete from t1 where a=3;
delete from t2 where b=3; delete from t2 where b=3;
delete from t3 where a=3; delete from t3 where a=3;
--replace_column 6 # 7 # 8 #
show table status; show table status;
delete from t1; delete from t1;
delete from t2; delete from t2;
delete from t3; delete from t3;
--replace_column 6 # 7 # 8 #
show table status; show table status;
insert into t1 values (5); insert into t1 values (5);
insert into t2 values (5); insert into t2 values (5);
insert into t3 values (5,5); insert into t3 values (5,5);
--replace_column 6 # 7 # 8 #
show table status; show table status;
delete from t1 where a=5; delete from t1 where a=5;
delete from t2 where b=5; delete from t2 where b=5;
delete from t3 where a=5; delete from t3 where a=5;
--replace_column 6 # 7 # 8 #
show table status; show table status;
drop table t1, t2, t3; drop table t1, t2, t3;
...@@ -122,7 +122,7 @@ static uint hash_rec_mask(HASH *hash,HASH_LINK *pos,uint buffmax, ...@@ -122,7 +122,7 @@ static uint hash_rec_mask(HASH *hash,HASH_LINK *pos,uint buffmax,
#ifndef __SUNPRO_C /* SUNPRO can't handle this */ #if !defined(__SUNPRO_C) && !defined(__USLC__) /* broken compilers */
inline inline
#endif #endif
unsigned int rec_hashnr(HASH *hash,const byte *record) unsigned int rec_hashnr(HASH *hash,const byte *record)
......
...@@ -81,7 +81,6 @@ TODO: ...@@ -81,7 +81,6 @@ TODO:
#endif #endif
#include <my_getopt.h> #include <my_getopt.h>
#include "mysql_version.h" #include "mysql_version.h"
#include "mysql_priv.h"
#include "lex.h" #include "lex.h"
struct my_option my_long_options[] = struct my_option my_long_options[] =
......
...@@ -37,4 +37,13 @@ typedef struct st_lex_symbol ...@@ -37,4 +37,13 @@ typedef struct st_lex_symbol
uint length; uint length;
} LEX_SYMBOL; } LEX_SYMBOL;
typedef struct st_sym_group {
const char *name;
const char *needed_define;
} SYM_GROUP;
extern SYM_GROUP sym_group_common;
extern SYM_GROUP sym_group_geom;
extern SYM_GROUP sym_group_rtree;
#endif /* _lex_symbol_h */ #endif /* _lex_symbol_h */
...@@ -1126,12 +1126,3 @@ inline void setup_table_map(TABLE *table, TABLE_LIST *table_list, uint tablenr) ...@@ -1126,12 +1126,3 @@ inline void setup_table_map(TABLE *table, TABLE_LIST *table_list, uint tablenr)
table->map= (table_map) 1 << tablenr; table->map= (table_map) 1 << tablenr;
table->force_index= table_list->force_index; table->force_index= table_list->force_index;
} }
typedef struct st_sym_group {
const char *name;
const char *needed_define;
} SYM_GROUP;
extern SYM_GROUP sym_group_common;
extern SYM_GROUP sym_group_geom;
extern SYM_GROUP sym_group_rtree;
...@@ -488,7 +488,8 @@ static long mysql_rm_known_files(THD *thd, MY_DIR *dirp, const char *db, ...@@ -488,7 +488,8 @@ static long mysql_rm_known_files(THD *thd, MY_DIR *dirp, const char *db,
my_dirend(dirp); my_dirend(dirp);
DBUG_RETURN(-1); DBUG_RETURN(-1);
} }
raid_dirs.push_back(dir=new String(newpath, &my_charset_latin1)); raid_dirs.push_back(dir=new (&thd->mem_root)
String(newpath, &my_charset_latin1));
dir->copy(); dir->copy();
continue; continue;
} }
......
...@@ -140,7 +140,7 @@ void memorize_variant_topic(THD *thd, TABLE *topics, int count, ...@@ -140,7 +140,7 @@ void memorize_variant_topic(THD *thd, TABLE *topics, int count,
{ {
if (count == 1) if (count == 1)
names->push_back(name); names->push_back(name);
String *new_name= new String; String *new_name= new (&thd->mem_root) String;
get_field(mem_root,find_fields[help_topic_name].field,new_name); get_field(mem_root,find_fields[help_topic_name].field,new_name);
names->push_back(new_name); names->push_back(new_name);
} }
...@@ -391,7 +391,7 @@ int search_categories(THD *thd, TABLE *categories, ...@@ -391,7 +391,7 @@ int search_categories(THD *thd, TABLE *categories,
{ {
if (select && !select->cond->val_int()) if (select && !select->cond->val_int())
continue; continue;
String *lname= new String; String *lname= new (&thd->mem_root) String;
get_field(&thd->mem_root,pfname,lname); get_field(&thd->mem_root,pfname,lname);
if (++count == 1 && res_id) if (++count == 1 && res_id)
*res_id= (int16) pcat_id->val_int(); *res_id= (int16) pcat_id->val_int();
...@@ -425,7 +425,7 @@ void get_all_items_for_category(THD *thd, TABLE *items, Field *pfname, ...@@ -425,7 +425,7 @@ void get_all_items_for_category(THD *thd, TABLE *items, Field *pfname,
{ {
if (!select->cond->val_int()) if (!select->cond->val_int())
continue; continue;
String *name= new String(); String *name= new (&thd->mem_root) String();
get_field(&thd->mem_root,pfname,name); get_field(&thd->mem_root,pfname,name);
res->push_back(name); res->push_back(name);
} }
......
...@@ -69,12 +69,10 @@ public: ...@@ -69,12 +69,10 @@ public:
Alloced_length=str.Alloced_length; alloced=0; Alloced_length=str.Alloced_length; alloced=0;
str_charset=str.str_charset; str_charset=str.str_charset;
} }
static void *operator new(size_t size)
{ return (void*) sql_alloc((uint) size); }
static void *operator new(size_t size, MEM_ROOT *mem_root) static void *operator new(size_t size, MEM_ROOT *mem_root)
{ return (void*) alloc_root(mem_root, (uint) size); } { return (void*) alloc_root(mem_root, (uint) size); }
static void operator delete(void *ptr_arg,size_t size) /*lint -e715 */ static void operator delete(void *ptr_arg,size_t size) /*lint -e715 */
{ sql_element_free(ptr_arg); } {}
~String() { free(); } ~String() { free(); }
inline void set_charset(CHARSET_INFO *charset) { str_charset= charset; } inline void set_charset(CHARSET_INFO *charset) { str_charset= charset; }
......
...@@ -3043,7 +3043,7 @@ opt_distinct: ...@@ -3043,7 +3043,7 @@ opt_distinct:
|DISTINCT { $$ = 1; }; |DISTINCT { $$ = 1; };
opt_gconcat_separator: opt_gconcat_separator:
/* empty */ { $$ = new String(",",1,default_charset_info); } /* empty */ { $$ = new (&YYTHD->mem_root) String(",",1,default_charset_info); }
|SEPARATOR_SYM text_string { $$ = $2; }; |SEPARATOR_SYM text_string { $$ = $2; };
...@@ -3293,15 +3293,15 @@ key_list_or_empty: ...@@ -3293,15 +3293,15 @@ key_list_or_empty:
key_usage_list2: key_usage_list2:
key_usage_list2 ',' ident key_usage_list2 ',' ident
{ Select-> { Select->
interval_list.push_back(new String((const char*) $3.str, $3.length, interval_list.push_back(new (&YYTHD->mem_root) String((const char*) $3.str, $3.length,
system_charset_info)); } system_charset_info)); }
| ident | ident
{ Select-> { Select->
interval_list.push_back(new String((const char*) $1.str, $1.length, interval_list.push_back(new (&YYTHD->mem_root) String((const char*) $1.str, $1.length,
system_charset_info)); } system_charset_info)); }
| PRIMARY_SYM | PRIMARY_SYM
{ Select-> { Select->
interval_list.push_back(new String("PRIMARY", 7, interval_list.push_back(new (&YYTHD->mem_root) String("PRIMARY", 7,
system_charset_info)); }; system_charset_info)); };
using_list: using_list:
...@@ -4255,7 +4255,7 @@ opt_describe_column: ...@@ -4255,7 +4255,7 @@ opt_describe_column:
/* empty */ {} /* empty */ {}
| text_string { Lex->wild= $1; } | text_string { Lex->wild= $1; }
| ident | ident
{ Lex->wild= new String((const char*) $1.str,$1.length,system_charset_info); }; { Lex->wild= new (&YYTHD->mem_root) String((const char*) $1.str,$1.length,system_charset_info); };
/* flush things */ /* flush things */
...@@ -4467,7 +4467,7 @@ text_literal: ...@@ -4467,7 +4467,7 @@ text_literal:
text_string: text_string:
TEXT_STRING_literal TEXT_STRING_literal
{ $$= new String($1.str,$1.length,YYTHD->variables.collation_connection); } { $$= new (&YYTHD->mem_root) String($1.str,$1.length,YYTHD->variables.collation_connection); }
| HEX_NUM | HEX_NUM
{ {
Item *tmp = new Item_varbinary($1.str,$1.length); Item *tmp = new Item_varbinary($1.str,$1.length);
...@@ -5424,7 +5424,7 @@ column_list: ...@@ -5424,7 +5424,7 @@ column_list:
column_list_id: column_list_id:
ident ident
{ {
String *new_str = new String((const char*) $1.str,$1.length,system_charset_info); String *new_str = new (&YYTHD->mem_root) String((const char*) $1.str,$1.length,system_charset_info);
List_iterator <LEX_COLUMN> iter(Lex->columns); List_iterator <LEX_COLUMN> iter(Lex->columns);
class LEX_COLUMN *point; class LEX_COLUMN *point;
LEX *lex=Lex; LEX *lex=Lex;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment