1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Fixed a lot of wrong memory references as reported by valgrind

Portability fixes
Added new client function: mysql_get_server_version()
New server help code (From Victor Vagin)
Fixed wrong usage of binary()
Disabled RTREE usage for now.



BitKeeper/etc/ignore:
  added scripts/fill_help_tables.sql
client/mysql.cc:
  Some fixes when using 'help'
cmd-line-utils/libedit/compat.h:
  Portability fix
cmd-line-utils/libedit/fgetln.c:
  Portability fix
include/mysql.h:
  Added new client function: mysql_get_server_version()
libmysql/libmysql.c:
  Added new client function: mysql_get_server_version()
libmysqld/libmysqld.c:
  Fixed prototype
mysql-test/install_test_db.sh:
  Added creation of help tables
mysql-test/r/connect.result:
  Added help tables
mysql-test/r/myisam.result:
  Test of RTREE index
mysql-test/r/type_ranges.result:
  updated results
mysql-test/t/myisam.test:
  Test of RTREE index
mysql-test/t/type_ranges.test:
  Updated test
mysys/charset.c:
  Indentation change
mysys/my_symlink.c:
  Removed compiler warning
scripts/fill_help_tables.sh:
  Update for new help tables
sql/field.cc:
  Indentation changes
sql/filesort.cc:
  Optimized character set usage
sql/item_cmpfunc.cc:
  Fix wrong usage of binary()
sql/item_cmpfunc.h:
  Fix wrong usage of binary()
sql/item_func.cc:
  Fix wrong usage of binary()
sql/item_func.h:
  Fix wrong usage of binary()
sql/item_strfunc.cc:
  Fix wrong usage of binary()
sql/item_sum.cc:
  Fix wrong usage of binary()
sql/item_sum.h:
  Fix wrong usage of binary()
sql/key.cc:
  Indentation change
sql/lex.h:
  HELP -> HELP_SYM
sql/mysql_priv.h:
  Make get_field() more general
sql/password.c:
  Indentation change + variable initialisation moved
sql/sql_acl.cc:
  Make get_field() more general
sql/sql_base.cc:
  Added comments + assertion for double call to mysql_lock_tables
sql/sql_cache.cc:
  Indentation changes
sql/sql_class.h:
  Added need_strxnfrm to SORT_FIELD to be able to optimise character set handling in filesort
sql/sql_derived.cc:
  Renamed variables
sql/sql_help.cc:
  New help functions (from Victor Vagin)
sql/sql_lex.cc:
  Removed variables that doesn't have to be initialized for each query
sql/sql_lex.h:
  Removed not used variable (olap)
sql/sql_parse.cc:
  Fixed (not fatal) access of unitialized memory
  Indentation / code cleanup
sql/sql_prepare.cc:
  Indentaion cleanup
sql/sql_table.cc:
  Disabled RTREE until 5.0
sql/sql_udf.cc:
  Make get_field() more general
sql/sql_yacc.yy:
  Removed access to uninitialized memory
  Always set offset_limit and select_limit when using LIMIT (removed warnings)
  Allow usage of 'help week'
sql/table.cc:
  Make get_field() more general
  More comments
sql/table.h:
  Fixded type of TABLE_LIST->derived
sql/time.cc:
  Stricter date / datetime handling (to be able to handle timestamps with days and microseconds)
strings/ctype-bin.c:
  Added cha
This commit is contained in:
unknown
2003-02-12 21:55:37 +02:00
parent 363fd89b92
commit fcb61f5917
48 changed files with 1200 additions and 650 deletions

View File

@ -112,6 +112,8 @@ class Item_bool_func2 :public Item_int_func
protected:
Arg_comparator cmp;
String tmp_value1,tmp_value2;
bool binary_cmp;
public:
Item_bool_func2(Item *a,Item *b):
Item_int_func(a,b), cmp(tmp_arg, tmp_arg+1) {}
@ -125,6 +127,7 @@ public:
bool have_rev_func() const { return rev_functype() != UNKNOWN_FUNC; }
void print(String *str) { Item_func::print_op(str); }
bool is_null() { return test(args[0]->is_null() || args[1]->is_null()); }
virtual bool binary() const { return binary_cmp; }
static Item_bool_func2* eq_creator(Item *a, Item *b);
static Item_bool_func2* ne_creator(Item *a, Item *b);
@ -156,7 +159,7 @@ public:
class Item_func_eq :public Item_bool_rowready_func2
{
public:
Item_func_eq(Item *a,Item *b) :Item_bool_rowready_func2(a,b) { };
Item_func_eq(Item *a,Item *b) :Item_bool_rowready_func2(a,b) {};
longlong val_int();
enum Functype functype() const { return EQ_FUNC; }
enum Functype rev_functype() const { return EQ_FUNC; }
@ -180,7 +183,7 @@ public:
class Item_func_ge :public Item_bool_rowready_func2
{
public:
Item_func_ge(Item *a,Item *b) :Item_bool_rowready_func2(a,b) { };
Item_func_ge(Item *a,Item *b) :Item_bool_rowready_func2(a,b) {};
longlong val_int();
enum Functype functype() const { return GE_FUNC; }
enum Functype rev_functype() const { return LE_FUNC; }
@ -192,7 +195,7 @@ public:
class Item_func_gt :public Item_bool_rowready_func2
{
public:
Item_func_gt(Item *a,Item *b) :Item_bool_rowready_func2(a,b) { };
Item_func_gt(Item *a,Item *b) :Item_bool_rowready_func2(a,b) {};
longlong val_int();
enum Functype functype() const { return GT_FUNC; }
enum Functype rev_functype() const { return LT_FUNC; }
@ -204,7 +207,7 @@ public:
class Item_func_le :public Item_bool_rowready_func2
{
public:
Item_func_le(Item *a,Item *b) :Item_bool_rowready_func2(a,b) { };
Item_func_le(Item *a,Item *b) :Item_bool_rowready_func2(a,b) {};
longlong val_int();
enum Functype functype() const { return LE_FUNC; }
enum Functype rev_functype() const { return GE_FUNC; }
@ -216,7 +219,7 @@ public:
class Item_func_lt :public Item_bool_rowready_func2
{
public:
Item_func_lt(Item *a,Item *b) :Item_bool_rowready_func2(a,b) { }
Item_func_lt(Item *a,Item *b) :Item_bool_rowready_func2(a,b) {}
longlong val_int();
enum Functype functype() const { return LT_FUNC; }
enum Functype rev_functype() const { return GT_FUNC; }
@ -228,7 +231,7 @@ public:
class Item_func_ne :public Item_bool_rowready_func2
{
public:
Item_func_ne(Item *a,Item *b) :Item_bool_rowready_func2(a,b) { }
Item_func_ne(Item *a,Item *b) :Item_bool_rowready_func2(a,b) {}
longlong val_int();
enum Functype functype() const { return NE_FUNC; }
cond_result eq_cmp_result() const { return COND_FALSE; }
@ -257,7 +260,11 @@ class Item_func_strcmp :public Item_bool_func2
public:
Item_func_strcmp(Item *a,Item *b) :Item_bool_func2(a,b) {}
longlong val_int();
void fix_length_and_dec() { max_length=2; }
void fix_length_and_dec()
{
max_length=2;
binary_cmp= args[0]->binary() || args[1]->binary();
}
optimize_type select_optimize() const { return OPTIMIZE_NONE; }
const char *func_name() const { return "strcmp"; }
};
@ -280,7 +287,9 @@ class Item_func_ifnull :public Item_func
{
enum Item_result cached_result_type;
public:
Item_func_ifnull(Item *a,Item *b) :Item_func(a,b) { }
Item_func_ifnull(Item *a,Item *b)
:Item_func(a,b), cached_result_type(INT_RESULT)
{}
double val();
longlong val_int();
String *val_str(String *str);
@ -294,7 +303,9 @@ class Item_func_if :public Item_func
{
enum Item_result cached_result_type;
public:
Item_func_if(Item *a,Item *b,Item *c) :Item_func(a,b,c) { }
Item_func_if(Item *a,Item *b,Item *c)
:Item_func(a,b,c), cached_result_type(INT_RESULT)
{}
double val();
longlong val_int();
String *val_str(String *str);
@ -313,7 +324,9 @@ class Item_func_nullif :public Item_bool_func2
{
enum Item_result cached_result_type;
public:
Item_func_nullif(Item *a,Item *b) :Item_bool_func2(a,b) { }
Item_func_nullif(Item *a,Item *b)
:Item_bool_func2(a,b), cached_result_type(INT_RESULT)
{}
double val();
longlong val_int();
String *val_str(String *str);
@ -327,7 +340,9 @@ class Item_func_coalesce :public Item_func
{
enum Item_result cached_result_type;
public:
Item_func_coalesce(List<Item> &list) :Item_func(list) {}
Item_func_coalesce(List<Item> &list)
:Item_func(list),cached_result_type(INT_RESULT)
{}
double val();
longlong val_int();
String *val_str(String *);
@ -341,9 +356,12 @@ class Item_func_case :public Item_func
Item * first_expr, *else_expr;
enum Item_result cached_result_type;
String tmp_value;
bool first_expr_is_binary;
public:
Item_func_case(List<Item> &list, Item *first_expr_, Item *else_expr_)
:Item_func(list), first_expr(first_expr_), else_expr(else_expr_) {}
Item_func_case(List<Item> &list, Item *first_expr_arg, Item *else_expr_arg)
:Item_func(list), first_expr(first_expr_arg), else_expr(else_expr_arg),
cached_result_type(INT_RESULT)
{}
double val();
longlong val_int();
String *val_str(String *);
@ -723,7 +741,6 @@ public:
optimize_type select_optimize() const;
cond_result eq_cmp_result() const { return COND_TRUE; }
const char *func_name() const { return "like"; }
void fix_length_and_dec();
bool fix_fields(THD *thd, struct st_table_list *tlist, Item **ref);
};
@ -737,6 +754,7 @@ class Item_func_regex :public Item_bool_func
bool regex_compiled;
bool regex_is_const;
String prev_regexp;
bool binary_cmp;
public:
Item_func_regex(Item *a,Item *b) :Item_bool_func(a,b),
regex_compiled(0),regex_is_const(0) {}