~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to sql/sql_yacc.yy

  • Committer: Monty Taylor
  • Date: 2008-07-01 14:33:36 UTC
  • mto: (28.1.12 backport_patch)
  • mto: This revision was merged to the branch mainline in revision 34.
  • Revision ID: monty@inaugust.com-20080701143336-8uihm7dhpu92rt0q
Somehow missed moving password.c. Duh.

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
#define YYLEX_PARAM yythd
30
30
#define YYTHD ((THD *)yythd)
31
31
 
32
 
#define YYENABLE_NLS 0
33
 
#define YYLTYPE_IS_TRIVIAL 0
34
 
 
35
 
#define DRIZZLE_YACC
 
32
#define MYSQL_YACC
36
33
#define YYINITDEPTH 100
37
34
#define YYMAXDEPTH 3200                        /* Because of 64K stack */
38
35
#define Lex (YYTHD->lex)
39
36
#define Select Lex->current_select
40
 
#include <drizzled/server_includes.h>
 
37
#include "mysql_priv.h"
 
38
#include "slave.h"
41
39
#include "lex_symbol.h"
42
 
#include <storage/myisam/myisam.h>
43
 
#include <drizzled/drizzled_error_messages.h>
 
40
#include "item_create.h"
 
41
#include <myisam.h>
44
42
 
45
43
int yylex(void *yylval, void *yythd);
46
44
 
58
56
    }                                         \
59
57
  }
60
58
 
61
 
#define DRIZZLE_YYABORT                         \
 
59
#define MYSQL_YYABORT                         \
62
60
  do                                          \
63
61
  {                                           \
64
62
    LEX::cleanup_lex_after_parse_error(YYTHD);\
65
63
    YYABORT;                                  \
66
64
  } while (0)
67
65
 
68
 
#define DRIZZLE_YYABORT_UNLESS(A)         \
 
66
#define MYSQL_YYABORT_UNLESS(A)         \
69
67
  if (!(A))                             \
70
68
  {                                     \
71
69
    my_parse_error(ER(ER_SYNTAX_ERROR));\
72
 
    DRIZZLE_YYABORT;                      \
 
70
    MYSQL_YYABORT;                      \
73
71
  }
74
72
 
75
73
/*
94
92
#define __attribute__(X)
95
93
#endif
96
94
 
 
95
 
 
96
#ifndef DBUG_OFF
 
97
#define YYDEBUG 1
 
98
#else
97
99
#define YYDEBUG 0
 
100
#endif
98
101
 
99
102
/**
100
103
  @brief Push an error message into MySQL error stack with line
127
130
  condition occurs. This function is not invoked when the
128
131
  parser is requested to abort by semantic action code
129
132
  by means of YYABORT or YYACCEPT macros. This is why these
130
 
  macros should not be used (use DRIZZLE_YYABORT/DRIZZLE_YYACCEPT
 
133
  macros should not be used (use MYSQL_YYABORT/MYSQL_YYACCEPT
131
134
  instead).
132
135
 
133
136
  The parser will abort immediately after invoking this callback.
135
138
  This function is not for use in semantic actions and is internal to
136
139
  the parser, as it performs some pre-return cleanup. 
137
140
  In semantic actions, please use my_parse_error or my_error to
138
 
  push an error into the error stack and DRIZZLE_YYABORT
 
141
  push an error into the error stack and MYSQL_YYABORT
139
142
  to abort from the parser.
140
143
*/
141
144
 
156
159
  my_parse_error(s);
157
160
}
158
161
 
 
162
 
 
163
#ifndef DBUG_OFF
 
164
void turn_parser_debug_on()
 
165
{
 
166
  /*
 
167
     MYSQLdebug is in sql/sql_yacc.cc, in bison generated code.
 
168
     Turning this option on is **VERY** verbose, and should be
 
169
     used when investigating a syntax error problem only.
 
170
 
 
171
     The syntax to run with bison traces is as follows :
 
172
     - Starting a server manually :
 
173
       mysqld --debug="d,parser_debug" ...
 
174
     - Running a test :
 
175
       mysql-test-run.pl --mysqld="--debug=d,parser_debug" ...
 
176
 
 
177
     The result will be in the process stderr (var/log/master.err)
 
178
   */
 
179
 
 
180
  extern int yydebug;
 
181
  yydebug= 1;
 
182
}
 
183
#endif
 
184
 
159
185
/**
160
186
  Helper to resolve the SQL:2003 Syntax exception 1) in <in predicate>.
161
187
  See SQL:2003, Part 2, section 8.4 <in predicate>, Note 184, page 383.
194
220
 
195
221
  Item *result;
196
222
 
 
223
  DBUG_ENTER("handle_sql2003_note184_exception");
 
224
 
197
225
  if (expr->type() == Item::SUBSELECT_ITEM)
198
226
  {
199
227
    Item_subselect *expr2 = (Item_subselect*) expr;
217
245
      if (! equal)
218
246
        result = negate_expression(thd, result);
219
247
 
220
 
      return(result);
 
248
      DBUG_RETURN(result);
221
249
    }
222
250
  }
223
251
 
226
254
  else
227
255
    result= new (thd->mem_root) Item_func_ne(left, expr);
228
256
 
229
 
  return(result);
 
257
  DBUG_RETURN(result);
230
258
}
231
259
 
232
260
/**
250
278
  {
251
279
    /* Only the last SELECT can have  INTO...... */
252
280
    my_error(ER_WRONG_USAGE, MYF(0), "UNION", "INTO");
253
 
    return true;
 
281
    return TRUE;
254
282
  }
255
283
  if (lex->current_select->linkage == GLOBAL_OPTIONS_TYPE)
256
284
  {
257
285
    my_parse_error(ER(ER_SYNTAX_ERROR));
258
 
    return true;
 
286
    return TRUE;
259
287
  }
260
288
  /* This counter shouldn't be incremented for UNION parts */
261
289
  lex->nest_level--;
262
290
  if (mysql_new_select(lex, 0))
263
 
    return true;
 
291
    return TRUE;
264
292
  mysql_init_select(lex);
265
293
  lex->current_select->linkage=UNION_TYPE;
266
294
  if (is_union_distinct) /* UNION DISTINCT - remember position */
267
295
    lex->current_select->master_unit()->union_distinct=
268
296
      lex->current_select;
269
 
  return false;
 
297
  return FALSE;
270
298
}
271
299
 
272
300
/**
282
310
  if (sel->set_braces(1))
283
311
  {
284
312
    my_parse_error(ER(ER_SYNTAX_ERROR));
285
 
    return true;
 
313
    return TRUE;
286
314
  }
287
315
  if (sel->linkage == UNION_TYPE &&
288
316
      !sel->master_unit()->first_select()->braces &&
290
318
      UNION_TYPE)
291
319
  {
292
320
    my_parse_error(ER(ER_SYNTAX_ERROR));
293
 
    return true;
 
321
    return TRUE;
294
322
  }
295
323
  if (sel->linkage == UNION_TYPE &&
296
324
      sel->olap != UNSPECIFIED_OLAP_TYPE &&
297
325
      sel->master_unit()->fake_select_lex)
298
326
  {
299
327
    my_error(ER_WRONG_USAGE, MYF(0), "CUBE/ROLLUP", "ORDER BY");
300
 
    return true;
 
328
    return TRUE;
301
329
  }
302
330
  /* select in braces, can't contain global parameters */
303
331
  if (sel->master_unit()->fake_select_lex)
304
332
    sel->master_unit()->global_parameters=
305
333
      sel->master_unit()->fake_select_lex;
306
 
  return false;
 
334
  return FALSE;
307
335
}
308
336
 
309
337
%}
310
338
%union {
311
339
  int  num;
312
340
  ulong ulong_num;
313
 
  uint64_t ulonglong_number;
314
 
  int64_t longlong_number;
 
341
  ulonglong ulonglong_number;
 
342
  longlong longlong_number;
315
343
  LEX_STRING lex_str;
316
344
  LEX_STRING *lex_str_ptr;
317
345
  LEX_SYMBOL symbol;
323
351
  List<String> *string_list;
324
352
  String *string;
325
353
  Key_part_spec *key_part;
326
 
  TableList *table_list;
 
354
  TABLE_LIST *table_list;
327
355
  udf_func *udf;
328
356
  LEX_USER *lex_user;
329
357
  struct sys_var_with_base variable;
337
365
  enum enum_tx_isolation tx_isolation;
338
366
  enum Cast_target cast_type;
339
367
  enum ha_choice choice;
340
 
  const CHARSET_INFO *charset;
 
368
  CHARSET_INFO *charset;
341
369
  thr_lock_type lock_type;
342
370
  struct st_table_lock_info table_lock_info;
343
371
  interval_type interval, interval_time_st;
344
 
  enum enum_drizzle_timestamp_type date_time_type;
 
372
  timestamp_type date_time_type;
345
373
  st_select_lex *select_lex;
346
374
  chooser_compare_func_creator boolfunc2creator;
347
375
  struct sp_cond_type *spcondtype;
360
388
 
361
389
%pure_parser                                    /* We have threads */
362
390
/*
363
 
  Currently there are 93 shift/reduce conflicts.
 
391
  Currently there are 100 shift/reduce conflicts.
364
392
  We should not introduce new conflicts any more.
365
393
*/
366
 
%expect 93
 
394
%expect 100
367
395
 
368
396
/*
369
397
   Comments for TOKENS.
393
421
%token  ALL                           /* SQL-2003-R */
394
422
%token  ALTER                         /* SQL-2003-R */
395
423
%token  ANALYZE_SYM
 
424
%token  AND_AND_SYM                   /* OPERATOR */
396
425
%token  AND_SYM                       /* SQL-2003-R */
397
426
%token  ANY_SYM                       /* SQL-2003-R */
398
427
%token  AS                            /* SQL-2003-R */
412
441
%token  BINARY                        /* SQL-2003-R */
413
442
%token  BINLOG_SYM
414
443
%token  BIN_NUM
 
444
%token  BIT_AND                       /* MYSQL-FUNC */
 
445
%token  BIT_OR                        /* MYSQL-FUNC */
415
446
%token  BIT_SYM                       /* MYSQL-FUNC */
 
447
%token  BIT_XOR                       /* MYSQL-FUNC */
416
448
%token  BLOB_SYM                      /* SQL-2003-R */
417
 
%token  BLOCK_SIZE_SYM
418
449
%token  BLOCK_SYM
419
450
%token  BOOLEAN_SYM                   /* SQL-2003-R */
420
451
%token  BOOL_SYM
435
466
%token  CHAR_SYM                      /* SQL-2003-R */
436
467
%token  CHECKSUM_SYM
437
468
%token  CHECK_SYM                     /* SQL-2003-R */
 
469
%token  CIPHER_SYM
 
470
%token  CLIENT_SYM
438
471
%token  CLOSE_SYM                     /* SQL-2003-R */
439
472
%token  COALESCE                      /* SQL-2003-N */
 
473
%token  CODE_SYM
440
474
%token  COLLATE_SYM                   /* SQL-2003-R */
441
475
%token  COLLATION_SYM                 /* SQL-2003-N */
442
476
%token  COLUMNS
455
489
%token  CONTAINS_SYM                  /* SQL-2003-N */
456
490
%token  CONTEXT_SYM
457
491
%token  CONTINUE_SYM                  /* SQL-2003-R */
 
492
%token  CONTRIBUTORS_SYM
458
493
%token  CONVERT_SYM                   /* SQL-2003-N */
459
494
%token  COUNT_SYM                     /* SQL-2003-N */
 
495
%token  CPU_SYM
460
496
%token  CREATE                        /* SQL-2003-R */
461
497
%token  CROSS                         /* SQL-2003-R */
462
498
%token  CUBE_SYM                      /* SQL-2003-R */
482
518
%token  DECIMAL_SYM                   /* SQL-2003-R */
483
519
%token  DECLARE_SYM                   /* SQL-2003-R */
484
520
%token  DEFAULT                       /* SQL-2003-R */
 
521
%token  DEFINER_SYM
485
522
%token  DELAYED_SYM
486
523
%token  DELAY_KEY_WRITE_SYM
487
524
%token  DELETE_SYM                    /* SQL-2003-R */
488
525
%token  DESC                          /* SQL-2003-N */
489
526
%token  DESCRIBE                      /* SQL-2003-R */
 
527
%token  DES_KEY_FILE
490
528
%token  DETERMINISTIC_SYM             /* SQL-2003-R */
491
529
%token  DIRECTORY_SYM
492
530
%token  DISABLE_SYM
493
531
%token  DISCARD
 
532
%token  DISK_SYM
494
533
%token  DISTINCT                      /* SQL-2003-R */
495
534
%token  DIV_SYM
496
535
%token  DOUBLE_SYM                    /* SQL-2003-R */
506
545
%token  END                           /* SQL-2003-R */
507
546
%token  ENDS_SYM
508
547
%token  END_OF_INPUT                  /* INTERNAL */
 
548
%token  ENGINES_SYM
509
549
%token  ENGINE_SYM
510
550
%token  ENUM
511
551
%token  EQ                            /* OPERATOR */
513
553
%token  ERRORS
514
554
%token  ESCAPED
515
555
%token  ESCAPE_SYM                    /* SQL-2003-R */
 
556
%token  EVENTS_SYM
 
557
%token  EVERY_SYM                     /* SQL-2003-N */
516
558
%token  EXCLUSIVE_SYM
517
559
%token  EXISTS                        /* SQL-2003-R */
518
560
%token  EXIT_SYM
528
570
%token  FIRST_SYM                     /* SQL-2003-N */
529
571
%token  FIXED_SYM
530
572
%token  FLOAT_NUM
 
573
%token  FLOAT_SYM                     /* SQL-2003-R */
531
574
%token  FLUSH_SYM
532
575
%token  FORCE_SYM
533
576
%token  FOREIGN                       /* SQL-2003-R */
573
616
%token  INTO                          /* SQL-2003-R */
574
617
%token  INT_SYM                       /* SQL-2003-R */
575
618
%token  IN_SYM                        /* SQL-2003-R */
 
619
%token  IO_SYM
 
620
%token  IPC_SYM
576
621
%token  IS                            /* SQL-2003-R */
577
622
%token  ISOLATION                     /* SQL-2003-R */
 
623
%token  ISSUER_SYM
578
624
%token  ITERATE_SYM
579
625
%token  JOIN_SYM                      /* SQL-2003-R */
580
626
%token  KEYS
601
647
%token  LOCK_SYM
602
648
%token  LOGFILE_SYM
603
649
%token  LOGS_SYM
 
650
%token  LONGBLOB
 
651
%token  LONGTEXT
604
652
%token  LONG_NUM
605
653
%token  LONG_SYM
606
654
%token  LOOP_SYM
625
673
%token  MAX_UPDATES_PER_HOUR
626
674
%token  MAX_USER_CONNECTIONS_SYM
627
675
%token  MAX_VALUE_SYM                 /* SQL-2003-N */
 
676
%token  MEDIUMBLOB
 
677
%token  MEDIUMINT
 
678
%token  MEDIUMTEXT
628
679
%token  MEDIUM_SYM
 
680
%token  MEMORY_SYM
629
681
%token  MERGE_SYM                     /* SQL-2003-R */
630
682
%token  MICROSECOND_SYM               /* MYSQL-FUNC */
631
683
%token  MIGRATE_SYM
643
695
%token  NAME_SYM                      /* SQL-2003-N */
644
696
%token  NATIONAL_SYM                  /* SQL-2003-R */
645
697
%token  NATURAL                       /* SQL-2003-R */
 
698
%token  NCHAR_STRING
 
699
%token  NCHAR_SYM                     /* SQL-2003-R */
646
700
%token  NE                            /* OPERATOR */
647
701
%token  NEG
648
702
%token  NEW_SYM                       /* SQL-2003-R */
658
712
%token  NULL_SYM                      /* SQL-2003-R */
659
713
%token  NUM
660
714
%token  NUMERIC_SYM                   /* SQL-2003-R */
 
715
%token  NVARCHAR_SYM
661
716
%token  OFFLINE_SYM
662
717
%token  OFFSET_SYM
 
718
%token  OLD_PASSWORD
663
719
%token  ON                            /* SQL-2003-R */
664
720
%token  ONE_SHOT_SYM
665
721
%token  ONE_SYM
678
734
%token  PAGE_SYM
679
735
%token  PAGE_CHECKSUM_SYM
680
736
%token  PARAM_MARKER
681
 
%token  PARSE_VCOL_EXPR_SYM
682
737
%token  PARTIAL                       /* SQL-2003-N */
 
738
%token  PASSWORD
683
739
%token  PHASE_SYM
684
740
%token  PLUGINS_SYM
685
741
%token  PLUGIN_SYM
686
742
%token  POINT_SYM
 
743
%token  POLYGON
687
744
%token  PORT_SYM
688
745
%token  POSITION_SYM                  /* SQL-2003-N */
689
746
%token  PRECISION                     /* SQL-2003-R */
691
748
%token  PRIMARY_SYM                   /* SQL-2003-R */
692
749
%token  PROCESS
693
750
%token  PROCESSLIST_SYM
 
751
%token  PROFILE_SYM
 
752
%token  PROFILES_SYM
694
753
%token  PURGE
695
754
%token  QUARTER_SYM
696
755
%token  QUERY_SYM
751
810
%token  SET                           /* SQL-2003-R */
752
811
%token  SET_VAR
753
812
%token  SHARE_SYM
 
813
%token  SHIFT_LEFT                    /* OPERATOR */
 
814
%token  SHIFT_RIGHT                   /* OPERATOR */
754
815
%token  SHOW
755
816
%token  SHUTDOWN
 
817
%token  SIGNED_SYM
756
818
%token  SIMPLE_SYM                    /* SQL-2003-N */
757
819
%token  SLAVE
 
820
%token  SMALLINT                      /* SQL-2003-R */
758
821
%token  SNAPSHOT_SYM
759
822
%token  SOCKET_SYM
760
823
%token  SONAME_SYM
777
840
%token  STD_SYM
778
841
%token  STOP_SYM
779
842
%token  STORAGE_SYM
780
 
%token  STORED_SYM
781
843
%token  STRAIGHT_JOIN
782
844
%token  STRING_SYM
783
845
%token  SUBDATE_SYM
805
867
%token  TIMESTAMP_ADD
806
868
%token  TIMESTAMP_DIFF
807
869
%token  TIME_SYM                      /* SQL-2003-R */
 
870
%token  TINYBLOB
 
871
%token  TINYINT
 
872
%token  TINYTEXT
808
873
%token  TO_SYM                        /* SQL-2003-R */
809
874
%token  TRAILING                      /* SQL-2003-R */
810
875
%token  TRANSACTION_SYM
820
885
%token  UNDERSCORE_CHARSET
821
886
%token  UNDOFILE_SYM
822
887
%token  UNDO_SYM                      /* FUTURE-USE */
 
888
%token  UNICODE_SYM
 
889
%token  UNINSTALL_SYM
823
890
%token  UNION_SYM                     /* SQL-2003-R */
824
891
%token  UNIQUE_SYM
825
892
%token  UNKNOWN_SYM                   /* SQL-2003-R */
826
893
%token  UNLOCK_SYM
 
894
%token  UNSIGNED
827
895
%token  UNTIL_SYM
828
896
%token  UPDATE_SYM                    /* SQL-2003-R */
829
897
%token  UPGRADE_SYM
843
911
%token  VARIANCE_SYM
844
912
%token  VARYING                       /* SQL-2003-R */
845
913
%token  VAR_SAMP_SYM
846
 
%token  VIRTUAL_SYM
847
914
%token  WAIT_SYM
848
915
%token  WARNINGS
849
916
%token  WEEK_SYM
851
918
%token  WHEN_SYM                      /* SQL-2003-R */
852
919
%token  WHERE                         /* SQL-2003-R */
853
920
%token  WITH                          /* SQL-2003-R */
 
921
%token  WITH_CUBE_SYM                 /* INTERNAL */
854
922
%token  WITH_ROLLUP_SYM               /* INTERNAL */
855
923
%token  WORK_SYM                      /* SQL-2003-N */
 
924
%token  WRAPPER_SYM
856
925
%token  WRITE_SYM                     /* SQL-2003-N */
 
926
%token  XML_SYM
857
927
%token  XOR
858
928
%token  YEAR_MONTH_SYM
859
929
%token  YEAR_SYM                      /* SQL-2003-R */
 
930
%token  ZEROFILL
860
931
 
861
932
%left   JOIN_SYM INNER_SYM STRAIGHT_JOIN CROSS LEFT RIGHT
862
933
/* A dummy token to force the priority of table_ref production in a join. */
864
935
%left   SET_VAR
865
936
%left   OR_SYM
866
937
%left   XOR
867
 
%left   AND_SYM
 
938
%left   AND_SYM AND_AND_SYM
868
939
%left   BETWEEN_SYM CASE_SYM WHEN_SYM THEN_SYM ELSE
869
940
%left   EQ EQUAL_SYM GE GT_SYM LE LT NE IS LIKE IN_SYM
 
941
%left   '|'
 
942
%left   '&'
 
943
%left   SHIFT_LEFT SHIFT_RIGHT
870
944
%left   '-' '+'
871
945
%left   '*' '/' '%' DIV_SYM MOD_SYM
872
 
%left   NEG
 
946
%left   '^'
 
947
%left   NEG '~'
873
948
%right  NOT_SYM
874
949
%right  BINARY COLLATE_SYM
875
950
%left  INTERVAL_SYM
878
953
        IDENT IDENT_QUOTED TEXT_STRING DECIMAL_NUM FLOAT_NUM NUM LONG_NUM HEX_NUM
879
954
        LEX_HOSTNAME ULONGLONG_NUM field_ident select_alias ident ident_or_text
880
955
        IDENT_sys TEXT_STRING_sys TEXT_STRING_literal
881
 
        opt_component key_cache_name
 
956
        NCHAR_STRING opt_component key_cache_name
882
957
        BIN_NUM TEXT_STRING_filesystem ident_or_empty
883
958
        opt_constraint constraint opt_ident
884
959
 
895
970
        text_string opt_gconcat_separator
896
971
 
897
972
%type <num>
898
 
        type int_type real_type order_dir field_def
 
973
        type int_type real_type order_dir
899
974
        if_exists opt_local opt_table_options table_options
900
 
        table_option opt_if_not_exists
 
975
        table_option opt_if_not_exists opt_no_write_to_binlog
901
976
        opt_temporary all_or_any opt_distinct
902
 
        union_option
 
977
        opt_ignore_leaves union_option
903
978
        start_transaction_opts opt_chain opt_release
904
979
        union_opt select_derived_init option_type2
905
980
        opt_transactional_lock_timeout
934
1009
        predicate bit_expr
935
1010
        table_wild simple_expr udf_expr
936
1011
        expr_or_default set_expr_or_default
 
1012
        param_marker 
937
1013
        signed_literal now_or_signed_literal opt_escape
938
1014
        simple_ident_nospvar simple_ident_q
939
1015
        field_or_var limit_option
989
1065
%type <symbol> keyword keyword_sp
990
1066
 
991
1067
%type <charset>
 
1068
        opt_collate
 
1069
        charset_name
 
1070
        charset_name_or_default
 
1071
        old_or_new_charset_name
 
1072
        old_or_new_charset_name_or_default
992
1073
        collation_name
993
1074
        collation_name_or_default
 
1075
        opt_load_data_charset
994
1076
        UNDERSCORE_CHARSET
995
1077
 
996
1078
%type <variable> internal_variable_name
1006
1088
%type <NONE>
1007
1089
        query verb_clause create change select drop insert replace insert2
1008
1090
        insert_values update delete truncate rename
1009
 
        show describe load alter optimize keycache flush
 
1091
        show describe load alter optimize keycache preload flush
1010
1092
        reset purge begin commit rollback savepoint release
1011
1093
        slave master_def master_defs master_file_def slave_until_opts
1012
1094
        repair analyze check start checksum
1013
1095
        field_list field_list_item field_spec kill column_def key_def
1014
 
        keycache_list assign_to_keycache
 
1096
        keycache_list assign_to_keycache preload_list preload_keys
1015
1097
        select_item_list select_item values_list no_braces
1016
1098
        opt_limit_clause delete_limit_clause fields opt_values values
1017
 
        opt_precision opt_ignore opt_column
1018
 
        set lock unlock string_list
1019
 
        opt_binary table_lock_list table_lock
 
1099
        opt_precision opt_ignore opt_column opt_restrict
 
1100
        set lock unlock string_list field_options field_option
 
1101
        field_opt_list opt_binary table_lock_list table_lock
1020
1102
        ref_list opt_match_clause opt_on_update_delete use
1021
 
        opt_delete_options opt_delete_option varchar
 
1103
        opt_delete_options opt_delete_option varchar nchar nvarchar
1022
1104
        opt_outer table_list table_name table_alias_ref_list table_alias_ref
1023
1105
        opt_option opt_place
1024
1106
        opt_attribute opt_attribute_list attribute
1035
1117
        opt_field_or_var_spec fields_or_vars opt_load_data_set_spec
1036
1118
        binlog_base64_event
1037
1119
        init_key_options key_options key_opts key_opt key_using_alg
1038
 
        parse_vcol_expr vcol_opt_attribute vcol_opt_attribute_list
1039
 
        vcol_attribute
1040
1120
END_OF_INPUT
1041
1121
 
1042
1122
%type <index_hint> index_hint_type
1043
1123
%type <num> index_hint_clause
1044
 
%type <filetype> data_file
 
1124
%type <filetype> data_or_xml
1045
1125
 
1046
1126
%type <NONE>
1047
1127
        '-' '+' '*' '/' '%' '(' ')'
1048
 
        ',' '!' '{' '}' AND_SYM OR_SYM BETWEEN_SYM CASE_SYM
1049
 
        THEN_SYM WHEN_SYM DIV_SYM MOD_SYM DELETE_SYM
 
1128
        ',' '!' '{' '}' '&' '|' AND_SYM OR_SYM BETWEEN_SYM CASE_SYM
 
1129
        THEN_SYM WHEN_SYM DIV_SYM MOD_SYM AND_AND_SYM DELETE_SYM
1050
1130
%%
1051
1131
 
1052
1132
/*
1074
1154
          END_OF_INPUT
1075
1155
          {
1076
1156
            THD *thd= YYTHD;
1077
 
            if (!(thd->lex->select_lex.options & OPTION_FOUND_COMMENT))
 
1157
            if (!thd->bootstrap &&
 
1158
              (!(thd->lex->select_lex.options & OPTION_FOUND_COMMENT)))
1078
1159
            {
1079
1160
              my_message(ER_EMPTY_QUERY, ER(ER_EMPTY_QUERY), MYF(0));
1080
 
              DRIZZLE_YYABORT;
 
1161
              MYSQL_YYABORT;
1081
1162
            }
1082
1163
            else
1083
1164
            {
1112
1193
        | lock
1113
1194
        | optimize
1114
1195
        | keycache
1115
 
        | parse_vcol_expr
 
1196
        | preload
1116
1197
        | purge
1117
1198
        | release
1118
1199
        | rename
1140
1221
          {
1141
1222
            LEX *lex = Lex;
1142
1223
            lex->sql_command = SQLCOM_CHANGE_MASTER;
1143
 
            memset(&lex->mi, 0, sizeof(lex->mi));
 
1224
            bzero((char*) &lex->mi, sizeof(lex->mi));
1144
1225
          }
1145
1226
          master_defs
1146
1227
          {}
1179
1260
                Lex->mi.heartbeat_period < 0.0)
1180
1261
            {
1181
1262
              char buf[sizeof(SLAVE_MAX_HEARTBEAT_PERIOD*4)];
1182
 
              sprintf(buf, "%d seconds", SLAVE_MAX_HEARTBEAT_PERIOD);
 
1263
              my_sprintf(buf, (buf, "%d seconds", SLAVE_MAX_HEARTBEAT_PERIOD));
1183
1264
              my_error(ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE,
1184
1265
                       MYF(0),
1185
1266
                       " is negative or exceeds the maximum ",
1186
1267
                       buf); 
1187
 
              DRIZZLE_YYABORT;
 
1268
              MYSQL_YYABORT;
1188
1269
            }
1189
1270
            if (Lex->mi.heartbeat_period > slave_net_timeout)
1190
1271
            {
1191
 
              push_warning_printf(YYTHD, DRIZZLE_ERROR::WARN_LEVEL_WARN,
 
1272
              push_warning_printf(YYTHD, MYSQL_ERROR::WARN_LEVEL_WARN,
1192
1273
                                  ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE,
1193
1274
                                  ER(ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE),
1194
1275
                                  " exceeds the value of `slave_net_timeout' sec.",
1199
1280
            {
1200
1281
              if (Lex->mi.heartbeat_period != 0.0)
1201
1282
              {
1202
 
                push_warning_printf(YYTHD, DRIZZLE_ERROR::WARN_LEVEL_WARN,
 
1283
                push_warning_printf(YYTHD, MYSQL_ERROR::WARN_LEVEL_WARN,
1203
1284
                                    ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE,
1204
1285
                                    ER(ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE),
1205
1286
                                    " is less than 1 msec.",
1234
1315
               from 0" (4 in fact), unspecified means "don't change the position
1235
1316
               (keep the preceding value)").
1236
1317
            */
1237
 
            Lex->mi.pos = cmax((uint64_t)BIN_LOG_HEADER_SIZE, Lex->mi.pos);
 
1318
            Lex->mi.pos = max(BIN_LOG_HEADER_SIZE, Lex->mi.pos);
1238
1319
          }
1239
1320
        | RELAY_LOG_FILE_SYM EQ TEXT_STRING_sys
1240
1321
          {
1244
1325
          {
1245
1326
            Lex->mi.relay_log_pos = $3;
1246
1327
            /* Adjust if < BIN_LOG_HEADER_SIZE (same comment as Lex->mi.pos) */
1247
 
            Lex->mi.relay_log_pos = cmax((uint32_t)BIN_LOG_HEADER_SIZE, Lex->mi.relay_log_pos);
 
1328
            Lex->mi.relay_log_pos = max(BIN_LOG_HEADER_SIZE, Lex->mi.relay_log_pos);
1248
1329
          }
1249
1330
        ;
1250
1331
 
1259
1340
            if (!lex->select_lex.add_table_to_list(thd, $5, NULL,
1260
1341
                                                   TL_OPTION_UPDATING,
1261
1342
                                                   TL_WRITE))
1262
 
              DRIZZLE_YYABORT;
 
1343
              MYSQL_YYABORT;
1263
1344
            lex->alter_info.reset();
1264
1345
            lex->col_list.empty();
1265
 
            lex->change=NULL;
1266
 
            memset(&lex->create_info, 0, sizeof(lex->create_info));
 
1346
            lex->change=NullS;
 
1347
            bzero((char*) &lex->create_info,sizeof(lex->create_info));
1267
1348
            lex->create_info.options=$2 | $4;
1268
1349
            lex->create_info.db_type= ha_default_handlerton(thd);
1269
1350
            lex->create_info.default_table_charset= NULL;
1277
1358
            if (!lex->create_info.db_type)
1278
1359
            {
1279
1360
              lex->create_info.db_type= ha_default_handlerton(YYTHD);
1280
 
              push_warning_printf(YYTHD, DRIZZLE_ERROR::WARN_LEVEL_WARN,
 
1361
              push_warning_printf(YYTHD, MYSQL_ERROR::WARN_LEVEL_WARN,
1281
1362
                                  ER_WARN_USING_OTHER_HANDLER,
1282
1363
                                  ER(ER_WARN_USING_OTHER_HANDLER),
1283
1364
                                  ha_resolve_storage_engine_name(lex->create_info.db_type),
1292
1373
            if (!lex->current_select->add_table_to_list(lex->thd, $8,
1293
1374
                                                        NULL,
1294
1375
                                                        TL_OPTION_UPDATING))
1295
 
              DRIZZLE_YYABORT;
 
1376
              MYSQL_YYABORT;
1296
1377
            lex->alter_info.reset();
1297
1378
            lex->alter_info.flags= ALTER_ADD_INDEX;
1298
1379
            lex->alter_info.build_method= $2;
1299
1380
            lex->col_list.empty();
1300
 
            lex->change=NULL;
 
1381
            lex->change=NullS;
1301
1382
          }
1302
1383
          '(' key_list ')' key_options
1303
1384
          {
1322
1403
          }
1323
1404
        ;
1324
1405
 
 
1406
 
 
1407
/*
 
1408
  End tablespace part
 
1409
*/
 
1410
 
1325
1411
create2:
1326
1412
          '(' create2a {}
1327
1413
        | opt_create_table_options
1333
1419
 
1334
1420
            lex->create_info.options|= HA_LEX_CREATE_TABLE_LIKE;
1335
1421
            if (!lex->select_lex.add_table_to_list(thd, $2, NULL, 0, TL_READ))
1336
 
              DRIZZLE_YYABORT;
 
1422
              MYSQL_YYABORT;
1337
1423
          }
1338
1424
        | '(' LIKE table_ident ')'
1339
1425
          {
1342
1428
 
1343
1429
            lex->create_info.options|= HA_LEX_CREATE_TABLE_LIKE;
1344
1430
            if (!lex->select_lex.add_table_to_list(thd, $3, NULL, 0, TL_READ))
1345
 
              DRIZZLE_YYABORT;
 
1431
              MYSQL_YYABORT;
1346
1432
          }
1347
1433
        ;
1348
1434
 
1412
1498
 
1413
1499
create_database_option:
1414
1500
          default_collation {}
 
1501
        | default_charset {}
1415
1502
        ;
1416
1503
 
1417
1504
opt_table_options:
1470
1557
            Lex->create_info.avg_row_length=$3;
1471
1558
            Lex->create_info.used_fields|= HA_CREATE_USED_AVG_ROW_LENGTH;
1472
1559
          }
1473
 
        | BLOCK_SIZE_SYM opt_equal ulong_num    
1474
 
          { 
1475
 
            Lex->create_info.block_size= $3; 
1476
 
            Lex->create_info.used_fields|= HA_CREATE_USED_BLOCK_SIZE;
 
1560
        | PASSWORD opt_equal TEXT_STRING_sys
 
1561
          {
 
1562
            Lex->create_info.password=$3.str;
 
1563
            Lex->create_info.used_fields|= HA_CREATE_USED_PASSWORD;
1477
1564
          }
1478
1565
        | COMMENT_SYM opt_equal TEXT_STRING_sys
1479
1566
          {
1496
1583
                break;
1497
1584
            default:
1498
1585
                my_parse_error(ER(ER_SYNTAX_ERROR));
1499
 
                DRIZZLE_YYABORT;
 
1586
                MYSQL_YYABORT;
1500
1587
            }
1501
1588
            Lex->create_info.used_fields|= HA_CREATE_USED_PACK_KEYS;
1502
1589
          }
1532
1619
            Lex->create_info.used_fields|= HA_CREATE_USED_ROW_FORMAT;
1533
1620
            Lex->alter_info.flags|= ALTER_ROW_FORMAT;
1534
1621
          }
 
1622
        | UNION_SYM opt_equal '(' opt_table_list ')'
 
1623
          {
 
1624
            /* Move the union list to the merge_list */
 
1625
            LEX *lex=Lex;
 
1626
            TABLE_LIST *table_list= lex->select_lex.get_table_list();
 
1627
            lex->create_info.merge_list= lex->select_lex.table_list;
 
1628
            lex->create_info.merge_list.elements--;
 
1629
            lex->create_info.merge_list.first=
 
1630
              (uchar*) (table_list->next_local);
 
1631
            lex->select_lex.table_list.elements=1;
 
1632
            lex->select_lex.table_list.next=
 
1633
              (uchar**) &(table_list->next_local);
 
1634
            table_list->next_local= 0;
 
1635
            lex->create_info.used_fields|= HA_CREATE_USED_UNION;
 
1636
          }
 
1637
        | default_charset
1535
1638
        | default_collation
1536
1639
        | DATA_SYM DIRECTORY_SYM opt_equal TEXT_STRING_sys
1537
1640
          {
1554
1657
            Lex->create_info.used_fields|= HA_CREATE_USED_KEY_BLOCK_SIZE;
1555
1658
            Lex->create_info.key_block_size= $3;
1556
1659
          }
 
1660
        | TRANSACTIONAL_SYM opt_equal choice
 
1661
          {
 
1662
            Lex->create_info.used_fields|= HA_CREATE_USED_TRANSACTIONAL;
 
1663
            Lex->create_info.transactional= $3;
 
1664
          }
 
1665
        ;
 
1666
 
 
1667
default_charset:
 
1668
          opt_default charset opt_equal charset_name_or_default
 
1669
          {
 
1670
            HA_CREATE_INFO *cinfo= &Lex->create_info;
 
1671
            if ((cinfo->used_fields & HA_CREATE_USED_DEFAULT_CHARSET) &&
 
1672
                 cinfo->default_table_charset && $4 &&
 
1673
                 !my_charset_same(cinfo->default_table_charset,$4))
 
1674
            {
 
1675
              my_error(ER_CONFLICTING_DECLARATIONS, MYF(0),
 
1676
                       "CHARACTER SET ", cinfo->default_table_charset->csname,
 
1677
                       "CHARACTER SET ", $4->csname);
 
1678
              MYSQL_YYABORT;
 
1679
            }
 
1680
            Lex->create_info.default_table_charset= $4;
 
1681
            Lex->create_info.used_fields|= HA_CREATE_USED_DEFAULT_CHARSET;
 
1682
          }
1557
1683
        ;
1558
1684
 
1559
1685
default_collation:
1566
1692
              {
1567
1693
                my_error(ER_COLLATION_CHARSET_MISMATCH, MYF(0),
1568
1694
                         $4->name, cinfo->default_table_charset->csname);
1569
 
                DRIZZLE_YYABORT;
 
1695
                MYSQL_YYABORT;
1570
1696
              }
1571
1697
              Lex->create_info.default_table_charset= $4;
1572
1698
              Lex->create_info.used_fields|= HA_CREATE_USED_DEFAULT_CHARSET;
1583
1709
            else
1584
1710
            {
1585
1711
              my_error(ER_UNKNOWN_STORAGE_ENGINE, MYF(0), $1.str);
1586
 
              DRIZZLE_YYABORT;
 
1712
              MYSQL_YYABORT;
1587
1713
            }
1588
1714
          }
1589
1715
        ;
1597
1723
            else
1598
1724
            {
1599
1725
              my_error(ER_UNKNOWN_STORAGE_ENGINE, MYF(0), $1.str);
1600
 
              DRIZZLE_YYABORT;
 
1726
              MYSQL_YYABORT;
1601
1727
            }
1602
1728
          }
1603
1729
        ;
1713
1839
            lex->default_value= lex->on_update_value= 0;
1714
1840
            lex->comment=null_lex_str;
1715
1841
            lex->charset=NULL;
 
1842
            lex->storage_type= HA_SM_DEFAULT;
1716
1843
            lex->column_format= COLUMN_FORMAT_TYPE_DEFAULT;
1717
 
            lex->vcol_info= NULL;
1718
1844
          }
1719
 
          field_def
 
1845
          type opt_attribute
1720
1846
          {
1721
1847
            LEX *lex=Lex;
1722
1848
            if (add_field_to_list(lex->thd, &$1, (enum enum_field_types) $3,
1723
1849
                                  lex->length,lex->dec,lex->type,
1724
 
                                  lex->column_format,
 
1850
                                  lex->storage_type, lex->column_format,
1725
1851
                                  lex->default_value, lex->on_update_value, 
1726
1852
                                  &lex->comment,
1727
 
                                  lex->change,&lex->interval_list,lex->charset,
1728
 
                                  lex->vcol_info))
1729
 
              DRIZZLE_YYABORT;
1730
 
          }
1731
 
        ;
1732
 
field_def:
1733
 
          type opt_attribute {}
1734
 
        | VIRTUAL_SYM type AS '(' virtual_column_func ')' vcol_opt_attribute
1735
 
          {
1736
 
            $$=DRIZZLE_TYPE_VIRTUAL;
1737
 
            Lex->vcol_info->set_field_type((enum enum_field_types) $2);
1738
 
          }
1739
 
        ;
1740
 
 
1741
 
vcol_opt_attribute:
1742
 
          /* empty */ {}
1743
 
        | vcol_opt_attribute_list {}
1744
 
        ;
1745
 
 
1746
 
vcol_opt_attribute_list:
1747
 
          vcol_opt_attribute_list vcol_attribute {}
1748
 
        | vcol_attribute
1749
 
        ;
1750
 
 
1751
 
vcol_attribute:
1752
 
          UNIQUE_SYM
1753
 
          {
1754
 
            LEX *lex=Lex;
1755
 
            lex->type|= UNIQUE_FLAG; 
1756
 
            lex->alter_info.flags|= ALTER_ADD_INDEX;
1757
 
          }
1758
 
        | UNIQUE_SYM KEY_SYM
1759
 
          {
1760
 
            LEX *lex=Lex;
1761
 
            lex->type|= UNIQUE_KEY_FLAG; 
1762
 
            lex->alter_info.flags|= ALTER_ADD_INDEX; 
1763
 
          }
1764
 
        | COMMENT_SYM TEXT_STRING_sys { Lex->comment= $2; }
1765
 
        | STORED_SYM
1766
 
          {
1767
 
            Lex->vcol_info->set_field_stored(true);
1768
 
          }
1769
 
        ;
1770
 
 
1771
 
parse_vcol_expr:
1772
 
          PARSE_VCOL_EXPR_SYM '(' virtual_column_func ')'
1773
 
          {
1774
 
            /* 
1775
 
              "PARSE_VCOL_EXPR" can only be used by the SQL server
1776
 
              when reading a '*.frm' file.
1777
 
              Prevent the end user from invoking this command.
1778
 
            */
1779
 
            if (not Lex->parse_vcol_expr)
1780
 
            {
1781
 
              my_message(ER_SYNTAX_ERROR, ER(ER_SYNTAX_ERROR), MYF(0));
1782
 
              DRIZZLE_YYABORT;
1783
 
            }
1784
 
          }
1785
 
        ;
1786
 
 
1787
 
virtual_column_func:
1788
 
          remember_name expr remember_end
1789
 
          {
1790
 
            Lex->vcol_info= new virtual_column_info();
1791
 
            if (not Lex->vcol_info)
1792
 
            {
1793
 
              my_error(ER_OUTOFMEMORY, MYF(0), sizeof(virtual_column_info));
1794
 
              DRIZZLE_YYABORT;
1795
 
            }
1796
 
            uint expr_len= (uint)($3 - $1) - 1;
1797
 
            Lex->vcol_info->expr_str.str= (char* ) sql_memdup($1 + 1, expr_len);
1798
 
            Lex->vcol_info->expr_str.length= expr_len;
1799
 
            Lex->vcol_info->expr_item= $2;
 
1853
                                  lex->change,&lex->interval_list,lex->charset))
 
1854
              MYSQL_YYABORT;
1800
1855
          }
1801
1856
        ;
1802
1857
 
1803
1858
type:
1804
 
        int_type
1805
 
        { 
1806
 
          $$=$1; 
1807
 
          Lex->length=(char*) 0; /* use default length */
1808
 
        }
1809
 
        | real_type opt_precision { $$=$1; }
 
1859
          int_type opt_len field_options { $$=$1; }
 
1860
        | real_type opt_precision field_options { $$=$1; }
 
1861
        | FLOAT_SYM float_options field_options { $$=MYSQL_TYPE_FLOAT; }
 
1862
        | BIT_SYM
 
1863
          {
 
1864
            Lex->length= (char*) "1";
 
1865
            $$=MYSQL_TYPE_BIT;
 
1866
          }
 
1867
        | BIT_SYM '(' NUM ')'
 
1868
          {
 
1869
            Lex->length= $3.str;
 
1870
            $$=MYSQL_TYPE_BIT;
 
1871
          }
 
1872
        | BOOL_SYM
 
1873
          {
 
1874
            Lex->length=(char*) "1";
 
1875
            $$=MYSQL_TYPE_TINY;
 
1876
          }
 
1877
        | BOOLEAN_SYM
 
1878
          {
 
1879
            Lex->length=(char*) "1";
 
1880
            $$=MYSQL_TYPE_TINY;
 
1881
          }
1810
1882
        | char '(' NUM ')' opt_binary
1811
1883
          {
1812
1884
            Lex->length=$3.str;
1813
 
            $$=DRIZZLE_TYPE_VARCHAR;
 
1885
            $$=MYSQL_TYPE_STRING;
1814
1886
          }
1815
1887
        | char opt_binary
1816
1888
          {
1817
1889
            Lex->length=(char*) "1";
1818
 
            $$=DRIZZLE_TYPE_VARCHAR;
 
1890
            $$=MYSQL_TYPE_STRING;
 
1891
          }
 
1892
        | nchar '(' NUM ')' opt_bin_mod
 
1893
          {
 
1894
            Lex->length=$3.str;
 
1895
            $$=MYSQL_TYPE_STRING;
 
1896
            Lex->charset=national_charset_info;
 
1897
          }
 
1898
        | nchar opt_bin_mod
 
1899
          {
 
1900
            Lex->length=(char*) "1";
 
1901
            $$=MYSQL_TYPE_STRING;
 
1902
            Lex->charset=national_charset_info;
 
1903
          }
 
1904
        | BINARY '(' NUM ')'
 
1905
          {
 
1906
            Lex->length=$3.str;
 
1907
            Lex->charset=&my_charset_bin;
 
1908
            $$=MYSQL_TYPE_STRING;
 
1909
          }
 
1910
        | BINARY
 
1911
          {
 
1912
            Lex->length= (char*) "1";
 
1913
            Lex->charset=&my_charset_bin;
 
1914
            $$=MYSQL_TYPE_STRING;
1819
1915
          }
1820
1916
        | varchar '(' NUM ')' opt_binary
1821
1917
          {
1822
1918
            Lex->length=$3.str;
1823
 
            $$= DRIZZLE_TYPE_VARCHAR;
 
1919
            $$= MYSQL_TYPE_VARCHAR;
 
1920
          }
 
1921
        | nvarchar '(' NUM ')' opt_bin_mod
 
1922
          {
 
1923
            Lex->length=$3.str;
 
1924
            $$= MYSQL_TYPE_VARCHAR;
 
1925
            Lex->charset=national_charset_info;
1824
1926
          }
1825
1927
        | VARBINARY '(' NUM ')'
1826
1928
          {
1827
1929
            Lex->length=$3.str;
1828
1930
            Lex->charset=&my_charset_bin;
1829
 
            $$= DRIZZLE_TYPE_VARCHAR;
 
1931
            $$= MYSQL_TYPE_VARCHAR;
1830
1932
          }
 
1933
        | YEAR_SYM opt_len field_options
 
1934
          { $$=MYSQL_TYPE_YEAR; }
1831
1935
        | DATE_SYM
1832
 
          { $$=DRIZZLE_TYPE_NEWDATE; }
 
1936
          { $$=MYSQL_TYPE_DATE; }
1833
1937
        | TIME_SYM
1834
 
          { $$=DRIZZLE_TYPE_TIME; }
 
1938
          { $$=MYSQL_TYPE_TIME; }
1835
1939
        | TIMESTAMP
1836
1940
          {
1837
1941
            /* Unlike other types TIMESTAMP fields are NOT NULL by default */
1838
1942
            Lex->type|= NOT_NULL_FLAG;
1839
 
            $$=DRIZZLE_TYPE_TIMESTAMP;
 
1943
            $$=MYSQL_TYPE_TIMESTAMP;
1840
1944
          }
1841
1945
        | DATETIME
1842
 
          { $$=DRIZZLE_TYPE_DATETIME; }
1843
 
        | BLOB_SYM
1844
 
          {
1845
 
            Lex->charset=&my_charset_bin;
1846
 
            $$=DRIZZLE_TYPE_BLOB;
1847
 
            Lex->length=(char*) 0; /* use default length */
1848
 
          }
1849
 
        | TEXT_SYM opt_binary
1850
 
          { 
1851
 
            $$=DRIZZLE_TYPE_BLOB; 
1852
 
            Lex->length=(char*) 0; /* use default length */
1853
 
          }
1854
 
        | DECIMAL_SYM float_options
1855
 
          { $$=DRIZZLE_TYPE_NEWDECIMAL;}
1856
 
        | NUMERIC_SYM float_options
1857
 
          { $$=DRIZZLE_TYPE_NEWDECIMAL;}
1858
 
        | FIXED_SYM float_options
1859
 
          { $$=DRIZZLE_TYPE_NEWDECIMAL;}
 
1946
          { $$=MYSQL_TYPE_DATETIME; }
 
1947
        | TINYBLOB
 
1948
          {
 
1949
            Lex->charset=&my_charset_bin;
 
1950
            $$=MYSQL_TYPE_TINY_BLOB;
 
1951
          }
 
1952
        | BLOB_SYM opt_len
 
1953
          {
 
1954
            Lex->charset=&my_charset_bin;
 
1955
            $$=MYSQL_TYPE_BLOB;
 
1956
          }
 
1957
        | MEDIUMBLOB
 
1958
          {
 
1959
            Lex->charset=&my_charset_bin;
 
1960
            $$=MYSQL_TYPE_MEDIUM_BLOB;
 
1961
          }
 
1962
        | LONGBLOB
 
1963
          {
 
1964
            Lex->charset=&my_charset_bin;
 
1965
            $$=MYSQL_TYPE_LONG_BLOB;
 
1966
          }
 
1967
        | LONG_SYM VARBINARY
 
1968
          {
 
1969
            Lex->charset=&my_charset_bin;
 
1970
            $$=MYSQL_TYPE_MEDIUM_BLOB;
 
1971
          }
 
1972
        | LONG_SYM varchar opt_binary
 
1973
          { $$=MYSQL_TYPE_MEDIUM_BLOB; }
 
1974
        | TINYTEXT opt_binary
 
1975
          { $$=MYSQL_TYPE_TINY_BLOB; }
 
1976
        | TEXT_SYM opt_len opt_binary
 
1977
          { $$=MYSQL_TYPE_BLOB; }
 
1978
        | MEDIUMTEXT opt_binary
 
1979
          { $$=MYSQL_TYPE_MEDIUM_BLOB; }
 
1980
        | LONGTEXT opt_binary
 
1981
          { $$=MYSQL_TYPE_LONG_BLOB; }
 
1982
        | DECIMAL_SYM float_options field_options
 
1983
          { $$=MYSQL_TYPE_NEWDECIMAL;}
 
1984
        | NUMERIC_SYM float_options field_options
 
1985
          { $$=MYSQL_TYPE_NEWDECIMAL;}
 
1986
        | FIXED_SYM float_options field_options
 
1987
          { $$=MYSQL_TYPE_NEWDECIMAL;}
1860
1988
        | ENUM
1861
1989
          {Lex->interval_list.empty();}
1862
1990
          '(' string_list ')' opt_binary
1863
 
          { $$=DRIZZLE_TYPE_ENUM; }
 
1991
          { $$=MYSQL_TYPE_ENUM; }
 
1992
        | SET
 
1993
          { Lex->interval_list.empty();}
 
1994
          '(' string_list ')' opt_binary
 
1995
          { $$=MYSQL_TYPE_SET; }
 
1996
        | LONG_SYM opt_binary
 
1997
          { $$=MYSQL_TYPE_MEDIUM_BLOB; }
1864
1998
        | SERIAL_SYM
1865
1999
          {
1866
 
            $$=DRIZZLE_TYPE_LONGLONG;
1867
 
            Lex->type|= (AUTO_INCREMENT_FLAG | NOT_NULL_FLAG | UNIQUE_FLAG);
 
2000
            $$=MYSQL_TYPE_LONGLONG;
 
2001
            Lex->type|= (AUTO_INCREMENT_FLAG | NOT_NULL_FLAG | UNSIGNED_FLAG |
 
2002
              UNIQUE_FLAG);
1868
2003
          }
1869
2004
        ;
1870
2005
 
1872
2007
          CHAR_SYM {}
1873
2008
        ;
1874
2009
 
 
2010
nchar:
 
2011
          NCHAR_SYM {}
 
2012
        | NATIONAL_SYM CHAR_SYM {}
 
2013
        ;
 
2014
 
1875
2015
varchar:
1876
2016
          char VARYING {}
1877
2017
        | VARCHAR {}
1878
2018
        ;
1879
2019
 
 
2020
nvarchar:
 
2021
          NATIONAL_SYM VARCHAR {}
 
2022
        | NVARCHAR_SYM {}
 
2023
        | NCHAR_SYM VARCHAR {}
 
2024
        | NATIONAL_SYM CHAR_SYM VARYING {}
 
2025
        | NCHAR_SYM VARYING {}
 
2026
        ;
 
2027
 
1880
2028
int_type:
1881
 
          INT_SYM   { $$=DRIZZLE_TYPE_LONG; }
1882
 
        | BIGINT    { $$=DRIZZLE_TYPE_LONGLONG; }
 
2029
          INT_SYM   { $$=MYSQL_TYPE_LONG; }
 
2030
        | TINYINT   { $$=MYSQL_TYPE_TINY; }
 
2031
        | SMALLINT  { $$=MYSQL_TYPE_SHORT; }
 
2032
        | MEDIUMINT { $$=MYSQL_TYPE_INT24; }
 
2033
        | BIGINT    { $$=MYSQL_TYPE_LONGLONG; }
1883
2034
        ;
1884
2035
 
1885
2036
real_type:
1886
2037
          REAL
1887
2038
          {
1888
 
            $$= DRIZZLE_TYPE_DOUBLE;
 
2039
            $$= MYSQL_TYPE_DOUBLE;
1889
2040
          }
1890
2041
        | DOUBLE_SYM
1891
 
          { $$=DRIZZLE_TYPE_DOUBLE; }
 
2042
          { $$=MYSQL_TYPE_DOUBLE; }
1892
2043
        | DOUBLE_SYM PRECISION
1893
 
          { $$=DRIZZLE_TYPE_DOUBLE; }
 
2044
          { $$=MYSQL_TYPE_DOUBLE; }
1894
2045
        ;
1895
2046
 
1896
2047
float_options:
1911
2062
          }
1912
2063
        ;
1913
2064
 
 
2065
field_options:
 
2066
          /* empty */ {}
 
2067
        | field_opt_list {}
 
2068
        ;
 
2069
 
 
2070
field_opt_list:
 
2071
          field_opt_list field_option {}
 
2072
        | field_option {}
 
2073
        ;
 
2074
 
 
2075
field_option:
 
2076
          SIGNED_SYM {}
 
2077
        | UNSIGNED { Lex->type|= UNSIGNED_FLAG;}
 
2078
        | ZEROFILL { Lex->type|= UNSIGNED_FLAG | ZEROFILL_FLAG; }
 
2079
        ;
 
2080
 
1914
2081
opt_len:
1915
2082
          /* empty */ { Lex->length=(char*) 0; /* use default length */ }
1916
2083
        | '(' NUM ')' { Lex->length= $2.str; }
1933
2100
 
1934
2101
attribute:
1935
2102
          NULL_SYM { Lex->type&= ~ NOT_NULL_FLAG; }
 
2103
        | STORAGE_SYM DEFAULT
 
2104
          {
 
2105
            Lex->storage_type= HA_SM_DEFAULT;
 
2106
            Lex->alter_info.flags|= ALTER_COLUMN_STORAGE;
 
2107
          }
 
2108
        | STORAGE_SYM DISK_SYM
 
2109
          {
 
2110
            Lex->storage_type= HA_SM_DISK;
 
2111
            Lex->alter_info.flags|= ALTER_COLUMN_STORAGE;
 
2112
          }
 
2113
        | STORAGE_SYM MEMORY_SYM
 
2114
          {
 
2115
            Lex->storage_type= HA_SM_MEMORY;
 
2116
            Lex->alter_info.flags|= ALTER_COLUMN_STORAGE;
 
2117
          }
1936
2118
        | COLUMN_FORMAT_SYM column_format_types
1937
2119
          {
1938
2120
            Lex->column_format= $2;
1978
2160
            {
1979
2161
              my_error(ER_COLLATION_CHARSET_MISMATCH, MYF(0),
1980
2162
                       $2->name,Lex->charset->csname);
1981
 
              DRIZZLE_YYABORT;
 
2163
              MYSQL_YYABORT;
1982
2164
            }
1983
2165
            else
1984
2166
            {
1999
2181
        | CHARSET {}
2000
2182
        ;
2001
2183
 
 
2184
charset_name:
 
2185
          ident_or_text
 
2186
          {
 
2187
            if (!($$=get_charset_by_csname($1.str,MY_CS_PRIMARY,MYF(0))))
 
2188
            {
 
2189
              my_error(ER_UNKNOWN_CHARACTER_SET, MYF(0), $1.str);
 
2190
              MYSQL_YYABORT;
 
2191
            }
 
2192
          }
 
2193
        | BINARY { $$= &my_charset_bin; }
 
2194
        ;
 
2195
 
 
2196
charset_name_or_default:
 
2197
          charset_name { $$=$1;   }
 
2198
        | DEFAULT    { $$=NULL; }
 
2199
        ;
 
2200
 
 
2201
opt_load_data_charset:
 
2202
          /* Empty */ { $$= NULL; }
 
2203
        | charset charset_name_or_default { $$= $2; }
 
2204
        ;
 
2205
 
 
2206
old_or_new_charset_name:
 
2207
          ident_or_text
 
2208
          {
 
2209
            if (!($$=get_charset_by_csname($1.str,MY_CS_PRIMARY,MYF(0))) &&
 
2210
                !($$=get_old_charset_by_name($1.str)))
 
2211
            {
 
2212
              my_error(ER_UNKNOWN_CHARACTER_SET, MYF(0), $1.str);
 
2213
              MYSQL_YYABORT;
 
2214
            }
 
2215
          }
 
2216
        | BINARY { $$= &my_charset_bin; }
 
2217
        ;
 
2218
 
 
2219
old_or_new_charset_name_or_default:
 
2220
          old_or_new_charset_name { $$=$1;   }
 
2221
        | DEFAULT    { $$=NULL; }
 
2222
        ;
 
2223
 
2002
2224
collation_name:
2003
2225
          ident_or_text
2004
2226
          {
2005
2227
            if (!($$=get_charset_by_name($1.str,MYF(0))))
2006
2228
            {
2007
2229
              my_error(ER_UNKNOWN_COLLATION, MYF(0), $1.str);
2008
 
              DRIZZLE_YYABORT;
 
2230
              MYSQL_YYABORT;
2009
2231
            }
2010
2232
          }
2011
2233
        ;
2012
2234
 
 
2235
opt_collate:
 
2236
          /* empty */ { $$=NULL; }
 
2237
        | COLLATE_SYM collation_name_or_default { $$=$2; }
 
2238
        ;
 
2239
 
2013
2240
collation_name_or_default:
2014
2241
          collation_name { $$=$1; }
2015
2242
        | DEFAULT    { $$=NULL; }
2022
2249
 
2023
2250
opt_binary:
2024
2251
          /* empty */ { Lex->charset=NULL; }
 
2252
        | ASCII_SYM opt_bin_mod { Lex->charset=&my_charset_latin1; }
2025
2253
        | BYTE_SYM { Lex->charset=&my_charset_bin; }
 
2254
        | UNICODE_SYM opt_bin_mod
 
2255
          {
 
2256
            if (!(Lex->charset=get_charset_by_csname("ucs2",
 
2257
                                                     MY_CS_PRIMARY,MYF(0))))
 
2258
            {
 
2259
              my_error(ER_UNKNOWN_CHARACTER_SET, MYF(0), "ucs2");
 
2260
              MYSQL_YYABORT;
 
2261
            }
 
2262
          }
 
2263
        | charset charset_name opt_bin_mod { Lex->charset=$2; }
 
2264
        | BINARY opt_bin_charset { Lex->type|= BINCMP_FLAG; }
 
2265
        ;
 
2266
 
 
2267
opt_bin_mod:
 
2268
          /* empty */ { }
2026
2269
        | BINARY { Lex->type|= BINCMP_FLAG; }
2027
2270
        ;
2028
2271
 
 
2272
opt_bin_charset:
 
2273
          /* empty */ { Lex->charset= NULL; }
 
2274
        | ASCII_SYM { Lex->charset=&my_charset_latin1; }
 
2275
        | UNICODE_SYM
 
2276
          {
 
2277
            if (!(Lex->charset=get_charset_by_csname("ucs2",
 
2278
                                                     MY_CS_PRIMARY,MYF(0))))
 
2279
            {
 
2280
              my_error(ER_UNKNOWN_CHARACTER_SET, MYF(0), "ucs2");
 
2281
              MYSQL_YYABORT;
 
2282
            }
 
2283
          }
 
2284
        | charset charset_name { Lex->charset=$2; }
 
2285
        ;
 
2286
 
2029
2287
ws_nweights:
2030
2288
        '(' real_ulong_num
2031
2289
        {
2032
2290
          if ($2 == 0)
2033
2291
          {
2034
2292
            my_parse_error(ER(ER_SYNTAX_ERROR));
2035
 
            DRIZZLE_YYABORT;
 
2293
            MYSQL_YYABORT;
2036
2294
          }
2037
2295
        }
2038
2296
        ')'
2077
2335
ws_level_range:
2078
2336
        ws_level_number '-' ws_level_number
2079
2337
        {
2080
 
          uint32_t start= $1;
2081
 
          uint32_t end= $3;
 
2338
          uint start= $1;
 
2339
          uint end= $3;
2082
2340
          for ($$= 0; start <= end; start++)
2083
2341
            $$|= (1 << start);
2084
2342
        }
2303
2561
            lex->duplicates= DUP_ERROR; 
2304
2562
            if (!lex->select_lex.add_table_to_list(thd, $5, NULL,
2305
2563
                                                   TL_OPTION_UPDATING))
2306
 
              DRIZZLE_YYABORT;
 
2564
              MYSQL_YYABORT;
2307
2565
            lex->alter_info.reset();
2308
2566
            lex->col_list.empty();
2309
2567
            lex->select_lex.init_order();
2310
2568
            lex->select_lex.db=
2311
 
              ((TableList*) lex->select_lex.table_list.first)->db;
2312
 
            memset(&lex->create_info, 0, sizeof(lex->create_info));
 
2569
              ((TABLE_LIST*) lex->select_lex.table_list.first)->db;
 
2570
            bzero((char*) &lex->create_info,sizeof(lex->create_info));
2313
2571
            lex->create_info.db_type= 0;
2314
2572
            lex->create_info.default_table_charset= NULL;
2315
2573
            lex->create_info.row_type= ROW_TYPE_NOT_USED;
2316
2574
            lex->alter_info.reset();
 
2575
            lex->no_write_to_binlog= 0;
 
2576
            lex->create_info.default_storage_media= HA_SM_DEFAULT;
2317
2577
            lex->alter_info.build_method= $2;
2318
2578
          }
2319
2579
          alter_commands
2330
2590
            lex->name= $3;
2331
2591
            if (lex->name.str == NULL &&
2332
2592
                lex->copy_db_to(&lex->name.str, &lex->name.length))
2333
 
              DRIZZLE_YYABORT;
 
2593
              MYSQL_YYABORT;
 
2594
          }
 
2595
        | ALTER DATABASE ident UPGRADE_SYM DATA_SYM DIRECTORY_SYM NAME_SYM
 
2596
          {
 
2597
            LEX *lex= Lex;
 
2598
            lex->sql_command= SQLCOM_ALTER_DB_UPGRADE;
 
2599
            lex->name= $3;
2334
2600
          }
2335
2601
        ;
2336
2602
 
2400
2666
            lex->comment=null_lex_str;
2401
2667
            lex->charset= NULL;
2402
2668
            lex->alter_info.flags|= ALTER_CHANGE_COLUMN;
 
2669
            lex->storage_type= HA_SM_DEFAULT;
2403
2670
            lex->column_format= COLUMN_FORMAT_TYPE_DEFAULT;
2404
 
            lex->vcol_info= NULL;
2405
2671
          }
2406
 
          field_def
 
2672
          type opt_attribute
2407
2673
          {
2408
2674
            LEX *lex=Lex;
2409
2675
            if (add_field_to_list(lex->thd,&$3,
2410
2676
                                  (enum enum_field_types) $5,
2411
2677
                                  lex->length,lex->dec,lex->type,
2412
 
                                  lex->column_format,
 
2678
                                  lex->storage_type, lex->column_format,
2413
2679
                                  lex->default_value, lex->on_update_value,
2414
2680
                                  &lex->comment,
2415
 
                                  $3.str, &lex->interval_list, lex->charset,
2416
 
                                  lex->vcol_info))
2417
 
              DRIZZLE_YYABORT;
 
2681
                                  $3.str, &lex->interval_list, lex->charset))
 
2682
              MYSQL_YYABORT;
2418
2683
          }
2419
2684
          opt_place
2420
 
        | DROP opt_column field_ident
 
2685
        | DROP opt_column field_ident opt_restrict
2421
2686
          {
2422
2687
            LEX *lex=Lex;
2423
2688
            lex->alter_info.drop_list.push_back(new Alter_drop(Alter_drop::COLUMN,
2475
2740
            if (lex->select_lex.db == NULL &&
2476
2741
                lex->copy_db_to(&lex->select_lex.db, &dummy))
2477
2742
            {
2478
 
              DRIZZLE_YYABORT;
 
2743
              MYSQL_YYABORT;
2479
2744
            }
2480
2745
            if (check_table_name($3->table.str,$3->table.length) || ($3->db.str && check_db_name(&$3->db)))
2481
2746
            {
2482
2747
              my_error(ER_WRONG_TABLE_NAME, MYF(0), $3->table.str);
2483
 
              DRIZZLE_YYABORT;
 
2748
              MYSQL_YYABORT;
2484
2749
            }
2485
2750
            lex->name= $3->table;
2486
2751
            lex->alter_info.flags|= ALTER_RENAME;
2487
2752
          }
2488
 
        | CONVERT_SYM TO_SYM collation_name_or_default
 
2753
        | CONVERT_SYM TO_SYM charset charset_name_or_default opt_collate
2489
2754
          {
2490
 
            if (!$3)
 
2755
            if (!$4)
2491
2756
            {
2492
2757
              THD *thd= YYTHD;
2493
 
              $3= thd->variables.collation_database;
 
2758
              $4= thd->variables.collation_database;
 
2759
            }
 
2760
            $5= $5 ? $5 : $4;
 
2761
            if (!my_charset_same($4,$5))
 
2762
            {
 
2763
              my_error(ER_COLLATION_CHARSET_MISMATCH, MYF(0),
 
2764
                       $5->name, $4->csname);
 
2765
              MYSQL_YYABORT;
2494
2766
            }
2495
2767
            LEX *lex= Lex;
2496
2768
            lex->create_info.table_charset=
2497
 
            lex->create_info.default_table_charset= $3;
 
2769
            lex->create_info.default_table_charset= $5;
2498
2770
            lex->create_info.used_fields|= (HA_CREATE_USED_CHARSET |
2499
2771
              HA_CREATE_USED_DEFAULT_CHARSET);
2500
2772
            lex->alter_info.flags|= ALTER_CONVERT;
2525
2797
        | IGNORE_SYM { Lex->ignore= 1;}
2526
2798
        ;
2527
2799
 
 
2800
opt_restrict:
 
2801
          /* empty */ { Lex->drop_mode= DROP_DEFAULT; }
 
2802
        | RESTRICT    { Lex->drop_mode= DROP_RESTRICT; }
 
2803
        | CASCADE     { Lex->drop_mode= DROP_CASCADE; }
 
2804
        ;
 
2805
 
2528
2806
opt_place:
2529
2807
          /* empty */ {}
2530
2808
        | AFTER_SYM ident
2557
2835
            lex->sql_command = SQLCOM_SLAVE_START;
2558
2836
            lex->type = 0;
2559
2837
            /* We'll use mi structure for UNTIL options */
2560
 
            memset(&lex->mi, 0, sizeof(lex->mi));
 
2838
            bzero((char*) &lex->mi, sizeof(lex->mi));
2561
2839
            /* If you change this code don't forget to update SLAVE START too */
2562
2840
          }
2563
2841
          slave_until
2575
2853
            lex->sql_command = SQLCOM_SLAVE_START;
2576
2854
            lex->type = 0;
2577
2855
            /* We'll use mi structure for UNTIL options */
2578
 
            memset(&lex->mi, 0, sizeof(lex->mi));
 
2856
            bzero((char*) &lex->mi, sizeof(lex->mi));
2579
2857
          }
2580
2858
          slave_until
2581
2859
          {}
2600
2878
          /*empty*/ { $$ = 0; }
2601
2879
        | WITH CONSISTENT_SYM SNAPSHOT_SYM
2602
2880
          {
2603
 
            $$= DRIZZLE_START_TRANS_OPT_WITH_CONS_SNAPSHOT;
 
2881
            $$= MYSQL_START_TRANS_OPT_WITH_CONS_SNAPSHOT;
2604
2882
          }
2605
2883
        ;
2606
2884
 
2632
2910
            {
2633
2911
               my_message(ER_BAD_SLAVE_UNTIL_COND,
2634
2912
                          ER(ER_BAD_SLAVE_UNTIL_COND), MYF(0));
2635
 
               DRIZZLE_YYABORT;
 
2913
               MYSQL_YYABORT;
2636
2914
            }
2637
2915
          }
2638
2916
        ;
2659
2937
        ;
2660
2938
 
2661
2939
repair:
2662
 
          REPAIR table_or_tables
 
2940
          REPAIR opt_no_write_to_binlog table_or_tables
2663
2941
          {
2664
2942
            LEX *lex=Lex;
2665
2943
            lex->sql_command = SQLCOM_REPAIR;
 
2944
            lex->no_write_to_binlog= $2;
2666
2945
            lex->check_opt.init();
2667
2946
          }
2668
2947
          table_list opt_mi_repair_type
2686
2965
        ;
2687
2966
 
2688
2967
analyze:
2689
 
          ANALYZE_SYM table_or_tables
 
2968
          ANALYZE_SYM opt_no_write_to_binlog table_or_tables
2690
2969
          {
2691
2970
            LEX *lex=Lex;
2692
2971
            lex->sql_command = SQLCOM_ANALYZE;
 
2972
            lex->no_write_to_binlog= $2;
2693
2973
            lex->check_opt.init();
2694
2974
          }
2695
2975
          table_list
2736
3016
        ;
2737
3017
 
2738
3018
optimize:
2739
 
          OPTIMIZE table_or_tables
 
3019
          OPTIMIZE opt_no_write_to_binlog table_or_tables
2740
3020
          {
2741
3021
            LEX *lex=Lex;
2742
3022
            lex->sql_command = SQLCOM_OPTIMIZE;
 
3023
            lex->no_write_to_binlog= $2;
2743
3024
            lex->check_opt.init();
2744
3025
          }
2745
3026
          table_list
2746
3027
          {}
2747
3028
        ;
2748
3029
 
 
3030
opt_no_write_to_binlog:
 
3031
          /* empty */ { $$= 0; }
 
3032
        | NO_WRITE_TO_BINLOG { $$= 1; }
 
3033
        | LOCAL_SYM { $$= 1; }
 
3034
        ;
 
3035
 
2749
3036
rename:
2750
3037
          RENAME table_or_tables
2751
3038
          {
2769
3056
                                       TL_IGNORE) ||
2770
3057
                !sl->add_table_to_list(lex->thd, $3,NULL,TL_OPTION_UPDATING,
2771
3058
                                       TL_IGNORE))
2772
 
              DRIZZLE_YYABORT;
 
3059
              MYSQL_YYABORT;
2773
3060
          }
2774
3061
        ;
2775
3062
 
2792
3079
          {
2793
3080
            if (!Select->add_table_to_list(YYTHD, $1, NULL, 0, TL_READ, 
2794
3081
                                           Select->pop_index_hints()))
2795
 
              DRIZZLE_YYABORT;
 
3082
              MYSQL_YYABORT;
2796
3083
          }
2797
3084
        ;
2798
3085
 
2801
3088
        | DEFAULT  { $$ = default_key_cache_base; }
2802
3089
        ;
2803
3090
 
 
3091
preload:
 
3092
          LOAD INDEX_SYM INTO CACHE_SYM
 
3093
          {
 
3094
            LEX *lex=Lex;
 
3095
            lex->sql_command=SQLCOM_PRELOAD_KEYS;
 
3096
          }
 
3097
          preload_list
 
3098
          {}
 
3099
        ;
 
3100
 
 
3101
preload_list:
 
3102
          preload_keys
 
3103
        | preload_list ',' preload_keys
 
3104
        ;
 
3105
 
 
3106
preload_keys:
 
3107
          table_ident cache_keys_spec opt_ignore_leaves
 
3108
          {
 
3109
            if (!Select->add_table_to_list(YYTHD, $1, NULL, $3, TL_READ,
 
3110
                                           Select->pop_index_hints()))
 
3111
              MYSQL_YYABORT;
 
3112
          }
 
3113
        ;
 
3114
 
2804
3115
cache_keys_spec:
2805
3116
          {
2806
3117
            Lex->select_lex.alloc_index_hints(YYTHD);
2817
3128
        | key_or_index '(' opt_key_usage_list ')'
2818
3129
        ;
2819
3130
 
 
3131
opt_ignore_leaves:
 
3132
          /* empty */
 
3133
          { $$= 0; }
 
3134
        | IGNORE_SYM LEAVES { $$= TL_OPTION_IGNORE_LEAVES; }
 
3135
        ;
 
3136
 
2820
3137
/*
2821
3138
  Select : retrieve data from table
2822
3139
*/
2840
3157
          SELECT_SYM select_part2
2841
3158
          {
2842
3159
            if (setup_select_in_parentheses(Lex))
2843
 
              DRIZZLE_YYABORT;
 
3160
              MYSQL_YYABORT;
2844
3161
          }
2845
3162
        | '(' select_paren ')'
2846
3163
        ;
2850
3167
          SELECT_SYM select_part2_derived
2851
3168
          {
2852
3169
            if (setup_select_in_parentheses(Lex))
2853
 
              DRIZZLE_YYABORT;
 
3170
              MYSQL_YYABORT;
2854
3171
          }
2855
3172
        | '(' select_paren_derived ')'
2856
3173
        ;
2863
3180
            if (lex->current_select->set_braces(0))
2864
3181
            {
2865
3182
              my_parse_error(ER(ER_SYNTAX_ERROR));
2866
 
              DRIZZLE_YYABORT;
 
3183
              MYSQL_YYABORT;
2867
3184
            }
2868
3185
            if (sel->linkage == UNION_TYPE &&
2869
3186
                sel->master_unit()->first_select()->braces)
2870
3187
            {
2871
3188
              my_parse_error(ER(ER_SYNTAX_ERROR));
2872
 
              DRIZZLE_YYABORT;
 
3189
              MYSQL_YYABORT;
2873
3190
            }
2874
3191
          }
2875
3192
          union_clause
2904
3221
          {
2905
3222
            Select->context.table_list=
2906
3223
              Select->context.first_name_resolution_table= 
2907
 
                (TableList *) Select->table_list.first;
 
3224
                (TABLE_LIST *) Select->table_list.first;
2908
3225
          }
2909
3226
        ;
2910
3227
 
2915
3232
            if (Select->options & SELECT_DISTINCT && Select->options & SELECT_ALL)
2916
3233
            {
2917
3234
              my_error(ER_WRONG_USAGE, MYF(0), "ALL", "DISTINCT");
2918
 
              DRIZZLE_YYABORT;
 
3235
              MYSQL_YYABORT;
2919
3236
            }
2920
3237
          }
2921
3238
        ;
2930
3247
        | HIGH_PRIORITY
2931
3248
          {
2932
3249
            if (check_simple_select())
2933
 
              DRIZZLE_YYABORT;
 
3250
              MYSQL_YYABORT;
2934
3251
            Lex->lock_option= TL_READ_HIGH_PRIORITY;
2935
3252
          }
2936
3253
        | DISTINCT         { Select->options|= SELECT_DISTINCT; }
2939
3256
        | SQL_BUFFER_RESULT
2940
3257
          {
2941
3258
            if (check_simple_select())
2942
 
              DRIZZLE_YYABORT;
 
3259
              MYSQL_YYABORT;
2943
3260
            Select->options|= OPTION_BUFFER_RESULT;
2944
3261
          }
2945
3262
        | SQL_CALC_FOUND_ROWS
2946
3263
          {
2947
3264
            if (check_simple_select())
2948
 
              DRIZZLE_YYABORT;
 
3265
              MYSQL_YYABORT;
2949
3266
            Select->options|= OPTION_FOUND_ROWS;
2950
3267
          }
2951
3268
        | ALL { Select->options|= SELECT_ALL; }
2976
3293
                                 new Item_field(&thd->lex->current_select->
2977
3294
                                                context,
2978
3295
                                                NULL, NULL, "*")))
2979
 
              DRIZZLE_YYABORT;
 
3296
              MYSQL_YYABORT;
2980
3297
            (thd->lex->current_select->with_wild)++;
2981
3298
          }
2982
3299
        ;
2987
3304
            THD *thd= YYTHD;
2988
3305
 
2989
3306
            if (add_item_to_list(thd, $2))
2990
 
              DRIZZLE_YYABORT;
 
3307
              MYSQL_YYABORT;
2991
3308
          }
2992
3309
        | remember_name expr remember_end select_alias
2993
3310
          {
2994
3311
            THD *thd= YYTHD;
2995
 
            assert($1 < $3);
 
3312
            DBUG_ASSERT($1 < $3);
2996
3313
 
2997
3314
            if (add_item_to_list(thd, $2))
2998
 
              DRIZZLE_YYABORT;
 
3315
              MYSQL_YYABORT;
2999
3316
            if ($4.str)
3000
3317
            {
3001
 
              $2->is_autogenerated_name= false;
 
3318
              $2->is_autogenerated_name= FALSE;
3002
3319
              $2->set_name($4.str, $4.length, system_charset_info);
3003
3320
            }
3004
3321
            else if (!$2->name)
3214
3531
        ;
3215
3532
 
3216
3533
bit_expr:
3217
 
          bit_expr '+' bit_expr %prec '+'
 
3534
          bit_expr '|' bit_expr %prec '|'
 
3535
          { $$= new Item_func_bit_or($1,$3); }
 
3536
        | bit_expr '&' bit_expr %prec '&'
 
3537
          { $$= new Item_func_bit_and($1,$3); }
 
3538
        | bit_expr SHIFT_LEFT bit_expr %prec SHIFT_LEFT
 
3539
          { $$= new Item_func_shift_left($1,$3); }
 
3540
        | bit_expr SHIFT_RIGHT bit_expr %prec SHIFT_RIGHT
 
3541
          { $$= new Item_func_shift_right($1,$3); }
 
3542
        | bit_expr '+' bit_expr %prec '+'
3218
3543
          { $$= new Item_func_plus($1,$3); }
3219
3544
        | bit_expr '-' bit_expr %prec '-'
3220
3545
          { $$= new Item_func_minus($1,$3); }
3232
3557
          { $$= new Item_func_int_div($1,$3); }
3233
3558
        | bit_expr MOD_SYM bit_expr %prec MOD_SYM
3234
3559
          { $$= new Item_func_mod($1,$3); }
 
3560
        | bit_expr '^' bit_expr
 
3561
          { $$= new Item_func_bit_xor($1,$3); }
3235
3562
        | simple_expr
3236
3563
        ;
3237
3564
 
3241
3568
 
3242
3569
and:
3243
3570
          AND_SYM
 
3571
       | AND_AND_SYM
3244
3572
       ;
3245
3573
 
3246
3574
not:
3276
3604
            $$= new (thd->mem_root) Item_func_set_collation($1, i1);
3277
3605
          }
3278
3606
        | literal
 
3607
        | param_marker
3279
3608
        | variable
3280
3609
        | sum_expr
3281
3610
        | '+' simple_expr %prec NEG { $$= $2; }
3282
3611
        | '-' simple_expr %prec NEG
3283
3612
          { $$= new (YYTHD->mem_root) Item_func_neg($2); }
 
3613
        | '~' simple_expr %prec NEG
 
3614
          { $$= new (YYTHD->mem_root) Item_func_bit_neg($2); }
3284
3615
        | '(' subselect ')'
3285
3616
          { 
3286
3617
            $$= new (YYTHD->mem_root) Item_singlerow_subselect($2);
3312
3643
            $$= create_func_cast(YYTHD, $3, $5, lex->length, lex->dec,
3313
3644
                                 lex->charset);
3314
3645
            if (!$$)
3315
 
              DRIZZLE_YYABORT;
 
3646
              MYSQL_YYABORT;
3316
3647
          }
3317
3648
        | CASE_SYM opt_expr when_list opt_else END
3318
3649
          { $$= new (YYTHD->mem_root) Item_func_case(* $3, $2, $4 ); }
3321
3652
            $$= create_func_cast(YYTHD, $3, $5, Lex->length, Lex->dec,
3322
3653
                                 Lex->charset);
3323
3654
            if (!$$)
3324
 
              DRIZZLE_YYABORT;
 
3655
              MYSQL_YYABORT;
3325
3656
          }
 
3657
        | CONVERT_SYM '(' expr USING charset_name ')'
 
3658
          { $$= new (YYTHD->mem_root) Item_func_conv_charset($3,$5); }
3326
3659
        | DEFAULT '(' simple_ident ')'
3327
3660
          {
3328
3661
            $$= new (YYTHD->mem_root) Item_default_value(Lex->current_context(),
3347
3680
function_call_keyword:
3348
3681
          CHAR_SYM '(' expr_list ')'
3349
3682
          { $$= new (YYTHD->mem_root) Item_func_char(*$3); }
 
3683
        | CHAR_SYM '(' expr_list USING charset_name ')'
 
3684
          { $$= new (YYTHD->mem_root) Item_func_char(*$3, $5); }
3350
3685
        | CURRENT_USER optional_braces
3351
3686
          {
3352
3687
            $$= new (YYTHD->mem_root) Item_func_current_user(Lex->current_context());
3523
3858
function_call_conflict:
3524
3859
          ASCII_SYM '(' expr ')'
3525
3860
          { $$= new (YYTHD->mem_root) Item_func_ascii($3); }
 
3861
        | CHARSET '(' expr ')'
 
3862
          { $$= new (YYTHD->mem_root) Item_func_charset($3); }
3526
3863
        | COALESCE '(' expr_list ')'
3527
3864
          { $$= new (YYTHD->mem_root) Item_func_coalesce(* $3); }
3528
3865
        | COLLATION_SYM '(' expr ')'
3537
3874
          { $$= new (YYTHD->mem_root) Item_func_microsecond($3); }
3538
3875
        | MOD_SYM '(' expr ',' expr ')'
3539
3876
          { $$ = new (YYTHD->mem_root) Item_func_mod( $3, $5); }
 
3877
        | OLD_PASSWORD '(' expr ')'
 
3878
          { $$=  new (YYTHD->mem_root) Item_func_old_password($3); }
 
3879
        | PASSWORD '(' expr ')'
 
3880
          {
 
3881
            THD *thd= YYTHD;
 
3882
            Item* i1;
 
3883
            if (thd->variables.old_passwords)
 
3884
              i1= new (thd->mem_root) Item_func_old_password($3);
 
3885
            else
 
3886
              i1= new (thd->mem_root) Item_func_password($3);
 
3887
            $$= i1;
 
3888
          }
3540
3889
        | QUARTER_SYM '(' expr ')'
3541
3890
          { $$ = new (YYTHD->mem_root) Item_func_quarter($3); }
3542
3891
        | REPEAT_SYM '(' expr ',' expr ')'
3585
3934
function_call_generic:
3586
3935
          IDENT_sys '('
3587
3936
          {
 
3937
#ifdef HAVE_DLOPEN
3588
3938
            udf_func *udf= 0;
3589
 
            udf= find_udf($1.str, $1.length);
3590
 
 
 
3939
            LEX *lex= Lex;
 
3940
            if (using_udf_functions &&
 
3941
                (udf= find_udf($1.str, $1.length)) &&
 
3942
                udf->type == UDFTYPE_AGGREGATE)
 
3943
            {
 
3944
              if (lex->current_select->inc_in_sum_expr())
 
3945
              {
 
3946
                my_parse_error(ER(ER_SYNTAX_ERROR));
 
3947
                MYSQL_YYABORT;
 
3948
              }
 
3949
            }
3591
3950
            /* Temporary placing the result of find_udf in $3 */
3592
3951
            $<udf>$= udf;
 
3952
#endif
3593
3953
          }
3594
3954
          opt_udf_expr_list ')'
3595
3955
          {
3613
3973
            }
3614
3974
            else
3615
3975
            {
 
3976
#ifdef HAVE_DLOPEN
3616
3977
              /* Retrieving the result of find_udf */
3617
3978
              udf_func *udf= $<udf>3;
3618
 
              if (udf)
 
3979
 
3619
3980
              {
 
3981
                if (udf->type == UDFTYPE_AGGREGATE)
 
3982
                {
 
3983
                  Select->in_sum_expr--;
 
3984
                }
 
3985
 
3620
3986
                item= Create_udf_func::s_singleton.create(thd, udf, $4);
3621
 
              } else {
3622
 
                /* fix for bug 250065, from Andrew Garner <muzazzi@gmail.com> */
3623
 
                my_error(ER_SP_DOES_NOT_EXIST, MYF(0), "FUNCTION", $1.str);
3624
3987
              }
 
3988
#endif
3625
3989
            }
3626
3990
 
3627
3991
            if (! ($$= item))
3628
3992
            {
3629
 
              DRIZZLE_YYABORT;
 
3993
              MYSQL_YYABORT;
3630
3994
            }
3631
3995
          }
3632
3996
        ;
3660
4024
            */
3661
4025
            if ($4.str)
3662
4026
            {
3663
 
              $2->is_autogenerated_name= false;
 
4027
              $2->is_autogenerated_name= FALSE;
3664
4028
              $2->set_name($4.str, $4.length, system_charset_info);
3665
4029
            }
3666
4030
            else
3674
4038
          { $$=new Item_sum_avg($3); }
3675
4039
        | AVG_SYM '(' DISTINCT in_sum_expr ')'
3676
4040
          { $$=new Item_sum_avg_distinct($4); }
 
4041
        | BIT_AND  '(' in_sum_expr ')'
 
4042
          { $$=new Item_sum_and($3); }
 
4043
        | BIT_OR  '(' in_sum_expr ')'
 
4044
          { $$=new Item_sum_or($3); }
 
4045
        | BIT_XOR  '(' in_sum_expr ')'
 
4046
          { $$=new Item_sum_xor($3); }
3677
4047
        | COUNT_SYM '(' opt_all '*' ')'
3678
 
          { $$=new Item_sum_count(new Item_int((int32_t) 0L,1)); }
 
4048
          { $$=new Item_sum_count(new Item_int((int32) 0L,1)); }
3679
4049
        | COUNT_SYM '(' in_sum_expr ')'
3680
4050
          { $$=new Item_sum_count($3); }
3681
4051
        | COUNT_SYM '(' DISTINCT
3729
4099
            if (! Lex->parsing_options.allows_variable)
3730
4100
            {
3731
4101
              my_error(ER_VIEW_SELECT_VARIABLE, MYF(0));
3732
 
              DRIZZLE_YYABORT;
 
4102
              MYSQL_YYABORT;
3733
4103
            }
3734
4104
          }
3735
4105
          variable_aux
3753
4123
            if ($3.str && $4.str && check_reserved_words(&$3))
3754
4124
            {
3755
4125
              my_parse_error(ER(ER_SYNTAX_ERROR));
3756
 
              DRIZZLE_YYABORT;
 
4126
              MYSQL_YYABORT;
3757
4127
            }
3758
4128
            if (!($$= get_system_var(YYTHD, $2, $3, $4)))
3759
 
              DRIZZLE_YYABORT;
 
4129
              MYSQL_YYABORT;
3760
4130
            if (!((Item_func_get_system_var*) $$)->is_written_to_binlog())
3761
4131
              Lex->set_stmt_unsafe();
3762
4132
          }
3770
4140
opt_gconcat_separator:
3771
4141
          /* empty */
3772
4142
            {
3773
 
              $$= new (YYTHD->mem_root) String(",", 1, &my_charset_utf8_general_ci);
 
4143
              $$= new (YYTHD->mem_root) String(",", 1, &my_charset_latin1);
3774
4144
            }
3775
4145
        | SEPARATOR_SYM text_string { $$ = $2; }
3776
4146
        ;
3797
4167
            if (lex->current_select->inc_in_sum_expr())
3798
4168
            {
3799
4169
              my_parse_error(ER(ER_SYNTAX_ERROR));
3800
 
              DRIZZLE_YYABORT;
 
4170
              MYSQL_YYABORT;
3801
4171
            }
3802
4172
          }
3803
4173
          expr
3812
4182
          { $$=ITEM_CAST_CHAR; Lex->charset= &my_charset_bin; Lex->dec= 0; }
3813
4183
        | CHAR_SYM opt_len opt_binary
3814
4184
          { $$=ITEM_CAST_CHAR; Lex->dec= 0; }
 
4185
        | NCHAR_SYM opt_len
 
4186
          { $$=ITEM_CAST_CHAR; Lex->charset= national_charset_info; Lex->dec=0; }
 
4187
        | SIGNED_SYM
 
4188
          { $$=ITEM_CAST_SIGNED_INT; Lex->charset= NULL; Lex->dec=Lex->length= (char*)0; }
 
4189
        | SIGNED_SYM INT_SYM
 
4190
          { $$=ITEM_CAST_SIGNED_INT; Lex->charset= NULL; Lex->dec=Lex->length= (char*)0; }
 
4191
        | UNSIGNED
 
4192
          { $$=ITEM_CAST_UNSIGNED_INT; Lex->charset= NULL; Lex->dec=Lex->length= (char*)0; }
 
4193
        | UNSIGNED INT_SYM
 
4194
          { $$=ITEM_CAST_UNSIGNED_INT; Lex->charset= NULL; Lex->dec=Lex->length= (char*)0; }
3815
4195
        | DATE_SYM
3816
4196
          { $$=ITEM_CAST_DATE; Lex->charset= NULL; Lex->dec=Lex->length= (char*)0; }
3817
4197
        | TIME_SYM
3868
4248
          {
3869
4249
            LEX *lex= Lex;
3870
4250
            if (!($$= lex->current_select->nest_last_join(lex->thd)))
3871
 
              DRIZZLE_YYABORT;
 
4251
              MYSQL_YYABORT;
3872
4252
          }
3873
4253
        ;
3874
4254
 
3875
4255
join_table_list:
3876
 
          derived_table_list { DRIZZLE_YYABORT_UNLESS($$=$1); }
 
4256
          derived_table_list { MYSQL_YYABORT_UNLESS($$=$1); }
3877
4257
        ;
3878
4258
 
3879
4259
/*
3894
4274
          esc_table_ref { $$=$1; }
3895
4275
        | derived_table_list ',' esc_table_ref
3896
4276
          {
3897
 
            DRIZZLE_YYABORT_UNLESS($1 && ($$=$3));
 
4277
            MYSQL_YYABORT_UNLESS($1 && ($$=$3));
3898
4278
          }
3899
4279
        ;
3900
4280
 
3913
4293
            left-associative joins.
3914
4294
          */
3915
4295
          table_ref normal_join table_ref %prec TABLE_REF_PRIORITY
3916
 
          { DRIZZLE_YYABORT_UNLESS($1 && ($$=$3)); }
 
4296
          { MYSQL_YYABORT_UNLESS($1 && ($$=$3)); }
3917
4297
        | table_ref STRAIGHT_JOIN table_factor
3918
 
          { DRIZZLE_YYABORT_UNLESS($1 && ($$=$3)); $3->straight=1; }
 
4298
          { MYSQL_YYABORT_UNLESS($1 && ($$=$3)); $3->straight=1; }
3919
4299
        | table_ref normal_join table_ref
3920
4300
          ON
3921
4301
          {
3922
 
            DRIZZLE_YYABORT_UNLESS($1 && $3);
 
4302
            MYSQL_YYABORT_UNLESS($1 && $3);
3923
4303
            /* Change the current name resolution context to a local context. */
3924
4304
            if (push_new_name_resolution_context(YYTHD, $1, $3))
3925
 
              DRIZZLE_YYABORT;
 
4305
              MYSQL_YYABORT;
3926
4306
            Select->parsing_place= IN_ON;
3927
4307
          }
3928
4308
          expr
3934
4314
        | table_ref STRAIGHT_JOIN table_factor
3935
4315
          ON
3936
4316
          {
3937
 
            DRIZZLE_YYABORT_UNLESS($1 && $3);
 
4317
            MYSQL_YYABORT_UNLESS($1 && $3);
3938
4318
            /* Change the current name resolution context to a local context. */
3939
4319
            if (push_new_name_resolution_context(YYTHD, $1, $3))
3940
 
              DRIZZLE_YYABORT;
 
4320
              MYSQL_YYABORT;
3941
4321
            Select->parsing_place= IN_ON;
3942
4322
          }
3943
4323
          expr
3950
4330
        | table_ref normal_join table_ref
3951
4331
          USING
3952
4332
          {
3953
 
            DRIZZLE_YYABORT_UNLESS($1 && $3);
 
4333
            MYSQL_YYABORT_UNLESS($1 && $3);
3954
4334
          }
3955
4335
          '(' using_list ')'
3956
4336
          { add_join_natural($1,$3,$7,Select); $$=$3; }
3957
4337
        | table_ref NATURAL JOIN_SYM table_factor
3958
4338
          {
3959
 
            DRIZZLE_YYABORT_UNLESS($1 && ($$=$4));
 
4339
            MYSQL_YYABORT_UNLESS($1 && ($$=$4));
3960
4340
            add_join_natural($1,$4,NULL,Select);
3961
4341
          }
3962
4342
 
3964
4344
        | table_ref LEFT opt_outer JOIN_SYM table_ref
3965
4345
          ON
3966
4346
          {
3967
 
            DRIZZLE_YYABORT_UNLESS($1 && $5);
 
4347
            MYSQL_YYABORT_UNLESS($1 && $5);
3968
4348
            /* Change the current name resolution context to a local context. */
3969
4349
            if (push_new_name_resolution_context(YYTHD, $1, $5))
3970
 
              DRIZZLE_YYABORT;
 
4350
              MYSQL_YYABORT;
3971
4351
            Select->parsing_place= IN_ON;
3972
4352
          }
3973
4353
          expr
3980
4360
          }
3981
4361
        | table_ref LEFT opt_outer JOIN_SYM table_factor
3982
4362
          {
3983
 
            DRIZZLE_YYABORT_UNLESS($1 && $5);
 
4363
            MYSQL_YYABORT_UNLESS($1 && $5);
3984
4364
          }
3985
4365
          USING '(' using_list ')'
3986
4366
          { 
3990
4370
          }
3991
4371
        | table_ref NATURAL LEFT opt_outer JOIN_SYM table_factor
3992
4372
          {
3993
 
            DRIZZLE_YYABORT_UNLESS($1 && $6);
 
4373
            MYSQL_YYABORT_UNLESS($1 && $6);
3994
4374
            add_join_natural($1,$6,NULL,Select);
3995
4375
            $6->outer_join|=JOIN_TYPE_LEFT;
3996
4376
            $$=$6;
4000
4380
        | table_ref RIGHT opt_outer JOIN_SYM table_ref
4001
4381
          ON
4002
4382
          {
4003
 
            DRIZZLE_YYABORT_UNLESS($1 && $5);
 
4383
            MYSQL_YYABORT_UNLESS($1 && $5);
4004
4384
            /* Change the current name resolution context to a local context. */
4005
4385
            if (push_new_name_resolution_context(YYTHD, $1, $5))
4006
 
              DRIZZLE_YYABORT;
 
4386
              MYSQL_YYABORT;
4007
4387
            Select->parsing_place= IN_ON;
4008
4388
          }
4009
4389
          expr
4010
4390
          {
4011
4391
            LEX *lex= Lex;
4012
4392
            if (!($$= lex->current_select->convert_right_join()))
4013
 
              DRIZZLE_YYABORT;
 
4393
              MYSQL_YYABORT;
4014
4394
            add_join_on($$, $8);
4015
4395
            Lex->pop_context();
4016
4396
            Select->parsing_place= NO_MATTER;
4017
4397
          }
4018
4398
        | table_ref RIGHT opt_outer JOIN_SYM table_factor
4019
4399
          {
4020
 
            DRIZZLE_YYABORT_UNLESS($1 && $5);
 
4400
            MYSQL_YYABORT_UNLESS($1 && $5);
4021
4401
          }
4022
4402
          USING '(' using_list ')'
4023
4403
          {
4024
4404
            LEX *lex= Lex;
4025
4405
            if (!($$= lex->current_select->convert_right_join()))
4026
 
              DRIZZLE_YYABORT;
 
4406
              MYSQL_YYABORT;
4027
4407
            add_join_natural($$,$5,$9,Select);
4028
4408
          }
4029
4409
        | table_ref NATURAL RIGHT opt_outer JOIN_SYM table_factor
4030
4410
          {
4031
 
            DRIZZLE_YYABORT_UNLESS($1 && $6);
 
4411
            MYSQL_YYABORT_UNLESS($1 && $6);
4032
4412
            add_join_natural($6,$1,NULL,Select);
4033
4413
            LEX *lex= Lex;
4034
4414
            if (!($$= lex->current_select->convert_right_join()))
4035
 
              DRIZZLE_YYABORT;
 
4415
              MYSQL_YYABORT;
4036
4416
          }
4037
4417
        ;
4038
4418
 
4061
4441
                                                Select->get_table_join_options(),
4062
4442
                                                Lex->lock_option,
4063
4443
                                                Select->pop_index_hints())))
4064
 
              DRIZZLE_YYABORT;
 
4444
              MYSQL_YYABORT;
4065
4445
            Select->add_joined_table($$);
4066
4446
          }
4067
4447
        | select_derived_init get_select_lex select_derived2
4073
4453
              if (sel->set_braces(1))
4074
4454
              {
4075
4455
                my_parse_error(ER(ER_SYNTAX_ERROR));
4076
 
                DRIZZLE_YYABORT;
 
4456
                MYSQL_YYABORT;
4077
4457
              }
4078
4458
              /* select in braces, can't contain global parameters */
4079
4459
              if (sel->master_unit()->fake_select_lex)
4081
4461
                   sel->master_unit()->fake_select_lex;
4082
4462
            }
4083
4463
            if ($2->init_nested_join(lex->thd))
4084
 
              DRIZZLE_YYABORT;
 
4464
              MYSQL_YYABORT;
4085
4465
            $$= 0;
4086
4466
            /* incomplete derived tables return NULL, we must be
4087
4467
               nested in select_derived rule to be here. */
4130
4510
                                               new Table_ident(unit), $5, 0,
4131
4511
                                               TL_READ)))
4132
4512
 
4133
 
                DRIZZLE_YYABORT;
 
4513
                MYSQL_YYABORT;
4134
4514
              sel->add_joined_table($$);
4135
4515
              lex->pop_context();
4136
4516
            }
4138
4518
            {
4139
4519
              /* simple nested joins cannot have aliases or unions */
4140
4520
              my_parse_error(ER(ER_SYNTAX_ERROR));
4141
 
              DRIZZLE_YYABORT;
 
4521
              MYSQL_YYABORT;
4142
4522
            }
4143
4523
            else
4144
4524
              $$= $3;
4152
4532
          union_option
4153
4533
          {
4154
4534
            if (add_select_to_union_list(Lex, (bool)$3))
4155
 
              DRIZZLE_YYABORT;
 
4535
              MYSQL_YYABORT;
4156
4536
          }
4157
4537
          query_specification
4158
4538
          {
4174
4554
            if (lex->current_select->set_braces(0))
4175
4555
            {
4176
4556
              my_parse_error(ER(ER_SYNTAX_ERROR));
4177
 
              DRIZZLE_YYABORT;
 
4557
              MYSQL_YYABORT;
4178
4558
            }
4179
4559
            if (sel->linkage == UNION_TYPE &&
4180
4560
                sel->master_unit()->first_select()->braces)
4181
4561
            {
4182
4562
              my_parse_error(ER(ER_SYNTAX_ERROR));
4183
 
              DRIZZLE_YYABORT;
 
4563
              MYSQL_YYABORT;
4184
4564
            }
4185
4565
          }
4186
4566
        ;
4207
4587
          {
4208
4588
            LEX *lex= Lex;
4209
4589
            if ($1->init_nested_join(lex->thd))
4210
 
              DRIZZLE_YYABORT;
 
4590
              MYSQL_YYABORT;
4211
4591
          }
4212
4592
          derived_table_list
4213
4593
          {
4216
4596
               for derived tables, both must equal NULL */
4217
4597
 
4218
4598
            if (!($$= $1->end_nested_join(lex->thd)) && $3)
4219
 
              DRIZZLE_YYABORT;
 
4599
              MYSQL_YYABORT;
4220
4600
            if (!$3 && $$)
4221
4601
            {
4222
4602
              my_parse_error(ER(ER_SYNTAX_ERROR));
4223
 
              DRIZZLE_YYABORT;
 
4603
              MYSQL_YYABORT;
4224
4604
            }
4225
4605
          }
4226
4606
        ;
4233
4613
                lex->sql_command == (int)SQLCOM_PURGE)
4234
4614
            {
4235
4615
              my_parse_error(ER(ER_SYNTAX_ERROR));
4236
 
              DRIZZLE_YYABORT;
 
4616
              MYSQL_YYABORT;
4237
4617
            }
4238
4618
            if (lex->current_select->linkage == GLOBAL_OPTIONS_TYPE ||
4239
4619
                mysql_new_select(lex, 1))
4240
 
              DRIZZLE_YYABORT;
 
4620
              MYSQL_YYABORT;
4241
4621
            mysql_init_select(lex);
4242
4622
            lex->current_select->linkage= DERIVED_TABLE_TYPE;
4243
4623
            lex->current_select->parsing_place= SELECT_LIST;
4261
4641
            if (! lex->parsing_options.allows_derived)
4262
4642
            {
4263
4643
              my_error(ER_VIEW_SELECT_DERIVED, MYF(0));
4264
 
              DRIZZLE_YYABORT;
 
4644
              MYSQL_YYABORT;
4265
4645
            }
4266
4646
 
4267
4647
            SELECT_LEX *sel= lex->current_select;
4268
 
            TableList *embedding;
 
4648
            TABLE_LIST *embedding;
4269
4649
            if (!sel->embedding || sel->end_nested_join(lex->thd))
4270
4650
            {
4271
4651
              /* we are not in parentheses */
4272
4652
              my_parse_error(ER(ER_SYNTAX_ERROR));
4273
 
              DRIZZLE_YYABORT;
 
4653
              MYSQL_YYABORT;
4274
4654
            }
4275
4655
            embedding= Select->embedding;
4276
4656
            $$= embedding &&
4349
4729
          ident
4350
4730
          {
4351
4731
            if (!($$= new List<String>))
4352
 
              DRIZZLE_YYABORT;
 
4732
              MYSQL_YYABORT;
4353
4733
            $$->push_back(new (YYTHD->mem_root)
4354
4734
                              String((const char *) $1.str, $1.length,
4355
4735
                                      system_charset_info));
4410
4790
        ;
4411
4791
 
4412
4792
date_time_type:
4413
 
          DATE_SYM  {$$=DRIZZLE_TIMESTAMP_DATE;}
4414
 
        | TIME_SYM  {$$=DRIZZLE_TIMESTAMP_TIME;}
4415
 
        | DATETIME  {$$=DRIZZLE_TIMESTAMP_DATETIME;}
4416
 
        | TIMESTAMP {$$=DRIZZLE_TIMESTAMP_DATETIME;}
 
4793
          DATE_SYM  {$$=MYSQL_TIMESTAMP_DATE;}
 
4794
        | TIME_SYM  {$$=MYSQL_TIMESTAMP_TIME;}
 
4795
        | DATETIME  {$$=MYSQL_TIMESTAMP_DATETIME;}
 
4796
        | TIMESTAMP {$$=MYSQL_TIMESTAMP_DATETIME;}
4417
4797
        ;
4418
4798
 
4419
4799
table_alias:
4468
4848
opt_escape:
4469
4849
          ESCAPE_SYM simple_expr 
4470
4850
          {
4471
 
            Lex->escape_used= true;
 
4851
            Lex->escape_used= TRUE;
4472
4852
            $$= $2;
4473
4853
          }
4474
4854
        | /* empty */
4475
4855
          {
4476
 
            Lex->escape_used= false;
4477
 
            $$= new Item_string("\\", 1, &my_charset_utf8_general_ci);
 
4856
            Lex->escape_used= FALSE;
 
4857
            $$= new Item_string("\\", 1, &my_charset_latin1);
4478
4858
          }
4479
4859
        ;
4480
4860
 
4489
4869
 
4490
4870
group_list:
4491
4871
          group_list ',' order_ident order_dir
4492
 
          { if (add_group_to_list(YYTHD, $3,(bool) $4)) DRIZZLE_YYABORT; }
 
4872
          { if (add_group_to_list(YYTHD, $3,(bool) $4)) MYSQL_YYABORT; }
4493
4873
        | order_ident order_dir
4494
 
          { if (add_group_to_list(YYTHD, $1,(bool) $2)) DRIZZLE_YYABORT; }
 
4874
          { if (add_group_to_list(YYTHD, $1,(bool) $2)) MYSQL_YYABORT; }
4495
4875
        ;
4496
4876
 
4497
4877
olap_opt:
4498
4878
          /* empty */ {}
 
4879
        | WITH_CUBE_SYM
 
4880
          {
 
4881
            /*
 
4882
              'WITH CUBE' is reserved in the MySQL syntax, but not implemented,
 
4883
              and cause LALR(2) conflicts.
 
4884
              This syntax is not standard.
 
4885
              MySQL syntax: GROUP BY col1, col2, col3 WITH CUBE
 
4886
              SQL-2003: GROUP BY ... CUBE(col1, col2, col3)
 
4887
            */
 
4888
            LEX *lex=Lex;
 
4889
            if (lex->current_select->linkage == GLOBAL_OPTIONS_TYPE)
 
4890
            {
 
4891
              my_error(ER_WRONG_USAGE, MYF(0), "WITH CUBE",
 
4892
                       "global union parameters");
 
4893
              MYSQL_YYABORT;
 
4894
            }
 
4895
            lex->current_select->olap= CUBE_TYPE;
 
4896
            my_error(ER_NOT_SUPPORTED_YET, MYF(0), "CUBE");
 
4897
            MYSQL_YYABORT;
 
4898
          }
4499
4899
        | WITH_ROLLUP_SYM
4500
4900
          {
4501
4901
            /*
4510
4910
            {
4511
4911
              my_error(ER_WRONG_USAGE, MYF(0), "WITH ROLLUP",
4512
4912
                       "global union parameters");
4513
 
              DRIZZLE_YYABORT;
 
4913
              MYSQL_YYABORT;
4514
4914
            }
4515
4915
            lex->current_select->olap= ROLLUP_TYPE;
4516
4916
          }
4535
4935
            THD *thd= YYTHD;
4536
4936
            bool ascending= ($2 == 1) ? true : false;
4537
4937
            if (add_order_to_list(thd, $1, ascending))
4538
 
              DRIZZLE_YYABORT;
 
4938
              MYSQL_YYABORT;
4539
4939
          }
4540
4940
        ;
4541
4941
 
4560
4960
            {
4561
4961
              my_error(ER_WRONG_USAGE, MYF(0),
4562
4962
                       "CUBE/ROLLUP", "ORDER BY");
4563
 
              DRIZZLE_YYABORT;
 
4963
              MYSQL_YYABORT;
4564
4964
            }
4565
4965
            if (lex->sql_command != SQLCOM_ALTER_TABLE && !unit->fake_select_lex)
4566
4966
            {
4577
4977
                  (first_sl->order_list.elements || 
4578
4978
                   first_sl->select_limit) &&            
4579
4979
                  unit->add_fake_select_lex(lex->thd))
4580
 
                DRIZZLE_YYABORT;
 
4980
                MYSQL_YYABORT;
4581
4981
            }
4582
4982
          }
4583
4983
          order_list
4585
4985
 
4586
4986
order_list:
4587
4987
          order_list ',' order_ident order_dir
4588
 
          { if (add_order_to_list(YYTHD, $3,(bool) $4)) DRIZZLE_YYABORT; }
 
4988
          { if (add_order_to_list(YYTHD, $3,(bool) $4)) MYSQL_YYABORT; }
4589
4989
        | order_ident order_dir
4590
 
          { if (add_order_to_list(YYTHD, $1,(bool) $2)) DRIZZLE_YYABORT; }
 
4990
          { if (add_order_to_list(YYTHD, $1,(bool) $2)) MYSQL_YYABORT; }
4591
4991
        ;
4592
4992
 
4593
4993
order_dir:
4641
5041
        ;
4642
5042
 
4643
5043
limit_option:
4644
 
          ULONGLONG_NUM { $$= new Item_uint($1.str, $1.length); }
 
5044
        param_marker
 
5045
        {
 
5046
          ((Item_param *) $1)->limit_clause_param= TRUE;
 
5047
        }
 
5048
        | ULONGLONG_NUM { $$= new Item_uint($1.str, $1.length); }
4645
5049
        | LONG_NUM      { $$= new Item_uint($1.str, $1.length); }
4646
5050
        | NUM           { $$= new Item_uint($1.str, $1.length); }
4647
5051
        ;
4674
5078
        | HEX_NUM       { $$= (ulong) strtol($1.str, (char**) 0, 16); }
4675
5079
        | LONG_NUM      { int error; $$= (ulong) my_strtoll10($1.str, (char**) 0, &error); }
4676
5080
        | ULONGLONG_NUM { int error; $$= (ulong) my_strtoll10($1.str, (char**) 0, &error); }
4677
 
        | dec_num_error { DRIZZLE_YYABORT; }
 
5081
        | dec_num_error { MYSQL_YYABORT; }
4678
5082
        ;
4679
5083
 
4680
5084
ulonglong_num:
4681
 
          NUM           { int error; $$= (uint64_t) my_strtoll10($1.str, (char**) 0, &error); }
4682
 
        | ULONGLONG_NUM { int error; $$= (uint64_t) my_strtoll10($1.str, (char**) 0, &error); }
4683
 
        | LONG_NUM      { int error; $$= (uint64_t) my_strtoll10($1.str, (char**) 0, &error); }
4684
 
        | DECIMAL_NUM   { int error; $$= (uint64_t) my_strtoll10($1.str, (char**) 0, &error); }
4685
 
        | FLOAT_NUM     { int error; $$= (uint64_t) my_strtoll10($1.str, (char**) 0, &error); }
 
5085
          NUM           { int error; $$= (ulonglong) my_strtoll10($1.str, (char**) 0, &error); }
 
5086
        | ULONGLONG_NUM { int error; $$= (ulonglong) my_strtoll10($1.str, (char**) 0, &error); }
 
5087
        | LONG_NUM      { int error; $$= (ulonglong) my_strtoll10($1.str, (char**) 0, &error); }
 
5088
        | DECIMAL_NUM   { int error; $$= (ulonglong) my_strtoll10($1.str, (char**) 0, &error); }
 
5089
        | FLOAT_NUM     { int error; $$= (ulonglong) my_strtoll10($1.str, (char**) 0, &error); }
4686
5090
        ;
4687
5091
 
4688
5092
dec_num_error:
4704
5108
          {
4705
5109
            LEX *lex=Lex;
4706
5110
            if (!lex->describe && (!(lex->result= new select_dumpvar())))
4707
 
              DRIZZLE_YYABORT;
 
5111
              MYSQL_YYABORT;
4708
5112
          }
4709
5113
          select_var_list
4710
5114
          {}
4726
5130
                The parser won't create select_result instance only
4727
5131
                if it's an EXPLAIN.
4728
5132
              */
4729
 
              assert(lex->describe);
 
5133
              DBUG_ASSERT(lex->describe);
4730
5134
          }
4731
5135
        ;
4732
5136
 
4736
5140
            if (! Lex->parsing_options.allows_select_into)
4737
5141
            {
4738
5142
              my_error(ER_VIEW_SELECT_CLAUSE, MYF(0), "INTO");
4739
 
              DRIZZLE_YYABORT;
 
5143
              MYSQL_YYABORT;
4740
5144
            }
4741
5145
          }
4742
5146
          into_destination
4748
5152
            LEX *lex= Lex;
4749
5153
            if (!(lex->exchange= new sql_exchange($2.str, 0)) ||
4750
5154
                !(lex->result= new select_export(lex->exchange)))
4751
 
              DRIZZLE_YYABORT;
 
5155
              MYSQL_YYABORT;
4752
5156
          }
4753
5157
          opt_field_term opt_line_term
4754
5158
        | DUMPFILE TEXT_STRING_filesystem
4757
5161
            if (!lex->describe)
4758
5162
            {
4759
5163
              if (!(lex->exchange= new sql_exchange($2.str,1)))
4760
 
                DRIZZLE_YYABORT;
 
5164
                MYSQL_YYABORT;
4761
5165
              if (!(lex->result= new select_dump(lex->exchange)))
4762
 
                DRIZZLE_YYABORT;
 
5166
                MYSQL_YYABORT;
4763
5167
            }
4764
5168
          }
4765
5169
        | select_var_list_init
4771
5175
*/
4772
5176
 
4773
5177
drop:
4774
 
          DROP opt_temporary table_or_tables if_exists table_list
 
5178
          DROP opt_temporary table_or_tables if_exists table_list opt_restrict
4775
5179
          {
4776
5180
            LEX *lex=Lex;
4777
5181
            lex->sql_command = SQLCOM_DROP_TABLE;
4789
5193
                                                               $4.str));
4790
5194
            if (!lex->current_select->add_table_to_list(lex->thd, $6, NULL,
4791
5195
                                                        TL_OPTION_UPDATING))
4792
 
              DRIZZLE_YYABORT;
 
5196
              MYSQL_YYABORT;
4793
5197
          }
4794
5198
        | DROP DATABASE if_exists ident
4795
5199
          {
4807
5211
          table_ident
4808
5212
          {
4809
5213
            if (!Select->add_table_to_list(YYTHD, $1, NULL, TL_OPTION_UPDATING))
4810
 
              DRIZZLE_YYABORT;
 
5214
              MYSQL_YYABORT;
4811
5215
          }
4812
5216
        ;
4813
5217
 
4822
5226
            if (!Select->add_table_to_list(YYTHD, $1, NULL,
4823
5227
                                           TL_OPTION_UPDATING | TL_OPTION_ALIAS,
4824
5228
                                           Lex->lock_option ))
4825
 
              DRIZZLE_YYABORT;
 
5229
              MYSQL_YYABORT;
4826
5230
          }
4827
5231
        ;
4828
5232
 
4914
5318
            LEX *lex=Lex;
4915
5319
            if (!(lex->insert_list = new List_item) ||
4916
5320
                lex->many_values.push_back(lex->insert_list))
4917
 
              DRIZZLE_YYABORT;
 
5321
              MYSQL_YYABORT;
4918
5322
          }
4919
5323
          ident_eq_list
4920
5324
        ;
4951
5355
            LEX *lex=Lex;
4952
5356
            if (lex->field_list.push_back($1) ||
4953
5357
                lex->insert_list->push_back($3))
4954
 
              DRIZZLE_YYABORT;
 
5358
              MYSQL_YYABORT;
4955
5359
          }
4956
5360
        ;
4957
5361
 
4969
5373
          '('
4970
5374
          {
4971
5375
              if (!(Lex->insert_list = new List_item))
4972
 
                DRIZZLE_YYABORT;
 
5376
                MYSQL_YYABORT;
4973
5377
          }
4974
5378
          opt_values ')'
4975
5379
          {
4976
5380
            LEX *lex=Lex;
4977
5381
            if (lex->many_values.push_back(lex->insert_list))
4978
 
              DRIZZLE_YYABORT;
 
5382
              MYSQL_YYABORT;
4979
5383
          }
4980
5384
        ;
4981
5385
 
4988
5392
          values ','  expr_or_default
4989
5393
          {
4990
5394
            if (Lex->insert_list->push_back($3))
4991
 
              DRIZZLE_YYABORT;
 
5395
              MYSQL_YYABORT;
4992
5396
          }
4993
5397
        | expr_or_default
4994
5398
          {
4995
5399
            if (Lex->insert_list->push_back($1))
4996
 
              DRIZZLE_YYABORT;
 
5400
              MYSQL_YYABORT;
4997
5401
          }
4998
5402
        ;
4999
5403
 
5030
5434
              /* it is single table update and it is update of derived table */
5031
5435
              my_error(ER_NON_UPDATABLE_TABLE, MYF(0),
5032
5436
                       lex->select_lex.get_table_list()->alias, "UPDATE");
5033
 
              DRIZZLE_YYABORT;
 
5437
              MYSQL_YYABORT;
5034
5438
            }
5035
5439
            /*
5036
5440
              In case of multi-update setting write lock for all tables may
5051
5455
          simple_ident_nospvar equal expr_or_default
5052
5456
          {
5053
5457
            if (add_item_to_list(YYTHD, $1) || add_value_to_list(YYTHD, $3))
5054
 
              DRIZZLE_YYABORT;
 
5458
              MYSQL_YYABORT;
5055
5459
          }
5056
5460
        ;
5057
5461
 
5066
5470
          LEX *lex= Lex;
5067
5471
          if (lex->update_list.push_back($1) || 
5068
5472
              lex->value_list.push_back($3))
5069
 
              DRIZZLE_YYABORT;
 
5473
              MYSQL_YYABORT;
5070
5474
          }
5071
5475
        ;
5072
5476
 
5095
5499
          {
5096
5500
            if (!Select->add_table_to_list(YYTHD, $2, NULL, TL_OPTION_UPDATING,
5097
5501
                                           Lex->lock_option))
5098
 
              DRIZZLE_YYABORT;
 
5502
              MYSQL_YYABORT;
5099
5503
          }
5100
5504
          where_clause opt_order_clause
5101
5505
          delete_limit_clause {}
5104
5508
          FROM join_table_list where_clause
5105
5509
          {
5106
5510
            if (multi_delete_set_locks_and_link_aux_tables(Lex))
5107
 
              DRIZZLE_YYABORT;
 
5511
              MYSQL_YYABORT;
5108
5512
          }
5109
5513
        | FROM table_alias_ref_list
5110
5514
          { mysql_init_multi_delete(Lex); }
5111
5515
          USING join_table_list where_clause
5112
5516
          {
5113
5517
            if (multi_delete_set_locks_and_link_aux_tables(Lex))
5114
 
              DRIZZLE_YYABORT;
 
5518
              MYSQL_YYABORT;
5115
5519
          }
5116
5520
        ;
5117
5521
 
5127
5531
                                           NULL,
5128
5532
                                           TL_OPTION_UPDATING | TL_OPTION_ALIAS,
5129
5533
                                           Lex->lock_option))
5130
 
              DRIZZLE_YYABORT;
 
5534
              MYSQL_YYABORT;
5131
5535
          }
5132
5536
        | ident '.' ident opt_wild
5133
5537
          {
5136
5540
                                           NULL,
5137
5541
                                           TL_OPTION_UPDATING | TL_OPTION_ALIAS,
5138
5542
                                           Lex->lock_option))
5139
 
              DRIZZLE_YYABORT;
 
5543
              MYSQL_YYABORT;
5140
5544
          }
5141
5545
        ;
5142
5546
 
5181
5585
            lex->lock_option= TL_READ;
5182
5586
            mysql_init_select(lex);
5183
5587
            lex->current_select->parsing_place= SELECT_LIST;
5184
 
            memset(&lex->create_info, 0, sizeof(lex->create_info));
 
5588
            bzero((char*) &lex->create_info,sizeof(lex->create_info));
5185
5589
          }
5186
5590
          show_param
5187
5591
          {}
5188
5592
        ;
5189
5593
 
5190
5594
show_param:
5191
 
           DATABASES show_wild
 
5595
           DATABASES wild_and_where
5192
5596
           {
5193
5597
             LEX *lex= Lex;
5194
5598
             lex->sql_command= SQLCOM_SHOW_DATABASES;
5195
5599
             if (prepare_schema_table(YYTHD, lex, 0, SCH_SCHEMATA))
5196
 
               DRIZZLE_YYABORT;
 
5600
               MYSQL_YYABORT;
5197
5601
           }
5198
 
         | opt_full TABLES opt_db show_wild
 
5602
         | opt_full TABLES opt_db wild_and_where
5199
5603
           {
5200
5604
             LEX *lex= Lex;
5201
5605
             lex->sql_command= SQLCOM_SHOW_TABLES;
5202
5606
             lex->select_lex.db= $3;
5203
5607
             if (prepare_schema_table(YYTHD, lex, 0, SCH_TABLE_NAMES))
5204
 
               DRIZZLE_YYABORT;
 
5608
               MYSQL_YYABORT;
5205
5609
           }
5206
 
         | TABLE_SYM STATUS_SYM opt_db show_wild
 
5610
         | TABLE_SYM STATUS_SYM opt_db wild_and_where
5207
5611
           {
5208
5612
             LEX *lex= Lex;
5209
5613
             lex->sql_command= SQLCOM_SHOW_TABLE_STATUS;
5210
5614
             lex->select_lex.db= $3;
5211
5615
             if (prepare_schema_table(YYTHD, lex, 0, SCH_TABLES))
5212
 
               DRIZZLE_YYABORT;
 
5616
               MYSQL_YYABORT;
5213
5617
           }
5214
 
        | OPEN_SYM TABLES opt_db show_wild
 
5618
        | OPEN_SYM TABLES opt_db wild_and_where
5215
5619
          {
5216
5620
            LEX *lex= Lex;
5217
5621
            lex->sql_command= SQLCOM_SHOW_OPEN_TABLES;
5218
5622
            lex->select_lex.db= $3;
5219
5623
            if (prepare_schema_table(YYTHD, lex, 0, SCH_OPEN_TABLES))
5220
 
              DRIZZLE_YYABORT;
 
5624
              MYSQL_YYABORT;
5221
5625
          }
5222
5626
        | ENGINE_SYM known_storage_engines STATUS_SYM /* This should either go... well it should go */
5223
5627
          { 
5224
5628
            Lex->create_info.db_type= $2; 
5225
5629
            Lex->sql_command= SQLCOM_SHOW_ENGINE_STATUS;
5226
5630
          }
5227
 
        | opt_full COLUMNS from_or_in table_ident opt_db show_wild
 
5631
        | opt_full COLUMNS from_or_in table_ident opt_db wild_and_where
5228
5632
          {
5229
5633
            LEX *lex= Lex;
5230
5634
            lex->sql_command= SQLCOM_SHOW_FIELDS;
5231
5635
            if ($5)
5232
5636
              $4->change_db($5);
5233
5637
            if (prepare_schema_table(YYTHD, lex, $4, SCH_COLUMNS))
5234
 
              DRIZZLE_YYABORT;
 
5638
              MYSQL_YYABORT;
5235
5639
          }
5236
5640
        | master_or_binary LOGS_SYM
5237
5641
          {
5238
5642
            Lex->sql_command = SQLCOM_SHOW_BINLOGS;
5239
5643
          }
 
5644
        | SLAVE HOSTS_SYM
 
5645
          {
 
5646
            Lex->sql_command = SQLCOM_SHOW_SLAVE_HOSTS;
 
5647
          }
 
5648
        | BINLOG_SYM EVENTS_SYM binlog_in binlog_from
 
5649
          {
 
5650
            LEX *lex= Lex;
 
5651
            lex->sql_command= SQLCOM_SHOW_BINLOG_EVENTS;
 
5652
          } opt_limit_clause_init
5240
5653
        | keys_or_index from_or_in table_ident opt_db where_clause
5241
5654
          {
5242
5655
            LEX *lex= Lex;
5244
5657
            if ($4)
5245
5658
              $3->change_db($4);
5246
5659
            if (prepare_schema_table(YYTHD, lex, $3, SCH_STATISTICS))
5247
 
              DRIZZLE_YYABORT;
 
5660
              MYSQL_YYABORT;
5248
5661
          }
5249
5662
        | COUNT_SYM '(' '*' ')' WARNINGS
5250
5663
          { (void) create_select_for_variable("warning_count"); }
5254
5667
          { Lex->sql_command = SQLCOM_SHOW_WARNS;}
5255
5668
        | ERRORS opt_limit_clause_init
5256
5669
          { Lex->sql_command = SQLCOM_SHOW_ERRORS;}
5257
 
        | opt_var_type STATUS_SYM show_wild
 
5670
        | opt_var_type STATUS_SYM wild_and_where
5258
5671
          {
5259
5672
            LEX *lex= Lex;
5260
5673
            lex->sql_command= SQLCOM_SHOW_STATUS;
5261
5674
            lex->option_type= $1;
5262
5675
            if (prepare_schema_table(YYTHD, lex, 0, SCH_STATUS))
5263
 
              DRIZZLE_YYABORT;
 
5676
              MYSQL_YYABORT;
5264
5677
          }
5265
5678
        | opt_full PROCESSLIST_SYM
5266
5679
          { Lex->sql_command= SQLCOM_SHOW_PROCESSLIST;}
5267
 
        | opt_var_type  VARIABLES show_wild
 
5680
        | opt_var_type  VARIABLES wild_and_where
5268
5681
          {
5269
5682
            LEX *lex= Lex;
5270
5683
            lex->sql_command= SQLCOM_SHOW_VARIABLES;
5271
5684
            lex->option_type= $1;
5272
5685
            if (prepare_schema_table(YYTHD, lex, 0, SCH_VARIABLES))
5273
 
              DRIZZLE_YYABORT;
 
5686
              MYSQL_YYABORT;
 
5687
          }
 
5688
        | charset wild_and_where
 
5689
          {
 
5690
            LEX *lex= Lex;
 
5691
            lex->sql_command= SQLCOM_SHOW_CHARSETS;
 
5692
            if (prepare_schema_table(YYTHD, lex, 0, SCH_CHARSETS))
 
5693
              MYSQL_YYABORT;
 
5694
          }
 
5695
        | COLLATION_SYM wild_and_where
 
5696
          {
 
5697
            LEX *lex= Lex;
 
5698
            lex->sql_command= SQLCOM_SHOW_COLLATIONS;
 
5699
            if (prepare_schema_table(YYTHD, lex, 0, SCH_COLLATIONS))
 
5700
              MYSQL_YYABORT;
5274
5701
          }
5275
5702
        | CREATE DATABASE opt_if_not_exists ident
5276
5703
          {
5283
5710
            LEX *lex= Lex;
5284
5711
            lex->sql_command = SQLCOM_SHOW_CREATE;
5285
5712
            if (!lex->select_lex.add_table_to_list(YYTHD, $3, NULL,0))
5286
 
              DRIZZLE_YYABORT;
 
5713
              MYSQL_YYABORT;
 
5714
            lex->create_info.default_storage_media= HA_SM_DEFAULT;
5287
5715
          }
5288
5716
        | MASTER_SYM STATUS_SYM
5289
5717
          {
5314
5742
        | IN_SYM
5315
5743
        ;
5316
5744
 
5317
 
show_wild:
 
5745
binlog_in:
 
5746
          /* empty */            { Lex->mi.log_file_name = 0; }
 
5747
        | IN_SYM TEXT_STRING_sys { Lex->mi.log_file_name = $2.str; }
 
5748
        ;
 
5749
 
 
5750
binlog_from:
 
5751
          /* empty */        { Lex->mi.pos = 4; /* skip magic number */ }
 
5752
        | FROM ulonglong_num { Lex->mi.pos = $2; }
 
5753
        ;
 
5754
 
 
5755
wild_and_where:
5318
5756
          /* empty */
5319
5757
        | LIKE TEXT_STRING_sys
5320
5758
          {
5321
5759
            Lex->wild= new (YYTHD->mem_root) String($2.str, $2.length,
5322
5760
                                                    system_charset_info);
5323
5761
          }
 
5762
        | WHERE expr
 
5763
          {
 
5764
            Select->where= $2;
 
5765
            if ($2)
 
5766
              $2->top_level_item();
 
5767
          }
5324
5768
        ;
5325
5769
 
5326
5770
/* A Oracle compatible synonym for show */
5335
5779
            lex->select_lex.db= 0;
5336
5780
            lex->verbose= 0;
5337
5781
            if (prepare_schema_table(YYTHD, lex, $2, SCH_COLUMNS))
5338
 
              DRIZZLE_YYABORT;
 
5782
              MYSQL_YYABORT;
5339
5783
          }
5340
5784
          opt_describe_column {}
5341
5785
        | describe_command opt_extended_describe
5372
5816
/* flush things */
5373
5817
 
5374
5818
flush:
5375
 
          FLUSH_SYM
 
5819
          FLUSH_SYM opt_no_write_to_binlog
5376
5820
          {
5377
5821
            LEX *lex=Lex;
5378
5822
            lex->sql_command= SQLCOM_FLUSH;
5379
5823
            lex->type= 0;
 
5824
            lex->no_write_to_binlog= $2;
5380
5825
          }
5381
5826
          flush_options
5382
5827
          {}
5405
5850
          { Lex->type|= REFRESH_SLAVE; }
5406
5851
        | MASTER_SYM
5407
5852
          { Lex->type|= REFRESH_MASTER; }
 
5853
        | DES_KEY_FILE
 
5854
          { Lex->type|= REFRESH_DES_KEY_FILE; }
5408
5855
        | RESOURCES
5409
5856
          { Lex->type|= REFRESH_USER_RESOURCES; }
5410
5857
        ;
5496
5943
/* import, export of files */
5497
5944
 
5498
5945
load:
5499
 
          LOAD data_file
 
5946
          LOAD data_or_xml
5500
5947
          {
5501
5948
            THD *thd= YYTHD;
5502
5949
            LEX *lex= thd->lex;
5513
5960
            lex->duplicates= DUP_ERROR;
5514
5961
            lex->ignore= 0;
5515
5962
            if (!(lex->exchange= new sql_exchange($7.str, 0, $2)))
5516
 
              DRIZZLE_YYABORT;
 
5963
              MYSQL_YYABORT;
5517
5964
          }
5518
5965
          opt_duplicate INTO
5519
5966
          {
5527
5974
            LEX *lex=Lex;
5528
5975
            if (!Select->add_table_to_list(YYTHD, $13, NULL, TL_OPTION_UPDATING,
5529
5976
                                           lex->lock_option))
5530
 
              DRIZZLE_YYABORT;
 
5977
              MYSQL_YYABORT;
5531
5978
            lex->field_list.empty();
5532
5979
            lex->update_list.empty();
5533
5980
            lex->value_list.empty();
5534
5981
          }
 
5982
          opt_load_data_charset
 
5983
          { Lex->exchange->cs= $15; }
 
5984
          opt_xml_rows_identified_by
5535
5985
          opt_field_term opt_line_term opt_ignore_lines opt_field_or_var_spec
5536
5986
          opt_load_data_set_spec
5537
5987
          {}
5538
5988
        ;
5539
5989
 
5540
 
data_file:
5541
 
        DATA_SYM  { $$= FILETYPE_CSV; };
 
5990
data_or_xml:
 
5991
        DATA_SYM  { $$= FILETYPE_CSV; }
 
5992
        | XML_SYM { $$= FILETYPE_XML; }
 
5993
        ;
5542
5994
 
5543
5995
opt_local:
5544
5996
          /* empty */ { $$=0;}
5573
6025
field_term:
5574
6026
          TERMINATED BY text_string 
5575
6027
          {
5576
 
            assert(Lex->exchange != 0);
 
6028
            DBUG_ASSERT(Lex->exchange != 0);
5577
6029
            Lex->exchange->field_term= $3;
5578
6030
          }
5579
6031
        | OPTIONALLY ENCLOSED BY text_string
5580
6032
          {
5581
6033
            LEX *lex= Lex;
5582
 
            assert(lex->exchange != 0);
 
6034
            DBUG_ASSERT(lex->exchange != 0);
5583
6035
            lex->exchange->enclosed= $4;
5584
6036
            lex->exchange->opt_enclosed= 1;
5585
6037
          }
5586
6038
        | ENCLOSED BY text_string
5587
6039
          {
5588
 
            assert(Lex->exchange != 0);
 
6040
            DBUG_ASSERT(Lex->exchange != 0);
5589
6041
            Lex->exchange->enclosed= $3;
5590
6042
          }
5591
6043
        | ESCAPED BY text_string
5592
6044
          {
5593
 
            assert(Lex->exchange != 0);
 
6045
            DBUG_ASSERT(Lex->exchange != 0);
5594
6046
            Lex->exchange->escaped= $3;
5595
6047
          }
5596
6048
        ;
5608
6060
line_term:
5609
6061
          TERMINATED BY text_string
5610
6062
          {
5611
 
            assert(Lex->exchange != 0);
 
6063
            DBUG_ASSERT(Lex->exchange != 0);
5612
6064
            Lex->exchange->line_term= $3;
5613
6065
          }
5614
6066
        | STARTING BY text_string
5615
6067
          {
5616
 
            assert(Lex->exchange != 0);
 
6068
            DBUG_ASSERT(Lex->exchange != 0);
5617
6069
            Lex->exchange->line_start= $3;
5618
6070
          }
5619
6071
        ;
5620
6072
 
 
6073
opt_xml_rows_identified_by:
 
6074
        /* empty */ { }
 
6075
        | ROWS_SYM IDENTIFIED_SYM BY text_string
 
6076
          { Lex->exchange->line_term = $4; };
 
6077
 
5621
6078
opt_ignore_lines:
5622
6079
          /* empty */
5623
6080
        | IGNORE_SYM NUM lines_or_rows
5624
6081
          {
5625
 
            assert(Lex->exchange != 0);
 
6082
            DBUG_ASSERT(Lex->exchange != 0);
5626
6083
            Lex->exchange->skip_lines= atol($2.str);
5627
6084
          }
5628
6085
        ;
5663
6120
          {
5664
6121
            LEX_STRING tmp;
5665
6122
            THD *thd= YYTHD;
5666
 
            const CHARSET_INFO * const cs_con= thd->variables.collation_connection;
5667
 
            const CHARSET_INFO * const cs_cli= thd->variables.character_set_client;
5668
 
            uint32_t repertoire= thd->lex->text_string_is_7bit &&
 
6123
            CHARSET_INFO *cs_con= thd->variables.collation_connection;
 
6124
            CHARSET_INFO *cs_cli= thd->variables.character_set_client;
 
6125
            uint repertoire= thd->lex->text_string_is_7bit &&
5669
6126
                             my_charset_is_ascii_based(cs_cli) ?
5670
6127
                             MY_REPERTOIRE_ASCII : MY_REPERTOIRE_UNICODE30;
5671
6128
            if (thd->charset_is_collation_connection ||
5677
6134
            $$= new Item_string(tmp.str, tmp.length, cs_con,
5678
6135
                                DERIVATION_COERCIBLE, repertoire);
5679
6136
          }
 
6137
        | NCHAR_STRING
 
6138
          {
 
6139
            uint repertoire= Lex->text_string_is_7bit ?
 
6140
                             MY_REPERTOIRE_ASCII : MY_REPERTOIRE_UNICODE30;
 
6141
            DBUG_ASSERT(my_charset_is_ascii_based(national_charset_info));
 
6142
            $$= new Item_string($1.str, $1.length, national_charset_info,
 
6143
                                DERIVATION_COERCIBLE, repertoire);
 
6144
          }
5680
6145
        | UNDERSCORE_CHARSET TEXT_STRING
5681
6146
          {
5682
6147
            Item_string *str= new Item_string($2.str, $2.length, $1);
5683
6148
            str->set_repertoire_from_value();
5684
 
            str->set_cs_specified(true);
 
6149
            str->set_cs_specified(TRUE);
5685
6150
 
5686
6151
            $$= str;
5687
6152
          }
5695
6160
                 If the string has been pure ASCII so far,
5696
6161
                 check the new part.
5697
6162
              */
5698
 
              const CHARSET_INFO * const cs= YYTHD->variables.collation_connection;
 
6163
              CHARSET_INFO *cs= YYTHD->variables.collation_connection;
5699
6164
              item->collation.repertoire|= my_string_repertoire(cs,
5700
6165
                                                                $2.str,
5701
6166
                                                                $2.length);
5733
6198
          }
5734
6199
        ;
5735
6200
 
 
6201
param_marker:
 
6202
          PARAM_MARKER
 
6203
          {
 
6204
            THD *thd= YYTHD;
 
6205
            LEX *lex= thd->lex;
 
6206
            Lex_input_stream *lip= thd->m_lip;
 
6207
            Item_param *item;
 
6208
            if (! lex->parsing_options.allows_variable)
 
6209
            {
 
6210
              my_error(ER_VIEW_SELECT_VARIABLE, MYF(0));
 
6211
              MYSQL_YYABORT;
 
6212
            }
 
6213
            item= new Item_param((uint) (lip->get_tok_start() - thd->query));
 
6214
            if (!($$= item) || lex->param_list.push_back(item))
 
6215
            {
 
6216
              my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0));
 
6217
              MYSQL_YYABORT;
 
6218
            }
 
6219
          }
 
6220
        ;
 
6221
 
5736
6222
signed_literal:
5737
6223
          literal { $$ = $1; }
5738
6224
        | '+' NUM_literal { $$ = $2; }
5772
6258
                              str ? str->length() : 0,
5773
6259
                              $1);
5774
6260
            if (!item_str ||
5775
 
                !item_str->check_well_formed_result(&item_str->str_value, true))
 
6261
                !item_str->check_well_formed_result(&item_str->str_value, TRUE))
5776
6262
            {
5777
 
              DRIZZLE_YYABORT;
 
6263
              MYSQL_YYABORT;
5778
6264
            }
5779
6265
 
5780
6266
            item_str->set_repertoire_from_value();
5781
 
            item_str->set_cs_specified(true);
 
6267
            item_str->set_cs_specified(TRUE);
5782
6268
 
5783
6269
            $$= item_str;
5784
6270
          }
5799
6285
                              str ? str->length() : 0,
5800
6286
                              $1);
5801
6287
            if (!item_str ||
5802
 
                !item_str->check_well_formed_result(&item_str->str_value, true))
 
6288
                !item_str->check_well_formed_result(&item_str->str_value, TRUE))
5803
6289
            {
5804
 
              DRIZZLE_YYABORT;
 
6290
              MYSQL_YYABORT;
5805
6291
            }
5806
6292
 
5807
 
            item_str->set_cs_specified(true);
 
6293
            item_str->set_cs_specified(TRUE);
5808
6294
 
5809
6295
            $$= item_str;
5810
6296
          }
5817
6303
          NUM
5818
6304
          {
5819
6305
            int error;
5820
 
            $$ = new Item_int($1.str, (int64_t) my_strtoll10($1.str, NULL, &error), $1.length);
 
6306
            $$ = new Item_int($1.str, (longlong) my_strtoll10($1.str, NULL, &error), $1.length);
5821
6307
          }
5822
6308
        | LONG_NUM
5823
6309
          {
5824
6310
            int error;
5825
 
            $$ = new Item_int($1.str, (int64_t) my_strtoll10($1.str, NULL, &error), $1.length);
 
6311
            $$ = new Item_int($1.str, (longlong) my_strtoll10($1.str, NULL, &error), $1.length);
5826
6312
          }
5827
6313
        | ULONGLONG_NUM
5828
6314
          { $$ = new Item_uint($1.str, $1.length); }
5831
6317
            $$= new Item_decimal($1.str, $1.length, YYTHD->charset());
5832
6318
            if (YYTHD->is_error())
5833
6319
            {
5834
 
              DRIZZLE_YYABORT;
 
6320
              MYSQL_YYABORT;
5835
6321
            }
5836
6322
          }
5837
6323
        | FLOAT_NUM
5839
6325
            $$ = new Item_float($1.str, $1.length);
5840
6326
            if (YYTHD->is_error())
5841
6327
            {
5842
 
              DRIZZLE_YYABORT;
 
6328
              MYSQL_YYABORT;
5843
6329
            }
5844
6330
          }
5845
6331
        ;
5857
6343
          ident '.' '*'
5858
6344
          {
5859
6345
            SELECT_LEX *sel= Select;
5860
 
            $$ = new Item_field(Lex->current_context(), NULL, $1.str, "*");
 
6346
            $$ = new Item_field(Lex->current_context(), NullS, $1.str, "*");
5861
6347
            sel->with_wild++;
5862
6348
          }
5863
6349
        | ident '.' ident '.' '*'
5864
6350
          {
5865
6351
            SELECT_LEX *sel= Select;
5866
6352
            $$ = new Item_field(Lex->current_context(), (YYTHD->client_capabilities &
5867
 
                                CLIENT_NO_SCHEMA ? NULL : $1.str),
 
6353
                                CLIENT_NO_SCHEMA ? NullS : $1.str),
5868
6354
                                $3.str,"*");
5869
6355
            sel->with_wild++;
5870
6356
          }
5881
6367
              SELECT_LEX *sel=Select;
5882
6368
              $$= (sel->parsing_place != IN_HAVING ||
5883
6369
                  sel->get_in_sum_expr() > 0) ?
5884
 
                  (Item*) new Item_field(Lex->current_context(),
5885
 
                                         (const char *)NULL, NULL, $1.str) :
5886
 
                  (Item*) new Item_ref(Lex->current_context(),
5887
 
                                       (const char *)NULL, NULL, $1.str);
 
6370
                  (Item*) new Item_field(Lex->current_context(), NullS, NullS, $1.str) :
 
6371
                  (Item*) new Item_ref(Lex->current_context(), NullS, NullS, $1.str);
5888
6372
            }
5889
6373
          }
5890
6374
        | simple_ident_q { $$= $1; }
5896
6380
            SELECT_LEX *sel=Select;
5897
6381
            $$= (sel->parsing_place != IN_HAVING ||
5898
6382
                sel->get_in_sum_expr() > 0) ?
5899
 
                (Item*) new Item_field(Lex->current_context(),
5900
 
                                       (const char *)NULL, NULL, $1.str) :
5901
 
                (Item*) new Item_ref(Lex->current_context(),
5902
 
                                     (const char *)NULL, NULL, $1.str);
 
6383
                (Item*) new Item_field(Lex->current_context(), NullS, NullS, $1.str) :
 
6384
                (Item*) new Item_ref(Lex->current_context(), NullS, NullS, $1.str);
5903
6385
          }
5904
6386
        | simple_ident_q { $$= $1; }
5905
6387
        ;
5919
6401
              }
5920
6402
              $$= (sel->parsing_place != IN_HAVING ||
5921
6403
                  sel->get_in_sum_expr() > 0) ?
5922
 
                  (Item*) new Item_field(Lex->current_context(),
5923
 
                                         (const char *)NULL, $1.str, $3.str) :
5924
 
                  (Item*) new Item_ref(Lex->current_context(),
5925
 
                                       (const char *)NULL, $1.str, $3.str);
 
6404
                  (Item*) new Item_field(Lex->current_context(), NullS, $1.str, $3.str) :
 
6405
                  (Item*) new Item_ref(Lex->current_context(), NullS, $1.str, $3.str);
5926
6406
            }
5927
6407
          }
5928
6408
        | '.' ident '.' ident
5937
6417
            }
5938
6418
            $$= (sel->parsing_place != IN_HAVING ||
5939
6419
                sel->get_in_sum_expr() > 0) ?
5940
 
                (Item*) new Item_field(Lex->current_context(), NULL, $2.str, $4.str) :
5941
 
                (Item*) new Item_ref(Lex->current_context(),
5942
 
                                     (const char *)NULL, $2.str, $4.str);
 
6420
                (Item*) new Item_field(Lex->current_context(), NullS, $2.str, $4.str) :
 
6421
                (Item*) new Item_ref(Lex->current_context(), NullS, $2.str, $4.str);
5943
6422
          }
5944
6423
        | ident '.' ident '.' ident
5945
6424
          {
5955
6434
                sel->get_in_sum_expr() > 0) ?
5956
6435
                (Item*) new Item_field(Lex->current_context(),
5957
6436
                                       (YYTHD->client_capabilities &
5958
 
                                       CLIENT_NO_SCHEMA ? NULL : $1.str),
 
6437
                                       CLIENT_NO_SCHEMA ? NullS : $1.str),
5959
6438
                                       $3.str, $5.str) :
5960
6439
                (Item*) new Item_ref(Lex->current_context(),
5961
6440
                                     (YYTHD->client_capabilities &
5962
 
                                     CLIENT_NO_SCHEMA ? NULL : $1.str),
 
6441
                                     CLIENT_NO_SCHEMA ? NullS : $1.str),
5963
6442
                                     $3.str, $5.str);
5964
6443
          }
5965
6444
        ;
5968
6447
          ident { $$=$1;}
5969
6448
        | ident '.' ident '.' ident
5970
6449
          {
5971
 
            TableList *table= (TableList*) Select->table_list.first;
 
6450
            TABLE_LIST *table= (TABLE_LIST*) Select->table_list.first;
5972
6451
            if (my_strcasecmp(table_alias_charset, $1.str, table->db))
5973
6452
            {
5974
6453
              my_error(ER_WRONG_DB_NAME, MYF(0), $1.str);
5975
 
              DRIZZLE_YYABORT;
 
6454
              MYSQL_YYABORT;
5976
6455
            }
5977
6456
            if (my_strcasecmp(table_alias_charset, $3.str,
5978
6457
                              table->table_name))
5979
6458
            {
5980
6459
              my_error(ER_WRONG_TABLE_NAME, MYF(0), $3.str);
5981
 
              DRIZZLE_YYABORT;
 
6460
              MYSQL_YYABORT;
5982
6461
            }
5983
6462
            $$=$5;
5984
6463
          }
5985
6464
        | ident '.' ident
5986
6465
          {
5987
 
            TableList *table= (TableList*) Select->table_list.first;
 
6466
            TABLE_LIST *table= (TABLE_LIST*) Select->table_list.first;
5988
6467
            if (my_strcasecmp(table_alias_charset, $1.str, table->alias))
5989
6468
            {
5990
6469
              my_error(ER_WRONG_TABLE_NAME, MYF(0), $1.str);
5991
 
              DRIZZLE_YYABORT;
 
6470
              MYSQL_YYABORT;
5992
6471
            }
5993
6472
            $$=$3;
5994
6473
          }
6009
6488
 
6010
6489
            if (thd->charset_is_system_charset)
6011
6490
            {
6012
 
              const CHARSET_INFO * const cs= system_charset_info;
 
6491
              CHARSET_INFO *cs= system_charset_info;
6013
6492
              int dummy_error;
6014
 
              uint32_t wlen= cs->cset->well_formed_len(cs, $1.str,
 
6493
              uint wlen= cs->cset->well_formed_len(cs, $1.str,
6015
6494
                                                   $1.str+$1.length,
6016
6495
                                                   $1.length, &dummy_error);
6017
6496
              if (wlen < $1.length)
6018
6497
              {
6019
6498
                my_error(ER_INVALID_CHARACTER_STRING, MYF(0),
6020
6499
                         cs->csname, $1.str + wlen);
6021
 
                DRIZZLE_YYABORT;
 
6500
                MYSQL_YYABORT;
6022
6501
              }
6023
6502
              $$= $1;
6024
6503
            }
6113
6592
        | SAVEPOINT_SYM         {}
6114
6593
        | SECURITY_SYM          {}
6115
6594
        | SERVER_SYM            {}
 
6595
        | SIGNED_SYM            {}
6116
6596
        | SOCKET_SYM            {}
6117
6597
        | SLAVE                 {}
6118
6598
        | SONAME_SYM            {}
6119
6599
        | START_SYM             {}
6120
6600
        | STOP_SYM              {}
6121
6601
        | TRUNCATE_SYM          {}
 
6602
        | UNICODE_SYM           {}
 
6603
        | UNINSTALL_SYM         {}
 
6604
        | WRAPPER_SYM           {}
6122
6605
        | UPGRADE_SYM           {}
6123
6606
        ;
6124
6607
 
6143
6626
        | AVG_SYM                  {}
6144
6627
        | BINLOG_SYM               {}
6145
6628
        | BIT_SYM                  {}
6146
 
        | BLOCK_SIZE_SYM           {}
6147
6629
        | BLOCK_SYM                {}
6148
6630
        | BOOL_SYM                 {}
6149
6631
        | BOOLEAN_SYM              {}
6151
6633
        | CASCADED                 {}
6152
6634
        | CHAIN_SYM                {}
6153
6635
        | CHANGED                  {}
 
6636
        | CIPHER_SYM               {}
 
6637
        | CLIENT_SYM               {}
6154
6638
        | COALESCE                 {}
 
6639
        | CODE_SYM                 {}
6155
6640
        | COLLATION_SYM            {}
6156
6641
        | COLUMN_FORMAT_SYM        {}
6157
6642
        | COLUMNS                  {}
6163
6648
        | CONNECTION_SYM           {}
6164
6649
        | CONSISTENT_SYM           {}
6165
6650
        | CONTEXT_SYM              {}
 
6651
        | CONTRIBUTORS_SYM         {}
 
6652
        | CPU_SYM                  {}
6166
6653
        | CUBE_SYM                 {}
6167
6654
        | DATA_SYM                 {}
6168
6655
        | DATAFILE_SYM             {}
6169
6656
        | DATETIME                 {}
6170
6657
        | DATE_SYM                 {}
6171
6658
        | DAY_SYM                  {}
 
6659
        | DEFINER_SYM              {}
6172
6660
        | DELAY_KEY_WRITE_SYM      {}
 
6661
        | DES_KEY_FILE             {}
6173
6662
        | DIRECTORY_SYM            {}
6174
6663
        | DISABLE_SYM              {}
6175
6664
        | DISCARD                  {}
 
6665
        | DISK_SYM                 {}
6176
6666
        | DUMPFILE                 {}
6177
6667
        | DUPLICATE_SYM            {}
6178
6668
        | DYNAMIC_SYM              {}
6179
6669
        | ENDS_SYM                 {}
6180
6670
        | ENUM                     {}
6181
6671
        | ENGINE_SYM               {}
 
6672
        | ENGINES_SYM              {}
6182
6673
        | ERRORS                   {}
6183
6674
        | ESCAPE_SYM               {}
 
6675
        | EVENTS_SYM               {}
 
6676
        | EVERY_SYM                {}
6184
6677
        | EXCLUSIVE_SYM            {}
6185
6678
        | EXTENDED_SYM             {}
6186
6679
        | EXTENT_SIZE_SYM          {}
6202
6695
        | IMPORT                   {}
6203
6696
        | INDEXES                  {}
6204
6697
        | INITIAL_SIZE_SYM         {}
 
6698
        | IO_SYM                   {}
 
6699
        | IPC_SYM                  {}
6205
6700
        | ISOLATION                {}
 
6701
        | ISSUER_SYM               {}
6206
6702
        | INSERT_METHOD            {}
6207
6703
        | KEY_BLOCK_SIZE           {}
6208
6704
        | LAST_SYM                 {}
6231
6727
        | MAX_USER_CONNECTIONS_SYM {}
6232
6728
        | MAX_VALUE_SYM            {}
6233
6729
        | MEDIUM_SYM               {}
 
6730
        | MEMORY_SYM               {}
6234
6731
        | MERGE_SYM                {}
6235
6732
        | MICROSECOND_SYM          {}
6236
6733
        | MIGRATE_SYM              {}
6242
6739
        | NAME_SYM                 {}
6243
6740
        | NAMES_SYM                {}
6244
6741
        | NATIONAL_SYM             {}
 
6742
        | NCHAR_SYM                {}
6245
6743
        | NEXT_SYM                 {}
6246
6744
        | NEW_SYM                  {}
6247
6745
        | NO_WAIT_SYM              {}
6248
6746
        | NODEGROUP_SYM            {}
6249
6747
        | NONE_SYM                 {}
6250
6748
        | NOWAIT_SYM               {}
 
6749
        | NVARCHAR_SYM             {}
6251
6750
        | OFFLINE_SYM              {}
6252
6751
        | OFFSET_SYM               {}
 
6752
        | OLD_PASSWORD             {}
6253
6753
        | ONE_SHOT_SYM             {}
6254
6754
        | ONE_SYM                  {}
6255
6755
        | ONLINE_SYM               {}
6257
6757
        | PAGE_SYM                 {}
6258
6758
        | PAGE_CHECKSUM_SYM        {}
6259
6759
        | PARTIAL                  {}
 
6760
        | PASSWORD                 {}
6260
6761
        | PHASE_SYM                {}
6261
6762
        | PLUGIN_SYM               {}
6262
6763
        | PLUGINS_SYM              {}
6264
6765
        | PREV_SYM                 {}
6265
6766
        | PROCESS                  {}
6266
6767
        | PROCESSLIST_SYM          {}
 
6768
        | PROFILE_SYM              {}
 
6769
        | PROFILES_SYM             {}
6267
6770
        | QUARTER_SYM              {}
6268
6771
        | QUERY_SYM                {}
6269
6772
        | QUICK                    {}
6339
6842
        | WEEK_SYM                 {}
6340
6843
        | WEIGHT_STRING_SYM        {}
6341
6844
        | WORK_SYM                 {}
 
6845
        | XML_SYM                  {}
6342
6846
        | YEAR_SYM                 {}
6343
6847
        ;
6344
6848
 
6428
6932
            lex->var_list.push_back(new set_var(lex->option_type,
6429
6933
                                                find_sys_var(YYTHD, "tx_isolation"),
6430
6934
                                                &null_lex_str,
6431
 
                                                new Item_int((int32_t) $5)));
 
6935
                                                new Item_int((int32) $5)));
6432
6936
          }
6433
6937
        ;
6434
6938
 
6442
6946
            LEX *lex=Lex;
6443
6947
            lex->var_list.push_back(new set_var($3, $4.var, &$4.base_name, $6));
6444
6948
          }
6445
 
        | NAMES_SYM COLLATE_SYM collation_name_or_default
 
6949
        | charset old_or_new_charset_name_or_default
 
6950
          {
 
6951
            THD *thd= YYTHD;
 
6952
            LEX *lex= thd->lex;
 
6953
            $2= $2 ? $2: global_system_variables.character_set_client;
 
6954
            lex->var_list.push_back(new set_var_collation_client($2,thd->variables.collation_database,$2));
 
6955
          }
 
6956
        | NAMES_SYM charset_name_or_default opt_collate
6446
6957
          {
6447
6958
            LEX *lex= Lex;
6448
 
            $3= $3 ? $3 : global_system_variables.character_set_client;
 
6959
            $2= $2 ? $2 : global_system_variables.character_set_client;
 
6960
            $3= $3 ? $3 : $2;
 
6961
            if (!my_charset_same($2,$3))
 
6962
            {
 
6963
              my_error(ER_COLLATION_CHARSET_MISMATCH, MYF(0),
 
6964
                       $3->name, $2->csname);
 
6965
              MYSQL_YYABORT;
 
6966
            }
6449
6967
            lex->var_list.push_back(new set_var_collation_client($3,$3,$3));
6450
6968
          }
6451
6969
        ;
6460
6978
              /* Not an SP local variable */
6461
6979
              sys_var *tmp=find_sys_var(thd, $1.str, $1.length);
6462
6980
              if (!tmp)
6463
 
                DRIZZLE_YYABORT;
 
6981
                MYSQL_YYABORT;
6464
6982
              $$.var= tmp;
6465
6983
              $$.base_name= null_lex_str;
6466
6984
            }
6470
6988
            if (check_reserved_words(&$1))
6471
6989
            {
6472
6990
              my_parse_error(ER(ER_SYNTAX_ERROR));
6473
 
              DRIZZLE_YYABORT;
 
6991
              MYSQL_YYABORT;
6474
6992
            }
6475
6993
            {
6476
6994
              sys_var *tmp=find_sys_var(YYTHD, $3.str, $3.length);
6477
6995
              if (!tmp)
6478
 
                DRIZZLE_YYABORT;
 
6996
                MYSQL_YYABORT;
6479
6997
              if (!tmp->is_struct())
6480
6998
                my_error(ER_VARIABLE_IS_NOT_STRUCT, MYF(0), $3.str);
6481
6999
              $$.var= tmp;
6486
7004
          {
6487
7005
            sys_var *tmp=find_sys_var(YYTHD, $3.str, $3.length);
6488
7006
            if (!tmp)
6489
 
              DRIZZLE_YYABORT;
 
7007
              MYSQL_YYABORT;
6490
7008
            if (!tmp->is_struct())
6491
7009
              my_error(ER_VARIABLE_IS_NOT_STRUCT, MYF(0), $3.str);
6492
7010
            $$.var= tmp;
6523
7041
              requested for the table. This is used to warn about a
6524
7042
              changed locking method later.
6525
7043
            */
6526
 
            Lex->lock_transactional= true;
 
7044
            Lex->lock_transactional= TRUE;
6527
7045
          }
6528
7046
          table_or_tables
6529
7047
          {
6547
7065
table_lock:
6548
7066
        table_ident opt_table_alias table_lock_info
6549
7067
        {
6550
 
          TableList *tlist;
 
7068
          TABLE_LIST *tlist;
6551
7069
          if (!(tlist= Select->add_table_to_list(YYTHD, $1, $2, 0,
6552
7070
                                                 $3.lock_type)))
6553
 
            DRIZZLE_YYABORT; /* purecov: inspected */
 
7071
            MYSQL_YYABORT; /* purecov: inspected */
6554
7072
          tlist->lock_timeout= $3.lock_timeout;
6555
7073
          /* Store the requested lock method for later warning. */
6556
7074
          tlist->lock_transactional= $3.lock_transactional;
6557
7075
          /* Compute the resulting lock method for all tables. */
6558
7076
          if (!$3.lock_transactional)
6559
 
            Lex->lock_transactional= false;
 
7077
            Lex->lock_transactional= FALSE;
6560
7078
        }
6561
7079
        ;
6562
7080
 
6565
7083
        {
6566
7084
          $$.lock_type=          TL_READ_NO_INSERT;
6567
7085
          $$.lock_timeout=       -1;
6568
 
          $$.lock_transactional= false;
 
7086
          $$.lock_transactional= FALSE;
6569
7087
        }
6570
7088
        | WRITE_SYM
6571
7089
        {
6572
7090
          $$.lock_type=          TL_WRITE_DEFAULT;
6573
7091
          $$.lock_timeout=       -1;
6574
 
          $$.lock_transactional= false;
 
7092
          $$.lock_transactional= FALSE;
6575
7093
        }
6576
7094
        | LOW_PRIORITY WRITE_SYM
6577
7095
        {
6578
7096
          $$.lock_type=          TL_WRITE_LOW_PRIORITY;
6579
7097
          $$.lock_timeout=       -1;
6580
 
          $$.lock_transactional= false;
 
7098
          $$.lock_transactional= FALSE;
6581
7099
        }
6582
7100
        | READ_SYM LOCAL_SYM
6583
7101
        {
6584
7102
          $$.lock_type=          TL_READ;
6585
7103
          $$.lock_timeout=       -1;
6586
 
          $$.lock_transactional= false;
 
7104
          $$.lock_transactional= FALSE;
6587
7105
        }
6588
7106
        | IN_SYM transactional_lock_mode MODE_SYM opt_transactional_lock_timeout
6589
7107
        {
6590
7108
          $$.lock_type=          $2;
6591
7109
          $$.lock_timeout=       $4;
6592
 
          $$.lock_transactional= true;
 
7110
          $$.lock_transactional= TRUE;
6593
7111
        }
6594
7112
        ;
6595
7113
 
6716
7234
          UNION_SYM union_option
6717
7235
          {
6718
7236
            if (add_select_to_union_list(Lex, (bool)$2))
6719
 
              DRIZZLE_YYABORT;
 
7237
              MYSQL_YYABORT;
6720
7238
          }
6721
7239
          select_init
6722
7240
          {
6738
7256
          {
6739
7257
            THD *thd= YYTHD;
6740
7258
            LEX *lex= thd->lex;
6741
 
            assert(lex->current_select->linkage != GLOBAL_OPTIONS_TYPE);
 
7259
            DBUG_ASSERT(lex->current_select->linkage != GLOBAL_OPTIONS_TYPE);
6742
7260
            SELECT_LEX *sel= lex->current_select;
6743
7261
            SELECT_LEX_UNIT *unit= sel->master_unit();
6744
7262
            SELECT_LEX *fake= unit->fake_select_lex;
6786
7304
          UNION_SYM union_option 
6787
7305
          {
6788
7306
            if (add_select_to_union_list(Lex, (bool)$3))
6789
 
              DRIZZLE_YYABORT;
 
7307
              MYSQL_YYABORT;
6790
7308
          }
6791
7309
          query_specification
6792
7310
          {
6810
7328
               lex->sql_command == (int)SQLCOM_PURGE)
6811
7329
            {
6812
7330
              my_parse_error(ER(ER_SYNTAX_ERROR));
6813
 
              DRIZZLE_YYABORT;
 
7331
              MYSQL_YYABORT;
6814
7332
            }
6815
7333
            /* 
6816
7334
              we are making a "derived table" for the parenthesis
6820
7338
              SELECT * FROM ((SELECT ...) UNION ...)
6821
7339
            */
6822
7340
            if (mysql_new_select(Lex, 1))
6823
 
              DRIZZLE_YYABORT;
 
7341
              MYSQL_YYABORT;
6824
7342
          }
6825
7343
        ;
6826
7344