diff options
author | unknown <monty@mysql.com> | 2004-06-10 12:36:11 +0300 |
---|---|---|
committer | unknown <monty@mysql.com> | 2004-06-10 12:36:11 +0300 |
commit | 956d4f4e4eedab6151c5e70155bc4f0cd54305f3 (patch) | |
tree | 6b8f87f164bf656f436ac4c7b18b6b166204c6e6 | |
parent | 7a00d199a4bc83f9e3d940003c6c0f6c117d9650 (diff) | |
parent | 3e5eb498bcc47361928d20672ff6c76329860cef (diff) | |
download | mariadb-git-956d4f4e4eedab6151c5e70155bc4f0cd54305f3.tar.gz |
Merge bk-internal.mysql.com:/home/bk/mysql-4.0
into mysql.com:/home/my/mysql-4.0
sql/sql_parse.cc:
Auto merged
-rw-r--r-- | mysql-test/r/type_date.result | 15 | ||||
-rw-r--r-- | mysql-test/t/type_date.test | 8 | ||||
-rw-r--r-- | sql/field.cc | 18 | ||||
-rw-r--r-- | sql/field.h | 1 | ||||
-rw-r--r-- | sql/item_cmpfunc.h | 1 | ||||
-rw-r--r-- | sql/sql_acl.cc | 4 | ||||
-rw-r--r-- | sql/sql_parse.cc | 6 |
7 files changed, 35 insertions, 18 deletions
diff --git a/mysql-test/r/type_date.result b/mysql-test/r/type_date.result index 8dfe14bc1a2..6faf01f1f2b 100644 --- a/mysql-test/r/type_date.result +++ b/mysql-test/r/type_date.result @@ -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) 2000-08-11 2000-08-10 00:00:01 2000-08-12 2000-08-11 00:00:01 -drop table t1; -CREATE TABLE t1(AFIELD INT); -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; +DATE_FORMAT(f1, "%l.%i %p") DATE_FORMAT(f2, "%l.%i %p") +9.00 AM 12.00 PM diff --git a/mysql-test/t/type_date.test b/mysql-test/t/type_date.test index bd6d8c49c22..fe706e9bf57 100644 --- a/mysql-test/t/type_date.test +++ b/mysql-test/t/type_date.test @@ -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); 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; + +# +# 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; diff --git a/sql/field.cc b/sql/field.cc index 4e9718ca458..7273c9036c4 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -2960,6 +2960,24 @@ String *Field_time::val_str(String *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) { long tmp=(long) sint3korr(ptr); diff --git a/sql/field.h b/sql/field.h index 6f049e3809e..5a1ab163266 100644 --- a/sql/field.h +++ b/sql/field.h @@ -690,6 +690,7 @@ public: double val_real(void); longlong val_int(void); String *val_str(String*,String *); + bool get_date(TIME *ltime,bool fuzzydate); bool get_time(TIME *ltime); int cmp(const char *,const char*); void sort_string(char *buff,uint length); diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h index 9f19e7575d5..a0bcd864d4b 100644 --- a/sql/item_cmpfunc.h +++ b/sql/item_cmpfunc.h @@ -583,7 +583,6 @@ public: 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) { list.push_back(i1); list.push_back(i2); } - ~Item_cond() { list.delete_elements(); } bool add(Item *item) { return list.push_back(item); } bool fix_fields(THD *,struct st_table_list *); diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 9b676442995..4af6f407b57 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -2715,7 +2715,7 @@ bool check_grant_all_columns(THD *thd, ulong want_access, TABLE *table) if (table->grant.version != grant_version) { 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, table->real_name,0); /* purecov: inspected */ table->grant.version=grant_version; /* purecov: inspected */ @@ -2821,7 +2821,7 @@ ulong get_column_grant(THD *thd, TABLE_LIST *table, Field *field) if (table->grant.version != grant_version) { 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, table->real_name,0); /* purecov: inspected */ table->grant.version=grant_version; /* purecov: inspected */ diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index d4d61b54768..4dd5d126cc9 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -3158,10 +3158,12 @@ bool add_field_to_list(char *field_name, enum_field_types type, break; case FIELD_TYPE_DECIMAL: if (!length) - if (new_field->length= new_field->decimals) + { + if ((new_field->length= new_field->decimals)) new_field->length++; 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 { new_field->length+=sign_len; |