mirror of
https://github.com/MariaDB/server.git
synced 2025-01-19 13:32:33 +01:00
Merge bk-internal.mysql.com:/home/bk/mysql-4.0
into mysql.com:/home/my/mysql-4.0 sql/sql_parse.cc: Auto merged
This commit is contained in:
commit
956d4f4e4e
7 changed files with 35 additions and 18 deletions
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
18
sql/field.cc
18
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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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 *);
|
||||
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue