Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygensql.tab.c
Go to the documentation of this file.
00001 00002 /* A Bison parser, made by GNU Bison 2.4.1. */ 00003 00004 /* Skeleton implementation for Bison's Yacc-like parsers in C 00005 00006 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 00007 Free Software Foundation, Inc. 00008 00009 This program is free software: you can redistribute it and/or modify 00010 it under the terms of the GNU General Public License as published by 00011 the Free Software Foundation, either version 3 of the License, or 00012 (at your option) any later version. 00013 00014 This program is distributed in the hope that it will be useful, 00015 but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00017 GNU General Public License for more details. 00018 00019 You should have received a copy of the GNU General Public License 00020 along with this program. If not, see <http://www.gnu.org/licenses/>. */ 00021 00022 /* As a special exception, you may create a larger work that contains 00023 part or all of the Bison parser skeleton and distribute that work 00024 under terms of your choice, so long as that work isn't itself a 00025 parser generator using the skeleton or a modified version thereof 00026 as a parser skeleton. Alternatively, if you modify or redistribute 00027 the parser skeleton itself, you may (at your option) remove this 00028 special exception, which will cause the skeleton and the resulting 00029 Bison output files to be licensed under the GNU General Public 00030 License without this special exception. 00031 00032 This special exception was added by the Free Software Foundation in 00033 version 2.2 of Bison. */ 00034 00035 /* C LALR(1) parser skeleton written by Richard Stallman, by 00036 simplifying the original so-called "semantic" parser. */ 00037 00038 /* All symbols defined below should begin with yy or YY, to avoid 00039 infringing on user name space. This should be done even for local 00040 variables, as they might otherwise be expanded by user macros. 00041 There are some unavoidable exceptions within include files to 00042 define necessary library symbols; they are noted "INFRINGES ON 00043 USER NAME SPACE" below. */ 00044 00045 /* Identify Bison output. */ 00046 #define YYBISON 1 00047 00048 /* Bison version. */ 00049 #define YYBISON_VERSION "2.4.1" 00050 00051 /* Skeleton name. */ 00052 #define YYSKELETON_NAME "yacc.c" 00053 00054 /* Pure parsers. */ 00055 #define YYPURE 1 00056 00057 /* Push parsers. */ 00058 #define YYPUSH 0 00059 00060 /* Pull parsers. */ 00061 #define YYPULL 1 00062 00063 /* Using locations. */ 00064 #define YYLSP_NEEDED 0 00065 00066 /* Substitute the variable and function names. */ 00067 #define yyparse sql_parse 00068 #define yylex sql_lex 00069 #define yyerror sql_error 00070 #define yylval sql_lval 00071 #define yychar sql_char 00072 #define yydebug sql_debug 00073 #define yynerrs sql_nerrs 00074 00075 /* Copy the first part of user declarations. */ 00076 00077 /* Line 189 of yacc.c */ 00078 #line 1 "sql.y" 00079 00080 00081 /* 00082 * Implementation of the Microsoft Installer (msi.dll) 00083 * 00084 * Copyright 2002-2004 Mike McCormack for CodeWeavers 00085 * 00086 * This library is free software; you can redistribute it and/or 00087 * modify it under the terms of the GNU Lesser General Public 00088 * License as published by the Free Software Foundation; either 00089 * version 2.1 of the License, or (at your option) any later version. 00090 * 00091 * This library is distributed in the hope that it will be useful, 00092 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00093 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00094 * Lesser General Public License for more details. 00095 * 00096 * You should have received a copy of the GNU Lesser General Public 00097 * License along with this library; if not, write to the Free Software 00098 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA 00099 */ 00100 00101 00102 #include "config.h" 00103 00104 #include <stdarg.h> 00105 #include <stdio.h> 00106 #include <stdlib.h> 00107 00108 #include "windef.h" 00109 #include "winbase.h" 00110 #include "query.h" 00111 #include "wine/list.h" 00112 #include "wine/debug.h" 00113 #include "wine/unicode.h" 00114 00115 #define YYLEX_PARAM info 00116 #define YYPARSE_PARAM info 00117 00118 static int sql_error(const char *str); 00119 00120 WINE_DEFAULT_DEBUG_CHANNEL(msi); 00121 00122 typedef struct tag_SQL_input 00123 { 00124 MSIDATABASE *db; 00125 LPCWSTR command; 00126 DWORD n, len; 00127 UINT r; 00128 MSIVIEW **view; /* View structure for the resulting query. This value 00129 * tracks the view currently being created so we can free 00130 * this view on syntax error. 00131 */ 00132 struct list *mem; 00133 } SQL_input; 00134 00135 static UINT SQL_getstring( void *info, const struct sql_str *strdata, LPWSTR *str ); 00136 static INT SQL_getint( void *info ); 00137 static int sql_lex( void *SQL_lval, SQL_input *info ); 00138 00139 static LPWSTR parser_add_table( void *info, LPCWSTR list, LPCWSTR table ); 00140 static void *parser_alloc( void *info, unsigned int sz ); 00141 static column_info *parser_alloc_column( void *info, LPCWSTR table, LPCWSTR column ); 00142 00143 static BOOL SQL_MarkPrimaryKeys( column_info **cols, column_info *keys); 00144 00145 static struct expr * EXPR_complex( void *info, struct expr *l, UINT op, struct expr *r ); 00146 static struct expr * EXPR_unary( void *info, struct expr *l, UINT op ); 00147 static struct expr * EXPR_column( void *info, const column_info *column ); 00148 static struct expr * EXPR_ival( void *info, int val ); 00149 static struct expr * EXPR_sval( void *info, const struct sql_str *str ); 00150 static struct expr * EXPR_wildcard( void *info ); 00151 00152 #define PARSER_BUBBLE_UP_VIEW( sql, result, current_view ) \ 00153 *sql->view = current_view; \ 00154 result = current_view 00155 00156 00157 00158 /* Line 189 of yacc.c */ 00159 #line 161 "sql.tab.c" 00160 00161 /* Enabling traces. */ 00162 #ifndef YYDEBUG 00163 # define YYDEBUG 0 00164 #endif 00165 00166 /* Enabling verbose error messages. */ 00167 #ifdef YYERROR_VERBOSE 00168 # undef YYERROR_VERBOSE 00169 # define YYERROR_VERBOSE 1 00170 #else 00171 # define YYERROR_VERBOSE 0 00172 #endif 00173 00174 /* Enabling the token table. */ 00175 #ifndef YYTOKEN_TABLE 00176 # define YYTOKEN_TABLE 0 00177 #endif 00178 00179 00180 /* Tokens. */ 00181 #ifndef YYTOKENTYPE 00182 # define YYTOKENTYPE 00183 /* Put the tokens into the symbol table, so that GDB and other debuggers 00184 know about them. */ 00185 enum yytokentype { 00186 TK_ALTER = 258, 00187 TK_AND = 259, 00188 TK_BY = 260, 00189 TK_CHAR = 261, 00190 TK_COMMA = 262, 00191 TK_CREATE = 263, 00192 TK_DELETE = 264, 00193 TK_DROP = 265, 00194 TK_DISTINCT = 266, 00195 TK_DOT = 267, 00196 TK_EQ = 268, 00197 TK_FREE = 269, 00198 TK_FROM = 270, 00199 TK_GE = 271, 00200 TK_GT = 272, 00201 TK_HOLD = 273, 00202 TK_ADD = 274, 00203 TK_ID = 275, 00204 TK_ILLEGAL = 276, 00205 TK_INSERT = 277, 00206 TK_INT = 278, 00207 TK_INTEGER = 279, 00208 TK_INTO = 280, 00209 TK_IS = 281, 00210 TK_KEY = 282, 00211 TK_LE = 283, 00212 TK_LONG = 284, 00213 TK_LONGCHAR = 285, 00214 TK_LP = 286, 00215 TK_LT = 287, 00216 TK_LOCALIZABLE = 288, 00217 TK_MINUS = 289, 00218 TK_NE = 290, 00219 TK_NOT = 291, 00220 TK_NULL = 292, 00221 TK_OBJECT = 293, 00222 TK_OR = 294, 00223 TK_ORDER = 295, 00224 TK_PRIMARY = 296, 00225 TK_RP = 297, 00226 TK_SELECT = 298, 00227 TK_SET = 299, 00228 TK_SHORT = 300, 00229 TK_SPACE = 301, 00230 TK_STAR = 302, 00231 TK_STRING = 303, 00232 TK_TABLE = 304, 00233 TK_TEMPORARY = 305, 00234 TK_UPDATE = 306, 00235 TK_VALUES = 307, 00236 TK_WHERE = 308, 00237 TK_WILDCARD = 309, 00238 COLUMN = 311, 00239 FUNCTION = 312, 00240 COMMENT = 313, 00241 UNCLOSED_STRING = 314, 00242 SPACE = 315, 00243 ILLEGAL = 316, 00244 END_OF_FILE = 317, 00245 TK_LIKE = 318, 00246 TK_NEGATION = 319 00247 }; 00248 #endif 00249 00250 00251 00252 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED 00253 typedef union YYSTYPE 00254 { 00255 00256 /* Line 214 of yacc.c */ 00257 #line 83 "sql.y" 00258 00259 struct sql_str str; 00260 LPWSTR string; 00261 column_info *column_list; 00262 MSIVIEW *query; 00263 struct expr *expr; 00264 USHORT column_type; 00265 int integer; 00266 00267 00268 00269 /* Line 214 of yacc.c */ 00270 #line 272 "sql.tab.c" 00271 } YYSTYPE; 00272 # define YYSTYPE_IS_TRIVIAL 1 00273 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ 00274 # define YYSTYPE_IS_DECLARED 1 00275 #endif 00276 00277 00278 /* Copy the second part of user declarations. */ 00279 00280 00281 /* Line 264 of yacc.c */ 00282 #line 276 "sql.tab.c" 00283 00284 #ifdef short 00285 # undef short 00286 #endif 00287 00288 #ifdef YYTYPE_UINT8 00289 typedef YYTYPE_UINT8 yytype_uint8; 00290 #else 00291 typedef unsigned char yytype_uint8; 00292 #endif 00293 00294 #ifdef YYTYPE_INT8 00295 typedef YYTYPE_INT8 yytype_int8; 00296 #elif (defined __STDC__ || defined __C99__FUNC__ \ 00297 || defined __cplusplus || defined _MSC_VER) 00298 typedef signed char yytype_int8; 00299 #else 00300 typedef short int yytype_int8; 00301 #endif 00302 00303 #ifdef YYTYPE_UINT16 00304 typedef YYTYPE_UINT16 yytype_uint16; 00305 #else 00306 typedef unsigned short int yytype_uint16; 00307 #endif 00308 00309 #ifdef YYTYPE_INT16 00310 typedef YYTYPE_INT16 yytype_int16; 00311 #else 00312 typedef short int yytype_int16; 00313 #endif 00314 00315 #ifndef YYSIZE_T 00316 # ifdef __SIZE_TYPE__ 00317 # define YYSIZE_T __SIZE_TYPE__ 00318 # elif defined size_t 00319 # define YYSIZE_T size_t 00320 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ 00321 || defined __cplusplus || defined _MSC_VER) 00322 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ 00323 # define YYSIZE_T size_t 00324 # else 00325 # define YYSIZE_T unsigned int 00326 # endif 00327 #endif 00328 00329 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) 00330 00331 #ifndef YY_ 00332 # if YYENABLE_NLS 00333 # if ENABLE_NLS 00334 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */ 00335 # define YY_(msgid) dgettext ("bison-runtime", msgid) 00336 # endif 00337 # endif 00338 # ifndef YY_ 00339 # define YY_(msgid) msgid 00340 # endif 00341 #endif 00342 00343 /* Suppress unused-variable warnings by "using" E. */ 00344 #if ! defined lint || defined __GNUC__ 00345 # define YYUSE(e) ((void) (e)) 00346 #else 00347 # define YYUSE(e) /* empty */ 00348 #endif 00349 00350 /* Identity function, used to suppress warnings about constant conditions. */ 00351 #ifndef lint 00352 # define YYID(n) (n) 00353 #else 00354 #if (defined __STDC__ || defined __C99__FUNC__ \ 00355 || defined __cplusplus || defined _MSC_VER) 00356 static int 00357 YYID (int yyi) 00358 #else 00359 static int 00360 YYID (yyi) 00361 int yyi; 00362 #endif 00363 { 00364 return yyi; 00365 } 00366 #endif 00367 00368 #if ! defined yyoverflow || YYERROR_VERBOSE 00369 00370 /* The parser invokes alloca or malloc; define the necessary symbols. */ 00371 00372 # ifdef YYSTACK_USE_ALLOCA 00373 # if YYSTACK_USE_ALLOCA 00374 # ifdef __GNUC__ 00375 # define YYSTACK_ALLOC __builtin_alloca 00376 # elif defined __BUILTIN_VA_ARG_INCR 00377 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */ 00378 # elif defined _AIX 00379 # define YYSTACK_ALLOC __alloca 00380 # elif defined _MSC_VER 00381 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */ 00382 # define alloca _alloca 00383 # else 00384 # define YYSTACK_ALLOC alloca 00385 # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ 00386 || defined __cplusplus || defined _MSC_VER) 00387 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ 00388 # ifndef _STDLIB_H 00389 # define _STDLIB_H 1 00390 # endif 00391 # endif 00392 # endif 00393 # endif 00394 # endif 00395 00396 # ifdef YYSTACK_ALLOC 00397 /* Pacify GCC's `empty if-body' warning. */ 00398 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) 00399 # ifndef YYSTACK_ALLOC_MAXIMUM 00400 /* The OS might guarantee only one guard page at the bottom of the stack, 00401 and a page size can be as small as 4096 bytes. So we cannot safely 00402 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number 00403 to allow for a few compiler-allocated temporary stack slots. */ 00404 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ 00405 # endif 00406 # else 00407 # define YYSTACK_ALLOC YYMALLOC 00408 # define YYSTACK_FREE YYFREE 00409 # ifndef YYSTACK_ALLOC_MAXIMUM 00410 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM 00411 # endif 00412 # if (defined __cplusplus && ! defined _STDLIB_H \ 00413 && ! ((defined YYMALLOC || defined malloc) \ 00414 && (defined YYFREE || defined free))) 00415 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ 00416 # ifndef _STDLIB_H 00417 # define _STDLIB_H 1 00418 # endif 00419 # endif 00420 # ifndef YYMALLOC 00421 # define YYMALLOC malloc 00422 # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ 00423 || defined __cplusplus || defined _MSC_VER) 00424 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ 00425 # endif 00426 # endif 00427 # ifndef YYFREE 00428 # define YYFREE free 00429 # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ 00430 || defined __cplusplus || defined _MSC_VER) 00431 void free (void *); /* INFRINGES ON USER NAME SPACE */ 00432 # endif 00433 # endif 00434 # endif 00435 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */ 00436 00437 00438 #if (! defined yyoverflow \ 00439 && (! defined __cplusplus \ 00440 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) 00441 00442 /* A type that is properly aligned for any stack member. */ 00443 union yyalloc 00444 { 00445 yytype_int16 yyss_alloc; 00446 YYSTYPE yyvs_alloc; 00447 }; 00448 00449 /* The size of the maximum gap between one aligned stack and the next. */ 00450 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) 00451 00452 /* The size of an array large to enough to hold all stacks, each with 00453 N elements. */ 00454 # define YYSTACK_BYTES(N) \ 00455 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ 00456 + YYSTACK_GAP_MAXIMUM) 00457 00458 /* Copy COUNT objects from FROM to TO. The source and destination do 00459 not overlap. */ 00460 # ifndef YYCOPY 00461 # if defined __GNUC__ && 1 < __GNUC__ 00462 # define YYCOPY(To, From, Count) \ 00463 __builtin_memcpy (To, From, (Count) * sizeof (*(From))) 00464 # else 00465 # define YYCOPY(To, From, Count) \ 00466 do \ 00467 { \ 00468 YYSIZE_T yyi; \ 00469 for (yyi = 0; yyi < (Count); yyi++) \ 00470 (To)[yyi] = (From)[yyi]; \ 00471 } \ 00472 while (YYID (0)) 00473 # endif 00474 # endif 00475 00476 /* Relocate STACK from its old location to the new one. The 00477 local variables YYSIZE and YYSTACKSIZE give the old and new number of 00478 elements in the stack, and YYPTR gives the new location of the 00479 stack. Advance YYPTR to a properly aligned location for the next 00480 stack. */ 00481 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \ 00482 do \ 00483 { \ 00484 YYSIZE_T yynewbytes; \ 00485 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ 00486 Stack = &yyptr->Stack_alloc; \ 00487 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ 00488 yyptr += yynewbytes / sizeof (*yyptr); \ 00489 } \ 00490 while (YYID (0)) 00491 00492 #endif 00493 00494 /* YYFINAL -- State number of the termination state. */ 00495 #define YYFINAL 36 00496 /* YYLAST -- Last index in YYTABLE. */ 00497 #define YYLAST 156 00498 00499 /* YYNTOKENS -- Number of terminals. */ 00500 #define YYNTOKENS 65 00501 /* YYNNTS -- Number of nonterminals. */ 00502 #define YYNNTS 37 00503 /* YYNRULES -- Number of rules. */ 00504 #define YYNRULES 87 00505 /* YYNRULES -- Number of states. */ 00506 #define YYNSTATES 154 00507 00508 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ 00509 #define YYUNDEFTOK 2 00510 #define YYMAXUTOK 319 00511 00512 #define YYTRANSLATE(YYX) \ 00513 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) 00514 00515 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ 00516 static const yytype_uint8 yytranslate[] = 00517 { 00518 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00519 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00520 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00521 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00522 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00523 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00524 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00525 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00526 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00527 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00528 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00529 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00530 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00531 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00532 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00533 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00534 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00535 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00536 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00537 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00538 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00539 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00540 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00541 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00542 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00543 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 00544 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 00545 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 00546 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 00547 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 00548 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 00549 55, 56, 57, 58, 59, 60, 61, 62, 63, 64 00550 }; 00551 00552 #if YYDEBUG 00553 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in 00554 YYRHS. */ 00555 static const yytype_uint16 yyprhs[] = 00556 { 00557 0, 0, 3, 5, 7, 9, 11, 13, 15, 17, 00558 19, 30, 42, 49, 57, 64, 69, 72, 77, 83, 00559 90, 92, 94, 98, 103, 107, 109, 112, 114, 117, 00560 120, 122, 126, 128, 133, 135, 137, 139, 141, 143, 00561 145, 148, 152, 155, 157, 161, 163, 165, 169, 171, 00562 174, 179, 181, 184, 189, 191, 195, 199, 203, 207, 00563 211, 215, 219, 223, 227, 231, 235, 240, 242, 244, 00564 246, 250, 252, 256, 260, 262, 265, 267, 269, 271, 00565 275, 277, 281, 283, 285, 287, 289, 291 00566 }; 00567 00568 /* YYRHS -- A `-1'-separated list of the rules' RHS. */ 00569 static const yytype_int8 yyrhs[] = 00570 { 00571 66, 0, -1, 67, -1, 82, -1, 69, -1, 68, 00572 -1, 70, -1, 71, -1, 72, -1, 74, -1, 22, 00573 25, 98, 31, 85, 42, 52, 31, 91, 42, -1, 00574 22, 25, 98, 31, 85, 42, 52, 31, 91, 42, 00575 50, -1, 8, 49, 98, 31, 75, 42, -1, 8, 00576 49, 98, 31, 75, 42, 18, -1, 51, 98, 44, 00577 92, 53, 89, -1, 51, 98, 44, 92, -1, 9, 00578 86, -1, 3, 49, 98, 73, -1, 3, 49, 98, 00579 19, 77, -1, 3, 49, 98, 19, 77, 18, -1, 00580 18, -1, 14, -1, 10, 49, 98, -1, 76, 41, 00581 27, 85, -1, 76, 7, 77, -1, 77, -1, 96, 00582 78, -1, 79, -1, 79, 33, -1, 79, 50, -1, 00583 80, -1, 80, 36, 37, -1, 6, -1, 6, 31, 00584 81, 42, -1, 30, -1, 45, -1, 23, -1, 29, 00585 -1, 38, -1, 101, -1, 43, 83, -1, 43, 11, 00586 83, -1, 84, 86, -1, 97, -1, 97, 7, 84, 00587 -1, 47, -1, 96, -1, 96, 7, 85, -1, 47, 00588 -1, 15, 98, -1, 87, 40, 5, 85, -1, 87, 00589 -1, 15, 88, -1, 15, 88, 53, 89, -1, 98, 00590 -1, 98, 7, 88, -1, 31, 89, 42, -1, 89, 00591 4, 89, -1, 89, 39, 89, -1, 95, 13, 90, 00592 -1, 95, 17, 90, -1, 95, 32, 90, -1, 95, 00593 28, 90, -1, 95, 16, 90, -1, 95, 35, 90, 00594 -1, 95, 26, 37, -1, 95, 26, 36, 37, -1, 00595 95, -1, 94, -1, 94, -1, 94, 7, 91, -1, 00596 93, -1, 93, 7, 92, -1, 96, 13, 94, -1, 00597 101, -1, 34, 101, -1, 48, -1, 54, -1, 96, 00598 -1, 98, 12, 99, -1, 99, -1, 98, 12, 99, 00599 -1, 99, -1, 100, -1, 99, -1, 20, -1, 48, 00600 -1, 24, -1 00601 }; 00602 00603 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ 00604 static const yytype_uint16 yyrline[] = 00605 { 00606 0, 132, 132, 140, 141, 142, 143, 144, 145, 146, 00607 150, 161, 175, 192, 208, 219, 233, 247, 258, 269, 00608 283, 287, 294, 309, 319, 329, 336, 345, 349, 353, 00609 360, 364, 371, 375, 379, 383, 387, 391, 395, 402, 00610 411, 415, 430, 450, 451, 455, 462, 463, 467, 474, 00611 486, 499, 503, 515, 530, 534, 543, 549, 555, 561, 00612 567, 573, 579, 585, 591, 597, 603, 612, 613, 617, 00613 624, 635, 636, 644, 652, 658, 664, 670, 679, 688, 00614 694, 703, 709, 715, 724, 731, 739, 747 00615 }; 00616 #endif 00617 00618 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE 00619 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. 00620 First, the terminals, then, starting at YYNTOKENS, nonterminals. */ 00621 static const char *const yytname[] = 00622 { 00623 "$end", "error", "$undefined", "TK_ALTER", "TK_AND", "TK_BY", "TK_CHAR", 00624 "TK_COMMA", "TK_CREATE", "TK_DELETE", "TK_DROP", "TK_DISTINCT", "TK_DOT", 00625 "TK_EQ", "TK_FREE", "TK_FROM", "TK_GE", "TK_GT", "TK_HOLD", "TK_ADD", 00626 "TK_ID", "TK_ILLEGAL", "TK_INSERT", "TK_INT", "TK_INTEGER", "TK_INTO", 00627 "TK_IS", "TK_KEY", "TK_LE", "TK_LONG", "TK_LONGCHAR", "TK_LP", "TK_LT", 00628 "TK_LOCALIZABLE", "TK_MINUS", "TK_NE", "TK_NOT", "TK_NULL", "TK_OBJECT", 00629 "TK_OR", "TK_ORDER", "TK_PRIMARY", "TK_RP", "TK_SELECT", "TK_SET", 00630 "TK_SHORT", "TK_SPACE", "TK_STAR", "TK_STRING", "TK_TABLE", 00631 "TK_TEMPORARY", "TK_UPDATE", "TK_VALUES", "TK_WHERE", "TK_WILDCARD", 00632 "AGG_FUNCTION.", "COLUMN", "FUNCTION", "COMMENT", "UNCLOSED_STRING", 00633 "SPACE", "ILLEGAL", "END_OF_FILE", "TK_LIKE", "TK_NEGATION", "$accept", 00634 "query", "onequery", "oneinsert", "onecreate", "oneupdate", "onedelete", 00635 "onealter", "alterop", "onedrop", "table_def", "column_def", 00636 "column_and_type", "column_type", "data_type_l", "data_type", 00637 "data_count", "oneselect", "selectfrom", "selcollist", "collist", "from", 00638 "unorderdfrom", "tablelist", "expr", "val", "constlist", 00639 "update_assign_list", "column_assignment", "const_val", "column_val", 00640 "column", "selcolumn", "table", "id", "string", "number", 0 00641 }; 00642 #endif 00643 00644 # ifdef YYPRINT 00645 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to 00646 token YYLEX-NUM. */ 00647 static const yytype_uint16 yytoknum[] = 00648 { 00649 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 00650 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 00651 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 00652 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 00653 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 00654 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 00655 315, 316, 317, 318, 319 00656 }; 00657 # endif 00658 00659 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ 00660 static const yytype_uint8 yyr1[] = 00661 { 00662 0, 65, 66, 67, 67, 67, 67, 67, 67, 67, 00663 68, 68, 69, 69, 70, 70, 71, 72, 72, 72, 00664 73, 73, 74, 75, 76, 76, 77, 78, 78, 78, 00665 79, 79, 80, 80, 80, 80, 80, 80, 80, 81, 00666 82, 82, 83, 84, 84, 84, 85, 85, 85, 86, 00667 86, 86, 87, 87, 88, 88, 89, 89, 89, 89, 00668 89, 89, 89, 89, 89, 89, 89, 90, 90, 91, 00669 91, 92, 92, 93, 94, 94, 94, 94, 95, 96, 00670 96, 97, 97, 97, 98, 99, 100, 101 00671 }; 00672 00673 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ 00674 static const yytype_uint8 yyr2[] = 00675 { 00676 0, 2, 1, 1, 1, 1, 1, 1, 1, 1, 00677 10, 11, 6, 7, 6, 4, 2, 4, 5, 6, 00678 1, 1, 3, 4, 3, 1, 2, 1, 2, 2, 00679 1, 3, 1, 4, 1, 1, 1, 1, 1, 1, 00680 2, 3, 2, 1, 3, 1, 1, 3, 1, 2, 00681 4, 1, 2, 4, 1, 3, 3, 3, 3, 3, 00682 3, 3, 3, 3, 3, 3, 4, 1, 1, 1, 00683 3, 1, 3, 3, 1, 2, 1, 1, 1, 3, 00684 1, 3, 1, 1, 1, 1, 1, 1 00685 }; 00686 00687 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state 00688 STATE-NUM when YYTABLE doesn't specify something else to do. Zero 00689 means the default is an error. */ 00690 static const yytype_uint8 yydefact[] = 00691 { 00692 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 00693 5, 4, 6, 7, 8, 9, 3, 0, 0, 0, 00694 16, 51, 0, 0, 0, 85, 45, 86, 40, 0, 00695 43, 0, 82, 83, 0, 84, 1, 0, 0, 52, 00696 54, 0, 22, 0, 41, 42, 0, 0, 0, 21, 00697 20, 0, 17, 0, 0, 0, 0, 0, 44, 81, 00698 15, 71, 0, 0, 80, 18, 0, 0, 0, 25, 00699 0, 53, 0, 78, 55, 54, 48, 50, 46, 0, 00700 0, 0, 0, 0, 19, 32, 36, 37, 34, 38, 00701 35, 26, 27, 30, 12, 0, 0, 0, 0, 0, 00702 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 00703 72, 87, 0, 76, 77, 73, 74, 79, 0, 28, 00704 29, 0, 13, 24, 0, 56, 57, 58, 59, 68, 00705 67, 63, 60, 0, 65, 62, 61, 64, 47, 0, 00706 75, 0, 39, 31, 23, 66, 0, 33, 0, 69, 00707 10, 0, 11, 70 00708 }; 00709 00710 /* YYDEFGOTO[NTERM-NUM]. */ 00711 static const yytype_int16 yydefgoto[] = 00712 { 00713 -1, 8, 9, 10, 11, 12, 13, 14, 52, 15, 00714 67, 68, 65, 91, 92, 93, 141, 16, 28, 29, 00715 77, 20, 21, 39, 71, 128, 148, 60, 61, 129, 00716 130, 73, 30, 63, 64, 33, 116 00717 }; 00718 00719 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing 00720 STATE-NUM. */ 00721 #define YYPACT_NINF -80 00722 static const yytype_int16 yypact[] = 00723 { 00724 36, -44, -39, -1, -26, 9, 50, 37, 56, -80, 00725 -80, -80, -80, -80, -80, -80, -80, 37, 37, 37, 00726 -80, 25, 37, 37, -18, -80, -80, -80, -80, -1, 00727 78, 47, 76, -80, 57, -80, -80, 105, 72, 51, 00728 55, 100, -80, 81, -80, -80, -18, 37, 37, -80, 00729 -80, 37, -80, 37, 62, 37, -12, -12, -80, -80, 00730 63, 102, 108, 101, 76, 97, 45, 83, 2, -80, 00731 62, 3, 94, -80, -80, 126, -80, -80, 127, 93, 00732 62, 37, 52, 37, -80, 106, -80, -80, -80, -80, 00733 -80, -80, 31, 103, 118, 37, 111, 11, 62, 62, 00734 60, 60, 60, -11, 60, 60, 60, -12, 88, 3, 00735 -80, -80, 117, -80, -80, -80, -80, -80, 117, -80, 00736 -80, 107, -80, -80, -12, -80, -80, 138, -80, -80, 00737 -80, -80, -80, 109, -80, -80, -80, -80, -80, 112, 00738 -80, 110, -80, -80, -80, -80, 52, -80, 113, 140, 00739 95, 52, -80, -80 00740 }; 00741 00742 /* YYPGOTO[NTERM-NUM]. */ 00743 static const yytype_int8 yypgoto[] = 00744 { 00745 -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, 00746 -80, -80, -47, -80, -80, -80, -80, -80, 124, 104, 00747 -53, 120, -80, 96, 19, 26, 5, 73, -80, -79, 00748 -7, -29, -80, 14, -6, -80, -16 00749 }; 00750 00751 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If 00752 positive, shift that token. If negative, reduce the rule which 00753 number is the opposite. If zero, do what YYDEFACT says. 00754 If YYTABLE_NINF, syntax error. */ 00755 #define YYTABLE_NINF -85 00756 static const yytype_int16 yytable[] = 00757 { 00758 32, 35, 25, 115, 79, 17, 69, 98, 25, 95, 00759 18, 35, 35, 35, 19, 98, 35, 35, 32, 62, 00760 31, 34, 66, 22, 66, 133, 134, 78, 78, 26, 00761 27, 37, 38, 40, 23, 76, 42, 43, 31, 1, 00762 32, 59, 99, 96, 2, 3, 4, 72, 123, 35, 00763 99, 85, 62, 125, 138, -49, 36, 25, 5, 47, 00764 31, 24, 55, 72, 119, 41, 66, 149, 86, 75, 00765 25, 144, 149, 72, 87, 88, 111, 117, 78, 6, 00766 25, 120, 25, 89, 111, 46, 112, 7, -84, 97, 00767 90, 72, 72, 70, 112, 78, 140, 26, 27, 109, 00768 113, 48, 142, 53, 54, 56, 114, 100, 113, 81, 00769 101, 102, 57, 83, 114, 84, 80, 126, 127, 49, 00770 103, 82, 104, 50, 51, 94, 105, 131, 132, 106, 00771 135, 136, 137, 55, 107, 108, 122, 118, 124, 121, 00772 139, 111, 98, 146, 143, 152, 145, 151, 44, 45, 00773 58, 74, 147, 0, 110, 150, 153 00774 }; 00775 00776 static const yytype_int16 yycheck[] = 00777 { 00778 6, 7, 20, 82, 57, 49, 53, 4, 20, 7, 00779 49, 17, 18, 19, 15, 4, 22, 23, 24, 48, 00780 6, 7, 51, 49, 53, 36, 37, 56, 57, 47, 00781 48, 17, 18, 19, 25, 47, 22, 23, 24, 3, 00782 46, 47, 39, 41, 8, 9, 10, 54, 95, 55, 00783 39, 6, 81, 42, 107, 0, 0, 20, 22, 12, 00784 46, 11, 7, 70, 33, 40, 95, 146, 23, 55, 00785 20, 124, 151, 80, 29, 30, 24, 83, 107, 43, 00786 20, 50, 20, 38, 24, 7, 34, 51, 12, 70, 00787 45, 98, 99, 31, 34, 124, 112, 47, 48, 80, 00788 48, 44, 118, 31, 53, 5, 54, 13, 48, 7, 00789 16, 17, 31, 12, 54, 18, 53, 98, 99, 14, 00790 26, 13, 28, 18, 19, 42, 32, 101, 102, 35, 00791 104, 105, 106, 7, 7, 42, 18, 31, 27, 36, 00792 52, 24, 4, 31, 37, 50, 37, 7, 24, 29, 00793 46, 55, 42, -1, 81, 42, 151 00794 }; 00795 00796 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing 00797 symbol of state STATE-NUM. */ 00798 static const yytype_uint8 yystos[] = 00799 { 00800 0, 3, 8, 9, 10, 22, 43, 51, 66, 67, 00801 68, 69, 70, 71, 72, 74, 82, 49, 49, 15, 00802 86, 87, 49, 25, 11, 20, 47, 48, 83, 84, 00803 97, 98, 99, 100, 98, 99, 0, 98, 98, 88, 00804 98, 40, 98, 98, 83, 86, 7, 12, 44, 14, 00805 18, 19, 73, 31, 53, 7, 5, 31, 84, 99, 00806 92, 93, 96, 98, 99, 77, 96, 75, 76, 77, 00807 31, 89, 95, 96, 88, 98, 47, 85, 96, 85, 00808 53, 7, 13, 12, 18, 6, 23, 29, 30, 38, 00809 45, 78, 79, 80, 42, 7, 41, 89, 4, 39, 00810 13, 16, 17, 26, 28, 32, 35, 7, 42, 89, 00811 92, 24, 34, 48, 54, 94, 101, 99, 31, 33, 00812 50, 36, 18, 77, 27, 42, 89, 89, 90, 94, 00813 95, 90, 90, 36, 37, 90, 90, 90, 85, 52, 00814 101, 81, 101, 37, 85, 37, 31, 42, 91, 94, 00815 42, 7, 50, 91 00816 }; 00817 00818 #define yyerrok (yyerrstatus = 0) 00819 #define yyclearin (yychar = YYEMPTY) 00820 #define YYEMPTY (-2) 00821 #define YYEOF 0 00822 00823 #define YYACCEPT goto yyacceptlab 00824 #define YYABORT goto yyabortlab 00825 #define YYERROR goto yyerrorlab 00826 00827 00828 /* Like YYERROR except do call yyerror. This remains here temporarily 00829 to ease the transition to the new meaning of YYERROR, for GCC. 00830 Once GCC version 2 has supplanted version 1, this can go. */ 00831 00832 #define YYFAIL goto yyerrlab 00833 00834 #define YYRECOVERING() (!!yyerrstatus) 00835 00836 #define YYBACKUP(Token, Value) \ 00837 do \ 00838 if (yychar == YYEMPTY && yylen == 1) \ 00839 { \ 00840 yychar = (Token); \ 00841 yylval = (Value); \ 00842 yytoken = YYTRANSLATE (yychar); \ 00843 YYPOPSTACK (1); \ 00844 goto yybackup; \ 00845 } \ 00846 else \ 00847 { \ 00848 yyerror (YY_("syntax error: cannot back up")); \ 00849 YYERROR; \ 00850 } \ 00851 while (YYID (0)) 00852 00853 00854 #define YYTERROR 1 00855 #define YYERRCODE 256 00856 00857 00858 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. 00859 If N is 0, then set CURRENT to the empty location which ends 00860 the previous symbol: RHS[0] (always defined). */ 00861 00862 #define YYRHSLOC(Rhs, K) ((Rhs)[K]) 00863 #ifndef YYLLOC_DEFAULT 00864 # define YYLLOC_DEFAULT(Current, Rhs, N) \ 00865 do \ 00866 if (YYID (N)) \ 00867 { \ 00868 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ 00869 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ 00870 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ 00871 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ 00872 } \ 00873 else \ 00874 { \ 00875 (Current).first_line = (Current).last_line = \ 00876 YYRHSLOC (Rhs, 0).last_line; \ 00877 (Current).first_column = (Current).last_column = \ 00878 YYRHSLOC (Rhs, 0).last_column; \ 00879 } \ 00880 while (YYID (0)) 00881 #endif 00882 00883 00884 /* YY_LOCATION_PRINT -- Print the location on the stream. 00885 This macro was not mandated originally: define only if we know 00886 we won't break user code: when these are the locations we know. */ 00887 00888 #ifndef YY_LOCATION_PRINT 00889 # if YYLTYPE_IS_TRIVIAL 00890 # define YY_LOCATION_PRINT(File, Loc) \ 00891 fprintf (File, "%d.%d-%d.%d", \ 00892 (Loc).first_line, (Loc).first_column, \ 00893 (Loc).last_line, (Loc).last_column) 00894 # else 00895 # define YY_LOCATION_PRINT(File, Loc) ((void) 0) 00896 # endif 00897 #endif 00898 00899 00900 /* YYLEX -- calling `yylex' with the right arguments. */ 00901 00902 #ifdef YYLEX_PARAM 00903 # define YYLEX yylex (&yylval, YYLEX_PARAM) 00904 #else 00905 # define YYLEX yylex (&yylval) 00906 #endif 00907 00908 /* Enable debugging if requested. */ 00909 #if YYDEBUG 00910 00911 # ifndef YYFPRINTF 00912 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */ 00913 # define YYFPRINTF fprintf 00914 # endif 00915 00916 # define YYDPRINTF(Args) \ 00917 do { \ 00918 if (yydebug) \ 00919 YYFPRINTF Args; \ 00920 } while (YYID (0)) 00921 00922 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ 00923 do { \ 00924 if (yydebug) \ 00925 { \ 00926 YYFPRINTF (stderr, "%s ", Title); \ 00927 yy_symbol_print (stderr, \ 00928 Type, Value); \ 00929 YYFPRINTF (stderr, "\n"); \ 00930 } \ 00931 } while (YYID (0)) 00932 00933 00934 /*--------------------------------. 00935 | Print this symbol on YYOUTPUT. | 00936 `--------------------------------*/ 00937 00938 /*ARGSUSED*/ 00939 #if (defined __STDC__ || defined __C99__FUNC__ \ 00940 || defined __cplusplus || defined _MSC_VER) 00941 static void 00942 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) 00943 #else 00944 static void 00945 yy_symbol_value_print (yyoutput, yytype, yyvaluep) 00946 FILE *yyoutput; 00947 int yytype; 00948 YYSTYPE const * const yyvaluep; 00949 #endif 00950 { 00951 if (!yyvaluep) 00952 return; 00953 # ifdef YYPRINT 00954 if (yytype < YYNTOKENS) 00955 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); 00956 # else 00957 YYUSE (yyoutput); 00958 # endif 00959 switch (yytype) 00960 { 00961 default: 00962 break; 00963 } 00964 } 00965 00966 00967 /*--------------------------------. 00968 | Print this symbol on YYOUTPUT. | 00969 `--------------------------------*/ 00970 00971 #if (defined __STDC__ || defined __C99__FUNC__ \ 00972 || defined __cplusplus || defined _MSC_VER) 00973 static void 00974 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) 00975 #else 00976 static void 00977 yy_symbol_print (yyoutput, yytype, yyvaluep) 00978 FILE *yyoutput; 00979 int yytype; 00980 YYSTYPE const * const yyvaluep; 00981 #endif 00982 { 00983 if (yytype < YYNTOKENS) 00984 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); 00985 else 00986 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); 00987 00988 yy_symbol_value_print (yyoutput, yytype, yyvaluep); 00989 YYFPRINTF (yyoutput, ")"); 00990 } 00991 00992 /*------------------------------------------------------------------. 00993 | yy_stack_print -- Print the state stack from its BOTTOM up to its | 00994 | TOP (included). | 00995 `------------------------------------------------------------------*/ 00996 00997 #if (defined __STDC__ || defined __C99__FUNC__ \ 00998 || defined __cplusplus || defined _MSC_VER) 00999 static void 01000 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) 01001 #else 01002 static void 01003 yy_stack_print (yybottom, yytop) 01004 yytype_int16 *yybottom; 01005 yytype_int16 *yytop; 01006 #endif 01007 { 01008 YYFPRINTF (stderr, "Stack now"); 01009 for (; yybottom <= yytop; yybottom++) 01010 { 01011 int yybot = *yybottom; 01012 YYFPRINTF (stderr, " %d", yybot); 01013 } 01014 YYFPRINTF (stderr, "\n"); 01015 } 01016 01017 # define YY_STACK_PRINT(Bottom, Top) \ 01018 do { \ 01019 if (yydebug) \ 01020 yy_stack_print ((Bottom), (Top)); \ 01021 } while (YYID (0)) 01022 01023 01024 /*------------------------------------------------. 01025 | Report that the YYRULE is going to be reduced. | 01026 `------------------------------------------------*/ 01027 01028 #if (defined __STDC__ || defined __C99__FUNC__ \ 01029 || defined __cplusplus || defined _MSC_VER) 01030 static void 01031 yy_reduce_print (YYSTYPE *yyvsp, int yyrule) 01032 #else 01033 static void 01034 yy_reduce_print (yyvsp, yyrule) 01035 YYSTYPE *yyvsp; 01036 int yyrule; 01037 #endif 01038 { 01039 int yynrhs = yyr2[yyrule]; 01040 int yyi; 01041 unsigned long int yylno = yyrline[yyrule]; 01042 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", 01043 yyrule - 1, yylno); 01044 /* The symbols being reduced. */ 01045 for (yyi = 0; yyi < yynrhs; yyi++) 01046 { 01047 YYFPRINTF (stderr, " $%d = ", yyi + 1); 01048 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], 01049 &(yyvsp[(yyi + 1) - (yynrhs)]) 01050 ); 01051 YYFPRINTF (stderr, "\n"); 01052 } 01053 } 01054 01055 # define YY_REDUCE_PRINT(Rule) \ 01056 do { \ 01057 if (yydebug) \ 01058 yy_reduce_print (yyvsp, Rule); \ 01059 } while (YYID (0)) 01060 01061 /* Nonzero means print parse trace. It is left uninitialized so that 01062 multiple parsers can coexist. */ 01063 int yydebug; 01064 #else /* !YYDEBUG */ 01065 # define YYDPRINTF(Args) 01066 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) 01067 # define YY_STACK_PRINT(Bottom, Top) 01068 # define YY_REDUCE_PRINT(Rule) 01069 #endif /* !YYDEBUG */ 01070 01071 01072 /* YYINITDEPTH -- initial size of the parser's stacks. */ 01073 #ifndef YYINITDEPTH 01074 # define YYINITDEPTH 200 01075 #endif 01076 01077 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only 01078 if the built-in stack extension method is used). 01079 01080 Do not make this value too large; the results are undefined if 01081 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) 01082 evaluated with infinite-precision integer arithmetic. */ 01083 01084 #ifndef YYMAXDEPTH 01085 # define YYMAXDEPTH 10000 01086 #endif 01087 01088 01089 01090 #if YYERROR_VERBOSE 01091 01092 # ifndef yystrlen 01093 # if defined __GLIBC__ && defined _STRING_H 01094 # define yystrlen strlen 01095 # else 01096 /* Return the length of YYSTR. */ 01097 #if (defined __STDC__ || defined __C99__FUNC__ \ 01098 || defined __cplusplus || defined _MSC_VER) 01099 static YYSIZE_T 01100 yystrlen (const char *yystr) 01101 #else 01102 static YYSIZE_T 01103 yystrlen (yystr) 01104 const char *yystr; 01105 #endif 01106 { 01107 YYSIZE_T yylen; 01108 for (yylen = 0; yystr[yylen]; yylen++) 01109 continue; 01110 return yylen; 01111 } 01112 # endif 01113 # endif 01114 01115 # ifndef yystpcpy 01116 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE 01117 # define yystpcpy stpcpy 01118 # else 01119 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in 01120 YYDEST. */ 01121 #if (defined __STDC__ || defined __C99__FUNC__ \ 01122 || defined __cplusplus || defined _MSC_VER) 01123 static char * 01124 yystpcpy (char *yydest, const char *yysrc) 01125 #else 01126 static char * 01127 yystpcpy (yydest, yysrc) 01128 char *yydest; 01129 const char *yysrc; 01130 #endif 01131 { 01132 char *yyd = yydest; 01133 const char *yys = yysrc; 01134 01135 while ((*yyd++ = *yys++) != '\0') 01136 continue; 01137 01138 return yyd - 1; 01139 } 01140 # endif 01141 # endif 01142 01143 # ifndef yytnamerr 01144 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary 01145 quotes and backslashes, so that it's suitable for yyerror. The 01146 heuristic is that double-quoting is unnecessary unless the string 01147 contains an apostrophe, a comma, or backslash (other than 01148 backslash-backslash). YYSTR is taken from yytname. If YYRES is 01149 null, do not copy; instead, return the length of what the result 01150 would have been. */ 01151 static YYSIZE_T 01152 yytnamerr (char *yyres, const char *yystr) 01153 { 01154 if (*yystr == '"') 01155 { 01156 YYSIZE_T yyn = 0; 01157 char const *yyp = yystr; 01158 01159 for (;;) 01160 switch (*++yyp) 01161 { 01162 case '\'': 01163 case ',': 01164 goto do_not_strip_quotes; 01165 01166 case '\\': 01167 if (*++yyp != '\\') 01168 goto do_not_strip_quotes; 01169 /* Fall through. */ 01170 default: 01171 if (yyres) 01172 yyres[yyn] = *yyp; 01173 yyn++; 01174 break; 01175 01176 case '"': 01177 if (yyres) 01178 yyres[yyn] = '\0'; 01179 return yyn; 01180 } 01181 do_not_strip_quotes: ; 01182 } 01183 01184 if (! yyres) 01185 return yystrlen (yystr); 01186 01187 return yystpcpy (yyres, yystr) - yyres; 01188 } 01189 # endif 01190 01191 /* Copy into YYRESULT an error message about the unexpected token 01192 YYCHAR while in state YYSTATE. Return the number of bytes copied, 01193 including the terminating null byte. If YYRESULT is null, do not 01194 copy anything; just return the number of bytes that would be 01195 copied. As a special case, return 0 if an ordinary "syntax error" 01196 message will do. Return YYSIZE_MAXIMUM if overflow occurs during 01197 size calculation. */ 01198 static YYSIZE_T 01199 yysyntax_error (char *yyresult, int yystate, int yychar) 01200 { 01201 int yyn = yypact[yystate]; 01202 01203 if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) 01204 return 0; 01205 else 01206 { 01207 int yytype = YYTRANSLATE (yychar); 01208 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); 01209 YYSIZE_T yysize = yysize0; 01210 YYSIZE_T yysize1; 01211 int yysize_overflow = 0; 01212 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; 01213 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; 01214 int yyx; 01215 01216 # if 0 01217 /* This is so xgettext sees the translatable formats that are 01218 constructed on the fly. */ 01219 YY_("syntax error, unexpected %s"); 01220 YY_("syntax error, unexpected %s, expecting %s"); 01221 YY_("syntax error, unexpected %s, expecting %s or %s"); 01222 YY_("syntax error, unexpected %s, expecting %s or %s or %s"); 01223 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); 01224 # endif 01225 char *yyfmt; 01226 char const *yyf; 01227 static char const yyunexpected[] = "syntax error, unexpected %s"; 01228 static char const yyexpecting[] = ", expecting %s"; 01229 static char const yyor[] = " or %s"; 01230 char yyformat[sizeof yyunexpected 01231 + sizeof yyexpecting - 1 01232 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) 01233 * (sizeof yyor - 1))]; 01234 char const *yyprefix = yyexpecting; 01235 01236 /* Start YYX at -YYN if negative to avoid negative indexes in 01237 YYCHECK. */ 01238 int yyxbegin = yyn < 0 ? -yyn : 0; 01239 01240 /* Stay within bounds of both yycheck and yytname. */ 01241 int yychecklim = YYLAST - yyn + 1; 01242 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; 01243 int yycount = 1; 01244 01245 yyarg[0] = yytname[yytype]; 01246 yyfmt = yystpcpy (yyformat, yyunexpected); 01247 01248 for (yyx = yyxbegin; yyx < yyxend; ++yyx) 01249 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) 01250 { 01251 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) 01252 { 01253 yycount = 1; 01254 yysize = yysize0; 01255 yyformat[sizeof yyunexpected - 1] = '\0'; 01256 break; 01257 } 01258 yyarg[yycount++] = yytname[yyx]; 01259 yysize1 = yysize + yytnamerr (0, yytname[yyx]); 01260 yysize_overflow |= (yysize1 < yysize); 01261 yysize = yysize1; 01262 yyfmt = yystpcpy (yyfmt, yyprefix); 01263 yyprefix = yyor; 01264 } 01265 01266 yyf = YY_(yyformat); 01267 yysize1 = yysize + yystrlen (yyf); 01268 yysize_overflow |= (yysize1 < yysize); 01269 yysize = yysize1; 01270 01271 if (yysize_overflow) 01272 return YYSIZE_MAXIMUM; 01273 01274 if (yyresult) 01275 { 01276 /* Avoid sprintf, as that infringes on the user's name space. 01277 Don't have undefined behavior even if the translation 01278 produced a string with the wrong number of "%s"s. */ 01279 char *yyp = yyresult; 01280 int yyi = 0; 01281 while ((*yyp = *yyf) != '\0') 01282 { 01283 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) 01284 { 01285 yyp += yytnamerr (yyp, yyarg[yyi++]); 01286 yyf += 2; 01287 } 01288 else 01289 { 01290 yyp++; 01291 yyf++; 01292 } 01293 } 01294 } 01295 return yysize; 01296 } 01297 } 01298 #endif /* YYERROR_VERBOSE */ 01299 01300 01301 /*-----------------------------------------------. 01302 | Release the memory associated to this symbol. | 01303 `-----------------------------------------------*/ 01304 01305 /*ARGSUSED*/ 01306 #if (defined __STDC__ || defined __C99__FUNC__ \ 01307 || defined __cplusplus || defined _MSC_VER) 01308 static void 01309 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) 01310 #else 01311 static void 01312 yydestruct (yymsg, yytype, yyvaluep) 01313 const char *yymsg; 01314 int yytype; 01315 YYSTYPE *yyvaluep; 01316 #endif 01317 { 01318 YYUSE (yyvaluep); 01319 01320 if (!yymsg) 01321 yymsg = "Deleting"; 01322 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); 01323 01324 switch (yytype) 01325 { 01326 01327 default: 01328 break; 01329 } 01330 } 01331 01332 /* Prevent warnings from -Wmissing-prototypes. */ 01333 #ifdef YYPARSE_PARAM 01334 #if defined __STDC__ || defined __cplusplus 01335 int yyparse (void *YYPARSE_PARAM); 01336 #else 01337 int yyparse (); 01338 #endif 01339 #else /* ! YYPARSE_PARAM */ 01340 #if defined __STDC__ || defined __cplusplus 01341 int yyparse (void); 01342 #else 01343 int yyparse (); 01344 #endif 01345 #endif /* ! YYPARSE_PARAM */ 01346 01347 01348 01349 01350 01351 /*-------------------------. 01352 | yyparse or yypush_parse. | 01353 `-------------------------*/ 01354 01355 #ifdef YYPARSE_PARAM 01356 #if (defined __STDC__ || defined __C99__FUNC__ \ 01357 || defined __cplusplus || defined _MSC_VER) 01358 int 01359 yyparse (void *YYPARSE_PARAM) 01360 #else 01361 int 01362 yyparse (YYPARSE_PARAM) 01363 void *YYPARSE_PARAM; 01364 #endif 01365 #else /* ! YYPARSE_PARAM */ 01366 #if (defined __STDC__ || defined __C99__FUNC__ \ 01367 || defined __cplusplus || defined _MSC_VER) 01368 int 01369 yyparse (void) 01370 #else 01371 int 01372 yyparse () 01373 01374 #endif 01375 #endif 01376 { 01377 /* The lookahead symbol. */ 01378 int yychar; 01379 01380 /* The semantic value of the lookahead symbol. */ 01381 YYSTYPE yylval; 01382 01383 /* Number of syntax errors so far. */ 01384 int yynerrs; 01385 01386 int yystate; 01387 /* Number of tokens to shift before error messages enabled. */ 01388 int yyerrstatus; 01389 01390 /* The stacks and their tools: 01391 `yyss': related to states. 01392 `yyvs': related to semantic values. 01393 01394 Refer to the stacks thru separate pointers, to allow yyoverflow 01395 to reallocate them elsewhere. */ 01396 01397 /* The state stack. */ 01398 yytype_int16 yyssa[YYINITDEPTH]; 01399 yytype_int16 *yyss; 01400 yytype_int16 *yyssp; 01401 01402 /* The semantic value stack. */ 01403 YYSTYPE yyvsa[YYINITDEPTH]; 01404 YYSTYPE *yyvs; 01405 YYSTYPE *yyvsp; 01406 01407 YYSIZE_T yystacksize; 01408 01409 int yyn; 01410 int yyresult; 01411 /* Lookahead token as an internal (translated) token number. */ 01412 int yytoken; 01413 /* The variables used to return semantic value and location from the 01414 action routines. */ 01415 YYSTYPE yyval; 01416 01417 #if YYERROR_VERBOSE 01418 /* Buffer for error messages, and its allocated size. */ 01419 char yymsgbuf[128]; 01420 char *yymsg = yymsgbuf; 01421 YYSIZE_T yymsg_alloc = sizeof yymsgbuf; 01422 #endif 01423 01424 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) 01425 01426 /* The number of symbols on the RHS of the reduced rule. 01427 Keep to zero when no symbol should be popped. */ 01428 int yylen = 0; 01429 01430 yytoken = 0; 01431 yyss = yyssa; 01432 yyvs = yyvsa; 01433 yystacksize = YYINITDEPTH; 01434 01435 YYDPRINTF ((stderr, "Starting parse\n")); 01436 01437 yystate = 0; 01438 yyerrstatus = 0; 01439 yynerrs = 0; 01440 yychar = YYEMPTY; /* Cause a token to be read. */ 01441 01442 /* Initialize stack pointers. 01443 Waste one element of value and location stack 01444 so that they stay on the same level as the state stack. 01445 The wasted elements are never initialized. */ 01446 yyssp = yyss; 01447 yyvsp = yyvs; 01448 01449 goto yysetstate; 01450 01451 /*------------------------------------------------------------. 01452 | yynewstate -- Push a new state, which is found in yystate. | 01453 `------------------------------------------------------------*/ 01454 yynewstate: 01455 /* In all cases, when you get here, the value and location stacks 01456 have just been pushed. So pushing a state here evens the stacks. */ 01457 yyssp++; 01458 01459 yysetstate: 01460 *yyssp = yystate; 01461 01462 if (yyss + yystacksize - 1 <= yyssp) 01463 { 01464 /* Get the current used size of the three stacks, in elements. */ 01465 YYSIZE_T yysize = yyssp - yyss + 1; 01466 01467 #ifdef yyoverflow 01468 { 01469 /* Give user a chance to reallocate the stack. Use copies of 01470 these so that the &'s don't force the real ones into 01471 memory. */ 01472 YYSTYPE *yyvs1 = yyvs; 01473 yytype_int16 *yyss1 = yyss; 01474 01475 /* Each stack pointer address is followed by the size of the 01476 data in use in that stack, in bytes. This used to be a 01477 conditional around just the two extra args, but that might 01478 be undefined if yyoverflow is a macro. */ 01479 yyoverflow (YY_("memory exhausted"), 01480 &yyss1, yysize * sizeof (*yyssp), 01481 &yyvs1, yysize * sizeof (*yyvsp), 01482 &yystacksize); 01483 01484 yyss = yyss1; 01485 yyvs = yyvs1; 01486 } 01487 #else /* no yyoverflow */ 01488 # ifndef YYSTACK_RELOCATE 01489 goto yyexhaustedlab; 01490 # else 01491 /* Extend the stack our own way. */ 01492 if (YYMAXDEPTH <= yystacksize) 01493 goto yyexhaustedlab; 01494 yystacksize *= 2; 01495 if (YYMAXDEPTH < yystacksize) 01496 yystacksize = YYMAXDEPTH; 01497 01498 { 01499 yytype_int16 *yyss1 = yyss; 01500 union yyalloc *yyptr = 01501 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); 01502 if (! yyptr) 01503 goto yyexhaustedlab; 01504 YYSTACK_RELOCATE (yyss_alloc, yyss); 01505 YYSTACK_RELOCATE (yyvs_alloc, yyvs); 01506 # undef YYSTACK_RELOCATE 01507 if (yyss1 != yyssa) 01508 YYSTACK_FREE (yyss1); 01509 } 01510 # endif 01511 #endif /* no yyoverflow */ 01512 01513 yyssp = yyss + yysize - 1; 01514 yyvsp = yyvs + yysize - 1; 01515 01516 YYDPRINTF ((stderr, "Stack size increased to %lu\n", 01517 (unsigned long int) yystacksize)); 01518 01519 if (yyss + yystacksize - 1 <= yyssp) 01520 YYABORT; 01521 } 01522 01523 YYDPRINTF ((stderr, "Entering state %d\n", yystate)); 01524 01525 if (yystate == YYFINAL) 01526 YYACCEPT; 01527 01528 goto yybackup; 01529 01530 /*-----------. 01531 | yybackup. | 01532 `-----------*/ 01533 yybackup: 01534 01535 /* Do appropriate processing given the current state. Read a 01536 lookahead token if we need one and don't already have one. */ 01537 01538 /* First try to decide what to do without reference to lookahead token. */ 01539 yyn = yypact[yystate]; 01540 if (yyn == YYPACT_NINF) 01541 goto yydefault; 01542 01543 /* Not known => get a lookahead token if don't already have one. */ 01544 01545 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ 01546 if (yychar == YYEMPTY) 01547 { 01548 YYDPRINTF ((stderr, "Reading a token: ")); 01549 yychar = YYLEX; 01550 } 01551 01552 if (yychar <= YYEOF) 01553 { 01554 yychar = yytoken = YYEOF; 01555 YYDPRINTF ((stderr, "Now at end of input.\n")); 01556 } 01557 else 01558 { 01559 yytoken = YYTRANSLATE (yychar); 01560 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); 01561 } 01562 01563 /* If the proper action on seeing token YYTOKEN is to reduce or to 01564 detect an error, take that action. */ 01565 yyn += yytoken; 01566 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) 01567 goto yydefault; 01568 yyn = yytable[yyn]; 01569 if (yyn <= 0) 01570 { 01571 if (yyn == 0 || yyn == YYTABLE_NINF) 01572 goto yyerrlab; 01573 yyn = -yyn; 01574 goto yyreduce; 01575 } 01576 01577 /* Count tokens shifted since error; after three, turn off error 01578 status. */ 01579 if (yyerrstatus) 01580 yyerrstatus--; 01581 01582 /* Shift the lookahead token. */ 01583 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); 01584 01585 /* Discard the shifted token. */ 01586 yychar = YYEMPTY; 01587 01588 yystate = yyn; 01589 *++yyvsp = yylval; 01590 01591 goto yynewstate; 01592 01593 01594 /*-----------------------------------------------------------. 01595 | yydefault -- do the default action for the current state. | 01596 `-----------------------------------------------------------*/ 01597 yydefault: 01598 yyn = yydefact[yystate]; 01599 if (yyn == 0) 01600 goto yyerrlab; 01601 goto yyreduce; 01602 01603 01604 /*-----------------------------. 01605 | yyreduce -- Do a reduction. | 01606 `-----------------------------*/ 01607 yyreduce: 01608 /* yyn is the number of a rule to reduce with. */ 01609 yylen = yyr2[yyn]; 01610 01611 /* If YYLEN is nonzero, implement the default value of the action: 01612 `$$ = $1'. 01613 01614 Otherwise, the following line sets YYVAL to garbage. 01615 This behavior is undocumented and Bison 01616 users should not rely upon it. Assigning to YYVAL 01617 unconditionally makes the parser a bit smaller, and it avoids a 01618 GCC warning that YYVAL may be used uninitialized. */ 01619 yyval = yyvsp[1-yylen]; 01620 01621 01622 YY_REDUCE_PRINT (yyn); 01623 switch (yyn) 01624 { 01625 case 2: 01626 01627 /* Line 1455 of yacc.c */ 01628 #line 133 "sql.y" 01629 { 01630 SQL_input* sql = (SQL_input*) info; 01631 *sql->view = (yyvsp[(1) - (1)].query); 01632 ;} 01633 break; 01634 01635 case 10: 01636 01637 /* Line 1455 of yacc.c */ 01638 #line 151 "sql.y" 01639 { 01640 SQL_input *sql = (SQL_input*) info; 01641 MSIVIEW *insert = NULL; 01642 01643 INSERT_CreateView( sql->db, &insert, (yyvsp[(3) - (10)].string), (yyvsp[(5) - (10)].column_list), (yyvsp[(9) - (10)].column_list), FALSE ); 01644 if( !insert ) 01645 YYABORT; 01646 01647 PARSER_BUBBLE_UP_VIEW( sql, (yyval.query), insert ); 01648 ;} 01649 break; 01650 01651 case 11: 01652 01653 /* Line 1455 of yacc.c */ 01654 #line 162 "sql.y" 01655 { 01656 SQL_input *sql = (SQL_input*) info; 01657 MSIVIEW *insert = NULL; 01658 01659 INSERT_CreateView( sql->db, &insert, (yyvsp[(3) - (11)].string), (yyvsp[(5) - (11)].column_list), (yyvsp[(9) - (11)].column_list), TRUE ); 01660 if( !insert ) 01661 YYABORT; 01662 01663 PARSER_BUBBLE_UP_VIEW( sql, (yyval.query), insert ); 01664 ;} 01665 break; 01666 01667 case 12: 01668 01669 /* Line 1455 of yacc.c */ 01670 #line 176 "sql.y" 01671 { 01672 SQL_input* sql = (SQL_input*) info; 01673 MSIVIEW *create = NULL; 01674 UINT r; 01675 01676 if( !(yyvsp[(5) - (6)].column_list) ) 01677 YYABORT; 01678 r = CREATE_CreateView( sql->db, &create, (yyvsp[(3) - (6)].string), (yyvsp[(5) - (6)].column_list), FALSE ); 01679 if( !create ) 01680 { 01681 sql->r = r; 01682 YYABORT; 01683 } 01684 01685 PARSER_BUBBLE_UP_VIEW( sql, (yyval.query), create ); 01686 ;} 01687 break; 01688 01689 case 13: 01690 01691 /* Line 1455 of yacc.c */ 01692 #line 193 "sql.y" 01693 { 01694 SQL_input* sql = (SQL_input*) info; 01695 MSIVIEW *create = NULL; 01696 01697 if( !(yyvsp[(5) - (7)].column_list) ) 01698 YYABORT; 01699 CREATE_CreateView( sql->db, &create, (yyvsp[(3) - (7)].string), (yyvsp[(5) - (7)].column_list), TRUE ); 01700 if( !create ) 01701 YYABORT; 01702 01703 PARSER_BUBBLE_UP_VIEW( sql, (yyval.query), create ); 01704 ;} 01705 break; 01706 01707 case 14: 01708 01709 /* Line 1455 of yacc.c */ 01710 #line 209 "sql.y" 01711 { 01712 SQL_input* sql = (SQL_input*) info; 01713 MSIVIEW *update = NULL; 01714 01715 UPDATE_CreateView( sql->db, &update, (yyvsp[(2) - (6)].string), (yyvsp[(4) - (6)].column_list), (yyvsp[(6) - (6)].expr) ); 01716 if( !update ) 01717 YYABORT; 01718 01719 PARSER_BUBBLE_UP_VIEW( sql, (yyval.query), update ); 01720 ;} 01721 break; 01722 01723 case 15: 01724 01725 /* Line 1455 of yacc.c */ 01726 #line 220 "sql.y" 01727 { 01728 SQL_input* sql = (SQL_input*) info; 01729 MSIVIEW *update = NULL; 01730 01731 UPDATE_CreateView( sql->db, &update, (yyvsp[(2) - (4)].string), (yyvsp[(4) - (4)].column_list), NULL ); 01732 if( !update ) 01733 YYABORT; 01734 01735 PARSER_BUBBLE_UP_VIEW( sql, (yyval.query), update ); 01736 ;} 01737 break; 01738 01739 case 16: 01740 01741 /* Line 1455 of yacc.c */ 01742 #line 234 "sql.y" 01743 { 01744 SQL_input* sql = (SQL_input*) info; 01745 MSIVIEW *delete = NULL; 01746 01747 DELETE_CreateView( sql->db, &delete, (yyvsp[(2) - (2)].query) ); 01748 if( !delete ) 01749 YYABORT; 01750 01751 PARSER_BUBBLE_UP_VIEW( sql, (yyval.query), delete ); 01752 ;} 01753 break; 01754 01755 case 17: 01756 01757 /* Line 1455 of yacc.c */ 01758 #line 248 "sql.y" 01759 { 01760 SQL_input* sql = (SQL_input*) info; 01761 MSIVIEW *alter = NULL; 01762 01763 ALTER_CreateView( sql->db, &alter, (yyvsp[(3) - (4)].string), NULL, (yyvsp[(4) - (4)].integer) ); 01764 if( !alter ) 01765 YYABORT; 01766 01767 PARSER_BUBBLE_UP_VIEW( sql, (yyval.query), alter ); 01768 ;} 01769 break; 01770 01771 case 18: 01772 01773 /* Line 1455 of yacc.c */ 01774 #line 259 "sql.y" 01775 { 01776 SQL_input *sql = (SQL_input *)info; 01777 MSIVIEW *alter = NULL; 01778 01779 ALTER_CreateView( sql->db, &alter, (yyvsp[(3) - (5)].string), (yyvsp[(5) - (5)].column_list), 0 ); 01780 if (!alter) 01781 YYABORT; 01782 01783 PARSER_BUBBLE_UP_VIEW( sql, (yyval.query), alter ); 01784 ;} 01785 break; 01786 01787 case 19: 01788 01789 /* Line 1455 of yacc.c */ 01790 #line 270 "sql.y" 01791 { 01792 SQL_input *sql = (SQL_input *)info; 01793 MSIVIEW *alter = NULL; 01794 01795 ALTER_CreateView( sql->db, &alter, (yyvsp[(3) - (6)].string), (yyvsp[(5) - (6)].column_list), 1 ); 01796 if (!alter) 01797 YYABORT; 01798 01799 PARSER_BUBBLE_UP_VIEW( sql, (yyval.query), alter ); 01800 ;} 01801 break; 01802 01803 case 20: 01804 01805 /* Line 1455 of yacc.c */ 01806 #line 284 "sql.y" 01807 { 01808 (yyval.integer) = 1; 01809 ;} 01810 break; 01811 01812 case 21: 01813 01814 /* Line 1455 of yacc.c */ 01815 #line 288 "sql.y" 01816 { 01817 (yyval.integer) = -1; 01818 ;} 01819 break; 01820 01821 case 22: 01822 01823 /* Line 1455 of yacc.c */ 01824 #line 295 "sql.y" 01825 { 01826 SQL_input* sql = (SQL_input*) info; 01827 MSIVIEW* drop = NULL; 01828 UINT r; 01829 01830 r = DROP_CreateView( sql->db, &drop, (yyvsp[(3) - (3)].string) ); 01831 if( r != ERROR_SUCCESS || !(yyval.query) ) 01832 YYABORT; 01833 01834 PARSER_BUBBLE_UP_VIEW( sql, (yyval.query), drop ); 01835 ;} 01836 break; 01837 01838 case 23: 01839 01840 /* Line 1455 of yacc.c */ 01841 #line 310 "sql.y" 01842 { 01843 if( SQL_MarkPrimaryKeys( &(yyvsp[(1) - (4)].column_list), (yyvsp[(4) - (4)].column_list) ) ) 01844 (yyval.column_list) = (yyvsp[(1) - (4)].column_list); 01845 else 01846 (yyval.column_list) = NULL; 01847 ;} 01848 break; 01849 01850 case 24: 01851 01852 /* Line 1455 of yacc.c */ 01853 #line 320 "sql.y" 01854 { 01855 column_info *ci; 01856 01857 for( ci = (yyvsp[(1) - (3)].column_list); ci->next; ci = ci->next ) 01858 ; 01859 01860 ci->next = (yyvsp[(3) - (3)].column_list); 01861 (yyval.column_list) = (yyvsp[(1) - (3)].column_list); 01862 ;} 01863 break; 01864 01865 case 25: 01866 01867 /* Line 1455 of yacc.c */ 01868 #line 330 "sql.y" 01869 { 01870 (yyval.column_list) = (yyvsp[(1) - (1)].column_list); 01871 ;} 01872 break; 01873 01874 case 26: 01875 01876 /* Line 1455 of yacc.c */ 01877 #line 337 "sql.y" 01878 { 01879 (yyval.column_list) = (yyvsp[(1) - (2)].column_list); 01880 (yyval.column_list)->type = ((yyvsp[(2) - (2)].column_type) | MSITYPE_VALID); 01881 (yyval.column_list)->temporary = (yyvsp[(2) - (2)].column_type) & MSITYPE_TEMPORARY ? TRUE : FALSE; 01882 ;} 01883 break; 01884 01885 case 27: 01886 01887 /* Line 1455 of yacc.c */ 01888 #line 346 "sql.y" 01889 { 01890 (yyval.column_type) = (yyvsp[(1) - (1)].column_type); 01891 ;} 01892 break; 01893 01894 case 28: 01895 01896 /* Line 1455 of yacc.c */ 01897 #line 350 "sql.y" 01898 { 01899 (yyval.column_type) = (yyvsp[(1) - (2)].column_type) | MSITYPE_LOCALIZABLE; 01900 ;} 01901 break; 01902 01903 case 29: 01904 01905 /* Line 1455 of yacc.c */ 01906 #line 354 "sql.y" 01907 { 01908 (yyval.column_type) = (yyvsp[(1) - (2)].column_type) | MSITYPE_TEMPORARY; 01909 ;} 01910 break; 01911 01912 case 30: 01913 01914 /* Line 1455 of yacc.c */ 01915 #line 361 "sql.y" 01916 { 01917 (yyval.column_type) |= MSITYPE_NULLABLE; 01918 ;} 01919 break; 01920 01921 case 31: 01922 01923 /* Line 1455 of yacc.c */ 01924 #line 365 "sql.y" 01925 { 01926 (yyval.column_type) = (yyvsp[(1) - (3)].column_type); 01927 ;} 01928 break; 01929 01930 case 32: 01931 01932 /* Line 1455 of yacc.c */ 01933 #line 372 "sql.y" 01934 { 01935 (yyval.column_type) = MSITYPE_STRING | 1; 01936 ;} 01937 break; 01938 01939 case 33: 01940 01941 /* Line 1455 of yacc.c */ 01942 #line 376 "sql.y" 01943 { 01944 (yyval.column_type) = MSITYPE_STRING | 0x400 | (yyvsp[(3) - (4)].column_type); 01945 ;} 01946 break; 01947 01948 case 34: 01949 01950 /* Line 1455 of yacc.c */ 01951 #line 380 "sql.y" 01952 { 01953 (yyval.column_type) = MSITYPE_STRING | 0x400; 01954 ;} 01955 break; 01956 01957 case 35: 01958 01959 /* Line 1455 of yacc.c */ 01960 #line 384 "sql.y" 01961 { 01962 (yyval.column_type) = 2 | 0x400; 01963 ;} 01964 break; 01965 01966 case 36: 01967 01968 /* Line 1455 of yacc.c */ 01969 #line 388 "sql.y" 01970 { 01971 (yyval.column_type) = 2 | 0x400; 01972 ;} 01973 break; 01974 01975 case 37: 01976 01977 /* Line 1455 of yacc.c */ 01978 #line 392 "sql.y" 01979 { 01980 (yyval.column_type) = 4; 01981 ;} 01982 break; 01983 01984 case 38: 01985 01986 /* Line 1455 of yacc.c */ 01987 #line 396 "sql.y" 01988 { 01989 (yyval.column_type) = MSITYPE_STRING | MSITYPE_VALID; 01990 ;} 01991 break; 01992 01993 case 39: 01994 01995 /* Line 1455 of yacc.c */ 01996 #line 403 "sql.y" 01997 { 01998 if( ( (yyvsp[(1) - (1)].integer) > 255 ) || ( (yyvsp[(1) - (1)].integer) < 0 ) ) 01999 YYABORT; 02000 (yyval.column_type) = (yyvsp[(1) - (1)].integer); 02001 ;} 02002 break; 02003 02004 case 40: 02005 02006 /* Line 1455 of yacc.c */ 02007 #line 412 "sql.y" 02008 { 02009 (yyval.query) = (yyvsp[(2) - (2)].query); 02010 ;} 02011 break; 02012 02013 case 41: 02014 02015 /* Line 1455 of yacc.c */ 02016 #line 416 "sql.y" 02017 { 02018 SQL_input* sql = (SQL_input*) info; 02019 MSIVIEW* distinct = NULL; 02020 UINT r; 02021 02022 r = DISTINCT_CreateView( sql->db, &distinct, (yyvsp[(3) - (3)].query) ); 02023 if (r != ERROR_SUCCESS) 02024 YYABORT; 02025 02026 PARSER_BUBBLE_UP_VIEW( sql, (yyval.query), distinct ); 02027 ;} 02028 break; 02029 02030 case 42: 02031 02032 /* Line 1455 of yacc.c */ 02033 #line 431 "sql.y" 02034 { 02035 SQL_input* sql = (SQL_input*) info; 02036 MSIVIEW* select = NULL; 02037 UINT r; 02038 02039 if( (yyvsp[(1) - (2)].column_list) ) 02040 { 02041 r = SELECT_CreateView( sql->db, &select, (yyvsp[(2) - (2)].query), (yyvsp[(1) - (2)].column_list) ); 02042 if (r != ERROR_SUCCESS) 02043 YYABORT; 02044 02045 PARSER_BUBBLE_UP_VIEW( sql, (yyval.query), select ); 02046 } 02047 else 02048 (yyval.query) = (yyvsp[(2) - (2)].query); 02049 ;} 02050 break; 02051 02052 case 44: 02053 02054 /* Line 1455 of yacc.c */ 02055 #line 452 "sql.y" 02056 { 02057 (yyvsp[(1) - (3)].column_list)->next = (yyvsp[(3) - (3)].column_list); 02058 ;} 02059 break; 02060 02061 case 45: 02062 02063 /* Line 1455 of yacc.c */ 02064 #line 456 "sql.y" 02065 { 02066 (yyval.column_list) = NULL; 02067 ;} 02068 break; 02069 02070 case 47: 02071 02072 /* Line 1455 of yacc.c */ 02073 #line 464 "sql.y" 02074 { 02075 (yyvsp[(1) - (3)].column_list)->next = (yyvsp[(3) - (3)].column_list); 02076 ;} 02077 break; 02078 02079 case 48: 02080 02081 /* Line 1455 of yacc.c */ 02082 #line 468 "sql.y" 02083 { 02084 (yyval.column_list) = NULL; 02085 ;} 02086 break; 02087 02088 case 49: 02089 02090 /* Line 1455 of yacc.c */ 02091 #line 475 "sql.y" 02092 { 02093 SQL_input* sql = (SQL_input*) info; 02094 MSIVIEW* table = NULL; 02095 UINT r; 02096 02097 r = TABLE_CreateView( sql->db, (yyvsp[(2) - (2)].string), &table ); 02098 if( r != ERROR_SUCCESS || !(yyval.query) ) 02099 YYABORT; 02100 02101 PARSER_BUBBLE_UP_VIEW( sql, (yyval.query), table ); 02102 ;} 02103 break; 02104 02105 case 50: 02106 02107 /* Line 1455 of yacc.c */ 02108 #line 487 "sql.y" 02109 { 02110 UINT r; 02111 02112 if( (yyvsp[(4) - (4)].column_list) ) 02113 { 02114 r = (yyvsp[(1) - (4)].query)->ops->sort( (yyvsp[(1) - (4)].query), (yyvsp[(4) - (4)].column_list) ); 02115 if ( r != ERROR_SUCCESS) 02116 YYABORT; 02117 } 02118 02119 (yyval.query) = (yyvsp[(1) - (4)].query); 02120 ;} 02121 break; 02122 02123 case 52: 02124 02125 /* Line 1455 of yacc.c */ 02126 #line 504 "sql.y" 02127 { 02128 SQL_input* sql = (SQL_input*) info; 02129 MSIVIEW* where = NULL; 02130 UINT r; 02131 02132 r = WHERE_CreateView( sql->db, &where, (yyvsp[(2) - (2)].string), NULL ); 02133 if( r != ERROR_SUCCESS ) 02134 YYABORT; 02135 02136 PARSER_BUBBLE_UP_VIEW( sql, (yyval.query), where ); 02137 ;} 02138 break; 02139 02140 case 53: 02141 02142 /* Line 1455 of yacc.c */ 02143 #line 516 "sql.y" 02144 { 02145 SQL_input* sql = (SQL_input*) info; 02146 MSIVIEW* where = NULL; 02147 UINT r; 02148 02149 r = WHERE_CreateView( sql->db, &where, (yyvsp[(2) - (4)].string), (yyvsp[(4) - (4)].expr) ); 02150 if( r != ERROR_SUCCESS ) 02151 YYABORT; 02152 02153 PARSER_BUBBLE_UP_VIEW( sql, (yyval.query), where ); 02154 ;} 02155 break; 02156 02157 case 54: 02158 02159 /* Line 1455 of yacc.c */ 02160 #line 531 "sql.y" 02161 { 02162 (yyval.string) = (yyvsp[(1) - (1)].string); 02163 ;} 02164 break; 02165 02166 case 55: 02167 02168 /* Line 1455 of yacc.c */ 02169 #line 535 "sql.y" 02170 { 02171 (yyval.string) = parser_add_table( info, (yyvsp[(3) - (3)].string), (yyvsp[(1) - (3)].string) ); 02172 if (!(yyval.string)) 02173 YYABORT; 02174 ;} 02175 break; 02176 02177 case 56: 02178 02179 /* Line 1455 of yacc.c */ 02180 #line 544 "sql.y" 02181 { 02182 (yyval.expr) = (yyvsp[(2) - (3)].expr); 02183 if( !(yyval.expr) ) 02184 YYABORT; 02185 ;} 02186 break; 02187 02188 case 57: 02189 02190 /* Line 1455 of yacc.c */ 02191 #line 550 "sql.y" 02192 { 02193 (yyval.expr) = EXPR_complex( info, (yyvsp[(1) - (3)].expr), OP_AND, (yyvsp[(3) - (3)].expr) ); 02194 if( !(yyval.expr) ) 02195 YYABORT; 02196 ;} 02197 break; 02198 02199 case 58: 02200 02201 /* Line 1455 of yacc.c */ 02202 #line 556 "sql.y" 02203 { 02204 (yyval.expr) = EXPR_complex( info, (yyvsp[(1) - (3)].expr), OP_OR, (yyvsp[(3) - (3)].expr) ); 02205 if( !(yyval.expr) ) 02206 YYABORT; 02207 ;} 02208 break; 02209 02210 case 59: 02211 02212 /* Line 1455 of yacc.c */ 02213 #line 562 "sql.y" 02214 { 02215 (yyval.expr) = EXPR_complex( info, (yyvsp[(1) - (3)].expr), OP_EQ, (yyvsp[(3) - (3)].expr) ); 02216 if( !(yyval.expr) ) 02217 YYABORT; 02218 ;} 02219 break; 02220 02221 case 60: 02222 02223 /* Line 1455 of yacc.c */ 02224 #line 568 "sql.y" 02225 { 02226 (yyval.expr) = EXPR_complex( info, (yyvsp[(1) - (3)].expr), OP_GT, (yyvsp[(3) - (3)].expr) ); 02227 if( !(yyval.expr) ) 02228 YYABORT; 02229 ;} 02230 break; 02231 02232 case 61: 02233 02234 /* Line 1455 of yacc.c */ 02235 #line 574 "sql.y" 02236 { 02237 (yyval.expr) = EXPR_complex( info, (yyvsp[(1) - (3)].expr), OP_LT, (yyvsp[(3) - (3)].expr) ); 02238 if( !(yyval.expr) ) 02239 YYABORT; 02240 ;} 02241 break; 02242 02243 case 62: 02244 02245 /* Line 1455 of yacc.c */ 02246 #line 580 "sql.y" 02247 { 02248 (yyval.expr) = EXPR_complex( info, (yyvsp[(1) - (3)].expr), OP_LE, (yyvsp[(3) - (3)].expr) ); 02249 if( !(yyval.expr) ) 02250 YYABORT; 02251 ;} 02252 break; 02253 02254 case 63: 02255 02256 /* Line 1455 of yacc.c */ 02257 #line 586 "sql.y" 02258 { 02259 (yyval.expr) = EXPR_complex( info, (yyvsp[(1) - (3)].expr), OP_GE, (yyvsp[(3) - (3)].expr) ); 02260 if( !(yyval.expr) ) 02261 YYABORT; 02262 ;} 02263 break; 02264 02265 case 64: 02266 02267 /* Line 1455 of yacc.c */ 02268 #line 592 "sql.y" 02269 { 02270 (yyval.expr) = EXPR_complex( info, (yyvsp[(1) - (3)].expr), OP_NE, (yyvsp[(3) - (3)].expr) ); 02271 if( !(yyval.expr) ) 02272 YYABORT; 02273 ;} 02274 break; 02275 02276 case 65: 02277 02278 /* Line 1455 of yacc.c */ 02279 #line 598 "sql.y" 02280 { 02281 (yyval.expr) = EXPR_unary( info, (yyvsp[(1) - (3)].expr), OP_ISNULL ); 02282 if( !(yyval.expr) ) 02283 YYABORT; 02284 ;} 02285 break; 02286 02287 case 66: 02288 02289 /* Line 1455 of yacc.c */ 02290 #line 604 "sql.y" 02291 { 02292 (yyval.expr) = EXPR_unary( info, (yyvsp[(1) - (4)].expr), OP_NOTNULL ); 02293 if( !(yyval.expr) ) 02294 YYABORT; 02295 ;} 02296 break; 02297 02298 case 69: 02299 02300 /* Line 1455 of yacc.c */ 02301 #line 618 "sql.y" 02302 { 02303 (yyval.column_list) = parser_alloc_column( info, NULL, NULL ); 02304 if( !(yyval.column_list) ) 02305 YYABORT; 02306 (yyval.column_list)->val = (yyvsp[(1) - (1)].expr); 02307 ;} 02308 break; 02309 02310 case 70: 02311 02312 /* Line 1455 of yacc.c */ 02313 #line 625 "sql.y" 02314 { 02315 (yyval.column_list) = parser_alloc_column( info, NULL, NULL ); 02316 if( !(yyval.column_list) ) 02317 YYABORT; 02318 (yyval.column_list)->val = (yyvsp[(1) - (3)].expr); 02319 (yyval.column_list)->next = (yyvsp[(3) - (3)].column_list); 02320 ;} 02321 break; 02322 02323 case 72: 02324 02325 /* Line 1455 of yacc.c */ 02326 #line 637 "sql.y" 02327 { 02328 (yyval.column_list) = (yyvsp[(1) - (3)].column_list); 02329 (yyval.column_list)->next = (yyvsp[(3) - (3)].column_list); 02330 ;} 02331 break; 02332 02333 case 73: 02334 02335 /* Line 1455 of yacc.c */ 02336 #line 645 "sql.y" 02337 { 02338 (yyval.column_list) = (yyvsp[(1) - (3)].column_list); 02339 (yyval.column_list)->val = (yyvsp[(3) - (3)].expr); 02340 ;} 02341 break; 02342 02343 case 74: 02344 02345 /* Line 1455 of yacc.c */ 02346 #line 653 "sql.y" 02347 { 02348 (yyval.expr) = EXPR_ival( info, (yyvsp[(1) - (1)].integer) ); 02349 if( !(yyval.expr) ) 02350 YYABORT; 02351 ;} 02352 break; 02353 02354 case 75: 02355 02356 /* Line 1455 of yacc.c */ 02357 #line 659 "sql.y" 02358 { 02359 (yyval.expr) = EXPR_ival( info, -(yyvsp[(2) - (2)].integer) ); 02360 if( !(yyval.expr) ) 02361 YYABORT; 02362 ;} 02363 break; 02364 02365 case 76: 02366 02367 /* Line 1455 of yacc.c */ 02368 #line 665 "sql.y" 02369 { 02370 (yyval.expr) = EXPR_sval( info, &(yyvsp[(1) - (1)].str) ); 02371 if( !(yyval.expr) ) 02372 YYABORT; 02373 ;} 02374 break; 02375 02376 case 77: 02377 02378 /* Line 1455 of yacc.c */ 02379 #line 671 "sql.y" 02380 { 02381 (yyval.expr) = EXPR_wildcard( info ); 02382 if( !(yyval.expr) ) 02383 YYABORT; 02384 ;} 02385 break; 02386 02387 case 78: 02388 02389 /* Line 1455 of yacc.c */ 02390 #line 680 "sql.y" 02391 { 02392 (yyval.expr) = EXPR_column( info, (yyvsp[(1) - (1)].column_list) ); 02393 if( !(yyval.expr) ) 02394 YYABORT; 02395 ;} 02396 break; 02397 02398 case 79: 02399 02400 /* Line 1455 of yacc.c */ 02401 #line 689 "sql.y" 02402 { 02403 (yyval.column_list) = parser_alloc_column( info, (yyvsp[(1) - (3)].string), (yyvsp[(3) - (3)].string) ); 02404 if( !(yyval.column_list) ) 02405 YYABORT; 02406 ;} 02407 break; 02408 02409 case 80: 02410 02411 /* Line 1455 of yacc.c */ 02412 #line 695 "sql.y" 02413 { 02414 (yyval.column_list) = parser_alloc_column( info, NULL, (yyvsp[(1) - (1)].string) ); 02415 if( !(yyval.column_list) ) 02416 YYABORT; 02417 ;} 02418 break; 02419 02420 case 81: 02421 02422 /* Line 1455 of yacc.c */ 02423 #line 704 "sql.y" 02424 { 02425 (yyval.column_list) = parser_alloc_column( info, (yyvsp[(1) - (3)].string), (yyvsp[(3) - (3)].string) ); 02426 if( !(yyval.column_list) ) 02427 YYABORT; 02428 ;} 02429 break; 02430 02431 case 82: 02432 02433 /* Line 1455 of yacc.c */ 02434 #line 710 "sql.y" 02435 { 02436 (yyval.column_list) = parser_alloc_column( info, NULL, (yyvsp[(1) - (1)].string) ); 02437 if( !(yyval.column_list) ) 02438 YYABORT; 02439 ;} 02440 break; 02441 02442 case 83: 02443 02444 /* Line 1455 of yacc.c */ 02445 #line 716 "sql.y" 02446 { 02447 (yyval.column_list) = parser_alloc_column( info, NULL, (yyvsp[(1) - (1)].string) ); 02448 if( !(yyval.column_list) ) 02449 YYABORT; 02450 ;} 02451 break; 02452 02453 case 84: 02454 02455 /* Line 1455 of yacc.c */ 02456 #line 725 "sql.y" 02457 { 02458 (yyval.string) = (yyvsp[(1) - (1)].string); 02459 ;} 02460 break; 02461 02462 case 85: 02463 02464 /* Line 1455 of yacc.c */ 02465 #line 732 "sql.y" 02466 { 02467 if ( SQL_getstring( info, &(yyvsp[(1) - (1)].str), &(yyval.string) ) != ERROR_SUCCESS || !(yyval.string) ) 02468 YYABORT; 02469 ;} 02470 break; 02471 02472 case 86: 02473 02474 /* Line 1455 of yacc.c */ 02475 #line 740 "sql.y" 02476 { 02477 if ( SQL_getstring( info, &(yyvsp[(1) - (1)].str), &(yyval.string) ) != ERROR_SUCCESS || !(yyval.string) ) 02478 YYABORT; 02479 ;} 02480 break; 02481 02482 case 87: 02483 02484 /* Line 1455 of yacc.c */ 02485 #line 748 "sql.y" 02486 { 02487 (yyval.integer) = SQL_getint( info ); 02488 ;} 02489 break; 02490 02491 02492 02493 /* Line 1455 of yacc.c */ 02494 #line 2488 "sql.tab.c" 02495 default: break; 02496 } 02497 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); 02498 02499 YYPOPSTACK (yylen); 02500 yylen = 0; 02501 YY_STACK_PRINT (yyss, yyssp); 02502 02503 *++yyvsp = yyval; 02504 02505 /* Now `shift' the result of the reduction. Determine what state 02506 that goes to, based on the state we popped back to and the rule 02507 number reduced by. */ 02508 02509 yyn = yyr1[yyn]; 02510 02511 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; 02512 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) 02513 yystate = yytable[yystate]; 02514 else 02515 yystate = yydefgoto[yyn - YYNTOKENS]; 02516 02517 goto yynewstate; 02518 02519 02520 /*------------------------------------. 02521 | yyerrlab -- here on detecting error | 02522 `------------------------------------*/ 02523 yyerrlab: 02524 /* If not already recovering from an error, report this error. */ 02525 if (!yyerrstatus) 02526 { 02527 ++yynerrs; 02528 #if ! YYERROR_VERBOSE 02529 yyerror (YY_("syntax error")); 02530 #else 02531 { 02532 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); 02533 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) 02534 { 02535 YYSIZE_T yyalloc = 2 * yysize; 02536 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) 02537 yyalloc = YYSTACK_ALLOC_MAXIMUM; 02538 if (yymsg != yymsgbuf) 02539 YYSTACK_FREE (yymsg); 02540 yymsg = (char *) YYSTACK_ALLOC (yyalloc); 02541 if (yymsg) 02542 yymsg_alloc = yyalloc; 02543 else 02544 { 02545 yymsg = yymsgbuf; 02546 yymsg_alloc = sizeof yymsgbuf; 02547 } 02548 } 02549 02550 if (0 < yysize && yysize <= yymsg_alloc) 02551 { 02552 (void) yysyntax_error (yymsg, yystate, yychar); 02553 yyerror (yymsg); 02554 } 02555 else 02556 { 02557 yyerror (YY_("syntax error")); 02558 if (yysize != 0) 02559 goto yyexhaustedlab; 02560 } 02561 } 02562 #endif 02563 } 02564 02565 02566 02567 if (yyerrstatus == 3) 02568 { 02569 /* If just tried and failed to reuse lookahead token after an 02570 error, discard it. */ 02571 02572 if (yychar <= YYEOF) 02573 { 02574 /* Return failure if at end of input. */ 02575 if (yychar == YYEOF) 02576 YYABORT; 02577 } 02578 else 02579 { 02580 yydestruct ("Error: discarding", 02581 yytoken, &yylval); 02582 yychar = YYEMPTY; 02583 } 02584 } 02585 02586 /* Else will try to reuse lookahead token after shifting the error 02587 token. */ 02588 goto yyerrlab1; 02589 02590 02591 /*---------------------------------------------------. 02592 | yyerrorlab -- error raised explicitly by YYERROR. | 02593 `---------------------------------------------------*/ 02594 yyerrorlab: 02595 02596 /* Pacify compilers like GCC when the user code never invokes 02597 YYERROR and the label yyerrorlab therefore never appears in user 02598 code. */ 02599 if (/*CONSTCOND*/ 0) 02600 goto yyerrorlab; 02601 02602 /* Do not reclaim the symbols of the rule which action triggered 02603 this YYERROR. */ 02604 YYPOPSTACK (yylen); 02605 yylen = 0; 02606 YY_STACK_PRINT (yyss, yyssp); 02607 yystate = *yyssp; 02608 goto yyerrlab1; 02609 02610 02611 /*-------------------------------------------------------------. 02612 | yyerrlab1 -- common code for both syntax error and YYERROR. | 02613 `-------------------------------------------------------------*/ 02614 yyerrlab1: 02615 yyerrstatus = 3; /* Each real token shifted decrements this. */ 02616 02617 for (;;) 02618 { 02619 yyn = yypact[yystate]; 02620 if (yyn != YYPACT_NINF) 02621 { 02622 yyn += YYTERROR; 02623 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) 02624 { 02625 yyn = yytable[yyn]; 02626 if (0 < yyn) 02627 break; 02628 } 02629 } 02630 02631 /* Pop the current state because it cannot handle the error token. */ 02632 if (yyssp == yyss) 02633 YYABORT; 02634 02635 02636 yydestruct ("Error: popping", 02637 yystos[yystate], yyvsp); 02638 YYPOPSTACK (1); 02639 yystate = *yyssp; 02640 YY_STACK_PRINT (yyss, yyssp); 02641 } 02642 02643 *++yyvsp = yylval; 02644 02645 02646 /* Shift the error token. */ 02647 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); 02648 02649 yystate = yyn; 02650 goto yynewstate; 02651 02652 02653 /*-------------------------------------. 02654 | yyacceptlab -- YYACCEPT comes here. | 02655 `-------------------------------------*/ 02656 yyacceptlab: 02657 yyresult = 0; 02658 goto yyreturn; 02659 02660 /*-----------------------------------. 02661 | yyabortlab -- YYABORT comes here. | 02662 `-----------------------------------*/ 02663 yyabortlab: 02664 yyresult = 1; 02665 goto yyreturn; 02666 02667 #if !defined(yyoverflow) || YYERROR_VERBOSE 02668 /*-------------------------------------------------. 02669 | yyexhaustedlab -- memory exhaustion comes here. | 02670 `-------------------------------------------------*/ 02671 yyexhaustedlab: 02672 yyerror (YY_("memory exhausted")); 02673 yyresult = 2; 02674 /* Fall through. */ 02675 #endif 02676 02677 yyreturn: 02678 if (yychar != YYEMPTY) 02679 yydestruct ("Cleanup: discarding lookahead", 02680 yytoken, &yylval); 02681 /* Do not reclaim the symbols of the rule which action triggered 02682 this YYABORT or YYACCEPT. */ 02683 YYPOPSTACK (yylen); 02684 YY_STACK_PRINT (yyss, yyssp); 02685 while (yyssp != yyss) 02686 { 02687 yydestruct ("Cleanup: popping", 02688 yystos[*yyssp], yyvsp); 02689 YYPOPSTACK (1); 02690 } 02691 #ifndef yyoverflow 02692 if (yyss != yyssa) 02693 YYSTACK_FREE (yyss); 02694 #endif 02695 #if YYERROR_VERBOSE 02696 if (yymsg != yymsgbuf) 02697 YYSTACK_FREE (yymsg); 02698 #endif 02699 /* Make sure YYID is used. */ 02700 return YYID (yyresult); 02701 } 02702 02703 02704 02705 /* Line 1675 of yacc.c */ 02706 #line 753 "sql.y" 02707 02708 02709 static LPWSTR parser_add_table( void *info, LPCWSTR list, LPCWSTR table ) 02710 { 02711 static const WCHAR space[] = {' ',0}; 02712 DWORD len = strlenW( list ) + strlenW( table ) + 2; 02713 LPWSTR ret; 02714 02715 ret = parser_alloc( info, len * sizeof(WCHAR) ); 02716 if( ret ) 02717 { 02718 strcpyW( ret, list ); 02719 strcatW( ret, space ); 02720 strcatW( ret, table ); 02721 } 02722 return ret; 02723 } 02724 02725 static void *parser_alloc( void *info, unsigned int sz ) 02726 { 02727 SQL_input* sql = (SQL_input*) info; 02728 struct list *mem; 02729 02730 mem = msi_alloc( sizeof (struct list) + sz ); 02731 list_add_tail( sql->mem, mem ); 02732 return &mem[1]; 02733 } 02734 02735 static column_info *parser_alloc_column( void *info, LPCWSTR table, LPCWSTR column ) 02736 { 02737 column_info *col; 02738 02739 col = parser_alloc( info, sizeof (*col) ); 02740 if( col ) 02741 { 02742 col->table = table; 02743 col->column = column; 02744 col->val = NULL; 02745 col->type = 0; 02746 col->next = NULL; 02747 } 02748 02749 return col; 02750 } 02751 02752 static int sql_lex( void *SQL_lval, SQL_input *sql ) 02753 { 02754 int token, skip; 02755 struct sql_str * str = SQL_lval; 02756 02757 do 02758 { 02759 sql->n += sql->len; 02760 if( ! sql->command[sql->n] ) 02761 return 0; /* end of input */ 02762 02763 /* TRACE("string : %s\n", debugstr_w(&sql->command[sql->n])); */ 02764 sql->len = sqliteGetToken( &sql->command[sql->n], &token, &skip ); 02765 if( sql->len==0 ) 02766 break; 02767 str->data = &sql->command[sql->n]; 02768 str->len = sql->len; 02769 sql->n += skip; 02770 } 02771 while( token == TK_SPACE ); 02772 02773 /* TRACE("token : %d (%s)\n", token, debugstr_wn(&sql->command[sql->n], sql->len)); */ 02774 02775 return token; 02776 } 02777 02778 UINT SQL_getstring( void *info, const struct sql_str *strdata, LPWSTR *str ) 02779 { 02780 LPCWSTR p = strdata->data; 02781 UINT len = strdata->len; 02782 02783 /* match quotes */ 02784 if( ( (p[0]=='`') && (p[len-1]!='`') ) || 02785 ( (p[0]=='\'') && (p[len-1]!='\'') ) ) 02786 return ERROR_FUNCTION_FAILED; 02787 02788 /* if there's quotes, remove them */ 02789 if( ( (p[0]=='`') && (p[len-1]=='`') ) || 02790 ( (p[0]=='\'') && (p[len-1]=='\'') ) ) 02791 { 02792 p++; 02793 len -= 2; 02794 } 02795 *str = parser_alloc( info, (len + 1)*sizeof(WCHAR) ); 02796 if( !*str ) 02797 return ERROR_OUTOFMEMORY; 02798 memcpy( *str, p, len*sizeof(WCHAR) ); 02799 (*str)[len]=0; 02800 02801 return ERROR_SUCCESS; 02802 } 02803 02804 INT SQL_getint( void *info ) 02805 { 02806 SQL_input* sql = (SQL_input*) info; 02807 LPCWSTR p = &sql->command[sql->n]; 02808 INT i, r = 0; 02809 02810 for( i=0; i<sql->len; i++ ) 02811 { 02812 if( '0' > p[i] || '9' < p[i] ) 02813 { 02814 ERR("should only be numbers here!\n"); 02815 break; 02816 } 02817 r = (p[i]-'0') + r*10; 02818 } 02819 02820 return r; 02821 } 02822 02823 static int sql_error( const char *str ) 02824 { 02825 return 0; 02826 } 02827 02828 static struct expr * EXPR_wildcard( void *info ) 02829 { 02830 struct expr *e = parser_alloc( info, sizeof *e ); 02831 if( e ) 02832 { 02833 e->type = EXPR_WILDCARD; 02834 } 02835 return e; 02836 } 02837 02838 static struct expr * EXPR_complex( void *info, struct expr *l, UINT op, struct expr *r ) 02839 { 02840 struct expr *e = parser_alloc( info, sizeof *e ); 02841 if( e ) 02842 { 02843 e->type = EXPR_COMPLEX; 02844 e->u.expr.left = l; 02845 e->u.expr.op = op; 02846 e->u.expr.right = r; 02847 } 02848 return e; 02849 } 02850 02851 static struct expr * EXPR_unary( void *info, struct expr *l, UINT op ) 02852 { 02853 struct expr *e = parser_alloc( info, sizeof *e ); 02854 if( e ) 02855 { 02856 e->type = EXPR_UNARY; 02857 e->u.expr.left = l; 02858 e->u.expr.op = op; 02859 e->u.expr.right = NULL; 02860 } 02861 return e; 02862 } 02863 02864 static struct expr * EXPR_column( void *info, const column_info *column ) 02865 { 02866 struct expr *e = parser_alloc( info, sizeof *e ); 02867 if( e ) 02868 { 02869 e->type = EXPR_COLUMN; 02870 e->u.column.unparsed.column = column->column; 02871 e->u.column.unparsed.table = column->table; 02872 } 02873 return e; 02874 } 02875 02876 static struct expr * EXPR_ival( void *info, int val ) 02877 { 02878 struct expr *e = parser_alloc( info, sizeof *e ); 02879 if( e ) 02880 { 02881 e->type = EXPR_IVAL; 02882 e->u.ival = val; 02883 } 02884 return e; 02885 } 02886 02887 static struct expr * EXPR_sval( void *info, const struct sql_str *str ) 02888 { 02889 struct expr *e = parser_alloc( info, sizeof *e ); 02890 if( e ) 02891 { 02892 e->type = EXPR_SVAL; 02893 if( SQL_getstring( info, str, (LPWSTR *)&e->u.sval ) != ERROR_SUCCESS ) 02894 return NULL; /* e will be freed by query destructor */ 02895 } 02896 return e; 02897 } 02898 02899 static void swap_columns( column_info **cols, column_info *A, int idx ) 02900 { 02901 column_info *preA = NULL, *preB = NULL, *B, *ptr; 02902 int i = 0; 02903 02904 B = NULL; 02905 ptr = *cols; 02906 while( ptr ) 02907 { 02908 if( i++ == idx ) 02909 B = ptr; 02910 else if( !B ) 02911 preB = ptr; 02912 02913 if( ptr->next == A ) 02914 preA = ptr; 02915 02916 ptr = ptr->next; 02917 } 02918 02919 if( preB ) preB->next = A; 02920 if( preA ) preA->next = B; 02921 ptr = A->next; 02922 A->next = B->next; 02923 B->next = ptr; 02924 if( idx == 0 ) 02925 *cols = A; 02926 } 02927 02928 static BOOL SQL_MarkPrimaryKeys( column_info **cols, 02929 column_info *keys ) 02930 { 02931 column_info *k; 02932 BOOL found = TRUE; 02933 int count; 02934 02935 for( k = keys, count = 0; k && found; k = k->next, count++ ) 02936 { 02937 column_info *c; 02938 int idx; 02939 02940 found = FALSE; 02941 for( c = *cols, idx = 0; c && !found; c = c->next, idx++ ) 02942 { 02943 if( strcmpW( k->column, c->column ) ) 02944 continue; 02945 c->type |= MSITYPE_KEY; 02946 found = TRUE; 02947 if (idx != count) 02948 swap_columns( cols, c, count ); 02949 } 02950 } 02951 02952 return found; 02953 } 02954 02955 UINT MSI_ParseSQL( MSIDATABASE *db, LPCWSTR command, MSIVIEW **phview, 02956 struct list *mem ) 02957 { 02958 SQL_input sql; 02959 int r; 02960 02961 *phview = NULL; 02962 02963 sql.db = db; 02964 sql.command = command; 02965 sql.n = 0; 02966 sql.len = 0; 02967 sql.r = ERROR_BAD_QUERY_SYNTAX; 02968 sql.view = phview; 02969 sql.mem = mem; 02970 02971 r = sql_parse(&sql); 02972 02973 TRACE("Parse returned %d\n", r); 02974 if( r ) 02975 { 02976 if (*sql.view) 02977 { 02978 (*sql.view)->ops->delete(*sql.view); 02979 *sql.view = NULL; 02980 } 02981 return sql.r; 02982 } 02983 02984 return ERROR_SUCCESS; 02985 } 02986 Generated on Sat May 26 2012 04:23:51 for ReactOS by
1.7.6.1
|