1 /* A Bison parser, made by GNU Bison 3.0.2. */
3 /* Bison implementation for Yacc-like parsers in C
5 Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
7 This program is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
20 /* As a special exception, you may create a larger work that contains
21 part or all of the Bison parser skeleton and distribute that work
22 under terms of your choice, so long as that work isn't itself a
23 parser generator using the skeleton or a modified version thereof
24 as a parser skeleton. Alternatively, if you modify or redistribute
25 the parser skeleton itself, you may (at your option) remove this
26 special exception, which will cause the skeleton and the resulting
27 Bison output files to be licensed under the GNU General Public
28 License without this special exception.
30 This special exception was added by the Free Software Foundation in
31 version 2.2 of Bison. */
33 /* C LALR(1) parser skeleton written by Richard Stallman, by
34 simplifying the original so-called "semantic" parser. */
36 /* All symbols defined below should begin with yy or YY, to avoid
37 infringing on user name space. This should be done even for local
38 variables, as they might otherwise be expanded by user macros.
39 There are some unavoidable exceptions within include files to
40 define necessary library symbols; they are noted "INFRINGES ON
41 USER NAME SPACE" below. */
43 /* Identify Bison output. */
47 #define YYBISON_VERSION "3.0.2"
50 #define YYSKELETON_NAME "yacc.c"
62 /* Substitute the variable and function names. */
63 #define yyparse sql_parse
65 #define yyerror sql_error
66 #define yydebug sql_debug
67 #define yynerrs sql_nerrs
70 /* Copy the first part of user declarations. */
71 #line 1 "sql.y" /* yacc.c:339 */
75 * Implementation of the Microsoft Installer (msi.dll)
77 * Copyright 2002-2004 Mike McCormack for CodeWeavers
79 * This library is free software; you can redistribute it and/or
80 * modify it under the terms of the GNU Lesser General Public
81 * License as published by the Free Software Foundation; either
82 * version 2.1 of the License, or (at your option) any later version.
84 * This library is distributed in the hope that it will be useful,
85 * but WITHOUT ANY WARRANTY; without even the implied warranty of
86 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
87 * Lesser General Public License for more details.
89 * You should have received a copy of the GNU Lesser General Public
90 * License along with this library; if not, write to the Free Software
91 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
96 WINE_DEFAULT_DEBUG_CHANNEL(msi
);
98 static UINT
SQL_getstring( void *info
, const struct sql_str
*strdata
, LPWSTR
*str
);
99 static INT
SQL_getint( void *info
);
100 static int sql_lex( void *SQL_lval
, SQL_input
*info
);
101 static int sql_error( SQL_input
*info
, const char *str
);
103 static LPWSTR
parser_add_table( void *info
, LPCWSTR list
, LPCWSTR table
);
104 static void *parser_alloc( void *info
, unsigned int sz
);
105 static column_info
*parser_alloc_column( void *info
, LPCWSTR table
, LPCWSTR column
);
107 static BOOL
SQL_MarkPrimaryKeys( column_info
**cols
, column_info
*keys
);
109 static struct expr
* EXPR_complex( void *info
, struct expr
*l
, UINT op
, struct expr
*r
);
110 static struct expr
* EXPR_unary( void *info
, struct expr
*l
, UINT op
);
111 static struct expr
* EXPR_column( void *info
, const column_info
*column
);
112 static struct expr
* EXPR_ival( void *info
, int val
);
113 static struct expr
* EXPR_sval( void *info
, const struct sql_str
*str
);
114 static struct expr
* EXPR_wildcard( void *info
);
116 #define PARSER_BUBBLE_UP_VIEW( sql, result, current_view ) \
117 *sql->view = current_view; \
118 result = current_view
121 #line 134 "sql.tab.c" /* yacc.c:339 */
124 # if defined __cplusplus && 201103L <= __cplusplus
125 # define YY_NULLPTR nullptr
127 # define YY_NULLPTR 0
131 /* Enabling verbose error messages. */
132 #ifdef YYERROR_VERBOSE
133 # undef YYERROR_VERBOSE
134 # define YYERROR_VERBOSE 1
136 # define YYERROR_VERBOSE 0
139 /* In a future release of Bison, this section will be replaced
140 by #include "sql.tab.h". */
141 #ifndef YY_SQL_SQL_TAB_H_INCLUDED
142 # define YY_SQL_SQL_TAB_H_INCLUDED
148 extern int sql_debug
;
186 TK_LOCALIZABLE
= 288,
211 UNCLOSED_STRING
= 313,
221 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
222 typedef union YYSTYPE YYSTYPE
;
225 #line 68 "sql.y" /* yacc.c:355 */
229 column_info
*column_list
;
235 #line 248 "sql.tab.c" /* yacc.c:355 */
237 # define YYSTYPE_IS_TRIVIAL 1
238 # define YYSTYPE_IS_DECLARED 1
243 int sql_parse (SQL_input
*info
);
245 #endif /* !YY_SQL_SQL_TAB_H_INCLUDED */
247 /* Copy the second part of user declarations. */
249 #line 262 "sql.tab.c" /* yacc.c:358 */
256 typedef YYTYPE_UINT8 yytype_uint8
;
258 typedef unsigned char yytype_uint8
;
262 typedef YYTYPE_INT8 yytype_int8
;
264 typedef signed char yytype_int8
;
268 typedef YYTYPE_UINT16 yytype_uint16
;
270 typedef unsigned short int yytype_uint16
;
274 typedef YYTYPE_INT16 yytype_int16
;
276 typedef short int yytype_int16
;
280 # ifdef __SIZE_TYPE__
281 # define YYSIZE_T __SIZE_TYPE__
282 # elif defined size_t
283 # define YYSIZE_T size_t
284 # elif ! defined YYSIZE_T
285 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
286 # define YYSIZE_T size_t
288 # define YYSIZE_T unsigned int
292 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
295 # if defined YYENABLE_NLS && YYENABLE_NLS
297 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
298 # define YY_(Msgid) dgettext ("bison-runtime", Msgid)
302 # define YY_(Msgid) Msgid
307 # if (defined __GNUC__ \
308 && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \
309 || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
310 # define YY_ATTRIBUTE(Spec) __attribute__(Spec)
312 # define YY_ATTRIBUTE(Spec) /* empty */
316 #ifndef YY_ATTRIBUTE_PURE
317 # define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__))
320 #ifndef YY_ATTRIBUTE_UNUSED
321 # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
324 #if !defined _Noreturn \
325 && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
326 # if defined _MSC_VER && 1200 <= _MSC_VER
327 # define _Noreturn __declspec (noreturn)
329 # define _Noreturn YY_ATTRIBUTE ((__noreturn__))
333 /* Suppress unused-variable warnings by "using" E. */
334 #if ! defined lint || defined __GNUC__
335 # define YYUSE(E) ((void) (E))
337 # define YYUSE(E) /* empty */
340 #if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
341 /* Suppress an incorrect diagnostic about yylval being uninitialized. */
342 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
343 _Pragma ("GCC diagnostic push") \
344 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
345 _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
346 # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
347 _Pragma ("GCC diagnostic pop")
349 # define YY_INITIAL_VALUE(Value) Value
351 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
352 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
353 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
355 #ifndef YY_INITIAL_VALUE
356 # define YY_INITIAL_VALUE(Value) /* Nothing. */
360 #if ! defined yyoverflow || YYERROR_VERBOSE
362 /* The parser invokes alloca or malloc; define the necessary symbols. */
364 # ifdef YYSTACK_USE_ALLOCA
365 # if YYSTACK_USE_ALLOCA
367 # define YYSTACK_ALLOC __builtin_alloca
368 # elif defined __BUILTIN_VA_ARG_INCR
369 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
371 # define YYSTACK_ALLOC __alloca
372 # elif defined _MSC_VER
373 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
374 # define alloca _alloca
376 # define YYSTACK_ALLOC alloca
377 # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
378 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
379 /* Use EXIT_SUCCESS as a witness for stdlib.h. */
380 # ifndef EXIT_SUCCESS
381 # define EXIT_SUCCESS 0
388 # ifdef YYSTACK_ALLOC
389 /* Pacify GCC's 'empty if-body' warning. */
390 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
391 # ifndef YYSTACK_ALLOC_MAXIMUM
392 /* The OS might guarantee only one guard page at the bottom of the stack,
393 and a page size can be as small as 4096 bytes. So we cannot safely
394 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
395 to allow for a few compiler-allocated temporary stack slots. */
396 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
399 # define YYSTACK_ALLOC YYMALLOC
400 # define YYSTACK_FREE YYFREE
401 # ifndef YYSTACK_ALLOC_MAXIMUM
402 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
404 # if (defined __cplusplus && ! defined EXIT_SUCCESS \
405 && ! ((defined YYMALLOC || defined malloc) \
406 && (defined YYFREE || defined free)))
407 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
408 # ifndef EXIT_SUCCESS
409 # define EXIT_SUCCESS 0
413 # define YYMALLOC malloc
414 # if ! defined malloc && ! defined EXIT_SUCCESS
415 void *malloc (YYSIZE_T
); /* INFRINGES ON USER NAME SPACE */
420 # if ! defined free && ! defined EXIT_SUCCESS
421 void free (void *); /* INFRINGES ON USER NAME SPACE */
425 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
428 #if (! defined yyoverflow \
429 && (! defined __cplusplus \
430 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
432 /* A type that is properly aligned for any stack member. */
435 yytype_int16 yyss_alloc
;
439 /* The size of the maximum gap between one aligned stack and the next. */
440 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
442 /* The size of an array large to enough to hold all stacks, each with
444 # define YYSTACK_BYTES(N) \
445 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
446 + YYSTACK_GAP_MAXIMUM)
448 # define YYCOPY_NEEDED 1
450 /* Relocate STACK from its old location to the new one. The
451 local variables YYSIZE and YYSTACKSIZE give the old and new number of
452 elements in the stack, and YYPTR gives the new location of the
453 stack. Advance YYPTR to a properly aligned location for the next
455 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
458 YYSIZE_T yynewbytes; \
459 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
460 Stack = &yyptr->Stack_alloc; \
461 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
462 yyptr += yynewbytes / sizeof (*yyptr); \
468 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
469 /* Copy COUNT objects from SRC to DST. The source and destination do
472 # if defined __GNUC__ && 1 < __GNUC__
473 # define YYCOPY(Dst, Src, Count) \
474 __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
476 # define YYCOPY(Dst, Src, Count) \
480 for (yyi = 0; yyi < (Count); yyi++) \
481 (Dst)[yyi] = (Src)[yyi]; \
486 #endif /* !YYCOPY_NEEDED */
488 /* YYFINAL -- State number of the termination state. */
490 /* YYLAST -- Last index in YYTABLE. */
493 /* YYNTOKENS -- Number of terminals. */
495 /* YYNNTS -- Number of nonterminals. */
497 /* YYNRULES -- Number of rules. */
499 /* YYNSTATES -- Number of states. */
500 #define YYNSTATES 154
502 /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
503 by yylex, with out-of-bounds checking. */
505 #define YYMAXUTOK 319
507 #define YYTRANSLATE(YYX) \
508 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
510 /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
511 as returned by yylex, without out-of-bounds checking. */
512 static const yytype_uint8 yytranslate
[] =
514 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
515 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
516 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
517 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
518 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
519 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
520 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
521 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
522 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
523 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
524 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
525 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
526 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
527 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
528 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
529 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
530 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
531 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
532 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
533 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
534 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
535 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
536 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
537 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
538 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
539 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
540 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
541 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
542 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
543 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
544 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
545 55, 56, 57, 58, 59, 60, 61, 62, 63, 64
549 /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
550 static const yytype_uint16 yyrline
[] =
552 0, 117, 117, 125, 126, 127, 128, 129, 130, 131,
553 135, 146, 160, 177, 193, 204, 218, 232, 243, 254,
554 268, 272, 279, 294, 304, 314, 321, 330, 334, 338,
555 345, 349, 356, 360, 364, 368, 372, 376, 380, 387,
556 396, 400, 415, 435, 436, 440, 447, 448, 452, 459,
557 471, 484, 488, 500, 515, 519, 528, 534, 540, 546,
558 552, 558, 564, 570, 576, 582, 588, 597, 598, 602,
559 609, 620, 621, 629, 637, 643, 649, 655, 664, 673,
560 679, 688, 694, 700, 709, 716, 724, 732
564 #if YYDEBUG || YYERROR_VERBOSE || 0
565 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
566 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
567 static const char *const yytname
[] =
569 "$end", "error", "$undefined", "TK_ALTER", "TK_AND", "TK_BY", "TK_CHAR",
570 "TK_COMMA", "TK_CREATE", "TK_DELETE", "TK_DROP", "TK_DISTINCT", "TK_DOT",
571 "TK_EQ", "TK_FREE", "TK_FROM", "TK_GE", "TK_GT", "TK_HOLD", "TK_ADD",
572 "TK_ID", "TK_ILLEGAL", "TK_INSERT", "TK_INT", "TK_INTEGER", "TK_INTO",
573 "TK_IS", "TK_KEY", "TK_LE", "TK_LONG", "TK_LONGCHAR", "TK_LP", "TK_LT",
574 "TK_LOCALIZABLE", "TK_MINUS", "TK_NE", "TK_NOT", "TK_NULL", "TK_OBJECT",
575 "TK_OR", "TK_ORDER", "TK_PRIMARY", "TK_RP", "TK_SELECT", "TK_SET",
576 "TK_SHORT", "TK_SPACE", "TK_STAR", "TK_STRING", "TK_TABLE",
577 "TK_TEMPORARY", "TK_UPDATE", "TK_VALUES", "TK_WHERE", "TK_WILDCARD",
578 "END_OF_FILE", "ILLEGAL", "SPACE", "UNCLOSED_STRING", "COMMENT",
579 "FUNCTION", "COLUMN", "AGG_FUNCTION.", "TK_LIKE", "TK_NEGATION",
580 "$accept", "query", "onequery", "oneinsert", "onecreate", "oneupdate",
581 "onedelete", "onealter", "alterop", "onedrop", "table_def", "column_def",
582 "column_and_type", "column_type", "data_type_l", "data_type",
583 "data_count", "oneselect", "selectfrom", "selcollist", "collist", "from",
584 "unorderdfrom", "tablelist", "expr", "val", "constlist",
585 "update_assign_list", "column_assignment", "const_val", "column_val",
586 "column", "selcolumn", "table", "id", "string", "number", YY_NULLPTR
591 /* YYTOKNUM[NUM] -- (External) token number corresponding to the
592 (internal) symbol number NUM (which must be that of a token). */
593 static const yytype_uint16 yytoknum
[] =
595 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
596 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
597 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
598 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
599 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
600 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
601 315, 316, 317, 318, 319
605 #define YYPACT_NINF -80
607 #define yypact_value_is_default(Yystate) \
608 (!!((Yystate) == (-80)))
610 #define YYTABLE_NINF -85
612 #define yytable_value_is_error(Yytable_value) \
615 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
617 static const yytype_int16 yypact
[] =
619 36, -44, -39, -1, -26, 9, 50, 37, 56, -80,
620 -80, -80, -80, -80, -80, -80, -80, 37, 37, 37,
621 -80, 25, 37, 37, -18, -80, -80, -80, -80, -1,
622 78, 47, 76, -80, 57, -80, -80, 105, 72, 51,
623 55, 100, -80, 81, -80, -80, -18, 37, 37, -80,
624 -80, 37, -80, 37, 62, 37, -12, -12, -80, -80,
625 63, 102, 108, 101, 76, 97, 45, 83, 2, -80,
626 62, 3, 94, -80, -80, 126, -80, -80, 127, 93,
627 62, 37, 52, 37, -80, 106, -80, -80, -80, -80,
628 -80, -80, 31, 103, 118, 37, 111, 11, 62, 62,
629 60, 60, 60, -11, 60, 60, 60, -12, 88, 3,
630 -80, -80, 117, -80, -80, -80, -80, -80, 117, -80,
631 -80, 107, -80, -80, -12, -80, -80, 138, -80, -80,
632 -80, -80, -80, 109, -80, -80, -80, -80, -80, 112,
633 -80, 110, -80, -80, -80, -80, 52, -80, 113, 140,
637 /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
638 Performed when YYTABLE does not specify something else to do. Zero
639 means the default is an error. */
640 static const yytype_uint8 yydefact
[] =
642 0, 0, 0, 0, 0, 0, 0, 0, 0, 2,
643 5, 4, 6, 7, 8, 9, 3, 0, 0, 0,
644 16, 51, 0, 0, 0, 85, 45, 86, 40, 0,
645 43, 0, 82, 83, 0, 84, 1, 0, 0, 52,
646 54, 0, 22, 0, 41, 42, 0, 0, 0, 21,
647 20, 0, 17, 0, 0, 0, 0, 0, 44, 81,
648 15, 71, 0, 0, 80, 18, 0, 0, 0, 25,
649 0, 53, 0, 78, 55, 54, 48, 50, 46, 0,
650 0, 0, 0, 0, 19, 32, 36, 37, 34, 38,
651 35, 26, 27, 30, 12, 0, 0, 0, 0, 0,
652 0, 0, 0, 0, 0, 0, 0, 0, 0, 14,
653 72, 87, 0, 76, 77, 73, 74, 79, 0, 28,
654 29, 0, 13, 24, 0, 56, 57, 58, 59, 68,
655 67, 63, 60, 0, 65, 62, 61, 64, 47, 0,
656 75, 0, 39, 31, 23, 66, 0, 33, 0, 69,
660 /* YYPGOTO[NTERM-NUM]. */
661 static const yytype_int8 yypgoto
[] =
663 -80, -80, -80, -80, -80, -80, -80, -80, -80, -80,
664 -80, -80, -47, -80, -80, -80, -80, -80, 124, 104,
665 -53, 120, -80, 96, 19, 26, 5, 73, -80, -79,
666 -7, -29, -80, 14, -6, -80, -16
669 /* YYDEFGOTO[NTERM-NUM]. */
670 static const yytype_int16 yydefgoto
[] =
672 -1, 8, 9, 10, 11, 12, 13, 14, 52, 15,
673 67, 68, 65, 91, 92, 93, 141, 16, 28, 29,
674 77, 20, 21, 39, 71, 128, 148, 60, 61, 129,
675 130, 73, 30, 63, 64, 33, 116
678 /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
679 positive, shift that token. If negative, reduce the rule whose
680 number is the opposite. If YYTABLE_NINF, syntax error. */
681 static const yytype_int16 yytable
[] =
683 32, 35, 25, 115, 79, 17, 69, 98, 25, 95,
684 18, 35, 35, 35, 19, 98, 35, 35, 32, 62,
685 31, 34, 66, 22, 66, 133, 134, 78, 78, 26,
686 27, 37, 38, 40, 23, 76, 42, 43, 31, 1,
687 32, 59, 99, 96, 2, 3, 4, 72, 123, 35,
688 99, 85, 62, 125, 138, -49, 36, 25, 5, 47,
689 31, 24, 55, 72, 119, 41, 66, 149, 86, 75,
690 25, 144, 149, 72, 87, 88, 111, 117, 78, 6,
691 25, 120, 25, 89, 111, 46, 112, 7, -84, 97,
692 90, 72, 72, 70, 112, 78, 140, 26, 27, 109,
693 113, 48, 142, 53, 54, 56, 114, 100, 113, 81,
694 101, 102, 57, 83, 114, 84, 80, 126, 127, 49,
695 103, 82, 104, 50, 51, 94, 105, 131, 132, 106,
696 135, 136, 137, 55, 107, 108, 122, 118, 124, 121,
697 139, 111, 98, 146, 143, 152, 145, 151, 44, 45,
698 58, 74, 147, 0, 110, 150, 153
701 static const yytype_int16 yycheck
[] =
703 6, 7, 20, 82, 57, 49, 53, 4, 20, 7,
704 49, 17, 18, 19, 15, 4, 22, 23, 24, 48,
705 6, 7, 51, 49, 53, 36, 37, 56, 57, 47,
706 48, 17, 18, 19, 25, 47, 22, 23, 24, 3,
707 46, 47, 39, 41, 8, 9, 10, 54, 95, 55,
708 39, 6, 81, 42, 107, 0, 0, 20, 22, 12,
709 46, 11, 7, 70, 33, 40, 95, 146, 23, 55,
710 20, 124, 151, 80, 29, 30, 24, 83, 107, 43,
711 20, 50, 20, 38, 24, 7, 34, 51, 12, 70,
712 45, 98, 99, 31, 34, 124, 112, 47, 48, 80,
713 48, 44, 118, 31, 53, 5, 54, 13, 48, 7,
714 16, 17, 31, 12, 54, 18, 53, 98, 99, 14,
715 26, 13, 28, 18, 19, 42, 32, 101, 102, 35,
716 104, 105, 106, 7, 7, 42, 18, 31, 27, 36,
717 52, 24, 4, 31, 37, 50, 37, 7, 24, 29,
718 46, 55, 42, -1, 81, 42, 151
721 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
722 symbol of state STATE-NUM. */
723 static const yytype_uint8 yystos
[] =
725 0, 3, 8, 9, 10, 22, 43, 51, 66, 67,
726 68, 69, 70, 71, 72, 74, 82, 49, 49, 15,
727 86, 87, 49, 25, 11, 20, 47, 48, 83, 84,
728 97, 98, 99, 100, 98, 99, 0, 98, 98, 88,
729 98, 40, 98, 98, 83, 86, 7, 12, 44, 14,
730 18, 19, 73, 31, 53, 7, 5, 31, 84, 99,
731 92, 93, 96, 98, 99, 77, 96, 75, 76, 77,
732 31, 89, 95, 96, 88, 98, 47, 85, 96, 85,
733 53, 7, 13, 12, 18, 6, 23, 29, 30, 38,
734 45, 78, 79, 80, 42, 7, 41, 89, 4, 39,
735 13, 16, 17, 26, 28, 32, 35, 7, 42, 89,
736 92, 24, 34, 48, 54, 94, 101, 99, 31, 33,
737 50, 36, 18, 77, 27, 42, 89, 89, 90, 94,
738 95, 90, 90, 36, 37, 90, 90, 90, 85, 52,
739 101, 81, 101, 37, 85, 37, 31, 42, 91, 94,
743 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
744 static const yytype_uint8 yyr1
[] =
746 0, 65, 66, 67, 67, 67, 67, 67, 67, 67,
747 68, 68, 69, 69, 70, 70, 71, 72, 72, 72,
748 73, 73, 74, 75, 76, 76, 77, 78, 78, 78,
749 79, 79, 80, 80, 80, 80, 80, 80, 80, 81,
750 82, 82, 83, 84, 84, 84, 85, 85, 85, 86,
751 86, 86, 87, 87, 88, 88, 89, 89, 89, 89,
752 89, 89, 89, 89, 89, 89, 89, 90, 90, 91,
753 91, 92, 92, 93, 94, 94, 94, 94, 95, 96,
754 96, 97, 97, 97, 98, 99, 100, 101
757 /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
758 static const yytype_uint8 yyr2
[] =
760 0, 2, 1, 1, 1, 1, 1, 1, 1, 1,
761 10, 11, 6, 7, 6, 4, 2, 4, 5, 6,
762 1, 1, 3, 4, 3, 1, 2, 1, 2, 2,
763 1, 3, 1, 4, 1, 1, 1, 1, 1, 1,
764 2, 3, 2, 1, 3, 1, 1, 3, 1, 2,
765 4, 1, 2, 4, 1, 3, 3, 3, 3, 3,
766 3, 3, 3, 3, 3, 3, 4, 1, 1, 1,
767 3, 1, 3, 3, 1, 2, 1, 1, 1, 3,
768 1, 3, 1, 1, 1, 1, 1, 1
772 #define yyerrok (yyerrstatus = 0)
773 #define yyclearin (yychar = YYEMPTY)
777 #define YYACCEPT goto yyacceptlab
778 #define YYABORT goto yyabortlab
779 #define YYERROR goto yyerrorlab
782 #define YYRECOVERING() (!!yyerrstatus)
784 #define YYBACKUP(Token, Value) \
786 if (yychar == YYEMPTY) \
790 YYPOPSTACK (yylen); \
796 yyerror (info, YY_("syntax error: cannot back up")); \
801 /* Error token number */
803 #define YYERRCODE 256
807 /* Enable debugging if requested. */
811 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
812 # define YYFPRINTF fprintf
815 # define YYDPRINTF(Args) \
821 /* This macro is provided for backward compatibility. */
822 #ifndef YY_LOCATION_PRINT
823 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
827 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
831 YYFPRINTF (stderr, "%s ", Title); \
832 yy_symbol_print (stderr, \
833 Type, Value, info); \
834 YYFPRINTF (stderr, "\n"); \
839 /*----------------------------------------.
840 | Print this symbol's value on YYOUTPUT. |
841 `----------------------------------------*/
844 yy_symbol_value_print (FILE *yyoutput
, int yytype
, YYSTYPE
const * const yyvaluep
, SQL_input
*info
)
846 FILE *yyo
= yyoutput
;
852 if (yytype
< YYNTOKENS
)
853 YYPRINT (yyoutput
, yytoknum
[yytype
], *yyvaluep
);
859 /*--------------------------------.
860 | Print this symbol on YYOUTPUT. |
861 `--------------------------------*/
864 yy_symbol_print (FILE *yyoutput
, int yytype
, YYSTYPE
const * const yyvaluep
, SQL_input
*info
)
866 YYFPRINTF (yyoutput
, "%s %s (",
867 yytype
< YYNTOKENS
? "token" : "nterm", yytname
[yytype
]);
869 yy_symbol_value_print (yyoutput
, yytype
, yyvaluep
, info
);
870 YYFPRINTF (yyoutput
, ")");
873 /*------------------------------------------------------------------.
874 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
876 `------------------------------------------------------------------*/
879 yy_stack_print (yytype_int16
*yybottom
, yytype_int16
*yytop
)
881 YYFPRINTF (stderr
, "Stack now");
882 for (; yybottom
<= yytop
; yybottom
++)
884 int yybot
= *yybottom
;
885 YYFPRINTF (stderr
, " %d", yybot
);
887 YYFPRINTF (stderr
, "\n");
890 # define YY_STACK_PRINT(Bottom, Top) \
893 yy_stack_print ((Bottom), (Top)); \
897 /*------------------------------------------------.
898 | Report that the YYRULE is going to be reduced. |
899 `------------------------------------------------*/
902 yy_reduce_print (yytype_int16
*yyssp
, YYSTYPE
*yyvsp
, int yyrule
, SQL_input
*info
)
904 unsigned long int yylno
= yyrline
[yyrule
];
905 int yynrhs
= yyr2
[yyrule
];
907 YYFPRINTF (stderr
, "Reducing stack by rule %d (line %lu):\n",
909 /* The symbols being reduced. */
910 for (yyi
= 0; yyi
< yynrhs
; yyi
++)
912 YYFPRINTF (stderr
, " $%d = ", yyi
+ 1);
913 yy_symbol_print (stderr
,
914 yystos
[yyssp
[yyi
+ 1 - yynrhs
]],
915 &(yyvsp
[(yyi
+ 1) - (yynrhs
)])
917 YYFPRINTF (stderr
, "\n");
921 # define YY_REDUCE_PRINT(Rule) \
924 yy_reduce_print (yyssp, yyvsp, Rule, info); \
927 /* Nonzero means print parse trace. It is left uninitialized so that
928 multiple parsers can coexist. */
931 # define YYDPRINTF(Args)
932 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
933 # define YY_STACK_PRINT(Bottom, Top)
934 # define YY_REDUCE_PRINT(Rule)
935 #endif /* !YYDEBUG */
938 /* YYINITDEPTH -- initial size of the parser's stacks. */
940 # define YYINITDEPTH 200
943 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
944 if the built-in stack extension method is used).
946 Do not make this value too large; the results are undefined if
947 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
948 evaluated with infinite-precision integer arithmetic. */
951 # define YYMAXDEPTH 10000
958 # if defined __GLIBC__ && defined _STRING_H
959 # define yystrlen strlen
961 /* Return the length of YYSTR. */
963 yystrlen (const char *yystr
)
966 for (yylen
= 0; yystr
[yylen
]; yylen
++)
974 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
975 # define yystpcpy stpcpy
977 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
980 yystpcpy (char *yydest
, const char *yysrc
)
983 const char *yys
= yysrc
;
985 while ((*yyd
++ = *yys
++) != '\0')
994 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
995 quotes and backslashes, so that it's suitable for yyerror. The
996 heuristic is that double-quoting is unnecessary unless the string
997 contains an apostrophe, a comma, or backslash (other than
998 backslash-backslash). YYSTR is taken from yytname. If YYRES is
999 null, do not copy; instead, return the length of what the result
1002 yytnamerr (char *yyres
, const char *yystr
)
1007 char const *yyp
= yystr
;
1014 goto do_not_strip_quotes
;
1018 goto do_not_strip_quotes
;
1031 do_not_strip_quotes
: ;
1035 return yystrlen (yystr
);
1037 return yystpcpy (yyres
, yystr
) - yyres
;
1041 /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
1042 about the unexpected token YYTOKEN for the state stack whose top is
1045 Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
1046 not large enough to hold the message. In that case, also set
1047 *YYMSG_ALLOC to the required number of bytes. Return 2 if the
1048 required number of bytes is too large to store. */
1050 yysyntax_error (YYSIZE_T
*yymsg_alloc
, char **yymsg
,
1051 yytype_int16
*yyssp
, int yytoken
)
1053 YYSIZE_T yysize0
= yytnamerr (YY_NULLPTR
, yytname
[yytoken
]);
1054 YYSIZE_T yysize
= yysize0
;
1055 enum { YYERROR_VERBOSE_ARGS_MAXIMUM
= 5 };
1056 /* Internationalized format string. */
1057 const char *yyformat
= YY_NULLPTR
;
1058 /* Arguments of yyformat. */
1059 char const *yyarg
[YYERROR_VERBOSE_ARGS_MAXIMUM
];
1060 /* Number of reported tokens (one for the "unexpected", one per
1064 /* There are many possibilities here to consider:
1065 - If this state is a consistent state with a default action, then
1066 the only way this function was invoked is if the default action
1067 is an error action. In that case, don't check for expected
1068 tokens because there are none.
1069 - The only way there can be no lookahead present (in yychar) is if
1070 this state is a consistent state with a default action. Thus,
1071 detecting the absence of a lookahead is sufficient to determine
1072 that there is no unexpected or expected token to report. In that
1073 case, just report a simple "syntax error".
1074 - Don't assume there isn't a lookahead just because this state is a
1075 consistent state with a default action. There might have been a
1076 previous inconsistent state, consistent state with a non-default
1077 action, or user semantic action that manipulated yychar.
1078 - Of course, the expected token list depends on states to have
1079 correct lookahead information, and it depends on the parser not
1080 to perform extra reductions after fetching a lookahead from the
1081 scanner and before detecting a syntax error. Thus, state merging
1082 (from LALR or IELR) and default reductions corrupt the expected
1083 token list. However, the list is correct for canonical LR with
1084 one exception: it will still contain any token that will not be
1085 accepted due to an error action in a later state.
1087 if (yytoken
!= YYEMPTY
)
1089 int yyn
= yypact
[*yyssp
];
1090 yyarg
[yycount
++] = yytname
[yytoken
];
1091 if (!yypact_value_is_default (yyn
))
1093 /* Start YYX at -YYN if negative to avoid negative indexes in
1094 YYCHECK. In other words, skip the first -YYN actions for
1095 this state because they are default actions. */
1096 int yyxbegin
= yyn
< 0 ? -yyn
: 0;
1097 /* Stay within bounds of both yycheck and yytname. */
1098 int yychecklim
= YYLAST
- yyn
+ 1;
1099 int yyxend
= yychecklim
< YYNTOKENS
? yychecklim
: YYNTOKENS
;
1102 for (yyx
= yyxbegin
; yyx
< yyxend
; ++yyx
)
1103 if (yycheck
[yyx
+ yyn
] == yyx
&& yyx
!= YYTERROR
1104 && !yytable_value_is_error (yytable
[yyx
+ yyn
]))
1106 if (yycount
== YYERROR_VERBOSE_ARGS_MAXIMUM
)
1112 yyarg
[yycount
++] = yytname
[yyx
];
1114 YYSIZE_T yysize1
= yysize
+ yytnamerr (YY_NULLPTR
, yytname
[yyx
]);
1115 if (! (yysize
<= yysize1
1116 && yysize1
<= YYSTACK_ALLOC_MAXIMUM
))
1126 # define YYCASE_(N, S) \
1130 YYCASE_(0, YY_("syntax error"));
1131 YYCASE_(1, YY_("syntax error, unexpected %s"));
1132 YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
1133 YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
1134 YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
1135 YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
1140 YYSIZE_T yysize1
= yysize
+ yystrlen (yyformat
);
1141 if (! (yysize
<= yysize1
&& yysize1
<= YYSTACK_ALLOC_MAXIMUM
))
1146 if (*yymsg_alloc
< yysize
)
1148 *yymsg_alloc
= 2 * yysize
;
1149 if (! (yysize
<= *yymsg_alloc
1150 && *yymsg_alloc
<= YYSTACK_ALLOC_MAXIMUM
))
1151 *yymsg_alloc
= YYSTACK_ALLOC_MAXIMUM
;
1155 /* Avoid sprintf, as that infringes on the user's name space.
1156 Don't have undefined behavior even if the translation
1157 produced a string with the wrong number of "%s"s. */
1161 while ((*yyp
= *yyformat
) != '\0')
1162 if (*yyp
== '%' && yyformat
[1] == 's' && yyi
< yycount
)
1164 yyp
+= yytnamerr (yyp
, yyarg
[yyi
++]);
1175 #endif /* YYERROR_VERBOSE */
1177 /*-----------------------------------------------.
1178 | Release the memory associated to this symbol. |
1179 `-----------------------------------------------*/
1182 yydestruct (const char *yymsg
, int yytype
, YYSTYPE
*yyvaluep
, SQL_input
*info
)
1188 YY_SYMBOL_PRINT (yymsg
, yytype
, yyvaluep
, yylocationp
);
1190 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1192 YY_IGNORE_MAYBE_UNINITIALIZED_END
1203 yyparse (SQL_input
*info
)
1205 /* The lookahead symbol. */
1209 /* The semantic value of the lookahead symbol. */
1210 /* Default value used for initialization, for pacifying older GCCs
1211 or non-GCC compilers. */
1212 YY_INITIAL_VALUE (static YYSTYPE yyval_default
;)
1213 YYSTYPE yylval
YY_INITIAL_VALUE (= yyval_default
);
1215 /* Number of syntax errors so far. */
1219 /* Number of tokens to shift before error messages enabled. */
1222 /* The stacks and their tools:
1223 'yyss': related to states.
1224 'yyvs': related to semantic values.
1226 Refer to the stacks through separate pointers, to allow yyoverflow
1227 to reallocate them elsewhere. */
1229 /* The state stack. */
1230 yytype_int16 yyssa
[YYINITDEPTH
];
1232 yytype_int16
*yyssp
;
1234 /* The semantic value stack. */
1235 YYSTYPE yyvsa
[YYINITDEPTH
];
1239 YYSIZE_T yystacksize
;
1243 /* Lookahead token as an internal (translated) token number. */
1245 /* The variables used to return semantic value and location from the
1250 /* Buffer for error messages, and its allocated size. */
1252 char *yymsg
= yymsgbuf
;
1253 YYSIZE_T yymsg_alloc
= sizeof yymsgbuf
;
1256 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1258 /* The number of symbols on the RHS of the reduced rule.
1259 Keep to zero when no symbol should be popped. */
1262 yyssp
= yyss
= yyssa
;
1263 yyvsp
= yyvs
= yyvsa
;
1264 yystacksize
= YYINITDEPTH
;
1266 YYDPRINTF ((stderr
, "Starting parse\n"));
1271 yychar
= YYEMPTY
; /* Cause a token to be read. */
1274 /*------------------------------------------------------------.
1275 | yynewstate -- Push a new state, which is found in yystate. |
1276 `------------------------------------------------------------*/
1278 /* In all cases, when you get here, the value and location stacks
1279 have just been pushed. So pushing a state here evens the stacks. */
1285 if (yyss
+ yystacksize
- 1 <= yyssp
)
1287 /* Get the current used size of the three stacks, in elements. */
1288 YYSIZE_T yysize
= yyssp
- yyss
+ 1;
1292 /* Give user a chance to reallocate the stack. Use copies of
1293 these so that the &'s don't force the real ones into
1295 YYSTYPE
*yyvs1
= yyvs
;
1296 yytype_int16
*yyss1
= yyss
;
1298 /* Each stack pointer address is followed by the size of the
1299 data in use in that stack, in bytes. This used to be a
1300 conditional around just the two extra args, but that might
1301 be undefined if yyoverflow is a macro. */
1302 yyoverflow (YY_("memory exhausted"),
1303 &yyss1
, yysize
* sizeof (*yyssp
),
1304 &yyvs1
, yysize
* sizeof (*yyvsp
),
1310 #else /* no yyoverflow */
1311 # ifndef YYSTACK_RELOCATE
1312 goto yyexhaustedlab
;
1314 /* Extend the stack our own way. */
1315 if (YYMAXDEPTH
<= yystacksize
)
1316 goto yyexhaustedlab
;
1318 if (YYMAXDEPTH
< yystacksize
)
1319 yystacksize
= YYMAXDEPTH
;
1322 yytype_int16
*yyss1
= yyss
;
1323 union yyalloc
*yyptr
=
1324 (union yyalloc
*) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize
));
1326 goto yyexhaustedlab
;
1327 YYSTACK_RELOCATE (yyss_alloc
, yyss
);
1328 YYSTACK_RELOCATE (yyvs_alloc
, yyvs
);
1329 # undef YYSTACK_RELOCATE
1331 YYSTACK_FREE (yyss1
);
1334 #endif /* no yyoverflow */
1336 yyssp
= yyss
+ yysize
- 1;
1337 yyvsp
= yyvs
+ yysize
- 1;
1339 YYDPRINTF ((stderr
, "Stack size increased to %lu\n",
1340 (unsigned long int) yystacksize
));
1342 if (yyss
+ yystacksize
- 1 <= yyssp
)
1346 YYDPRINTF ((stderr
, "Entering state %d\n", yystate
));
1348 if (yystate
== YYFINAL
)
1358 /* Do appropriate processing given the current state. Read a
1359 lookahead token if we need one and don't already have one. */
1361 /* First try to decide what to do without reference to lookahead token. */
1362 yyn
= yypact
[yystate
];
1363 if (yypact_value_is_default (yyn
))
1366 /* Not known => get a lookahead token if don't already have one. */
1368 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1369 if (yychar
== YYEMPTY
)
1371 YYDPRINTF ((stderr
, "Reading a token: "));
1372 yychar
= yylex (&yylval
, info
);
1375 if (yychar
<= YYEOF
)
1377 yychar
= yytoken
= YYEOF
;
1378 YYDPRINTF ((stderr
, "Now at end of input.\n"));
1382 yytoken
= YYTRANSLATE (yychar
);
1383 YY_SYMBOL_PRINT ("Next token is", yytoken
, &yylval
, &yylloc
);
1386 /* If the proper action on seeing token YYTOKEN is to reduce or to
1387 detect an error, take that action. */
1389 if (yyn
< 0 || YYLAST
< yyn
|| yycheck
[yyn
] != yytoken
)
1394 if (yytable_value_is_error (yyn
))
1400 /* Count tokens shifted since error; after three, turn off error
1405 /* Shift the lookahead token. */
1406 YY_SYMBOL_PRINT ("Shifting", yytoken
, &yylval
, &yylloc
);
1408 /* Discard the shifted token. */
1412 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1414 YY_IGNORE_MAYBE_UNINITIALIZED_END
1419 /*-----------------------------------------------------------.
1420 | yydefault -- do the default action for the current state. |
1421 `-----------------------------------------------------------*/
1423 yyn
= yydefact
[yystate
];
1429 /*-----------------------------.
1430 | yyreduce -- Do a reduction. |
1431 `-----------------------------*/
1433 /* yyn is the number of a rule to reduce with. */
1436 /* If YYLEN is nonzero, implement the default value of the action:
1439 Otherwise, the following line sets YYVAL to garbage.
1440 This behavior is undocumented and Bison
1441 users should not rely upon it. Assigning to YYVAL
1442 unconditionally makes the parser a bit smaller, and it avoids a
1443 GCC warning that YYVAL may be used uninitialized. */
1444 yyval
= yyvsp
[1-yylen
];
1447 YY_REDUCE_PRINT (yyn
);
1451 #line 118 "sql.y" /* yacc.c:1646 */
1453 SQL_input
* sql
= (SQL_input
*) info
;
1454 *sql
->view
= (yyvsp
[0].query
);
1456 #line 1469 "sql.tab.c" /* yacc.c:1646 */
1460 #line 136 "sql.y" /* yacc.c:1646 */
1462 SQL_input
*sql
= (SQL_input
*) info
;
1463 MSIVIEW
*insert
= NULL
;
1465 INSERT_CreateView( sql
->db
, &insert
, (yyvsp
[-7].string
), (yyvsp
[-5].column_list
), (yyvsp
[-1].column_list
), FALSE
);
1469 PARSER_BUBBLE_UP_VIEW( sql
, (yyval
.query
), insert
);
1471 #line 1484 "sql.tab.c" /* yacc.c:1646 */
1475 #line 147 "sql.y" /* yacc.c:1646 */
1477 SQL_input
*sql
= (SQL_input
*) info
;
1478 MSIVIEW
*insert
= NULL
;
1480 INSERT_CreateView( sql
->db
, &insert
, (yyvsp
[-8].string
), (yyvsp
[-6].column_list
), (yyvsp
[-2].column_list
), TRUE
);
1484 PARSER_BUBBLE_UP_VIEW( sql
, (yyval
.query
), insert
);
1486 #line 1499 "sql.tab.c" /* yacc.c:1646 */
1490 #line 161 "sql.y" /* yacc.c:1646 */
1492 SQL_input
* sql
= (SQL_input
*) info
;
1493 MSIVIEW
*create
= NULL
;
1496 if( !(yyvsp
[-1].column_list
) )
1498 r
= CREATE_CreateView( sql
->db
, &create
, (yyvsp
[-3].string
), (yyvsp
[-1].column_list
), FALSE
);
1505 PARSER_BUBBLE_UP_VIEW( sql
, (yyval
.query
), create
);
1507 #line 1520 "sql.tab.c" /* yacc.c:1646 */
1511 #line 178 "sql.y" /* yacc.c:1646 */
1513 SQL_input
* sql
= (SQL_input
*) info
;
1514 MSIVIEW
*create
= NULL
;
1516 if( !(yyvsp
[-2].column_list
) )
1518 CREATE_CreateView( sql
->db
, &create
, (yyvsp
[-4].string
), (yyvsp
[-2].column_list
), TRUE
);
1522 PARSER_BUBBLE_UP_VIEW( sql
, (yyval
.query
), create
);
1524 #line 1537 "sql.tab.c" /* yacc.c:1646 */
1528 #line 194 "sql.y" /* yacc.c:1646 */
1530 SQL_input
* sql
= (SQL_input
*) info
;
1531 MSIVIEW
*update
= NULL
;
1533 UPDATE_CreateView( sql
->db
, &update
, (yyvsp
[-4].string
), (yyvsp
[-2].column_list
), (yyvsp
[0].expr
) );
1537 PARSER_BUBBLE_UP_VIEW( sql
, (yyval
.query
), update
);
1539 #line 1552 "sql.tab.c" /* yacc.c:1646 */
1543 #line 205 "sql.y" /* yacc.c:1646 */
1545 SQL_input
* sql
= (SQL_input
*) info
;
1546 MSIVIEW
*update
= NULL
;
1548 UPDATE_CreateView( sql
->db
, &update
, (yyvsp
[-2].string
), (yyvsp
[0].column_list
), NULL
);
1552 PARSER_BUBBLE_UP_VIEW( sql
, (yyval
.query
), update
);
1554 #line 1567 "sql.tab.c" /* yacc.c:1646 */
1558 #line 219 "sql.y" /* yacc.c:1646 */
1560 SQL_input
* sql
= (SQL_input
*) info
;
1561 MSIVIEW
*delete = NULL
;
1563 DELETE_CreateView( sql
->db
, &delete, (yyvsp
[0].query
) );
1567 PARSER_BUBBLE_UP_VIEW( sql
, (yyval
.query
), delete );
1569 #line 1582 "sql.tab.c" /* yacc.c:1646 */
1573 #line 233 "sql.y" /* yacc.c:1646 */
1575 SQL_input
* sql
= (SQL_input
*) info
;
1576 MSIVIEW
*alter
= NULL
;
1578 ALTER_CreateView( sql
->db
, &alter
, (yyvsp
[-1].string
), NULL
, (yyvsp
[0].integer
) );
1582 PARSER_BUBBLE_UP_VIEW( sql
, (yyval
.query
), alter
);
1584 #line 1597 "sql.tab.c" /* yacc.c:1646 */
1588 #line 244 "sql.y" /* yacc.c:1646 */
1590 SQL_input
*sql
= (SQL_input
*)info
;
1591 MSIVIEW
*alter
= NULL
;
1593 ALTER_CreateView( sql
->db
, &alter
, (yyvsp
[-2].string
), (yyvsp
[0].column_list
), 0 );
1597 PARSER_BUBBLE_UP_VIEW( sql
, (yyval
.query
), alter
);
1599 #line 1612 "sql.tab.c" /* yacc.c:1646 */
1603 #line 255 "sql.y" /* yacc.c:1646 */
1605 SQL_input
*sql
= (SQL_input
*)info
;
1606 MSIVIEW
*alter
= NULL
;
1608 ALTER_CreateView( sql
->db
, &alter
, (yyvsp
[-3].string
), (yyvsp
[-1].column_list
), 1 );
1612 PARSER_BUBBLE_UP_VIEW( sql
, (yyval
.query
), alter
);
1614 #line 1627 "sql.tab.c" /* yacc.c:1646 */
1618 #line 269 "sql.y" /* yacc.c:1646 */
1620 (yyval
.integer
) = 1;
1622 #line 1635 "sql.tab.c" /* yacc.c:1646 */
1626 #line 273 "sql.y" /* yacc.c:1646 */
1628 (yyval
.integer
) = -1;
1630 #line 1643 "sql.tab.c" /* yacc.c:1646 */
1634 #line 280 "sql.y" /* yacc.c:1646 */
1636 SQL_input
* sql
= (SQL_input
*) info
;
1637 MSIVIEW
* drop
= NULL
;
1640 r
= DROP_CreateView( sql
->db
, &drop
, (yyvsp
[0].string
) );
1641 if( r
!= ERROR_SUCCESS
|| !(yyval
.query
) )
1644 PARSER_BUBBLE_UP_VIEW( sql
, (yyval
.query
), drop
);
1646 #line 1659 "sql.tab.c" /* yacc.c:1646 */
1650 #line 295 "sql.y" /* yacc.c:1646 */
1652 if( SQL_MarkPrimaryKeys( &(yyvsp
[-3].column_list
), (yyvsp
[0].column_list
) ) )
1653 (yyval
.column_list
) = (yyvsp
[-3].column_list
);
1655 (yyval
.column_list
) = NULL
;
1657 #line 1670 "sql.tab.c" /* yacc.c:1646 */
1661 #line 305 "sql.y" /* yacc.c:1646 */
1665 for( ci
= (yyvsp
[-2].column_list
); ci
->next
; ci
= ci
->next
)
1668 ci
->next
= (yyvsp
[0].column_list
);
1669 (yyval
.column_list
) = (yyvsp
[-2].column_list
);
1671 #line 1684 "sql.tab.c" /* yacc.c:1646 */
1675 #line 315 "sql.y" /* yacc.c:1646 */
1677 (yyval
.column_list
) = (yyvsp
[0].column_list
);
1679 #line 1692 "sql.tab.c" /* yacc.c:1646 */
1683 #line 322 "sql.y" /* yacc.c:1646 */
1685 (yyval
.column_list
) = (yyvsp
[-1].column_list
);
1686 (yyval
.column_list
)->type
= ((yyvsp
[0].column_type
) | MSITYPE_VALID
);
1687 (yyval
.column_list
)->temporary
= (yyvsp
[0].column_type
) & MSITYPE_TEMPORARY
? TRUE
: FALSE
;
1689 #line 1702 "sql.tab.c" /* yacc.c:1646 */
1693 #line 331 "sql.y" /* yacc.c:1646 */
1695 (yyval
.column_type
) = (yyvsp
[0].column_type
);
1697 #line 1710 "sql.tab.c" /* yacc.c:1646 */
1701 #line 335 "sql.y" /* yacc.c:1646 */
1703 (yyval
.column_type
) = (yyvsp
[-1].column_type
) | MSITYPE_LOCALIZABLE
;
1705 #line 1718 "sql.tab.c" /* yacc.c:1646 */
1709 #line 339 "sql.y" /* yacc.c:1646 */
1711 (yyval
.column_type
) = (yyvsp
[-1].column_type
) | MSITYPE_TEMPORARY
;
1713 #line 1726 "sql.tab.c" /* yacc.c:1646 */
1717 #line 346 "sql.y" /* yacc.c:1646 */
1719 (yyval
.column_type
) |= MSITYPE_NULLABLE
;
1721 #line 1734 "sql.tab.c" /* yacc.c:1646 */
1725 #line 350 "sql.y" /* yacc.c:1646 */
1727 (yyval
.column_type
) = (yyvsp
[-2].column_type
);
1729 #line 1742 "sql.tab.c" /* yacc.c:1646 */
1733 #line 357 "sql.y" /* yacc.c:1646 */
1735 (yyval
.column_type
) = MSITYPE_STRING
| 1;
1737 #line 1750 "sql.tab.c" /* yacc.c:1646 */
1741 #line 361 "sql.y" /* yacc.c:1646 */
1743 (yyval
.column_type
) = MSITYPE_STRING
| 0x400 | (yyvsp
[-1].column_type
);
1745 #line 1758 "sql.tab.c" /* yacc.c:1646 */
1749 #line 365 "sql.y" /* yacc.c:1646 */
1751 (yyval
.column_type
) = MSITYPE_STRING
| 0x400;
1753 #line 1766 "sql.tab.c" /* yacc.c:1646 */
1757 #line 369 "sql.y" /* yacc.c:1646 */
1759 (yyval
.column_type
) = 2 | 0x400;
1761 #line 1774 "sql.tab.c" /* yacc.c:1646 */
1765 #line 373 "sql.y" /* yacc.c:1646 */
1767 (yyval
.column_type
) = 2 | 0x400;
1769 #line 1782 "sql.tab.c" /* yacc.c:1646 */
1773 #line 377 "sql.y" /* yacc.c:1646 */
1775 (yyval
.column_type
) = 4;
1777 #line 1790 "sql.tab.c" /* yacc.c:1646 */
1781 #line 381 "sql.y" /* yacc.c:1646 */
1783 (yyval
.column_type
) = MSITYPE_STRING
| MSITYPE_VALID
;
1785 #line 1798 "sql.tab.c" /* yacc.c:1646 */
1789 #line 388 "sql.y" /* yacc.c:1646 */
1791 if( ( (yyvsp
[0].integer
) > 255 ) || ( (yyvsp
[0].integer
) < 0 ) )
1793 (yyval
.column_type
) = (yyvsp
[0].integer
);
1795 #line 1808 "sql.tab.c" /* yacc.c:1646 */
1799 #line 397 "sql.y" /* yacc.c:1646 */
1801 (yyval
.query
) = (yyvsp
[0].query
);
1803 #line 1816 "sql.tab.c" /* yacc.c:1646 */
1807 #line 401 "sql.y" /* yacc.c:1646 */
1809 SQL_input
* sql
= (SQL_input
*) info
;
1810 MSIVIEW
* distinct
= NULL
;
1813 r
= DISTINCT_CreateView( sql
->db
, &distinct
, (yyvsp
[0].query
) );
1814 if (r
!= ERROR_SUCCESS
)
1817 PARSER_BUBBLE_UP_VIEW( sql
, (yyval
.query
), distinct
);
1819 #line 1832 "sql.tab.c" /* yacc.c:1646 */
1823 #line 416 "sql.y" /* yacc.c:1646 */
1825 SQL_input
* sql
= (SQL_input
*) info
;
1826 MSIVIEW
* select
= NULL
;
1829 if( (yyvsp
[-1].column_list
) )
1831 r
= SELECT_CreateView( sql
->db
, &select
, (yyvsp
[0].query
), (yyvsp
[-1].column_list
) );
1832 if (r
!= ERROR_SUCCESS
)
1835 PARSER_BUBBLE_UP_VIEW( sql
, (yyval
.query
), select
);
1838 (yyval
.query
) = (yyvsp
[0].query
);
1840 #line 1853 "sql.tab.c" /* yacc.c:1646 */
1844 #line 437 "sql.y" /* yacc.c:1646 */
1846 (yyvsp
[-2].column_list
)->next
= (yyvsp
[0].column_list
);
1848 #line 1861 "sql.tab.c" /* yacc.c:1646 */
1852 #line 441 "sql.y" /* yacc.c:1646 */
1854 (yyval
.column_list
) = NULL
;
1856 #line 1869 "sql.tab.c" /* yacc.c:1646 */
1860 #line 449 "sql.y" /* yacc.c:1646 */
1862 (yyvsp
[-2].column_list
)->next
= (yyvsp
[0].column_list
);
1864 #line 1877 "sql.tab.c" /* yacc.c:1646 */
1868 #line 453 "sql.y" /* yacc.c:1646 */
1870 (yyval
.column_list
) = NULL
;
1872 #line 1885 "sql.tab.c" /* yacc.c:1646 */
1876 #line 460 "sql.y" /* yacc.c:1646 */
1878 SQL_input
* sql
= (SQL_input
*) info
;
1879 MSIVIEW
* table
= NULL
;
1882 r
= TABLE_CreateView( sql
->db
, (yyvsp
[0].string
), &table
);
1883 if( r
!= ERROR_SUCCESS
|| !(yyval
.query
) )
1886 PARSER_BUBBLE_UP_VIEW( sql
, (yyval
.query
), table
);
1888 #line 1901 "sql.tab.c" /* yacc.c:1646 */
1892 #line 472 "sql.y" /* yacc.c:1646 */
1896 if( (yyvsp
[0].column_list
) )
1898 r
= (yyvsp
[-3].query
)->ops
->sort( (yyvsp
[-3].query
), (yyvsp
[0].column_list
) );
1899 if ( r
!= ERROR_SUCCESS
)
1903 (yyval
.query
) = (yyvsp
[-3].query
);
1905 #line 1918 "sql.tab.c" /* yacc.c:1646 */
1909 #line 489 "sql.y" /* yacc.c:1646 */
1911 SQL_input
* sql
= (SQL_input
*) info
;
1912 MSIVIEW
* where
= NULL
;
1915 r
= WHERE_CreateView( sql
->db
, &where
, (yyvsp
[0].string
), NULL
);
1916 if( r
!= ERROR_SUCCESS
)
1919 PARSER_BUBBLE_UP_VIEW( sql
, (yyval
.query
), where
);
1921 #line 1934 "sql.tab.c" /* yacc.c:1646 */
1925 #line 501 "sql.y" /* yacc.c:1646 */
1927 SQL_input
* sql
= (SQL_input
*) info
;
1928 MSIVIEW
* where
= NULL
;
1931 r
= WHERE_CreateView( sql
->db
, &where
, (yyvsp
[-2].string
), (yyvsp
[0].expr
) );
1932 if( r
!= ERROR_SUCCESS
)
1935 PARSER_BUBBLE_UP_VIEW( sql
, (yyval
.query
), where
);
1937 #line 1950 "sql.tab.c" /* yacc.c:1646 */
1941 #line 516 "sql.y" /* yacc.c:1646 */
1943 (yyval
.string
) = (yyvsp
[0].string
);
1945 #line 1958 "sql.tab.c" /* yacc.c:1646 */
1949 #line 520 "sql.y" /* yacc.c:1646 */
1951 (yyval
.string
) = parser_add_table( info
, (yyvsp
[0].string
), (yyvsp
[-2].string
) );
1952 if (!(yyval
.string
))
1955 #line 1968 "sql.tab.c" /* yacc.c:1646 */
1959 #line 529 "sql.y" /* yacc.c:1646 */
1961 (yyval
.expr
) = (yyvsp
[-1].expr
);
1965 #line 1978 "sql.tab.c" /* yacc.c:1646 */
1969 #line 535 "sql.y" /* yacc.c:1646 */
1971 (yyval
.expr
) = EXPR_complex( info
, (yyvsp
[-2].expr
), OP_AND
, (yyvsp
[0].expr
) );
1975 #line 1988 "sql.tab.c" /* yacc.c:1646 */
1979 #line 541 "sql.y" /* yacc.c:1646 */
1981 (yyval
.expr
) = EXPR_complex( info
, (yyvsp
[-2].expr
), OP_OR
, (yyvsp
[0].expr
) );
1985 #line 1998 "sql.tab.c" /* yacc.c:1646 */
1989 #line 547 "sql.y" /* yacc.c:1646 */
1991 (yyval
.expr
) = EXPR_complex( info
, (yyvsp
[-2].expr
), OP_EQ
, (yyvsp
[0].expr
) );
1995 #line 2008 "sql.tab.c" /* yacc.c:1646 */
1999 #line 553 "sql.y" /* yacc.c:1646 */
2001 (yyval
.expr
) = EXPR_complex( info
, (yyvsp
[-2].expr
), OP_GT
, (yyvsp
[0].expr
) );
2005 #line 2018 "sql.tab.c" /* yacc.c:1646 */
2009 #line 559 "sql.y" /* yacc.c:1646 */
2011 (yyval
.expr
) = EXPR_complex( info
, (yyvsp
[-2].expr
), OP_LT
, (yyvsp
[0].expr
) );
2015 #line 2028 "sql.tab.c" /* yacc.c:1646 */
2019 #line 565 "sql.y" /* yacc.c:1646 */
2021 (yyval
.expr
) = EXPR_complex( info
, (yyvsp
[-2].expr
), OP_LE
, (yyvsp
[0].expr
) );
2025 #line 2038 "sql.tab.c" /* yacc.c:1646 */
2029 #line 571 "sql.y" /* yacc.c:1646 */
2031 (yyval
.expr
) = EXPR_complex( info
, (yyvsp
[-2].expr
), OP_GE
, (yyvsp
[0].expr
) );
2035 #line 2048 "sql.tab.c" /* yacc.c:1646 */
2039 #line 577 "sql.y" /* yacc.c:1646 */
2041 (yyval
.expr
) = EXPR_complex( info
, (yyvsp
[-2].expr
), OP_NE
, (yyvsp
[0].expr
) );
2045 #line 2058 "sql.tab.c" /* yacc.c:1646 */
2049 #line 583 "sql.y" /* yacc.c:1646 */
2051 (yyval
.expr
) = EXPR_unary( info
, (yyvsp
[-2].expr
), OP_ISNULL
);
2055 #line 2068 "sql.tab.c" /* yacc.c:1646 */
2059 #line 589 "sql.y" /* yacc.c:1646 */
2061 (yyval
.expr
) = EXPR_unary( info
, (yyvsp
[-3].expr
), OP_NOTNULL
);
2065 #line 2078 "sql.tab.c" /* yacc.c:1646 */
2069 #line 603 "sql.y" /* yacc.c:1646 */
2071 (yyval
.column_list
) = parser_alloc_column( info
, NULL
, NULL
);
2072 if( !(yyval
.column_list
) )
2074 (yyval
.column_list
)->val
= (yyvsp
[0].expr
);
2076 #line 2089 "sql.tab.c" /* yacc.c:1646 */
2080 #line 610 "sql.y" /* yacc.c:1646 */
2082 (yyval
.column_list
) = parser_alloc_column( info
, NULL
, NULL
);
2083 if( !(yyval
.column_list
) )
2085 (yyval
.column_list
)->val
= (yyvsp
[-2].expr
);
2086 (yyval
.column_list
)->next
= (yyvsp
[0].column_list
);
2088 #line 2101 "sql.tab.c" /* yacc.c:1646 */
2092 #line 622 "sql.y" /* yacc.c:1646 */
2094 (yyval
.column_list
) = (yyvsp
[-2].column_list
);
2095 (yyval
.column_list
)->next
= (yyvsp
[0].column_list
);
2097 #line 2110 "sql.tab.c" /* yacc.c:1646 */
2101 #line 630 "sql.y" /* yacc.c:1646 */
2103 (yyval
.column_list
) = (yyvsp
[-2].column_list
);
2104 (yyval
.column_list
)->val
= (yyvsp
[0].expr
);
2106 #line 2119 "sql.tab.c" /* yacc.c:1646 */
2110 #line 638 "sql.y" /* yacc.c:1646 */
2112 (yyval
.expr
) = EXPR_ival( info
, (yyvsp
[0].integer
) );
2116 #line 2129 "sql.tab.c" /* yacc.c:1646 */
2120 #line 644 "sql.y" /* yacc.c:1646 */
2122 (yyval
.expr
) = EXPR_ival( info
, -(yyvsp
[0].integer
) );
2126 #line 2139 "sql.tab.c" /* yacc.c:1646 */
2130 #line 650 "sql.y" /* yacc.c:1646 */
2132 (yyval
.expr
) = EXPR_sval( info
, &(yyvsp
[0].str
) );
2136 #line 2149 "sql.tab.c" /* yacc.c:1646 */
2140 #line 656 "sql.y" /* yacc.c:1646 */
2142 (yyval
.expr
) = EXPR_wildcard( info
);
2146 #line 2159 "sql.tab.c" /* yacc.c:1646 */
2150 #line 665 "sql.y" /* yacc.c:1646 */
2152 (yyval
.expr
) = EXPR_column( info
, (yyvsp
[0].column_list
) );
2156 #line 2169 "sql.tab.c" /* yacc.c:1646 */
2160 #line 674 "sql.y" /* yacc.c:1646 */
2162 (yyval
.column_list
) = parser_alloc_column( info
, (yyvsp
[-2].string
), (yyvsp
[0].string
) );
2163 if( !(yyval
.column_list
) )
2166 #line 2179 "sql.tab.c" /* yacc.c:1646 */
2170 #line 680 "sql.y" /* yacc.c:1646 */
2172 (yyval
.column_list
) = parser_alloc_column( info
, NULL
, (yyvsp
[0].string
) );
2173 if( !(yyval
.column_list
) )
2176 #line 2189 "sql.tab.c" /* yacc.c:1646 */
2180 #line 689 "sql.y" /* yacc.c:1646 */
2182 (yyval
.column_list
) = parser_alloc_column( info
, (yyvsp
[-2].string
), (yyvsp
[0].string
) );
2183 if( !(yyval
.column_list
) )
2186 #line 2199 "sql.tab.c" /* yacc.c:1646 */
2190 #line 695 "sql.y" /* yacc.c:1646 */
2192 (yyval
.column_list
) = parser_alloc_column( info
, NULL
, (yyvsp
[0].string
) );
2193 if( !(yyval
.column_list
) )
2196 #line 2209 "sql.tab.c" /* yacc.c:1646 */
2200 #line 701 "sql.y" /* yacc.c:1646 */
2202 (yyval
.column_list
) = parser_alloc_column( info
, NULL
, (yyvsp
[0].string
) );
2203 if( !(yyval
.column_list
) )
2206 #line 2219 "sql.tab.c" /* yacc.c:1646 */
2210 #line 710 "sql.y" /* yacc.c:1646 */
2212 (yyval
.string
) = (yyvsp
[0].string
);
2214 #line 2227 "sql.tab.c" /* yacc.c:1646 */
2218 #line 717 "sql.y" /* yacc.c:1646 */
2220 if ( SQL_getstring( info
, &(yyvsp
[0].str
), &(yyval
.string
) ) != ERROR_SUCCESS
|| !(yyval
.string
) )
2223 #line 2236 "sql.tab.c" /* yacc.c:1646 */
2227 #line 725 "sql.y" /* yacc.c:1646 */
2229 if ( SQL_getstring( info
, &(yyvsp
[0].str
), &(yyval
.string
) ) != ERROR_SUCCESS
|| !(yyval
.string
) )
2232 #line 2245 "sql.tab.c" /* yacc.c:1646 */
2236 #line 733 "sql.y" /* yacc.c:1646 */
2238 (yyval
.integer
) = SQL_getint( info
);
2240 #line 2253 "sql.tab.c" /* yacc.c:1646 */
2244 #line 2257 "sql.tab.c" /* yacc.c:1646 */
2247 /* User semantic actions sometimes alter yychar, and that requires
2248 that yytoken be updated with the new translation. We take the
2249 approach of translating immediately before every use of yytoken.
2250 One alternative is translating here after every semantic action,
2251 but that translation would be missed if the semantic action invokes
2252 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
2253 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
2254 incorrect destructor might then be invoked immediately. In the
2255 case of YYERROR or YYBACKUP, subsequent parser actions might lead
2256 to an incorrect destructor call or verbose syntax error message
2257 before the lookahead is translated. */
2258 YY_SYMBOL_PRINT ("-> $$ =", yyr1
[yyn
], &yyval
, &yyloc
);
2262 YY_STACK_PRINT (yyss
, yyssp
);
2266 /* Now 'shift' the result of the reduction. Determine what state
2267 that goes to, based on the state we popped back to and the rule
2268 number reduced by. */
2272 yystate
= yypgoto
[yyn
- YYNTOKENS
] + *yyssp
;
2273 if (0 <= yystate
&& yystate
<= YYLAST
&& yycheck
[yystate
] == *yyssp
)
2274 yystate
= yytable
[yystate
];
2276 yystate
= yydefgoto
[yyn
- YYNTOKENS
];
2281 /*--------------------------------------.
2282 | yyerrlab -- here on detecting error. |
2283 `--------------------------------------*/
2285 /* Make sure we have latest lookahead translation. See comments at
2286 user semantic actions for why this is necessary. */
2287 yytoken
= yychar
== YYEMPTY
? YYEMPTY
: YYTRANSLATE (yychar
);
2289 /* If not already recovering from an error, report this error. */
2293 #if ! YYERROR_VERBOSE
2294 yyerror (info
, YY_("syntax error"));
2296 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
2299 char const *yymsgp
= YY_("syntax error");
2300 int yysyntax_error_status
;
2301 yysyntax_error_status
= YYSYNTAX_ERROR
;
2302 if (yysyntax_error_status
== 0)
2304 else if (yysyntax_error_status
== 1)
2306 if (yymsg
!= yymsgbuf
)
2307 YYSTACK_FREE (yymsg
);
2308 yymsg
= (char *) YYSTACK_ALLOC (yymsg_alloc
);
2312 yymsg_alloc
= sizeof yymsgbuf
;
2313 yysyntax_error_status
= 2;
2317 yysyntax_error_status
= YYSYNTAX_ERROR
;
2321 yyerror (info
, yymsgp
);
2322 if (yysyntax_error_status
== 2)
2323 goto yyexhaustedlab
;
2325 # undef YYSYNTAX_ERROR
2331 if (yyerrstatus
== 3)
2333 /* If just tried and failed to reuse lookahead token after an
2334 error, discard it. */
2336 if (yychar
<= YYEOF
)
2338 /* Return failure if at end of input. */
2339 if (yychar
== YYEOF
)
2344 yydestruct ("Error: discarding",
2345 yytoken
, &yylval
, info
);
2350 /* Else will try to reuse lookahead token after shifting the error
2355 /*---------------------------------------------------.
2356 | yyerrorlab -- error raised explicitly by YYERROR. |
2357 `---------------------------------------------------*/
2360 /* Pacify compilers like GCC when the user code never invokes
2361 YYERROR and the label yyerrorlab therefore never appears in user
2363 if (/*CONSTCOND*/ 0)
2366 /* Do not reclaim the symbols of the rule whose action triggered
2370 YY_STACK_PRINT (yyss
, yyssp
);
2375 /*-------------------------------------------------------------.
2376 | yyerrlab1 -- common code for both syntax error and YYERROR. |
2377 `-------------------------------------------------------------*/
2379 yyerrstatus
= 3; /* Each real token shifted decrements this. */
2383 yyn
= yypact
[yystate
];
2384 if (!yypact_value_is_default (yyn
))
2387 if (0 <= yyn
&& yyn
<= YYLAST
&& yycheck
[yyn
] == YYTERROR
)
2395 /* Pop the current state because it cannot handle the error token. */
2400 yydestruct ("Error: popping",
2401 yystos
[yystate
], yyvsp
, info
);
2404 YY_STACK_PRINT (yyss
, yyssp
);
2407 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
2409 YY_IGNORE_MAYBE_UNINITIALIZED_END
2412 /* Shift the error token. */
2413 YY_SYMBOL_PRINT ("Shifting", yystos
[yyn
], yyvsp
, yylsp
);
2419 /*-------------------------------------.
2420 | yyacceptlab -- YYACCEPT comes here. |
2421 `-------------------------------------*/
2426 /*-----------------------------------.
2427 | yyabortlab -- YYABORT comes here. |
2428 `-----------------------------------*/
2433 #if !defined yyoverflow || YYERROR_VERBOSE
2434 /*-------------------------------------------------.
2435 | yyexhaustedlab -- memory exhaustion comes here. |
2436 `-------------------------------------------------*/
2438 yyerror (info
, YY_("memory exhausted"));
2444 if (yychar
!= YYEMPTY
)
2446 /* Make sure we have latest lookahead translation. See comments at
2447 user semantic actions for why this is necessary. */
2448 yytoken
= YYTRANSLATE (yychar
);
2449 yydestruct ("Cleanup: discarding lookahead",
2450 yytoken
, &yylval
, info
);
2452 /* Do not reclaim the symbols of the rule whose action triggered
2453 this YYABORT or YYACCEPT. */
2455 YY_STACK_PRINT (yyss
, yyssp
);
2456 while (yyssp
!= yyss
)
2458 yydestruct ("Cleanup: popping",
2459 yystos
[*yyssp
], yyvsp
, info
);
2464 YYSTACK_FREE (yyss
);
2467 if (yymsg
!= yymsgbuf
)
2468 YYSTACK_FREE (yymsg
);
2472 #line 738 "sql.y" /* yacc.c:1906 */
2475 static LPWSTR
parser_add_table( void *info
, LPCWSTR list
, LPCWSTR table
)
2477 static const WCHAR space
[] = {' ',0};
2478 DWORD len
= strlenW( list
) + strlenW( table
) + 2;
2481 ret
= parser_alloc( info
, len
* sizeof(WCHAR
) );
2484 strcpyW( ret
, list
);
2485 strcatW( ret
, space
);
2486 strcatW( ret
, table
);
2491 static void *parser_alloc( void *info
, unsigned int sz
)
2493 SQL_input
* sql
= (SQL_input
*) info
;
2496 mem
= msi_alloc( sizeof (struct list
) + sz
);
2497 list_add_tail( sql
->mem
, mem
);
2501 static column_info
*parser_alloc_column( void *info
, LPCWSTR table
, LPCWSTR column
)
2505 col
= parser_alloc( info
, sizeof (*col
) );
2509 col
->column
= column
;
2518 static int sql_lex( void *SQL_lval
, SQL_input
*sql
)
2521 struct sql_str
* str
= SQL_lval
;
2526 if( ! sql
->command
[sql
->n
] )
2527 return 0; /* end of input */
2529 /* TRACE("string : %s\n", debugstr_w(&sql->command[sql->n])); */
2530 sql
->len
= sqliteGetToken( &sql
->command
[sql
->n
], &token
, &skip
);
2533 str
->data
= &sql
->command
[sql
->n
];
2534 str
->len
= sql
->len
;
2537 while( token
== TK_SPACE
);
2539 /* TRACE("token : %d (%s)\n", token, debugstr_wn(&sql->command[sql->n], sql->len)); */
2544 UINT
SQL_getstring( void *info
, const struct sql_str
*strdata
, LPWSTR
*str
)
2546 LPCWSTR p
= strdata
->data
;
2547 UINT len
= strdata
->len
;
2550 if( ( (p
[0]=='`') && (p
[len
-1]!='`') ) ||
2551 ( (p
[0]=='\'') && (p
[len
-1]!='\'') ) )
2552 return ERROR_FUNCTION_FAILED
;
2554 /* if there are quotes, remove them */
2555 if( ( (p
[0]=='`') && (p
[len
-1]=='`') ) ||
2556 ( (p
[0]=='\'') && (p
[len
-1]=='\'') ) )
2561 *str
= parser_alloc( info
, (len
+ 1)*sizeof(WCHAR
) );
2563 return ERROR_OUTOFMEMORY
;
2564 memcpy( *str
, p
, len
*sizeof(WCHAR
) );
2567 return ERROR_SUCCESS
;
2570 INT
SQL_getint( void *info
)
2572 SQL_input
* sql
= (SQL_input
*) info
;
2573 LPCWSTR p
= &sql
->command
[sql
->n
];
2576 for( i
=0; i
<sql
->len
; i
++ )
2578 if( '0' > p
[i
] || '9' < p
[i
] )
2580 ERR("should only be numbers here!\n");
2583 r
= (p
[i
]-'0') + r
*10;
2589 static int sql_error( SQL_input
*info
, const char *str
)
2594 static struct expr
* EXPR_wildcard( void *info
)
2596 struct expr
*e
= parser_alloc( info
, sizeof *e
);
2599 e
->type
= EXPR_WILDCARD
;
2604 static struct expr
* EXPR_complex( void *info
, struct expr
*l
, UINT op
, struct expr
*r
)
2606 struct expr
*e
= parser_alloc( info
, sizeof *e
);
2609 e
->type
= EXPR_COMPLEX
;
2612 e
->u
.expr
.right
= r
;
2617 static struct expr
* EXPR_unary( void *info
, struct expr
*l
, UINT op
)
2619 struct expr
*e
= parser_alloc( info
, sizeof *e
);
2622 e
->type
= EXPR_UNARY
;
2625 e
->u
.expr
.right
= NULL
;
2630 static struct expr
* EXPR_column( void *info
, const column_info
*column
)
2632 struct expr
*e
= parser_alloc( info
, sizeof *e
);
2635 e
->type
= EXPR_COLUMN
;
2636 e
->u
.column
.unparsed
.column
= column
->column
;
2637 e
->u
.column
.unparsed
.table
= column
->table
;
2642 static struct expr
* EXPR_ival( void *info
, int val
)
2644 struct expr
*e
= parser_alloc( info
, sizeof *e
);
2647 e
->type
= EXPR_IVAL
;
2653 static struct expr
* EXPR_sval( void *info
, const struct sql_str
*str
)
2655 struct expr
*e
= parser_alloc( info
, sizeof *e
);
2658 e
->type
= EXPR_SVAL
;
2659 if( SQL_getstring( info
, str
, (LPWSTR
*)&e
->u
.sval
) != ERROR_SUCCESS
)
2660 return NULL
; /* e will be freed by query destructor */
2665 static void swap_columns( column_info
**cols
, column_info
*A
, int idx
)
2667 column_info
*preA
= NULL
, *preB
= NULL
, *B
, *ptr
;
2679 if( ptr
->next
== A
)
2685 if( preB
) preB
->next
= A
;
2686 if( preA
) preA
->next
= B
;
2694 static BOOL
SQL_MarkPrimaryKeys( column_info
**cols
,
2701 for( k
= keys
, count
= 0; k
&& found
; k
= k
->next
, count
++ )
2707 for( c
= *cols
, idx
= 0; c
&& !found
; c
= c
->next
, idx
++ )
2709 if( strcmpW( k
->column
, c
->column
) )
2711 c
->type
|= MSITYPE_KEY
;
2714 swap_columns( cols
, c
, count
);
2721 UINT
MSI_ParseSQL( MSIDATABASE
*db
, LPCWSTR command
, MSIVIEW
**phview
,
2730 sql
.command
= command
;
2733 sql
.r
= ERROR_BAD_QUERY_SYNTAX
;
2737 r
= sql_parse(&sql
);
2739 TRACE("Parse returned %d\n", r
);
2744 (*sql
.view
)->ops
->delete(*sql
.view
);
2750 return ERROR_SUCCESS
;