Commit 956d4f4e authored by unknown's avatar unknown

Merge bk-internal.mysql.com:/home/bk/mysql-4.0

into mysql.com:/home/my/mysql-4.0


sql/sql_parse.cc:
  Auto merged
parents 7a00d199 3e5eb498
...@@ -60,16 +60,5 @@ select date_add(date,INTERVAL 1 DAY),date_add(date,INTERVAL 1 SECOND) from t1; ...@@ -60,16 +60,5 @@ select date_add(date,INTERVAL 1 DAY),date_add(date,INTERVAL 1 SECOND) from t1;
date_add(date,INTERVAL 1 DAY) date_add(date,INTERVAL 1 SECOND) date_add(date,INTERVAL 1 DAY) date_add(date,INTERVAL 1 SECOND)
2000-08-11 2000-08-10 00:00:01 2000-08-11 2000-08-10 00:00:01
2000-08-12 2000-08-11 00:00:01 2000-08-12 2000-08-11 00:00:01
drop table t1; DATE_FORMAT(f1, "%l.%i %p") DATE_FORMAT(f2, "%l.%i %p")
CREATE TABLE t1(AFIELD INT); 9.00 AM 12.00 PM
INSERT INTO t1 VALUES(1);
CREATE TABLE t2(GMT VARCHAR(32));
INSERT INTO t2 VALUES('GMT-0800');
SELECT DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ' , t2.GMT)) FROM t1, t2 GROUP BY t1.AFIELD;
DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ' , t2.GMT))
Wed, 06 March 2002 10:11:12 GMT-0800
INSERT INTO t1 VALUES(1);
SELECT DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ' , t2.GMT)), DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ' , t2.GMT)) FROM t1,t2 GROUP BY t1.AFIELD;
DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ' , t2.GMT)) DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ' , t2.GMT))
Wed, 06 March 2002 10:11:12 GMT-0800 Wed, 06 March 2002 10:11:12 GMT-0800
drop table t1,t2;
...@@ -76,3 +76,11 @@ SELECT DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ' , t2. ...@@ -76,3 +76,11 @@ SELECT DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ' , t2.
INSERT INTO t1 VALUES(1); INSERT INTO t1 VALUES(1);
SELECT DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ' , t2.GMT)), DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ' , t2.GMT)) FROM t1,t2 GROUP BY t1.AFIELD; SELECT DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ' , t2.GMT)), DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ' , t2.GMT)) FROM t1,t2 GROUP BY t1.AFIELD;
drop table t1,t2; drop table t1,t2;
#
# Bug 4036
#
CREATE TABLE t1 (f1 time default NULL, f2 time default NULL) TYPE=MyISAM;
INSERT INTO t1 (f1, f2) VALUES ('09:00', '12:00');
SELECT DATE_FORMAT(f1, "%l.%i %p") , DATE_FORMAT(f2, "%l.%i %p") FROM t1;
DROP TABLE t1;
...@@ -2960,6 +2960,24 @@ String *Field_time::val_str(String *val_buffer, ...@@ -2960,6 +2960,24 @@ String *Field_time::val_str(String *val_buffer,
return val_buffer; return val_buffer;
} }
bool Field_time::get_date(TIME *ltime,
bool fuzzydate __attribute__((unused)))
{
long tmp=(long) sint3korr(ptr);
ltime->neg=0;
if (tmp < 0)
{
ltime->neg= 1;
tmp=-tmp;
}
ltime->hour=tmp/10000;
tmp-=ltime->hour*10000;
ltime->minute= tmp/100;
ltime->second= tmp % 100;
ltime->year= ltime->month= ltime->day= ltime->second_part= 0;
return 0;
}
bool Field_time::get_time(TIME *ltime) bool Field_time::get_time(TIME *ltime)
{ {
long tmp=(long) sint3korr(ptr); long tmp=(long) sint3korr(ptr);
......
...@@ -690,6 +690,7 @@ class Field_time :public Field_str { ...@@ -690,6 +690,7 @@ class Field_time :public Field_str {
double val_real(void); double val_real(void);
longlong val_int(void); longlong val_int(void);
String *val_str(String*,String *); String *val_str(String*,String *);
bool get_date(TIME *ltime,bool fuzzydate);
bool get_time(TIME *ltime); bool get_time(TIME *ltime);
int cmp(const char *,const char*); int cmp(const char *,const char*);
void sort_string(char *buff,uint length); void sort_string(char *buff,uint length);
......
...@@ -583,7 +583,6 @@ class Item_cond :public Item_bool_func ...@@ -583,7 +583,6 @@ class Item_cond :public Item_bool_func
Item_cond() : Item_bool_func(), abort_on_null(1) { const_item_cache=0; } Item_cond() : Item_bool_func(), abort_on_null(1) { const_item_cache=0; }
Item_cond(Item *i1,Item *i2) :Item_bool_func(), abort_on_null(0) Item_cond(Item *i1,Item *i2) :Item_bool_func(), abort_on_null(0)
{ list.push_back(i1); list.push_back(i2); } { list.push_back(i1); list.push_back(i2); }
~Item_cond() { list.delete_elements(); }
bool add(Item *item) { return list.push_back(item); } bool add(Item *item) { return list.push_back(item); }
bool fix_fields(THD *,struct st_table_list *); bool fix_fields(THD *,struct st_table_list *);
......
...@@ -2715,7 +2715,7 @@ bool check_grant_all_columns(THD *thd, ulong want_access, TABLE *table) ...@@ -2715,7 +2715,7 @@ bool check_grant_all_columns(THD *thd, ulong want_access, TABLE *table)
if (table->grant.version != grant_version) if (table->grant.version != grant_version)
{ {
table->grant.grant_table= table->grant.grant_table=
table_hash_search(thd->host,thd->ip,thd->db, table_hash_search(thd->host, thd->ip, table->table_cache_key,
thd->priv_user, thd->priv_user,
table->real_name,0); /* purecov: inspected */ table->real_name,0); /* purecov: inspected */
table->grant.version=grant_version; /* purecov: inspected */ table->grant.version=grant_version; /* purecov: inspected */
...@@ -2821,7 +2821,7 @@ ulong get_column_grant(THD *thd, TABLE_LIST *table, Field *field) ...@@ -2821,7 +2821,7 @@ ulong get_column_grant(THD *thd, TABLE_LIST *table, Field *field)
if (table->grant.version != grant_version) if (table->grant.version != grant_version)
{ {
table->grant.grant_table= table->grant.grant_table=
table_hash_search(thd->host,thd->ip,thd->db, table_hash_search(thd->host, thd->ip, table->db,
thd->priv_user, thd->priv_user,
table->real_name,0); /* purecov: inspected */ table->real_name,0); /* purecov: inspected */
table->grant.version=grant_version; /* purecov: inspected */ table->grant.version=grant_version; /* purecov: inspected */
......
...@@ -3158,10 +3158,12 @@ bool add_field_to_list(char *field_name, enum_field_types type, ...@@ -3158,10 +3158,12 @@ bool add_field_to_list(char *field_name, enum_field_types type,
break; break;
case FIELD_TYPE_DECIMAL: case FIELD_TYPE_DECIMAL:
if (!length) if (!length)
if (new_field->length= new_field->decimals) {
if ((new_field->length= new_field->decimals))
new_field->length++; new_field->length++;
else else
new_field->length=10; // Default length for DECIMAL new_field->length= 10; // Default length for DECIMAL
}
if (new_field->length < MAX_FIELD_WIDTH) // Skip wrong argument if (new_field->length < MAX_FIELD_WIDTH) // Skip wrong argument
{ {
new_field->length+=sign_len; new_field->length+=sign_len;
......
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