Commit 562faa29 authored by unknown's avatar unknown

sql_yacc.yy, mysql_priv.h, lex.h:

  Add syntax SET NO_FOREIGN_KEY_CHECKS=1 and SET RELAXED_UNIQUE_CHECKS=1


sql/lex.h:
  Add syntax SET NO_FOREIGN_KEY_CHECKS=1 and SET RELAXED_UNIQUE_CHECKS=1
sql/mysql_priv.h:
  Add syntax SET NO_FOREIGN_KEY_CHECKS=1 and SET RELAXED_UNIQUE_CHECKS=1
sql/sql_yacc.yy:
  Add syntax SET NO_FOREIGN_KEY_CHECKS=1 and SET RELAXED_UNIQUE_CHECKS=1
parent c9faa802
......@@ -30,9 +30,9 @@
#endif
/*
** Symbols are breaked in to separated arrays to allow fieldnames with
** Symbols are broken into separated arrays to allow fieldnames with
** same name as functions
** Theese are kept sorted for human lookup (the symbols are hashed)
** These are kept sorted for human lookup (the symbols are hashed)
*/
static SYMBOL symbols[] = {
......@@ -232,6 +232,7 @@ static SYMBOL symbols[] = {
{ "NCHAR", SYM(NCHAR_SYM),0,0},
{ "NUMERIC", SYM(NUMERIC_SYM),0,0},
{ "NO", SYM(NO_SYM),0,0},
{ "NO_FOREIGN_KEY_CHECKS", SYM(NO_FOREIGN_KEY_CHECKS), 0, 0},
{ "NOT", SYM(NOT),0,0},
{ "NULL", SYM(NULL_SYM),0,0},
{ "ON", SYM(ON),0,0},
......@@ -260,6 +261,7 @@ static SYMBOL symbols[] = {
{ "REFERENCES", SYM(REFERENCES),0,0},
{ "RELOAD", SYM(RELOAD),0,0},
{ "REGEXP", SYM(REGEXP),0,0},
{ "RELAXED_UNIQUE_CHECKS", SYM(RELAXED_UNIQUE_CHECKS), 0, 0},
{ "RENAME", SYM(RENAME),0,0},
{ "REPAIR", SYM(REPAIR),0,0},
{ "REPLACE", SYM(REPLACE),0,0},
......
......@@ -183,6 +183,13 @@ void kill_one_thread(THD *thd, ulong id);
/* The following is set when parsing the query */
#define QUERY_NO_INDEX_USED OPTION_STATUS_NO_TRANS_UPDATE*2
#define QUERY_NO_GOOD_INDEX_USED QUERY_NO_INDEX_USED*2
/* The following can be set when importing tables in a 'wrong order'
to suppress foreign key checks */
#define OPTION_NO_FOREIGN_KEY_CHECKS QUERY_NO_GOOD_INDEX_USED*2
/* The following speeds up inserts to InnoDB tables by suppressing unique
key checks in some cases */
#define OPTION_RELAXED_UNIQUE_CHECKS OPTION_NO_FOREIGN_KEY_CHECKS*2
/* NOTE: we have now used 31 bits of the OPTION flag! */
/* Bits for different SQL modes modes (including ANSI mode) */
#define MODE_REAL_AS_FLOAT 1
......
......@@ -224,6 +224,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
%token NATURAL
%token NCHAR_SYM
%token NOT
%token NO_FOREIGN_KEY_CHECKS
%token NO_SYM
%token NULL_SYM
%token NUM
......@@ -252,6 +253,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
%token REAL_NUM
%token REFERENCES
%token REGEXP
%token RELAXED_UNIQUE_CHECKS
%token RELOAD
%token RENAME
%token REPEATABLE_SYM
......@@ -2602,6 +2604,7 @@ keyword:
| MYISAM_SYM {}
| NATIONAL_SYM {}
| NCHAR_SYM {}
| NO_FOREIGN_KEY_CHECKS {}
| NO_SYM {}
| OPEN_SYM {}
| PACK_KEYS_SYM {}
......@@ -2614,6 +2617,7 @@ keyword:
| RAID_CHUNKSIZE {}
| RAID_STRIPED_SYM {}
| RAID_TYPE {}
| RELAXED_UNIQUE_CHECKS {}
| RELOAD {}
| REPAIR {}
| REPEATABLE_SYM {}
......@@ -2771,6 +2775,20 @@ option_value:
slave_skip_counter = $3;
pthread_mutex_unlock(&LOCK_slave);
}
| NO_FOREIGN_KEY_CHECKS equal NUM
{
if (atoi($3.str) != 0)
Lex->options|= OPTION_NO_FOREIGN_KEY_CHECKS;
else
Lex->options&= ~(OPTION_NO_FOREIGN_KEY_CHECKS);
}
| RELAXED_UNIQUE_CHECKS equal NUM
{
if (atoi($3.str) != 0)
Lex->options|= OPTION_RELAXED_UNIQUE_CHECKS;
else
Lex->options&= ~(OPTION_RELAXED_UNIQUE_CHECKS);
}
text_or_password:
TEXT_STRING { $$=$1.str;}
......
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