Automatic conversion from CHAR(length) to BLOB when length > 255
New operators MOD and DIV SELECT ... FROM DUAL TRUE = 1 and FALSE = 0
This commit is contained in:
parent
f86d328927
commit
305d16a7cb
@ -260,4 +260,5 @@
|
||||
#define ER_UNKNOWN_STMT_HANDLER 1241
|
||||
#define ER_CORRUPT_HELP_DB 1242
|
||||
#define ER_CYCLIC_REFERENCE 1243
|
||||
#define ER_ERROR_MESSAGES 244
|
||||
#define ER_AUTO_CONVERT 1244
|
||||
#define ER_ERROR_MESSAGES 245
|
||||
|
@ -4,3 +4,6 @@ test 1
|
||||
select version()>="3.23.29";
|
||||
version()>="3.23.29"
|
||||
1
|
||||
select TRUE,FALSE,NULL;
|
||||
TRUE FALSE NULL
|
||||
1 0 NULL
|
||||
|
@ -46,6 +46,9 @@ select 3 ^ 11, 1 ^ 1, 1 ^ 0, 1 ^ NULL, NULL ^ 1;
|
||||
select 1 XOR 1, 1 XOR 0, 0 XOR 1, 0 XOR 0, NULL XOR 1, 1 XOR NULL, 0 XOR NULL;
|
||||
1 XOR 1 1 XOR 0 0 XOR 1 0 XOR 0 NULL XOR 1 1 XOR NULL 0 XOR NULL
|
||||
0 1 1 0 NULL NULL NULL
|
||||
select 10 % 7, 10 mod 7, 10 div 3;
|
||||
10 % 7 10 mod 7 10 div 3
|
||||
3 3 3
|
||||
select 5 between 0 and 10 between 0 and 1,(5 between 0 and 10) between 0 and 1;
|
||||
5 between 0 and 10 between 0 and 1 (5 between 0 and 10) between 0 and 1
|
||||
0 1
|
||||
|
@ -1,4 +1,36 @@
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7;
|
||||
CREATE TABLE t1 (a blob, b text, c blob(250), d text(70000), e text(70000000));
|
||||
show columns from t1;
|
||||
Field Type Null Key Default Extra
|
||||
a blob YES NULL
|
||||
b text character set latin1 YES NULL
|
||||
c blob YES NULL
|
||||
d mediumtext character set latin1 YES NULL
|
||||
e longtext character set latin1 YES NULL
|
||||
CREATE TABLE t2 (a char(257), b varchar(70000) binary, c varchar(70000000));
|
||||
Warnings:
|
||||
Warning 1244 Converting column 'a' from CHAR to TEXT
|
||||
Warning 1244 Converting column 'b' from CHAR to BLOB
|
||||
Warning 1244 Converting column 'c' from CHAR to TEXT
|
||||
show columns from t2;
|
||||
Field Type Null Key Default Extra
|
||||
a text character set latin1 YES NULL
|
||||
b mediumblob YES NULL
|
||||
c longtext character set latin1 YES NULL
|
||||
create table t3 (a long, b long byte);
|
||||
show create TABLE t3;
|
||||
Table Create Table
|
||||
t3 CREATE TABLE `t3` (
|
||||
`a` mediumtext character set latin1,
|
||||
`b` mediumblob
|
||||
) TYPE=MyISAM CHARSET=latin1
|
||||
drop table t1,t2,t3
|
||||
#;
|
||||
CREATE TABLE t1 (a char(257) default "hello");
|
||||
Too big column length for column 'a' (max = 255). Use BLOB instead
|
||||
CREATE TABLE t2 (a blob default "hello");
|
||||
BLOB column 'a' can't have a default value
|
||||
drop table if exists t1,t2;
|
||||
create table t1 (nr int(5) not null auto_increment,b blob,str char(10), primary key (nr));
|
||||
insert into t1 values (null,"a","A");
|
||||
insert into t1 values (null,"bbb","BBB");
|
||||
|
@ -4,3 +4,4 @@
|
||||
|
||||
select database(),user() like "%@%";
|
||||
select version()>="3.23.29";
|
||||
select TRUE,FALSE,NULL;
|
||||
|
@ -17,6 +17,7 @@ select 2 in (3,2,5,9,5,1),"monty" in ("david","monty","allan"), 1.2 in (1.4,1.2,
|
||||
select -1.49 or -1.49,0.6 or 0.6;
|
||||
select 3 ^ 11, 1 ^ 1, 1 ^ 0, 1 ^ NULL, NULL ^ 1;
|
||||
select 1 XOR 1, 1 XOR 0, 0 XOR 1, 0 XOR 0, NULL XOR 1, 1 XOR NULL, 0 XOR NULL;
|
||||
select 10 % 7, 10 mod 7, 10 div 3;
|
||||
|
||||
#
|
||||
# Wrong usage of functions
|
||||
|
@ -1,8 +1,34 @@
|
||||
#
|
||||
# Basic cleanup
|
||||
#
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7;
|
||||
|
||||
#
|
||||
# Check syntax for creating BLOB/TEXT
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (a blob, b text, c blob(250), d text(70000), e text(70000000));
|
||||
show columns from t1;
|
||||
CREATE TABLE t2 (a char(257), b varchar(70000) binary, c varchar(70000000));
|
||||
show columns from t2;
|
||||
create table t3 (a long, b long byte);
|
||||
show create TABLE t3;
|
||||
drop table t1,t2,t3
|
||||
|
||||
#
|
||||
# Check errors with blob
|
||||
#
|
||||
|
||||
--error 1074
|
||||
CREATE TABLE t1 (a char(257) default "hello");
|
||||
--error 1101
|
||||
CREATE TABLE t2 (a blob default "hello");
|
||||
drop table if exists t1,t2;
|
||||
|
||||
#
|
||||
# test of full join with blob
|
||||
#
|
||||
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7;
|
||||
create table t1 (nr int(5) not null auto_increment,b blob,str char(10), primary key (nr));
|
||||
insert into t1 values (null,"a","A");
|
||||
insert into t1 values (null,"bbb","BBB");
|
||||
|
@ -455,6 +455,25 @@ void Item_func_div::fix_length_and_dec()
|
||||
maybe_null=1;
|
||||
}
|
||||
|
||||
|
||||
/* Integer division */
|
||||
longlong Item_func_int_div::val_int()
|
||||
{
|
||||
longlong value=args[0]->val_int();
|
||||
longlong val2=args[1]->val_int();
|
||||
if ((null_value= val2 == 0 || args[0]->null_value || args[1]->null_value))
|
||||
return 0;
|
||||
return value/val2;
|
||||
}
|
||||
|
||||
|
||||
void Item_func_int_div::fix_length_and_dec()
|
||||
{
|
||||
max_length=args[0]->max_length - args[0]->decimals;
|
||||
maybe_null=1;
|
||||
}
|
||||
|
||||
|
||||
double Item_func_mod::val()
|
||||
{
|
||||
double value= floor(args[0]->val()+0.5);
|
||||
|
@ -254,6 +254,18 @@ public:
|
||||
};
|
||||
|
||||
|
||||
class Item_func_int_div :public Item_num_op
|
||||
{
|
||||
public:
|
||||
Item_func_int_div(Item *a,Item *b) :Item_num_op(a,b)
|
||||
{ hybrid_type=INT_RESULT; }
|
||||
double val() { return (double) val_int(); }
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "DIV"; }
|
||||
void fix_length_and_dec();
|
||||
};
|
||||
|
||||
|
||||
class Item_func_mod :public Item_num_op
|
||||
{
|
||||
public:
|
||||
|
@ -127,8 +127,10 @@ static SYMBOL symbols[] = {
|
||||
{ "DISABLE", SYM(DISABLE_SYM),0,0},
|
||||
{ "DISTINCT", SYM(DISTINCT),0,0},
|
||||
{ "DISTINCTROW", SYM(DISTINCT),0,0}, /* Access likes this */
|
||||
{ "DIV", SYM(DIV_SYM),0,0},
|
||||
{ "DO", SYM(DO_SYM),0,0},
|
||||
{ "DOUBLE", SYM(DOUBLE_SYM),0,0},
|
||||
{ "DUAL", SYM(DUAL_SYM),0,0},
|
||||
{ "DROP", SYM(DROP),0,0},
|
||||
{ "DUMPFILE", SYM(DUMPFILE),0,0},
|
||||
{ "DYNAMIC", SYM(DYNAMIC_SYM),0,0},
|
||||
@ -154,6 +156,7 @@ static SYMBOL symbols[] = {
|
||||
{ "FLOAT4", SYM(FLOAT_SYM),0,0},
|
||||
{ "FLOAT8", SYM(DOUBLE_SYM),0,0},
|
||||
{ "FLUSH", SYM(FLUSH_SYM),0,0},
|
||||
{ "FALSE", SYM(FALSE_SYM),0,0},
|
||||
{ "FOREIGN", SYM(FOREIGN),0,0},
|
||||
{ "RAID_TYPE", SYM(RAID_TYPE),0,0},
|
||||
{ "RAID_CHUNKS", SYM(RAID_CHUNKS),0,0},
|
||||
@ -248,6 +251,7 @@ static SYMBOL symbols[] = {
|
||||
{ "MIN_ROWS", SYM(MIN_ROWS),0,0},
|
||||
{ "MINUTE", SYM(MINUTE_SYM),0,0},
|
||||
{ "MINUTE_SECOND", SYM(MINUTE_SECOND_SYM),0,0},
|
||||
{ "MOD", SYM(MOD_SYM),0,0},
|
||||
{ "MODE", SYM(MODE_SYM),0,0},
|
||||
{ "MODIFY", SYM(MODIFY_SYM),0,0},
|
||||
{ "MONTH", SYM(MONTH_SYM),0,0},
|
||||
@ -358,6 +362,7 @@ static SYMBOL symbols[] = {
|
||||
{ "TRAILING", SYM(TRAILING),0,0},
|
||||
{ "TRANSACTION", SYM(TRANSACTION_SYM),0,0},
|
||||
{ "TRUNCATE", SYM(TRUNCATE_SYM),0,0},
|
||||
{ "TRUE", SYM(TRUE_SYM),0,0},
|
||||
{ "TO", SYM(TO_SYM),0,0},
|
||||
{ "TYPE", SYM(TYPE_SYM),0,0},
|
||||
{ "TYPES", SYM(TYPES_SYM),0,0},
|
||||
@ -374,6 +379,7 @@ static SYMBOL symbols[] = {
|
||||
{ "VALUE", SYM(VALUE_SYM),0,0},
|
||||
{ "VALUES", SYM(VALUES),0,0},
|
||||
{ "VARCHAR", SYM(VARCHAR),0,0},
|
||||
{ "VARCHARACTER", SYM(VARCHAR),0,0},
|
||||
{ "VARIABLES", SYM(VARIABLES),0,0},
|
||||
{ "VARYING", SYM(VARYING),0,0},
|
||||
{ "VARBINARY", SYM(VARBINARY),0,0},
|
||||
@ -502,7 +508,6 @@ static SYMBOL sql_functions[] = {
|
||||
{ "MD5", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_md5)},
|
||||
{ "MID", SYM(SUBSTRING),0,0}, /* unireg function */
|
||||
{ "MIN", SYM(MIN_SYM),0,0},
|
||||
{ "MOD", SYM(FUNC_ARG2),0,CREATE_FUNC(create_func_mod)},
|
||||
{ "MLINEFROMTEXT", SYM(MLINEFROMTEXT),0,0},
|
||||
{ "MPOINTFROMTEXT", SYM(MPOINTFROMTEXT),0,0},
|
||||
{ "MPOLYFROMTEXT", SYM(MPOLYFROMTEXT),0,0},
|
||||
|
@ -254,3 +254,4 @@
|
||||
"Unknown prepared statement handler (%ld) given to %s",
|
||||
"Help database is corrupt or does not exist",
|
||||
"Cyclic reference on subqueries",
|
||||
"Converting column '%s' from %s to %s"
|
||||
|
@ -248,3 +248,4 @@
|
||||
"Unknown prepared statement handler (%ld) given to %s",
|
||||
"Help database is corrupt or does not exist",
|
||||
"Cyclic reference on subqueries",
|
||||
"Converting column '%s' from %s to %s"
|
||||
|
@ -256,3 +256,4 @@
|
||||
"Unknown prepared statement handler (%ld) given to %s",
|
||||
"Help database is corrupt or does not exist",
|
||||
"Cyclic reference on subqueries",
|
||||
"Converting column '%s' from %s to %s"
|
||||
|
@ -245,3 +245,4 @@
|
||||
"Unknown prepared statement handler (%ld) given to %s",
|
||||
"Help database is corrupt or does not exist",
|
||||
"Cyclic reference on subqueries",
|
||||
"Converting column '%s' from %s to %s"
|
||||
|
@ -250,3 +250,4 @@
|
||||
"Unknown prepared statement handler (%ld) given to %s",
|
||||
"Help database is corrupt or does not exist",
|
||||
"Cyclic reference on subqueries",
|
||||
"Converting column '%s' from %s to %s"
|
||||
|
@ -245,3 +245,4 @@
|
||||
"Unknown prepared statement handler (%ld) given to %s",
|
||||
"Help database is corrupt or does not exist",
|
||||
"Cyclic reference on subqueries",
|
||||
"Converting column '%s' from %s to %s"
|
||||
|
@ -248,3 +248,4 @@
|
||||
"Unknown prepared statement handler (%ld) given to %s",
|
||||
"Help database is corrupt or does not exist",
|
||||
"Cyclic reference on subqueries",
|
||||
"Converting column '%s' from %s to %s"
|
||||
|
@ -245,3 +245,4 @@
|
||||
"Unknown prepared statement handler (%ld) given to %s",
|
||||
"Help database is corrupt or does not exist",
|
||||
"Cyclic reference on subqueries",
|
||||
"Converting column '%s' from %s to %s"
|
||||
|
@ -247,3 +247,4 @@
|
||||
"Unknown prepared statement handler (%ld) given to %s",
|
||||
"Help database is corrupt or does not exist",
|
||||
"Cyclic reference on subqueries",
|
||||
"Converting column '%s' from %s to %s"
|
||||
|
@ -245,3 +245,4 @@
|
||||
"Unknown prepared statement handler (%ld) given to %s",
|
||||
"Help database is corrupt or does not exist",
|
||||
"Cyclic reference on subqueries",
|
||||
"Converting column '%s' from %s to %s"
|
||||
|
@ -247,3 +247,4 @@
|
||||
"Unknown prepared statement handler (%ld) given to %s",
|
||||
"Help database is corrupt or does not exist",
|
||||
"Cyclic reference on subqueries",
|
||||
"Converting column '%s' from %s to %s"
|
||||
|
@ -245,3 +245,4 @@
|
||||
"Unknown prepared statement handler (%ld) given to %s",
|
||||
"Help database is corrupt or does not exist",
|
||||
"Cyclic reference on subqueries",
|
||||
"Converting column '%s' from %s to %s"
|
||||
|
@ -247,3 +247,4 @@
|
||||
"Unknown prepared statement handler (%ld) given to %s",
|
||||
"Help database is corrupt or does not exist",
|
||||
"Cyclic reference on subqueries",
|
||||
"Converting column '%s' from %s to %s"
|
||||
|
@ -247,3 +247,4 @@
|
||||
"Unknown prepared statement handler (%ld) given to %s",
|
||||
"Help database is corrupt or does not exist",
|
||||
"Cyclic reference on subqueries",
|
||||
"Converting column '%s' from %s to %s"
|
||||
|
@ -249,3 +249,4 @@
|
||||
"Unknown prepared statement handler (%ld) given to %s",
|
||||
"Help database is corrupt or does not exist",
|
||||
"Cyclic reference on subqueries",
|
||||
"Converting column '%s' from %s to %s"
|
||||
|
@ -245,3 +245,4 @@
|
||||
"Unknown prepared statement handler (%ld) given to %s",
|
||||
"Help database is corrupt or does not exist",
|
||||
"Cyclic reference on subqueries",
|
||||
"Converting column '%s' from %s to %s"
|
||||
|
@ -249,3 +249,4 @@
|
||||
"Unknown prepared statement handler (%ld) given to %s",
|
||||
"Help database is corrupt or does not exist",
|
||||
"Cyclic reference on subqueries",
|
||||
"Converting column '%s' from %s to %s"
|
||||
|
@ -248,3 +248,4 @@
|
||||
"Unknown prepared statement handler (%ld) given to %s",
|
||||
"Help database is corrupt or does not exist",
|
||||
"ãÉËÌÉÞÅÓËÁÑ ÓÓÙÌËÁ ÎÁ ÐÏÄÚÁÐÒÏÓ",
|
||||
"Converting column '%s' from %s to %s"
|
||||
|
@ -241,3 +241,4 @@
|
||||
"Unknown prepared statement handler (%ld) given to %s",
|
||||
"Help database is corrupt or does not exist",
|
||||
"Cyclic reference on subqueries",
|
||||
"Converting column '%s' from %s to %s"
|
||||
|
@ -253,3 +253,4 @@
|
||||
"Unknown prepared statement handler (%ld) given to %s",
|
||||
"Help database is corrupt or does not exist",
|
||||
"Cyclic reference on subqueries",
|
||||
"Converting column '%s' from %s to %s"
|
||||
|
@ -246,3 +246,4 @@
|
||||
"Unknown prepared statement handler (%ld) given to %s",
|
||||
"Help database is corrupt or does not exist",
|
||||
"Cyclic reference on subqueries",
|
||||
"Converting column '%s' from %s to %s"
|
||||
|
@ -229,19 +229,20 @@
|
||||
"Option '%s' användes två gånger",
|
||||
"Användare '%-.64s' har överskridit '%s' (nuvarande värde: %ld)",
|
||||
"Du har inte privlegiet '%-.128s' som behövs för denna operation",
|
||||
"Variable '%-.64s' is a LOCAL variable and can't be used with SET GLOBAL",
|
||||
"Variable '%-.64s' is a GLOBAL variable and should be set with SET GLOBAL",
|
||||
"Variable '%-.64s' doesn't have a default value",
|
||||
"Variable '%-.64s' can't be set to the value of '%-.64s'",
|
||||
"Wrong argument type to variable '%-.64s'",
|
||||
"Variable '%-.64s' can only be set, not read",
|
||||
"Wrong usage/placement of '%s'",
|
||||
"This version of MySQL doesn't yet support '%s'",
|
||||
"Got fatal error %d: '%-.128s' from master when reading data from binary log",
|
||||
"Wrong foreign key definition for '%-.64s': %s",
|
||||
"Key reference and table reference doesn't match",
|
||||
"Subselect returns more than 1 field",
|
||||
"Subselect returns more than 1 record",
|
||||
"Unknown prepared statement handler (%ld) given to %s",
|
||||
"Help database is corrupt or does not exist",
|
||||
"Cyclic reference on subqueries",
|
||||
"Variable '%-.64s' är en LOCAL variabel och kan inte ändrad med SET GLOBAL",
|
||||
"Variable '%-.64s' är en GLOBAL variabel och bör sättas med SET GLOBAL",
|
||||
"Variable '%-.64s' har inte ett DEFAULT värde",
|
||||
"Variable '%-.64s' kan inte be satt till '%-.64s'",
|
||||
"Fel typ av argument till variabel '%-.64s'",
|
||||
"Variabeln '%-.64s' kan endast sättas, inte läsas",
|
||||
"Fel använding/placering av '%s'",
|
||||
"Denna version av MySQL kan inte utföra '%s'",
|
||||
"Fick fatalt fel %d: '%-.128s' från master vid läsning av binär loggen",
|
||||
"Felaktig FOREIGN KEY definition för '%-.64s': %s",
|
||||
"Nyckel referensen och table referensen stämmer inte överens",
|
||||
"Subselect returnerade mer än 1 fält",
|
||||
"Subselect returnerade mer än 1 rad",
|
||||
"Okänd PREPARED STATEMENT id (%ld) var given till %s",
|
||||
"Hjälp databasen finns inte eller är skadad",
|
||||
"Syklisk referens i subselect",
|
||||
"Konvertar kolumn '%s' från %s till %s"
|
||||
|
@ -250,3 +250,4 @@
|
||||
"Unknown prepared statement handler (%ld) given to %s",
|
||||
"Help database is corrupt or does not exist",
|
||||
"ãÉËÌiÞÎÅ ÐÏÓÉÌÁÎÎÑ ÎÁ ÐiÄÚÁÐÉÔ",
|
||||
"Converting column '%s' from %s to %s"
|
||||
|
@ -107,6 +107,7 @@ THD::THD():user_time(0), fatal_error(0),
|
||||
slave_proxy_id = 0;
|
||||
file_id = 0;
|
||||
cond_count=0;
|
||||
warn_id= 0;
|
||||
db_charset=default_charset_info;
|
||||
thd_charset=default_charset_info;
|
||||
mysys_var=0;
|
||||
|
@ -486,7 +486,7 @@ public:
|
||||
List <MYSQL_ERROR> warn_list;
|
||||
uint warn_count[(uint) MYSQL_ERROR::WARN_LEVEL_END];
|
||||
uint total_warn_count, old_total_warn_count;
|
||||
ulong query_id, version, options, thread_id, col_access;
|
||||
ulong query_id, warn_id, version, options, thread_id, col_access;
|
||||
ulong current_stmt_id;
|
||||
long dbug_thread_id;
|
||||
pthread_t real_id;
|
||||
|
@ -51,13 +51,22 @@ This file contains the implementation of error and warnings related
|
||||
SYNOPSIS
|
||||
mysql_reset_errors()
|
||||
thd Thread handle
|
||||
|
||||
IMPLEMENTATION
|
||||
Don't reset warnings if this has already been called for this query.
|
||||
This may happen if one gets a warning during the parsing stage,
|
||||
in which case push_warnings() has already called this function.
|
||||
*/
|
||||
|
||||
void mysql_reset_errors(THD *thd)
|
||||
{
|
||||
free_root(&thd->warn_root,MYF(0));
|
||||
bzero((char*) thd->warn_count, sizeof(thd->warn_count));
|
||||
thd->warn_list.empty();
|
||||
if (thd->query_id != thd->warn_id)
|
||||
{
|
||||
thd->warn_id= thd->query_id;
|
||||
free_root(&thd->warn_root,MYF(0));
|
||||
bzero((char*) thd->warn_count, sizeof(thd->warn_count));
|
||||
thd->warn_list.empty();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -75,6 +84,9 @@ void mysql_reset_errors(THD *thd)
|
||||
void push_warning(THD *thd, MYSQL_ERROR::enum_warning_level level, uint code,
|
||||
const char *msg)
|
||||
{
|
||||
if (thd->query_id != thd->warn_id)
|
||||
mysql_reset_errors(thd);
|
||||
|
||||
if (thd->warn_list.elements < thd->variables.max_error_count)
|
||||
{
|
||||
/*
|
||||
|
@ -855,9 +855,8 @@ int yylex(void *arg)
|
||||
case STATE_END:
|
||||
lex->next_state=STATE_END;
|
||||
return(0); // We found end of input last time
|
||||
|
||||
// Actually real shouldn't start
|
||||
// with . but allow them anyhow
|
||||
|
||||
/* Actually real shouldn't start with . but allow them anyhow */
|
||||
case STATE_REAL_OR_POINT:
|
||||
if (my_isdigit(system_charset_info,yyPeek()))
|
||||
state = STATE_REAL; // Real
|
||||
|
@ -3026,6 +3026,7 @@ bool add_field_to_list(char *field_name, enum_field_types type,
|
||||
THD *thd=current_thd;
|
||||
LEX *lex= &thd->lex;
|
||||
uint allowed_type_modifier=0;
|
||||
char warn_buff[MYSQL_ERRMSG_SIZE];
|
||||
DBUG_ENTER("add_field_to_list");
|
||||
|
||||
if (strlen(field_name) > NAME_LEN)
|
||||
@ -3117,8 +3118,6 @@ bool add_field_to_list(char *field_name, enum_field_types type,
|
||||
if (!length) new_field->length=20;
|
||||
allowed_type_modifier= AUTO_INCREMENT_FLAG;
|
||||
break;
|
||||
case FIELD_TYPE_STRING:
|
||||
case FIELD_TYPE_VAR_STRING:
|
||||
case FIELD_TYPE_NULL:
|
||||
case FIELD_TYPE_GEOMETRY:
|
||||
break;
|
||||
@ -3129,10 +3128,35 @@ bool add_field_to_list(char *field_name, enum_field_types type,
|
||||
if (new_field->decimals)
|
||||
new_field->length++;
|
||||
break;
|
||||
case FIELD_TYPE_STRING:
|
||||
case FIELD_TYPE_VAR_STRING:
|
||||
if (new_field->length < MAX_FIELD_WIDTH || default_value)
|
||||
break;
|
||||
/* Convert long CHAR() and VARCHAR columns to TEXT or BLOB */
|
||||
new_field->sql_type= FIELD_TYPE_BLOB;
|
||||
sprintf(warn_buff, ER(ER_AUTO_CONVERT), field_name, "CHAR",
|
||||
(cs == my_charset_bin) ? "BLOB" : "TEXT");
|
||||
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, ER_AUTO_CONVERT,
|
||||
warn_buff);
|
||||
/* fall through */
|
||||
case FIELD_TYPE_BLOB:
|
||||
case FIELD_TYPE_TINY_BLOB:
|
||||
case FIELD_TYPE_LONG_BLOB:
|
||||
case FIELD_TYPE_MEDIUM_BLOB:
|
||||
if (new_field->length)
|
||||
{
|
||||
/* The user has given a length to the blob column */
|
||||
if (new_field->length < 256)
|
||||
type= FIELD_TYPE_TINY_BLOB;
|
||||
if (new_field->length < 65536)
|
||||
type= FIELD_TYPE_BLOB;
|
||||
else if (new_field->length < 256L*256L*256L)
|
||||
type= FIELD_TYPE_MEDIUM_BLOB;
|
||||
else
|
||||
type= FIELD_TYPE_LONG_BLOB;
|
||||
new_field->length= 0;
|
||||
}
|
||||
new_field->sql_type= type;
|
||||
if (default_value) // Allow empty as default value
|
||||
{
|
||||
String str,*res;
|
||||
|
@ -86,6 +86,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
|
||||
%token NEXT_SYM
|
||||
%token PREV_SYM
|
||||
|
||||
%token DIV_SYM
|
||||
%token EQ
|
||||
%token EQUAL_SYM
|
||||
%token GE
|
||||
@ -94,6 +95,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
|
||||
%token LT
|
||||
%token NE
|
||||
%token IS
|
||||
%token MOD_SYM
|
||||
%token SHIFT_LEFT
|
||||
%token SHIFT_RIGHT
|
||||
%token SET_VAR
|
||||
@ -115,6 +117,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
|
||||
%token CROSS
|
||||
%token CUBE_SYM
|
||||
%token DELETE_SYM
|
||||
%token DUAL_SYM
|
||||
%token DO_SYM
|
||||
%token DROP
|
||||
%token EVENTS_SYM
|
||||
@ -200,6 +203,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
|
||||
%token ESCAPE_SYM
|
||||
%token EXISTS
|
||||
%token EXTENDED_SYM
|
||||
%token FALSE_SYM
|
||||
%token FILE_SYM
|
||||
%token FIRST_SYM
|
||||
%token FIXED_SYM
|
||||
@ -334,6 +338,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
|
||||
%token TO_SYM
|
||||
%token TRAILING
|
||||
%token TRANSACTION_SYM
|
||||
%token TRUE_SYM
|
||||
%token TYPE_SYM
|
||||
%token TYPES_SYM
|
||||
%token FUNC_ARG0
|
||||
@ -519,7 +524,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
|
||||
%left '&'
|
||||
%left SHIFT_LEFT SHIFT_RIGHT
|
||||
%left '-' '+'
|
||||
%left '*' '/' '%'
|
||||
%left '*' '/' '%' DIV_SYM MOD_SYM
|
||||
%left NEG '~'
|
||||
%left XOR
|
||||
%left '^'
|
||||
@ -542,7 +547,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
|
||||
table_ident references
|
||||
|
||||
%type <simple_string>
|
||||
remember_name remember_end opt_len opt_ident opt_db text_or_password
|
||||
remember_name remember_end opt_ident opt_db text_or_password
|
||||
opt_escape
|
||||
|
||||
%type <string>
|
||||
@ -642,12 +647,13 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
|
||||
handler_rkey_function handler_read_or_scan
|
||||
single_multi table_wild_list table_wild_one opt_wild union union_list
|
||||
precision union_option opt_on_delete_item subselect_start opt_and
|
||||
subselect_end select_var_list select_var_list_init help
|
||||
subselect_end select_var_list select_var_list_init help opt_len
|
||||
END_OF_INPUT
|
||||
|
||||
%type <NONE>
|
||||
'-' '+' '*' '/' '%' '(' ')'
|
||||
',' '!' '{' '}' '&' '|' AND OR OR_OR_CONCAT BETWEEN_SYM CASE_SYM THEN_SYM WHEN_SYM
|
||||
',' '!' '{' '}' '&' '|' AND OR OR_OR_CONCAT BETWEEN_SYM CASE_SYM
|
||||
THEN_SYM WHEN_SYM DIV_SYM MOD_SYM
|
||||
%%
|
||||
|
||||
|
||||
@ -1039,7 +1045,7 @@ field_spec:
|
||||
};
|
||||
|
||||
type:
|
||||
int_type opt_len field_options { Lex->length=$2; $$=$1; }
|
||||
int_type opt_len field_options { $$=$1; }
|
||||
| real_type opt_precision field_options { $$=$1; }
|
||||
| FLOAT_SYM float_options field_options { $$=FIELD_TYPE_FLOAT; }
|
||||
| BIT_SYM opt_len { Lex->length=(char*) "1";
|
||||
@ -1058,7 +1064,7 @@ type:
|
||||
| VARBINARY '(' NUM ')' { Lex->length=$3.str;
|
||||
Lex->charset=my_charset_bin;
|
||||
$$=FIELD_TYPE_VAR_STRING; }
|
||||
| YEAR_SYM opt_len field_options { $$=FIELD_TYPE_YEAR; Lex->length=$2; }
|
||||
| YEAR_SYM opt_len field_options { $$=FIELD_TYPE_YEAR; }
|
||||
| DATE_SYM { $$=FIELD_TYPE_DATE; }
|
||||
| TIME_SYM { $$=FIELD_TYPE_TIME; }
|
||||
| TIMESTAMP
|
||||
@ -1073,7 +1079,7 @@ type:
|
||||
| DATETIME { $$=FIELD_TYPE_DATETIME; }
|
||||
| TINYBLOB { Lex->charset=my_charset_bin;
|
||||
$$=FIELD_TYPE_TINY_BLOB; }
|
||||
| BLOB_SYM { Lex->charset=my_charset_bin;
|
||||
| BLOB_SYM opt_len { Lex->charset=my_charset_bin;
|
||||
$$=FIELD_TYPE_BLOB; }
|
||||
| GEOMETRY_SYM { Lex->charset=my_charset_bin;
|
||||
$$=FIELD_TYPE_GEOMETRY; }
|
||||
@ -1085,13 +1091,15 @@ type:
|
||||
$$=FIELD_TYPE_MEDIUM_BLOB; }
|
||||
| LONG_SYM varchar opt_binary { $$=FIELD_TYPE_MEDIUM_BLOB; }
|
||||
| TINYTEXT opt_binary { $$=FIELD_TYPE_TINY_BLOB; }
|
||||
| TEXT_SYM opt_binary { $$=FIELD_TYPE_BLOB; }
|
||||
| TEXT_SYM opt_len opt_binary { $$=FIELD_TYPE_BLOB; }
|
||||
| MEDIUMTEXT opt_binary { $$=FIELD_TYPE_MEDIUM_BLOB; }
|
||||
| LONGTEXT opt_binary { $$=FIELD_TYPE_LONG_BLOB; }
|
||||
| DECIMAL_SYM float_options field_options
|
||||
{ $$=FIELD_TYPE_DECIMAL;}
|
||||
| NUMERIC_SYM float_options field_options
|
||||
{ $$=FIELD_TYPE_DECIMAL;}
|
||||
| FIXED_SYM float_options field_options
|
||||
{ $$=FIELD_TYPE_DECIMAL;}
|
||||
| ENUM {Lex->interval_list.empty();} '(' string_list ')' opt_binary
|
||||
{
|
||||
LEX *lex=Lex;
|
||||
@ -1104,9 +1112,7 @@ type:
|
||||
lex->interval=typelib(lex->interval_list);
|
||||
$$=FIELD_TYPE_SET;
|
||||
}
|
||||
| LONG_SYM { $$=FIELD_TYPE_MEDIUM_BLOB; }
|
||||
| LONG_SYM BINARY { Lex->charset=my_charset_bin;
|
||||
$$=FIELD_TYPE_MEDIUM_BLOB; }
|
||||
| LONG_SYM opt_binary { $$=FIELD_TYPE_MEDIUM_BLOB; }
|
||||
;
|
||||
|
||||
char:
|
||||
@ -1160,8 +1166,8 @@ field_option:
|
||||
| ZEROFILL { Lex->type|= UNSIGNED_FLAG | ZEROFILL_FLAG; };
|
||||
|
||||
opt_len:
|
||||
/* empty */ { $$=(char*) 0; } /* use default length */
|
||||
| '(' NUM ')' { $$=$2.str; };
|
||||
/* empty */ { Lex->length=(char*) 0; } /* use default length */
|
||||
| '(' NUM ')' { Lex->length= $2.str; };
|
||||
|
||||
opt_precision:
|
||||
/* empty */ {}
|
||||
@ -1629,6 +1635,7 @@ select_part2:
|
||||
select_into:
|
||||
limit_clause {}
|
||||
| select_from
|
||||
| FROM DUAL_SYM
|
||||
| opt_into
|
||||
| opt_into select_from
|
||||
| select_from opt_into;
|
||||
@ -1772,6 +1779,8 @@ expr_expr:
|
||||
| expr '-' expr { $$= new Item_func_minus($1,$3); }
|
||||
| expr '*' expr { $$= new Item_func_mul($1,$3); }
|
||||
| expr '/' expr { $$= new Item_func_div($1,$3); }
|
||||
| expr DIV_SYM expr { $$= new Item_func_int_div($1,$3); }
|
||||
| expr MOD_SYM expr { $$= new Item_func_mod($1,$3); }
|
||||
| expr '|' expr { $$= new Item_func_bit_or($1,$3); }
|
||||
| expr '^' expr { $$= new Item_func_bit_xor($1,$3); }
|
||||
| expr '&' expr { $$= new Item_func_bit_and($1,$3); }
|
||||
@ -1812,10 +1821,12 @@ no_in_expr:
|
||||
| no_in_expr '-' expr { $$= new Item_func_minus($1,$3); }
|
||||
| no_in_expr '*' expr { $$= new Item_func_mul($1,$3); }
|
||||
| no_in_expr '/' expr { $$= new Item_func_div($1,$3); }
|
||||
| no_in_expr DIV_SYM expr { $$= new Item_func_int_div($1,$3); }
|
||||
| no_in_expr '|' expr { $$= new Item_func_bit_or($1,$3); }
|
||||
| no_in_expr '^' expr { $$= new Item_func_bit_xor($1,$3); }
|
||||
| no_in_expr '&' expr { $$= new Item_func_bit_and($1,$3); }
|
||||
| no_in_expr '%' expr { $$= new Item_func_mod($1,$3); }
|
||||
| no_in_expr MOD_SYM expr { $$= new Item_func_mod($1,$3); }
|
||||
| no_in_expr '+' INTERVAL_SYM expr interval
|
||||
{ $$= new Item_date_add_interval($1,$4,$5,0); }
|
||||
| no_in_expr '-' INTERVAL_SYM expr interval
|
||||
@ -1854,10 +1865,12 @@ no_and_expr:
|
||||
| no_and_expr '-' expr { $$= new Item_func_minus($1,$3); }
|
||||
| no_and_expr '*' expr { $$= new Item_func_mul($1,$3); }
|
||||
| no_and_expr '/' expr { $$= new Item_func_div($1,$3); }
|
||||
| no_and_expr DIV_SYM expr { $$= new Item_func_int_div($1,$3); }
|
||||
| no_and_expr '|' expr { $$= new Item_func_bit_or($1,$3); }
|
||||
| no_and_expr '^' expr { $$= new Item_func_bit_xor($1,$3); }
|
||||
| no_and_expr '&' expr { $$= new Item_func_bit_and($1,$3); }
|
||||
| no_and_expr '%' expr { $$= new Item_func_mod($1,$3); }
|
||||
| no_and_expr MOD_SYM expr { $$= new Item_func_mod($1,$3); }
|
||||
| no_and_expr '+' INTERVAL_SYM expr interval
|
||||
{ $$= new Item_date_add_interval($1,$4,$5,0); }
|
||||
| no_and_expr '-' INTERVAL_SYM expr interval
|
||||
@ -1975,6 +1988,8 @@ simple_expr:
|
||||
{ $$= new Item_func_export_set($3, $5, $7, $9); }
|
||||
| EXPORT_SET '(' expr ',' expr ',' expr ',' expr ',' expr ')'
|
||||
{ $$= new Item_func_export_set($3, $5, $7, $9, $11); }
|
||||
| FALSE_SYM
|
||||
{ $$= new Item_int((char*) "FALSE",0,1); }
|
||||
| FORMAT_SYM '(' expr ',' NUM ')'
|
||||
{ $$= new Item_func_format($3,atoi($5.str)); }
|
||||
| FROM_UNIXTIME '(' expr ')'
|
||||
@ -2041,6 +2056,8 @@ simple_expr:
|
||||
{ $$= new Item_func_geometry_from_text($3); }
|
||||
| MINUTE_SYM '(' expr ')'
|
||||
{ $$= new Item_func_minute($3); }
|
||||
| MOD_SYM '(' expr ',' expr ')'
|
||||
{ $$ = new Item_func_mod( $3, $5); }
|
||||
| MONTH_SYM '(' expr ')'
|
||||
{ $$= new Item_func_month($3); }
|
||||
| MULTILINESTRING '(' expr_list ')'
|
||||
@ -2120,6 +2137,8 @@ simple_expr:
|
||||
{ $$= new Item_func_trim($5,$3); }
|
||||
| TRUNCATE_SYM '(' expr ',' expr ')'
|
||||
{ $$= new Item_func_round($3,$5,1); }
|
||||
| TRUE_SYM
|
||||
{ $$= new Item_int((char*) "TRUE",1,1); }
|
||||
| UDA_CHAR_SUM '(' udf_expr_list ')'
|
||||
{
|
||||
if ($3 != NULL)
|
||||
@ -3533,6 +3552,7 @@ keyword:
|
||||
| DIRECTORY_SYM {}
|
||||
| DO_SYM {}
|
||||
| DUMPFILE {}
|
||||
| DUAL_SYM {}
|
||||
| DYNAMIC_SYM {}
|
||||
| END {}
|
||||
| ENUM {}
|
||||
|
Loading…
x
Reference in New Issue
Block a user