Commit 2723dbdb authored by unknown's avatar unknown

Automatic conversion from CHAR(length) to BLOB when length > 255

New operators MOD and DIV
SELECT ... FROM DUAL
TRUE = 1 and FALSE = 0


include/mysqld_error.h:
  New warning message
mysql-test/r/func_system.result:
  Added testing of new functions
mysql-test/r/func_test.result:
  Added testing of new functions
mysql-test/r/type_blob.result:
  Added testing of new functions
mysql-test/t/func_system.test:
  Added testing of new functions
mysql-test/t/func_test.test:
  Added testing of new functions
mysql-test/t/type_blob.test:
  Added testing of new functions
sql/item_func.cc:
  Added function DIV
sql/item_func.h:
  Added function DIV
sql/lex.h:
  New keywords
sql/share/czech/errmsg.txt:
  New warning message
sql/share/danish/errmsg.txt:
  New warning message
sql/share/dutch/errmsg.txt:
  New warning message
sql/share/english/errmsg.txt:
  New warning message
sql/share/estonian/errmsg.txt:
  New warning message
sql/share/french/errmsg.txt:
  New warning message
sql/share/german/errmsg.txt:
  New warning message
sql/share/greek/errmsg.txt:
  New warning message
sql/share/hungarian/errmsg.txt:
  New warning message
sql/share/italian/errmsg.txt:
  New warning message
sql/share/japanese/errmsg.txt:
  New warning message
sql/share/korean/errmsg.txt:
  New warning message
sql/share/norwegian-ny/errmsg.txt:
  New warning message
sql/share/norwegian/errmsg.txt:
  New warning message
sql/share/polish/errmsg.txt:
  New warning message
sql/share/portuguese/errmsg.txt:
  New warning message
sql/share/romanian/errmsg.txt:
  New warning message
sql/share/russian/errmsg.txt:
  New warning message
sql/share/serbian/errmsg.txt:
  New warning message
sql/share/slovak/errmsg.txt:
  New warning message
sql/share/spanish/errmsg.txt:
  New warning message
sql/share/swedish/errmsg.txt:
  New warning message
  Translated a lot of error messages
sql/share/ukrainian/errmsg.txt:
  New warning message
sql/sql_class.cc:
  Added support for warnings during parsing
sql/sql_class.h:
  Added support for warnings during parsing
sql/sql_error.cc:
  Added support for warnings during parsing
sql/sql_lex.cc:
  Fixed comment
sql/sql_parse.cc:
  Added automatic conversion from CHAR(length) to BLOB when length > 255
  Added support for BLOB(length)
sql/sql_yacc.yy:
  New operators MOD and DIV
  SELECT ... FROM DUAL
  TRUE = 1 and FALSE = 0
parent 548e59c6
...@@ -260,4 +260,5 @@ ...@@ -260,4 +260,5 @@
#define ER_UNKNOWN_STMT_HANDLER 1241 #define ER_UNKNOWN_STMT_HANDLER 1241
#define ER_CORRUPT_HELP_DB 1242 #define ER_CORRUPT_HELP_DB 1242
#define ER_CYCLIC_REFERENCE 1243 #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 ...@@ -4,3 +4,6 @@ test 1
select version()>="3.23.29"; select version()>="3.23.29";
version()>="3.23.29" version()>="3.23.29"
1 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; ...@@ -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; 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 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 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; 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 5 between 0 and 10 between 0 and 1 (5 between 0 and 10) between 0 and 1
0 1 0 1
......
drop table if exists t1,t2,t3,t4,t5,t6,t7; 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)); 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,"a","A");
insert into t1 values (null,"bbb","BBB"); insert into t1 values (null,"bbb","BBB");
......
...@@ -4,3 +4,4 @@ ...@@ -4,3 +4,4 @@
select database(),user() like "%@%"; select database(),user() like "%@%";
select version()>="3.23.29"; 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, ...@@ -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 -1.49 or -1.49,0.6 or 0.6;
select 3 ^ 11, 1 ^ 1, 1 ^ 0, 1 ^ NULL, NULL ^ 1; 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 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 # Wrong usage of functions
......
#
# 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 # 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)); 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,"a","A");
insert into t1 values (null,"bbb","BBB"); insert into t1 values (null,"bbb","BBB");
......
...@@ -455,6 +455,25 @@ void Item_func_div::fix_length_and_dec() ...@@ -455,6 +455,25 @@ void Item_func_div::fix_length_and_dec()
maybe_null=1; 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 Item_func_mod::val()
{ {
double value= floor(args[0]->val()+0.5); double value= floor(args[0]->val()+0.5);
......
...@@ -254,6 +254,18 @@ public: ...@@ -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 class Item_func_mod :public Item_num_op
{ {
public: public:
......
...@@ -127,8 +127,10 @@ static SYMBOL symbols[] = { ...@@ -127,8 +127,10 @@ static SYMBOL symbols[] = {
{ "DISABLE", SYM(DISABLE_SYM),0,0}, { "DISABLE", SYM(DISABLE_SYM),0,0},
{ "DISTINCT", SYM(DISTINCT),0,0}, { "DISTINCT", SYM(DISTINCT),0,0},
{ "DISTINCTROW", SYM(DISTINCT),0,0}, /* Access likes this */ { "DISTINCTROW", SYM(DISTINCT),0,0}, /* Access likes this */
{ "DIV", SYM(DIV_SYM),0,0},
{ "DO", SYM(DO_SYM),0,0}, { "DO", SYM(DO_SYM),0,0},
{ "DOUBLE", SYM(DOUBLE_SYM),0,0}, { "DOUBLE", SYM(DOUBLE_SYM),0,0},
{ "DUAL", SYM(DUAL_SYM),0,0},
{ "DROP", SYM(DROP),0,0}, { "DROP", SYM(DROP),0,0},
{ "DUMPFILE", SYM(DUMPFILE),0,0}, { "DUMPFILE", SYM(DUMPFILE),0,0},
{ "DYNAMIC", SYM(DYNAMIC_SYM),0,0}, { "DYNAMIC", SYM(DYNAMIC_SYM),0,0},
...@@ -154,6 +156,7 @@ static SYMBOL symbols[] = { ...@@ -154,6 +156,7 @@ static SYMBOL symbols[] = {
{ "FLOAT4", SYM(FLOAT_SYM),0,0}, { "FLOAT4", SYM(FLOAT_SYM),0,0},
{ "FLOAT8", SYM(DOUBLE_SYM),0,0}, { "FLOAT8", SYM(DOUBLE_SYM),0,0},
{ "FLUSH", SYM(FLUSH_SYM),0,0}, { "FLUSH", SYM(FLUSH_SYM),0,0},
{ "FALSE", SYM(FALSE_SYM),0,0},
{ "FOREIGN", SYM(FOREIGN),0,0}, { "FOREIGN", SYM(FOREIGN),0,0},
{ "RAID_TYPE", SYM(RAID_TYPE),0,0}, { "RAID_TYPE", SYM(RAID_TYPE),0,0},
{ "RAID_CHUNKS", SYM(RAID_CHUNKS),0,0}, { "RAID_CHUNKS", SYM(RAID_CHUNKS),0,0},
...@@ -248,6 +251,7 @@ static SYMBOL symbols[] = { ...@@ -248,6 +251,7 @@ static SYMBOL symbols[] = {
{ "MIN_ROWS", SYM(MIN_ROWS),0,0}, { "MIN_ROWS", SYM(MIN_ROWS),0,0},
{ "MINUTE", SYM(MINUTE_SYM),0,0}, { "MINUTE", SYM(MINUTE_SYM),0,0},
{ "MINUTE_SECOND", SYM(MINUTE_SECOND_SYM),0,0}, { "MINUTE_SECOND", SYM(MINUTE_SECOND_SYM),0,0},
{ "MOD", SYM(MOD_SYM),0,0},
{ "MODE", SYM(MODE_SYM),0,0}, { "MODE", SYM(MODE_SYM),0,0},
{ "MODIFY", SYM(MODIFY_SYM),0,0}, { "MODIFY", SYM(MODIFY_SYM),0,0},
{ "MONTH", SYM(MONTH_SYM),0,0}, { "MONTH", SYM(MONTH_SYM),0,0},
...@@ -358,6 +362,7 @@ static SYMBOL symbols[] = { ...@@ -358,6 +362,7 @@ static SYMBOL symbols[] = {
{ "TRAILING", SYM(TRAILING),0,0}, { "TRAILING", SYM(TRAILING),0,0},
{ "TRANSACTION", SYM(TRANSACTION_SYM),0,0}, { "TRANSACTION", SYM(TRANSACTION_SYM),0,0},
{ "TRUNCATE", SYM(TRUNCATE_SYM),0,0}, { "TRUNCATE", SYM(TRUNCATE_SYM),0,0},
{ "TRUE", SYM(TRUE_SYM),0,0},
{ "TO", SYM(TO_SYM),0,0}, { "TO", SYM(TO_SYM),0,0},
{ "TYPE", SYM(TYPE_SYM),0,0}, { "TYPE", SYM(TYPE_SYM),0,0},
{ "TYPES", SYM(TYPES_SYM),0,0}, { "TYPES", SYM(TYPES_SYM),0,0},
...@@ -374,6 +379,7 @@ static SYMBOL symbols[] = { ...@@ -374,6 +379,7 @@ static SYMBOL symbols[] = {
{ "VALUE", SYM(VALUE_SYM),0,0}, { "VALUE", SYM(VALUE_SYM),0,0},
{ "VALUES", SYM(VALUES),0,0}, { "VALUES", SYM(VALUES),0,0},
{ "VARCHAR", SYM(VARCHAR),0,0}, { "VARCHAR", SYM(VARCHAR),0,0},
{ "VARCHARACTER", SYM(VARCHAR),0,0},
{ "VARIABLES", SYM(VARIABLES),0,0}, { "VARIABLES", SYM(VARIABLES),0,0},
{ "VARYING", SYM(VARYING),0,0}, { "VARYING", SYM(VARYING),0,0},
{ "VARBINARY", SYM(VARBINARY),0,0}, { "VARBINARY", SYM(VARBINARY),0,0},
...@@ -502,7 +508,6 @@ static SYMBOL sql_functions[] = { ...@@ -502,7 +508,6 @@ static SYMBOL sql_functions[] = {
{ "MD5", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_md5)}, { "MD5", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_md5)},
{ "MID", SYM(SUBSTRING),0,0}, /* unireg function */ { "MID", SYM(SUBSTRING),0,0}, /* unireg function */
{ "MIN", SYM(MIN_SYM),0,0}, { "MIN", SYM(MIN_SYM),0,0},
{ "MOD", SYM(FUNC_ARG2),0,CREATE_FUNC(create_func_mod)},
{ "MLINEFROMTEXT", SYM(MLINEFROMTEXT),0,0}, { "MLINEFROMTEXT", SYM(MLINEFROMTEXT),0,0},
{ "MPOINTFROMTEXT", SYM(MPOINTFROMTEXT),0,0}, { "MPOINTFROMTEXT", SYM(MPOINTFROMTEXT),0,0},
{ "MPOLYFROMTEXT", SYM(MPOLYFROMTEXT),0,0}, { "MPOLYFROMTEXT", SYM(MPOLYFROMTEXT),0,0},
......
...@@ -254,3 +254,4 @@ ...@@ -254,3 +254,4 @@
"Unknown prepared statement handler (%ld) given to %s", "Unknown prepared statement handler (%ld) given to %s",
"Help database is corrupt or does not exist", "Help database is corrupt or does not exist",
"Cyclic reference on subqueries", "Cyclic reference on subqueries",
"Converting column '%s' from %s to %s"
...@@ -248,3 +248,4 @@ ...@@ -248,3 +248,4 @@
"Unknown prepared statement handler (%ld) given to %s", "Unknown prepared statement handler (%ld) given to %s",
"Help database is corrupt or does not exist", "Help database is corrupt or does not exist",
"Cyclic reference on subqueries", "Cyclic reference on subqueries",
"Converting column '%s' from %s to %s"
...@@ -256,3 +256,4 @@ ...@@ -256,3 +256,4 @@
"Unknown prepared statement handler (%ld) given to %s", "Unknown prepared statement handler (%ld) given to %s",
"Help database is corrupt or does not exist", "Help database is corrupt or does not exist",
"Cyclic reference on subqueries", "Cyclic reference on subqueries",
"Converting column '%s' from %s to %s"
...@@ -245,3 +245,4 @@ ...@@ -245,3 +245,4 @@
"Unknown prepared statement handler (%ld) given to %s", "Unknown prepared statement handler (%ld) given to %s",
"Help database is corrupt or does not exist", "Help database is corrupt or does not exist",
"Cyclic reference on subqueries", "Cyclic reference on subqueries",
"Converting column '%s' from %s to %s"
...@@ -250,3 +250,4 @@ ...@@ -250,3 +250,4 @@
"Unknown prepared statement handler (%ld) given to %s", "Unknown prepared statement handler (%ld) given to %s",
"Help database is corrupt or does not exist", "Help database is corrupt or does not exist",
"Cyclic reference on subqueries", "Cyclic reference on subqueries",
"Converting column '%s' from %s to %s"
...@@ -245,3 +245,4 @@ ...@@ -245,3 +245,4 @@
"Unknown prepared statement handler (%ld) given to %s", "Unknown prepared statement handler (%ld) given to %s",
"Help database is corrupt or does not exist", "Help database is corrupt or does not exist",
"Cyclic reference on subqueries", "Cyclic reference on subqueries",
"Converting column '%s' from %s to %s"
...@@ -248,3 +248,4 @@ ...@@ -248,3 +248,4 @@
"Unknown prepared statement handler (%ld) given to %s", "Unknown prepared statement handler (%ld) given to %s",
"Help database is corrupt or does not exist", "Help database is corrupt or does not exist",
"Cyclic reference on subqueries", "Cyclic reference on subqueries",
"Converting column '%s' from %s to %s"
...@@ -245,3 +245,4 @@ ...@@ -245,3 +245,4 @@
"Unknown prepared statement handler (%ld) given to %s", "Unknown prepared statement handler (%ld) given to %s",
"Help database is corrupt or does not exist", "Help database is corrupt or does not exist",
"Cyclic reference on subqueries", "Cyclic reference on subqueries",
"Converting column '%s' from %s to %s"
...@@ -247,3 +247,4 @@ ...@@ -247,3 +247,4 @@
"Unknown prepared statement handler (%ld) given to %s", "Unknown prepared statement handler (%ld) given to %s",
"Help database is corrupt or does not exist", "Help database is corrupt or does not exist",
"Cyclic reference on subqueries", "Cyclic reference on subqueries",
"Converting column '%s' from %s to %s"
...@@ -245,3 +245,4 @@ ...@@ -245,3 +245,4 @@
"Unknown prepared statement handler (%ld) given to %s", "Unknown prepared statement handler (%ld) given to %s",
"Help database is corrupt or does not exist", "Help database is corrupt or does not exist",
"Cyclic reference on subqueries", "Cyclic reference on subqueries",
"Converting column '%s' from %s to %s"
...@@ -247,3 +247,4 @@ ...@@ -247,3 +247,4 @@
"Unknown prepared statement handler (%ld) given to %s", "Unknown prepared statement handler (%ld) given to %s",
"Help database is corrupt or does not exist", "Help database is corrupt or does not exist",
"Cyclic reference on subqueries", "Cyclic reference on subqueries",
"Converting column '%s' from %s to %s"
...@@ -245,3 +245,4 @@ ...@@ -245,3 +245,4 @@
"Unknown prepared statement handler (%ld) given to %s", "Unknown prepared statement handler (%ld) given to %s",
"Help database is corrupt or does not exist", "Help database is corrupt or does not exist",
"Cyclic reference on subqueries", "Cyclic reference on subqueries",
"Converting column '%s' from %s to %s"
...@@ -247,3 +247,4 @@ ...@@ -247,3 +247,4 @@
"Unknown prepared statement handler (%ld) given to %s", "Unknown prepared statement handler (%ld) given to %s",
"Help database is corrupt or does not exist", "Help database is corrupt or does not exist",
"Cyclic reference on subqueries", "Cyclic reference on subqueries",
"Converting column '%s' from %s to %s"
...@@ -247,3 +247,4 @@ ...@@ -247,3 +247,4 @@
"Unknown prepared statement handler (%ld) given to %s", "Unknown prepared statement handler (%ld) given to %s",
"Help database is corrupt or does not exist", "Help database is corrupt or does not exist",
"Cyclic reference on subqueries", "Cyclic reference on subqueries",
"Converting column '%s' from %s to %s"
...@@ -249,3 +249,4 @@ ...@@ -249,3 +249,4 @@
"Unknown prepared statement handler (%ld) given to %s", "Unknown prepared statement handler (%ld) given to %s",
"Help database is corrupt or does not exist", "Help database is corrupt or does not exist",
"Cyclic reference on subqueries", "Cyclic reference on subqueries",
"Converting column '%s' from %s to %s"
...@@ -245,3 +245,4 @@ ...@@ -245,3 +245,4 @@
"Unknown prepared statement handler (%ld) given to %s", "Unknown prepared statement handler (%ld) given to %s",
"Help database is corrupt or does not exist", "Help database is corrupt or does not exist",
"Cyclic reference on subqueries", "Cyclic reference on subqueries",
"Converting column '%s' from %s to %s"
...@@ -249,3 +249,4 @@ ...@@ -249,3 +249,4 @@
"Unknown prepared statement handler (%ld) given to %s", "Unknown prepared statement handler (%ld) given to %s",
"Help database is corrupt or does not exist", "Help database is corrupt or does not exist",
"Cyclic reference on subqueries", "Cyclic reference on subqueries",
"Converting column '%s' from %s to %s"
...@@ -248,3 +248,4 @@ ...@@ -248,3 +248,4 @@
"Unknown prepared statement handler (%ld) given to %s", "Unknown prepared statement handler (%ld) given to %s",
"Help database is corrupt or does not exist", "Help database is corrupt or does not exist",
" ", " ",
"Converting column '%s' from %s to %s"
...@@ -241,3 +241,4 @@ ...@@ -241,3 +241,4 @@
"Unknown prepared statement handler (%ld) given to %s", "Unknown prepared statement handler (%ld) given to %s",
"Help database is corrupt or does not exist", "Help database is corrupt or does not exist",
"Cyclic reference on subqueries", "Cyclic reference on subqueries",
"Converting column '%s' from %s to %s"
...@@ -253,3 +253,4 @@ ...@@ -253,3 +253,4 @@
"Unknown prepared statement handler (%ld) given to %s", "Unknown prepared statement handler (%ld) given to %s",
"Help database is corrupt or does not exist", "Help database is corrupt or does not exist",
"Cyclic reference on subqueries", "Cyclic reference on subqueries",
"Converting column '%s' from %s to %s"
...@@ -246,3 +246,4 @@ ...@@ -246,3 +246,4 @@
"Unknown prepared statement handler (%ld) given to %s", "Unknown prepared statement handler (%ld) given to %s",
"Help database is corrupt or does not exist", "Help database is corrupt or does not exist",
"Cyclic reference on subqueries", "Cyclic reference on subqueries",
"Converting column '%s' from %s to %s"
...@@ -229,19 +229,20 @@ ...@@ -229,19 +229,20 @@
"Option '%s' användes två gånger", "Option '%s' användes två gånger",
"Användare '%-.64s' har överskridit '%s' (nuvarande värde: %ld)", "Användare '%-.64s' har överskridit '%s' (nuvarande värde: %ld)",
"Du har inte privlegiet '%-.128s' som behövs för denna operation", "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' är en LOCAL variabel och kan inte ändrad med SET GLOBAL",
"Variable '%-.64s' is a GLOBAL variable and should be set with SET GLOBAL", "Variable '%-.64s' är en GLOBAL variabel och bör sättas med SET GLOBAL",
"Variable '%-.64s' doesn't have a default value", "Variable '%-.64s' har inte ett DEFAULT värde",
"Variable '%-.64s' can't be set to the value of '%-.64s'", "Variable '%-.64s' kan inte be satt till '%-.64s'",
"Wrong argument type to variable '%-.64s'", "Fel typ av argument till variabel '%-.64s'",
"Variable '%-.64s' can only be set, not read", "Variabeln '%-.64s' kan endast sättas, inte läsas",
"Wrong usage/placement of '%s'", "Fel använding/placering av '%s'",
"This version of MySQL doesn't yet support '%s'", "Denna version av MySQL kan inte utföra '%s'",
"Got fatal error %d: '%-.128s' from master when reading data from binary log", "Fick fatalt fel %d: '%-.128s' från master vid läsning av binär loggen",
"Wrong foreign key definition for '%-.64s': %s", "Felaktig FOREIGN KEY definition för '%-.64s': %s",
"Key reference and table reference doesn't match", "Nyckel referensen och table referensen stämmer inte överens",
"Subselect returns more than 1 field", "Subselect returnerade mer än 1 fält",
"Subselect returns more than 1 record", "Subselect returnerade mer än 1 rad",
"Unknown prepared statement handler (%ld) given to %s", "Okänd PREPARED STATEMENT id (%ld) var given till %s",
"Help database is corrupt or does not exist", "Hjälp databasen finns inte eller är skadad",
"Cyclic reference on subqueries", "Syklisk referens i subselect",
"Konvertar kolumn '%s' från %s till %s"
...@@ -250,3 +250,4 @@ ...@@ -250,3 +250,4 @@
"Unknown prepared statement handler (%ld) given to %s", "Unknown prepared statement handler (%ld) given to %s",
"Help database is corrupt or does not exist", "Help database is corrupt or does not exist",
"i i", "i i",
"Converting column '%s' from %s to %s"
...@@ -107,6 +107,7 @@ THD::THD():user_time(0), fatal_error(0), ...@@ -107,6 +107,7 @@ THD::THD():user_time(0), fatal_error(0),
slave_proxy_id = 0; slave_proxy_id = 0;
file_id = 0; file_id = 0;
cond_count=0; cond_count=0;
warn_id= 0;
db_charset=default_charset_info; db_charset=default_charset_info;
thd_charset=default_charset_info; thd_charset=default_charset_info;
mysys_var=0; mysys_var=0;
......
...@@ -486,7 +486,7 @@ public: ...@@ -486,7 +486,7 @@ public:
List <MYSQL_ERROR> warn_list; List <MYSQL_ERROR> warn_list;
uint warn_count[(uint) MYSQL_ERROR::WARN_LEVEL_END]; uint warn_count[(uint) MYSQL_ERROR::WARN_LEVEL_END];
uint total_warn_count, old_total_warn_count; 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; ulong current_stmt_id;
long dbug_thread_id; long dbug_thread_id;
pthread_t real_id; pthread_t real_id;
......
...@@ -51,13 +51,22 @@ This file contains the implementation of error and warnings related ...@@ -51,13 +51,22 @@ This file contains the implementation of error and warnings related
SYNOPSIS SYNOPSIS
mysql_reset_errors() mysql_reset_errors()
thd Thread handle 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) void mysql_reset_errors(THD *thd)
{ {
free_root(&thd->warn_root,MYF(0)); if (thd->query_id != thd->warn_id)
bzero((char*) thd->warn_count, sizeof(thd->warn_count)); {
thd->warn_list.empty(); 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) ...@@ -75,6 +84,9 @@ void mysql_reset_errors(THD *thd)
void push_warning(THD *thd, MYSQL_ERROR::enum_warning_level level, uint code, void push_warning(THD *thd, MYSQL_ERROR::enum_warning_level level, uint code,
const char *msg) const char *msg)
{ {
if (thd->query_id != thd->warn_id)
mysql_reset_errors(thd);
if (thd->warn_list.elements < thd->variables.max_error_count) if (thd->warn_list.elements < thd->variables.max_error_count)
{ {
/* /*
......
...@@ -855,9 +855,8 @@ int yylex(void *arg) ...@@ -855,9 +855,8 @@ int yylex(void *arg)
case STATE_END: case STATE_END:
lex->next_state=STATE_END; lex->next_state=STATE_END;
return(0); // We found end of input last time return(0); // We found end of input last time
// Actually real shouldn't start /* Actually real shouldn't start with . but allow them anyhow */
// with . but allow them anyhow
case STATE_REAL_OR_POINT: case STATE_REAL_OR_POINT:
if (my_isdigit(system_charset_info,yyPeek())) if (my_isdigit(system_charset_info,yyPeek()))
state = STATE_REAL; // Real state = STATE_REAL; // Real
......
...@@ -3026,6 +3026,7 @@ bool add_field_to_list(char *field_name, enum_field_types type, ...@@ -3026,6 +3026,7 @@ bool add_field_to_list(char *field_name, enum_field_types type,
THD *thd=current_thd; THD *thd=current_thd;
LEX *lex= &thd->lex; LEX *lex= &thd->lex;
uint allowed_type_modifier=0; uint allowed_type_modifier=0;
char warn_buff[MYSQL_ERRMSG_SIZE];
DBUG_ENTER("add_field_to_list"); DBUG_ENTER("add_field_to_list");
if (strlen(field_name) > NAME_LEN) if (strlen(field_name) > NAME_LEN)
...@@ -3117,8 +3118,6 @@ bool add_field_to_list(char *field_name, enum_field_types type, ...@@ -3117,8 +3118,6 @@ bool add_field_to_list(char *field_name, enum_field_types type,
if (!length) new_field->length=20; if (!length) new_field->length=20;
allowed_type_modifier= AUTO_INCREMENT_FLAG; allowed_type_modifier= AUTO_INCREMENT_FLAG;
break; break;
case FIELD_TYPE_STRING:
case FIELD_TYPE_VAR_STRING:
case FIELD_TYPE_NULL: case FIELD_TYPE_NULL:
case FIELD_TYPE_GEOMETRY: case FIELD_TYPE_GEOMETRY:
break; break;
...@@ -3129,10 +3128,35 @@ bool add_field_to_list(char *field_name, enum_field_types type, ...@@ -3129,10 +3128,35 @@ bool add_field_to_list(char *field_name, enum_field_types type,
if (new_field->decimals) if (new_field->decimals)
new_field->length++; new_field->length++;
break; 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_BLOB:
case FIELD_TYPE_TINY_BLOB: case FIELD_TYPE_TINY_BLOB:
case FIELD_TYPE_LONG_BLOB: case FIELD_TYPE_LONG_BLOB:
case FIELD_TYPE_MEDIUM_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 if (default_value) // Allow empty as default value
{ {
String str,*res; String str,*res;
......
...@@ -86,6 +86,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize); ...@@ -86,6 +86,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
%token NEXT_SYM %token NEXT_SYM
%token PREV_SYM %token PREV_SYM
%token DIV_SYM
%token EQ %token EQ
%token EQUAL_SYM %token EQUAL_SYM
%token GE %token GE
...@@ -94,6 +95,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize); ...@@ -94,6 +95,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
%token LT %token LT
%token NE %token NE
%token IS %token IS
%token MOD_SYM
%token SHIFT_LEFT %token SHIFT_LEFT
%token SHIFT_RIGHT %token SHIFT_RIGHT
%token SET_VAR %token SET_VAR
...@@ -115,6 +117,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize); ...@@ -115,6 +117,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
%token CROSS %token CROSS
%token CUBE_SYM %token CUBE_SYM
%token DELETE_SYM %token DELETE_SYM
%token DUAL_SYM
%token DO_SYM %token DO_SYM
%token DROP %token DROP
%token EVENTS_SYM %token EVENTS_SYM
...@@ -200,6 +203,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize); ...@@ -200,6 +203,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
%token ESCAPE_SYM %token ESCAPE_SYM
%token EXISTS %token EXISTS
%token EXTENDED_SYM %token EXTENDED_SYM
%token FALSE_SYM
%token FILE_SYM %token FILE_SYM
%token FIRST_SYM %token FIRST_SYM
%token FIXED_SYM %token FIXED_SYM
...@@ -334,6 +338,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize); ...@@ -334,6 +338,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
%token TO_SYM %token TO_SYM
%token TRAILING %token TRAILING
%token TRANSACTION_SYM %token TRANSACTION_SYM
%token TRUE_SYM
%token TYPE_SYM %token TYPE_SYM
%token TYPES_SYM %token TYPES_SYM
%token FUNC_ARG0 %token FUNC_ARG0
...@@ -519,7 +524,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize); ...@@ -519,7 +524,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
%left '&' %left '&'
%left SHIFT_LEFT SHIFT_RIGHT %left SHIFT_LEFT SHIFT_RIGHT
%left '-' '+' %left '-' '+'
%left '*' '/' '%' %left '*' '/' '%' DIV_SYM MOD_SYM
%left NEG '~' %left NEG '~'
%left XOR %left XOR
%left '^' %left '^'
...@@ -542,7 +547,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize); ...@@ -542,7 +547,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
table_ident references table_ident references
%type <simple_string> %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 opt_escape
%type <string> %type <string>
...@@ -642,12 +647,13 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize); ...@@ -642,12 +647,13 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
handler_rkey_function handler_read_or_scan handler_rkey_function handler_read_or_scan
single_multi table_wild_list table_wild_one opt_wild union union_list single_multi table_wild_list table_wild_one opt_wild union union_list
precision union_option opt_on_delete_item subselect_start opt_and 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 END_OF_INPUT
%type <NONE> %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: ...@@ -1039,7 +1045,7 @@ field_spec:
}; };
type: 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; } | real_type opt_precision field_options { $$=$1; }
| FLOAT_SYM float_options field_options { $$=FIELD_TYPE_FLOAT; } | FLOAT_SYM float_options field_options { $$=FIELD_TYPE_FLOAT; }
| BIT_SYM opt_len { Lex->length=(char*) "1"; | BIT_SYM opt_len { Lex->length=(char*) "1";
...@@ -1058,7 +1064,7 @@ type: ...@@ -1058,7 +1064,7 @@ type:
| VARBINARY '(' NUM ')' { Lex->length=$3.str; | VARBINARY '(' NUM ')' { Lex->length=$3.str;
Lex->charset=my_charset_bin; Lex->charset=my_charset_bin;
$$=FIELD_TYPE_VAR_STRING; } $$=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; } | DATE_SYM { $$=FIELD_TYPE_DATE; }
| TIME_SYM { $$=FIELD_TYPE_TIME; } | TIME_SYM { $$=FIELD_TYPE_TIME; }
| TIMESTAMP | TIMESTAMP
...@@ -1073,7 +1079,7 @@ type: ...@@ -1073,7 +1079,7 @@ type:
| DATETIME { $$=FIELD_TYPE_DATETIME; } | DATETIME { $$=FIELD_TYPE_DATETIME; }
| TINYBLOB { Lex->charset=my_charset_bin; | TINYBLOB { Lex->charset=my_charset_bin;
$$=FIELD_TYPE_TINY_BLOB; } $$=FIELD_TYPE_TINY_BLOB; }
| BLOB_SYM { Lex->charset=my_charset_bin; | BLOB_SYM opt_len { Lex->charset=my_charset_bin;
$$=FIELD_TYPE_BLOB; } $$=FIELD_TYPE_BLOB; }
| GEOMETRY_SYM { Lex->charset=my_charset_bin; | GEOMETRY_SYM { Lex->charset=my_charset_bin;
$$=FIELD_TYPE_GEOMETRY; } $$=FIELD_TYPE_GEOMETRY; }
...@@ -1085,13 +1091,15 @@ type: ...@@ -1085,13 +1091,15 @@ type:
$$=FIELD_TYPE_MEDIUM_BLOB; } $$=FIELD_TYPE_MEDIUM_BLOB; }
| LONG_SYM varchar opt_binary { $$=FIELD_TYPE_MEDIUM_BLOB; } | LONG_SYM varchar opt_binary { $$=FIELD_TYPE_MEDIUM_BLOB; }
| TINYTEXT opt_binary { $$=FIELD_TYPE_TINY_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; } | MEDIUMTEXT opt_binary { $$=FIELD_TYPE_MEDIUM_BLOB; }
| LONGTEXT opt_binary { $$=FIELD_TYPE_LONG_BLOB; } | LONGTEXT opt_binary { $$=FIELD_TYPE_LONG_BLOB; }
| DECIMAL_SYM float_options field_options | DECIMAL_SYM float_options field_options
{ $$=FIELD_TYPE_DECIMAL;} { $$=FIELD_TYPE_DECIMAL;}
| NUMERIC_SYM float_options field_options | NUMERIC_SYM float_options field_options
{ $$=FIELD_TYPE_DECIMAL;} { $$=FIELD_TYPE_DECIMAL;}
| FIXED_SYM float_options field_options
{ $$=FIELD_TYPE_DECIMAL;}
| ENUM {Lex->interval_list.empty();} '(' string_list ')' opt_binary | ENUM {Lex->interval_list.empty();} '(' string_list ')' opt_binary
{ {
LEX *lex=Lex; LEX *lex=Lex;
...@@ -1104,9 +1112,7 @@ type: ...@@ -1104,9 +1112,7 @@ type:
lex->interval=typelib(lex->interval_list); lex->interval=typelib(lex->interval_list);
$$=FIELD_TYPE_SET; $$=FIELD_TYPE_SET;
} }
| LONG_SYM { $$=FIELD_TYPE_MEDIUM_BLOB; } | LONG_SYM opt_binary { $$=FIELD_TYPE_MEDIUM_BLOB; }
| LONG_SYM BINARY { Lex->charset=my_charset_bin;
$$=FIELD_TYPE_MEDIUM_BLOB; }
; ;
char: char:
...@@ -1160,8 +1166,8 @@ field_option: ...@@ -1160,8 +1166,8 @@ field_option:
| ZEROFILL { Lex->type|= UNSIGNED_FLAG | ZEROFILL_FLAG; }; | ZEROFILL { Lex->type|= UNSIGNED_FLAG | ZEROFILL_FLAG; };
opt_len: opt_len:
/* empty */ { $$=(char*) 0; } /* use default length */ /* empty */ { Lex->length=(char*) 0; } /* use default length */
| '(' NUM ')' { $$=$2.str; }; | '(' NUM ')' { Lex->length= $2.str; };
opt_precision: opt_precision:
/* empty */ {} /* empty */ {}
...@@ -1629,6 +1635,7 @@ select_part2: ...@@ -1629,6 +1635,7 @@ select_part2:
select_into: select_into:
limit_clause {} limit_clause {}
| select_from | select_from
| FROM DUAL_SYM
| opt_into | opt_into
| opt_into select_from | opt_into select_from
| select_from opt_into; | select_from opt_into;
...@@ -1772,6 +1779,8 @@ expr_expr: ...@@ -1772,6 +1779,8 @@ expr_expr:
| expr '-' expr { $$= new Item_func_minus($1,$3); } | expr '-' expr { $$= new Item_func_minus($1,$3); }
| expr '*' expr { $$= new Item_func_mul($1,$3); } | expr '*' expr { $$= new Item_func_mul($1,$3); }
| expr '/' expr { $$= new Item_func_div($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_or($1,$3); }
| expr '^' expr { $$= new Item_func_bit_xor($1,$3); } | expr '^' expr { $$= new Item_func_bit_xor($1,$3); }
| expr '&' expr { $$= new Item_func_bit_and($1,$3); } | expr '&' expr { $$= new Item_func_bit_and($1,$3); }
...@@ -1812,10 +1821,12 @@ no_in_expr: ...@@ -1812,10 +1821,12 @@ no_in_expr:
| no_in_expr '-' expr { $$= new Item_func_minus($1,$3); } | 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_mul($1,$3); }
| no_in_expr '/' expr { $$= new Item_func_div($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_or($1,$3); }
| no_in_expr '^' expr { $$= new Item_func_bit_xor($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_bit_and($1,$3); }
| no_in_expr '%' expr { $$= new Item_func_mod($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 | no_in_expr '+' INTERVAL_SYM expr interval
{ $$= new Item_date_add_interval($1,$4,$5,0); } { $$= new Item_date_add_interval($1,$4,$5,0); }
| no_in_expr '-' INTERVAL_SYM expr interval | no_in_expr '-' INTERVAL_SYM expr interval
...@@ -1854,10 +1865,12 @@ no_and_expr: ...@@ -1854,10 +1865,12 @@ no_and_expr:
| no_and_expr '-' expr { $$= new Item_func_minus($1,$3); } | 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_mul($1,$3); }
| no_and_expr '/' expr { $$= new Item_func_div($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_or($1,$3); }
| no_and_expr '^' expr { $$= new Item_func_bit_xor($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_bit_and($1,$3); }
| no_and_expr '%' expr { $$= new Item_func_mod($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 | no_and_expr '+' INTERVAL_SYM expr interval
{ $$= new Item_date_add_interval($1,$4,$5,0); } { $$= new Item_date_add_interval($1,$4,$5,0); }
| no_and_expr '-' INTERVAL_SYM expr interval | no_and_expr '-' INTERVAL_SYM expr interval
...@@ -1975,6 +1988,8 @@ simple_expr: ...@@ -1975,6 +1988,8 @@ simple_expr:
{ $$= new Item_func_export_set($3, $5, $7, $9); } { $$= new Item_func_export_set($3, $5, $7, $9); }
| EXPORT_SET '(' expr ',' expr ',' expr ',' expr ',' expr ')' | EXPORT_SET '(' expr ',' expr ',' expr ',' expr ',' expr ')'
{ $$= new Item_func_export_set($3, $5, $7, $9, $11); } { $$= new Item_func_export_set($3, $5, $7, $9, $11); }
| FALSE_SYM
{ $$= new Item_int((char*) "FALSE",0,1); }
| FORMAT_SYM '(' expr ',' NUM ')' | FORMAT_SYM '(' expr ',' NUM ')'
{ $$= new Item_func_format($3,atoi($5.str)); } { $$= new Item_func_format($3,atoi($5.str)); }
| FROM_UNIXTIME '(' expr ')' | FROM_UNIXTIME '(' expr ')'
...@@ -2041,6 +2056,8 @@ simple_expr: ...@@ -2041,6 +2056,8 @@ simple_expr:
{ $$= new Item_func_geometry_from_text($3); } { $$= new Item_func_geometry_from_text($3); }
| MINUTE_SYM '(' expr ')' | MINUTE_SYM '(' expr ')'
{ $$= new Item_func_minute($3); } { $$= new Item_func_minute($3); }
| MOD_SYM '(' expr ',' expr ')'
{ $$ = new Item_func_mod( $3, $5); }
| MONTH_SYM '(' expr ')' | MONTH_SYM '(' expr ')'
{ $$= new Item_func_month($3); } { $$= new Item_func_month($3); }
| MULTILINESTRING '(' expr_list ')' | MULTILINESTRING '(' expr_list ')'
...@@ -2120,6 +2137,8 @@ simple_expr: ...@@ -2120,6 +2137,8 @@ simple_expr:
{ $$= new Item_func_trim($5,$3); } { $$= new Item_func_trim($5,$3); }
| TRUNCATE_SYM '(' expr ',' expr ')' | TRUNCATE_SYM '(' expr ',' expr ')'
{ $$= new Item_func_round($3,$5,1); } { $$= new Item_func_round($3,$5,1); }
| TRUE_SYM
{ $$= new Item_int((char*) "TRUE",1,1); }
| UDA_CHAR_SUM '(' udf_expr_list ')' | UDA_CHAR_SUM '(' udf_expr_list ')'
{ {
if ($3 != NULL) if ($3 != NULL)
...@@ -3533,6 +3552,7 @@ keyword: ...@@ -3533,6 +3552,7 @@ keyword:
| DIRECTORY_SYM {} | DIRECTORY_SYM {}
| DO_SYM {} | DO_SYM {}
| DUMPFILE {} | DUMPFILE {}
| DUAL_SYM {}
| DYNAMIC_SYM {} | DYNAMIC_SYM {}
| END {} | END {}
| ENUM {} | ENUM {}
......
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