Commit 2977d218 authored by Sinisa@sinisa.nasamreza.org's avatar Sinisa@sinisa.nasamreza.org
Browse files

Merge sinisa@work.mysql.com:/home/bk/mysql-4.0

into sinisa.nasamreza.org:/mnt/hdc/Sinisa/mysql-4.0
parents b37297a3 ac98cf5c
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -76,4 +76,14 @@ x varchar(50) YES NULL
describe t2;
Field	Type	Null	Key	Default	Extra
x	char(50)	YES		NULL	
drop table t2;
create table t2 select now() as a , curtime() as b, curdate() as c , 1+1 as d , 1.0 + 1 as e , 33333333333333333 + 3 as f;
describe t2;
Field	Type	Null	Key	Default	Extra
a	datetime			0000-00-00 00:00:00	
b	time			00:00:00	
c	date			0000-00-00	
d	bigint(17)			0	
e	double(18,1)			0.0	
f	bigint(17)			0	
drop table t1,t2;
+3 −0
Original line number Diff line number Diff line
@@ -74,4 +74,7 @@ create table t1(x varchar(50) );
create table t2 select x from t1 where 1=2;
describe t1;
describe t2;
drop table t2;
create table t2 select now() as a , curtime() as b, curdate() as c , 1+1 as d , 1.0 + 1 as e , 33333333333333333 + 3 as f;
describe t2;
drop table t1,t2;
+12 −0
Original line number Diff line number Diff line
@@ -593,6 +593,10 @@ class Field_date :public Field_str {
    :Field_str(ptr_arg, 10, null_ptr_arg, null_bit_arg,
	       unireg_check_arg, field_name_arg, table_arg)
    {}
  Field_date(bool maybe_null_arg, const char *field_name_arg,
		 struct st_table *table_arg)
    :Field_str((char*) 0,10, maybe_null_arg ? (uchar*) "": 0,0,
	       NONE, field_name_arg, table_arg) {}
  enum_field_types type() const { return FIELD_TYPE_DATE;}
  enum ha_base_keytype key_type() const { return HA_KEYTYPE_ULONG_INT; }
  enum Item_result cmp_type () const { return INT_RESULT; }
@@ -650,6 +654,10 @@ class Field_time :public Field_str {
    :Field_str(ptr_arg, 8, null_ptr_arg, null_bit_arg,
	       unireg_check_arg, field_name_arg, table_arg)
    {}
  Field_time(bool maybe_null_arg, const char *field_name_arg,
		 struct st_table *table_arg)
    :Field_str((char*) 0,8, maybe_null_arg ? (uchar*) "": 0,0,
	       NONE, field_name_arg, table_arg) {}
  enum_field_types type() const { return FIELD_TYPE_TIME;}
  enum ha_base_keytype key_type() const { return HA_KEYTYPE_INT24; }
  enum Item_result cmp_type () const { return INT_RESULT; }
@@ -678,6 +686,10 @@ class Field_datetime :public Field_str {
    :Field_str(ptr_arg, 19, null_ptr_arg, null_bit_arg,
	       unireg_check_arg, field_name_arg, table_arg)
    {}
  Field_datetime(bool maybe_null_arg, const char *field_name_arg,
		 struct st_table *table_arg)
    :Field_str((char*) 0,19, maybe_null_arg ? (uchar*) "": 0,0,
	       NONE, field_name_arg, table_arg) {}
  enum_field_types type() const { return FIELD_TYPE_DATETIME;}
#ifdef HAVE_LONG_LONG
  enum ha_base_keytype key_type() const { return HA_KEYTYPE_ULONGLONG; }
+3 −3
Original line number Diff line number Diff line
@@ -64,7 +64,7 @@ class Item {
  virtual longlong val_int()=0;
  virtual String *val_str(String*)=0;
  virtual void make_field(Send_field *field)=0;
  virtual Field *tmp_table_field() { return 0; }
  virtual Field *tmp_table_field(TABLE *t_arg=(TABLE *)0) { return 0; }
  virtual const char *full_name() const { return name ? name : "???"; }
  virtual double  val_result() { return val(); }
  virtual longlong val_int_result() { return val_int(); }
@@ -128,7 +128,7 @@ class Item_field :public Item_ident
  {
    return field->result_type();
  }
  Field *tmp_table_field() { return result_field; }
  Field *tmp_table_field(TABLE *t_arg=(TABLE *)0) { return result_field; }
  bool get_date(TIME *ltime,bool fuzzydate);  
  bool get_time(TIME *ltime);  
  bool is_null() { return field->is_null(); }
@@ -308,7 +308,7 @@ class Item_result_field :public Item /* Item with result field */
  Field *result_field;				/* Save result here */
  Item_result_field() :result_field(0) {}
  ~Item_result_field() {}			/* Required with gcc 2.95 */
  Field *tmp_table_field() { return result_field; }
  Field *tmp_table_field(TABLE *t_arg=(TABLE *)0) { return result_field; }
  table_map used_tables() const { return 1; }
  virtual void fix_length_and_dec()=0;
};
+15 −0
Original line number Diff line number Diff line
@@ -135,6 +135,11 @@ class Item_real_func :public Item_func
  longlong val_int() { return (longlong) val(); }
  enum Item_result result_type () const { return REAL_RESULT; }
  void fix_length_and_dec() { decimals=NOT_FIXED_DEC; max_length=float_length(decimals); }
  Field *tmp_table_field(TABLE *t_arg)
  {
    if (!t_arg) return result_field;
    return new Field_double(max_length, maybe_null, name,t_arg,decimals);
  }  
};

class Item_num_func :public Item_func
@@ -164,6 +169,11 @@ class Item_num_op :public Item_func
  void fix_length_and_dec() { fix_num_length_and_dec(); find_num_type(); }
  void find_num_type(void);
  bool is_null() { (void) val(); return null_value; }
  Field *tmp_table_field(TABLE *t_arg)
  {
    if (!t_arg) return result_field;
    return args[0]->result_type() == INT_RESULT ? ((max_length > 11) ?  (Field *)new Field_longlong(max_length,maybe_null,name, t_arg,unsigned_flag) :  (Field *)new Field_long(max_length,maybe_null,name, t_arg,unsigned_flag))  : (Field *) new Field_double(max_length, maybe_null, name,t_arg,decimals);
  }  
};


@@ -179,6 +189,11 @@ class Item_int_func :public Item_func
  String *val_str(String*str);
  enum Item_result result_type () const { return INT_RESULT; }
  void fix_length_and_dec() { decimals=0; max_length=21; }
  Field *tmp_table_field(TABLE *t_arg)
  {
    if (!t_arg) return result_field;
    return (max_length > 11) ?  (Field *)new Field_longlong(max_length,maybe_null,name, t_arg,unsigned_flag) :  (Field *)new Field_long(max_length,maybe_null,name, t_arg,unsigned_flag);
  }  
};

class Item_func_plus :public Item_num_op
Loading