00001 #ifndef lint
00002 static char yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93";
00003 #endif
00004 #define YYBYACC 1
00005 #define YYMAJOR 1
00006 #define YYMINOR 9
00007 #define yyclearin (yychar=(-1))
00008 #define yyerrok (yyerrflag=0)
00009 #define YYRECOVERING (yyerrflag!=0)
00010 #define YYPREFIX "yy"
00011 #line 2 "dmlyacc.yxx"
00012 #include <CSql.h>
00013 #include <stdlib.h>
00014 #include "Parser.h"
00015
00016 class Predicate;
00017
00018 ParsedData *parsedData;
00019 extern char yytext[];
00020 int yylex( void );
00021 void yyerror(const char* Msg);
00022 #line 15 "dmlyacc.yxx"
00023 typedef union
00024 {
00025 char *stringval;
00026 void *predicate;
00027 } YYSTYPE;
00028 #line 29 "dmlyacc.cxx"
00029 #define STRING 257
00030 #define FIELD 258
00031 #define NUMBER_STRING 259
00032 #define BINARY_STRING 260
00033 #define DOUBLE 261
00034 #define OPERATOR 262
00035 #define PARAMETER 263
00036 #define SELECT 264
00037 #define FROM 265
00038 #define WHERE 266
00039 #define BETWEEN 267
00040 #define IN 268
00041 #define AND 269
00042 #define OR 270
00043 #define NOT 271
00044 #define STAR 272
00045 #define INSERT 273
00046 #define INTO 274
00047 #define VALUES 275
00048 #define DELETE 276
00049 #define UPDATE 277
00050 #define SET 278
00051 #define NULL_VALUE 279
00052 #define CREATE 280
00053 #define TABLE 281
00054 #define PRIMARY 282
00055 #define KEY 283
00056 #define DEFAULT 284
00057 #define INDEX 285
00058 #define ON 286
00059 #define HASH 287
00060 #define TREE 288
00061 #define UNIQUE 289
00062 #define DROP 290
00063 #define INT_TYPE 291
00064 #define LONG_TYPE 292
00065 #define SHORT_TYPE 293
00066 #define DOUBLE_TYPE 294
00067 #define TIMESTAMP_TYPE 295
00068 #define DATE_TYPE 296
00069 #define CHAR_TYPE 297
00070 #define TIME_TYPE 298
00071 #define BIGINT_TYPE 299
00072 #define FLOAT_TYPE 300
00073 #define TINYINT_TYPE 301
00074 #define YYERRCODE 256
00075 short yylhs[] = { -1,
00076 0, 0, 0, 0, 0, 7, 12, 12, 15, 8,
00077 16, 16, 17, 17, 18, 19, 19, 20, 9, 10,
00078 14, 14, 21, 21, 22, 23, 13, 13, 5, 5,
00079 5, 5, 5, 6, 6, 6, 6, 4, 4, 2,
00080 2, 1, 3, 3, 3, 3, 3, 3, 11, 11,
00081 11, 11, 26, 26, 26, 26, 25, 25, 25, 25,
00082 24, 24, 27, 28, 28, 29, 31, 33, 33, 35,
00083 35, 34, 34, 30, 36, 32, 32, 32, 32, 32,
00084 32, 32, 32, 32, 32, 32,
00085 };
00086 short yylen[] = { 2,
00087 1, 1, 1, 1, 1, 6, 2, 1, 2, 9,
00088 0, 3, 2, 1, 2, 2, 1, 2, 5, 6,
00089 1, 0, 2, 1, 2, 3, 2, 0, 3, 3,
00090 2, 3, 1, 3, 3, 6, 6, 1, 0, 1,
00091 1, 1, 1, 1, 1, 1, 1, 1, 7, 11,
00092 3, 3, 0, 2, 2, 0, 0, 1, 1, 0,
00093 2, 1, 2, 1, 1, 5, 1, 0, 3, 0,
00094 2, 0, 2, 1, 5, 1, 1, 1, 1, 1,
00095 1, 1, 1, 1, 1, 1,
00096 };
00097 short yydefred[] = { 0,
00098 0, 0, 0, 0, 0, 0, 0, 1, 2, 3,
00099 4, 5, 42, 41, 40, 8, 0, 0, 0, 0,
00100 0, 0, 0, 0, 0, 0, 7, 0, 0, 0,
00101 0, 0, 51, 52, 0, 9, 0, 0, 0, 0,
00102 0, 0, 24, 0, 0, 0, 0, 0, 0, 0,
00103 0, 0, 33, 21, 19, 0, 0, 0, 23, 0,
00104 67, 0, 62, 64, 65, 0, 74, 0, 6, 12,
00105 0, 0, 0, 0, 38, 0, 0, 0, 43, 44,
00106 45, 46, 47, 48, 26, 25, 20, 0, 0, 0,
00107 61, 76, 77, 78, 82, 85, 83, 86, 84, 79,
00108 81, 80, 0, 0, 14, 0, 32, 35, 34, 0,
00109 0, 0, 0, 0, 63, 49, 0, 0, 0, 0,
00110 0, 13, 0, 0, 0, 0, 0, 0, 0, 15,
00111 10, 0, 17, 0, 75, 69, 73, 0, 66, 59,
00112 58, 0, 36, 0, 37, 16, 71, 0, 0, 0,
00113 18, 54, 55, 50,
00114 };
00115 short yydgoto[] = { 7,
00116 15, 16, 85, 76, 52, 53, 8, 9, 10, 11,
00117 12, 17, 40, 55, 27, 38, 106, 122, 134, 146,
00118 42, 59, 43, 62, 142, 150, 91, 63, 64, 65,
00119 66, 103, 118, 128, 139, 67,
00120 };
00121 short yysindex[] = { -181,
00122 -246, -235, -237, -209, -256, -241, 0, 0, 0, 0,
00123 0, 0, 0, 0, 0, 0, -34, -209, -209, -223,
00124 -209, -209, -209, -209, -209, -246, 0, 19, -202, -209,
00125 31, -211, 0, 0, -202, 0, -246, -195, -36, 28,
00126 -164, -38, 0, -244, -209, 28, 24, 60, -36, -36,
00127 -230, -176, 0, 0, 0, -145, -209, 28, 0, -172,
00128 0, 26, 0, 0, 0, -156, 0, 81, 0, 0,
00129 -145, -176, -33, -155, 0, -138, -36, -36, 0, 0,
00130 0, 0, 0, 0, 0, 0, 0, 87, -244, 28,
00131 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
00132 0, 0, 93, -246, 0, 66, 0, 0, 0, -145,
00133 108, -176, -176, -246, 0, 0, -110, -119, 76, -145,
00134 28, 0, -116, -145, 78, 113, -124, -128, -239, 0,
00135 0, -145, 0, 82, 0, 0, 0, -145, 0, 0,
00136 0, -141, 0, -145, 0, 0, 0, -239, -239, 28,
00137 0, 0, 0, 0,
00138 };
00139 short yyrindex[] = { 0,
00140 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
00141 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
00142 0, 0, 0, 0, 0, 0, 0, -118, 15, 0,
00143 0, 0, 0, 0, 15, 0, 0, 0, 0, 158,
00144 0, 15, 0, 0, 0, 158, 0, 0, 0, 0,
00145 -136, 20, 0, 0, 0, 0, 0, 158, 0, 0,
00146 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
00147 0, 7, 0, 0, 0, 0, 0, 0, 0, 0,
00148 0, 0, 0, 0, 0, 0, 0, 0, 0, 158,
00149 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
00150 0, 0, -41, 0, 0, 0, 0, 0, 0, 0,
00151 0, 13, 17, 0, 0, 0, 0, -39, 0, 0,
00152 158, 0, 0, 0, 0, 0, 0, 84, 1, 0,
00153 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
00154 0, 22, 0, 0, 0, 0, 0, 23, 23, 158,
00155 0, 0, 0, 0,
00156 };
00157 short yygindex[] = { 0,
00158 12, 133, -47, 0, -31, 0, 0, 0, 0, 0,
00159 0, -26, 10, -37, 0, 0, 0, 0, 0, 0,
00160 0, 0, 103, 0, 2, 0, 0, 72, 0, 0,
00161 0, 0, 0, 0, 0, 0,
00162 };
00163 #define YYTABLESIZE 289
00164 short yytable[] = { 68,
00165 57, 72, 68, 50, 72, 57, 31, 107, 69, 26,
00166 47, 13, 29, 13, 28, 20, 30, 72, 73, 27,
00167 87, 53, 57, 105, 21, 14, 109, 19, 22, 28,
00168 29, 74, 31, 32, 33, 34, 35, 60, 18, 23,
00169 75, 41, 140, 24, 46, 112, 113, 31, 13, 141,
00170 51, 58, 116, 29, 30, 61, 68, 30, 37, 57,
00171 51, 51, 123, 39, 70, 31, 90, 26, 41, 89,
00172 44, 29, 130, 28, 45, 30, 133, 119, 27, 48,
00173 53, 57, 1, 131, 143, 108, 54, 125, 51, 51,
00174 147, 2, 77, 78, 3, 4, 151, 56, 5, 71,
00175 61, 79, 13, 80, 81, 82, 121, 83, 6, 120,
00176 88, 79, 154, 80, 81, 82, 129, 83, 135, 26,
00177 104, 26, 145, 84, 70, 144, 114, 70, 110, 111,
00178 39, 39, 117, 84, 92, 93, 94, 95, 96, 97,
00179 98, 99, 100, 101, 102, 148, 149, 124, 126, 152,
00180 153, 127, 132, 136, 137, 138, 11, 22, 36, 86,
00181 115, 0, 0, 0, 0, 0, 0, 0, 0, 0,
00182 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
00183 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
00184 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
00185 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
00186 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
00187 0, 13, 0, 0, 0, 0, 0, 39, 0, 68,
00188 25, 0, 0, 0, 49, 77, 78, 0, 0, 0,
00189 0, 0, 68, 0, 72, 0, 0, 0, 0, 0,
00190 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
00191 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
00192 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
00193 0, 0, 0, 0, 0, 0, 0, 57, 57,
00194 };
00195 short yycheck[] = { 41,
00196 0, 41, 44, 40, 44, 44, 0, 41, 46, 44,
00197 37, 258, 0, 258, 0, 4, 0, 49, 50, 0,
00198 58, 0, 0, 71, 281, 272, 74, 265, 285, 18,
00199 19, 262, 21, 22, 23, 24, 25, 282, 274, 281,
00200 271, 30, 282, 285, 35, 77, 78, 41, 258, 289,
00201 39, 42, 90, 41, 278, 44, 45, 41, 40, 59,
00202 49, 50, 110, 266, 41, 59, 41, 44, 57, 44,
00203 40, 59, 120, 59, 286, 59, 124, 104, 59, 275,
00204 59, 59, 264, 121, 132, 74, 59, 114, 77, 78,
00205 138, 273, 269, 270, 276, 277, 144, 262, 280, 40,
00206 89, 257, 258, 259, 260, 261, 41, 263, 290, 44,
00207 283, 257, 150, 259, 260, 261, 41, 263, 41, 44,
00208 40, 44, 41, 279, 41, 44, 40, 44, 267, 268,
00209 267, 268, 40, 279, 291, 292, 293, 294, 295, 296,
00210 297, 298, 299, 300, 301, 287, 288, 40, 259, 148,
00211 149, 271, 269, 41, 279, 284, 275, 0, 26, 57,
00212 89, -1, -1, -1, -1, -1, -1, -1, -1, -1,
00213 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
00214 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
00215 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
00216 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
00217 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
00218 -1, 258, -1, -1, -1, -1, -1, 266, -1, 271,
00219 265, -1, -1, -1, 271, 269, 270, -1, -1, -1,
00220 -1, -1, 284, -1, 284, -1, -1, -1, -1, -1,
00221 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
00222 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
00223 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
00224 -1, -1, -1, -1, -1, -1, -1, 287, 288,
00225 };
00226 #define YYFINAL 7
00227 #ifndef YYDEBUG
00228 #define YYDEBUG 0
00229 #endif
00230 #define YYMAXTOKEN 301
00231 #if YYDEBUG
00232 char *yyname[] = {
00233 "end-of-file",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
00234 0,0,0,0,0,0,"'('","')'",0,0,"','",0,0,0,0,0,0,0,0,0,0,0,0,0,0,"';'",0,0,0,0,0,0,
00235 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
00236 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
00237 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
00238 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
00239 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"STRING","FIELD",
00240 "NUMBER_STRING","BINARY_STRING","DOUBLE","OPERATOR","PARAMETER","SELECT","FROM",
00241 "WHERE","BETWEEN","IN","AND","OR","NOT","STAR","INSERT","INTO","VALUES",
00242 "DELETE","UPDATE","SET","NULL_VALUE","CREATE","TABLE","PRIMARY","KEY","DEFAULT",
00243 "INDEX","ON","HASH","TREE","UNIQUE","DROP","INT_TYPE","LONG_TYPE","SHORT_TYPE",
00244 "DOUBLE_TYPE","TIMESTAMP_TYPE","DATE_TYPE","CHAR_TYPE","TIME_TYPE",
00245 "BIGINT_TYPE","FLOAT_TYPE","TINYINT_TYPE",
00246 };
00247 char *yyrule[] = {
00248 "$accept : command",
00249 "command : select_statement",
00250 "command : insert_statement",
00251 "command : delete_statement",
00252 "command : update_statement",
00253 "command : ddl_statement",
00254 "select_statement : SELECT field_list FROM ident where_clause_opt semicolon_opt",
00255 "field_list : field_list field_list_L",
00256 "field_list : field",
00257 "field_list_L : ',' field",
00258 "insert_statement : INSERT INTO ident field_list_opt VALUES '(' value_list ')' semicolon_opt",
00259 "field_list_opt :",
00260 "field_list_opt : '(' field_list ')'",
00261 "value_list : value_list value_list_L",
00262 "value_list : value",
00263 "value_list_L : ',' value",
00264 "invalue_list : invalue_list invalue_list_L",
00265 "invalue_list : value",
00266 "invalue_list_L : ',' value",
00267 "delete_statement : DELETE FROM ident where_clause_opt semicolon_opt",
00268 "update_statement : UPDATE ident SET assign_list where_clause_opt semicolon_opt",
00269 "semicolon_opt : ';'",
00270 "semicolon_opt :",
00271 "assign_list : assign_list assign_list_L",
00272 "assign_list : assign_stmt",
00273 "assign_list_L : ',' assign_stmt",
00274 "assign_stmt : ident OPERATOR value",
00275 "where_clause_opt : WHERE conditions",
00276 "where_clause_opt :",
00277 "conditions : conditions AND conditions",
00278 "conditions : conditions OR conditions",
00279 "conditions : NOT conditions",
00280 "conditions : '(' conditions ')'",
00281 "conditions : condition",
00282 "condition : ident OPERATOR value",
00283 "condition : ident OPERATOR ident",
00284 "condition : ident not_opt BETWEEN value AND value",
00285 "condition : ident not_opt IN '(' invalue_list ')'",
00286 "not_opt : NOT",
00287 "not_opt :",
00288 "field : ident",
00289 "field : STAR",
00290 "ident : FIELD",
00291 "value : STRING",
00292 "value : NUMBER_STRING",
00293 "value : BINARY_STRING",
00294 "value : DOUBLE",
00295 "value : PARAMETER",
00296 "value : NULL_VALUE",
00297 "ddl_statement : CREATE TABLE ident '(' create_defn_list ')' semicolon_opt",
00298 "ddl_statement : CREATE INDEX ident ON ident '(' field_list ')' opt_constr_type opt_ind_type semicolon_opt",
00299 "ddl_statement : DROP TABLE ident",
00300 "ddl_statement : DROP INDEX ident",
00301 "opt_ind_type :",
00302 "opt_ind_type : HASH opt_constr_type",
00303 "opt_ind_type : TREE opt_constr_type",
00304 "opt_ind_type :",
00305 "opt_constr_type :",
00306 "opt_constr_type : UNIQUE",
00307 "opt_constr_type : PRIMARY",
00308 "opt_constr_type :",
00309 "create_defn_list : create_defn_list create_defn_list_L",
00310 "create_defn_list : create_defn",
00311 "create_defn_list_L : ',' create_defn",
00312 "create_defn : field_defn",
00313 "create_defn : constraint_defn",
00314 "field_defn : field_name field_type size_opt null_expr_opt default_expr_opt",
00315 "field_name : ident",
00316 "size_opt :",
00317 "size_opt : '(' NUMBER_STRING ')'",
00318 "default_expr_opt :",
00319 "default_expr_opt : DEFAULT value",
00320 "null_expr_opt :",
00321 "null_expr_opt : NOT NULL_VALUE",
00322 "constraint_defn : primary_key_constraint",
00323 "primary_key_constraint : PRIMARY KEY '(' field_list ')'",
00324 "field_type : INT_TYPE",
00325 "field_type : LONG_TYPE",
00326 "field_type : SHORT_TYPE",
00327 "field_type : BIGINT_TYPE",
00328 "field_type : TINYINT_TYPE",
00329 "field_type : FLOAT_TYPE",
00330 "field_type : DOUBLE_TYPE",
00331 "field_type : DATE_TYPE",
00332 "field_type : TIME_TYPE",
00333 "field_type : TIMESTAMP_TYPE",
00334 "field_type : CHAR_TYPE",
00335 };
00336 #endif
00337 #ifdef YYSTACKSIZE
00338 #undef YYMAXDEPTH
00339 #define YYMAXDEPTH YYSTACKSIZE
00340 #else
00341 #ifdef YYMAXDEPTH
00342 #define YYSTACKSIZE YYMAXDEPTH
00343 #else
00344 #define YYSTACKSIZE 500
00345 #define YYMAXDEPTH 500
00346 #endif
00347 #endif
00348 int yydebug;
00349 int yynerrs;
00350 int yyerrflag;
00351 int yychar;
00352 short *yyssp;
00353 YYSTYPE *yyvsp;
00354 YYSTYPE yyval;
00355 YYSTYPE yylval;
00356 short yyss[YYSTACKSIZE];
00357 YYSTYPE yyvs[YYSTACKSIZE];
00358 #define yystacksize YYSTACKSIZE
00359 #line 406 "dmlyacc.yxx"
00360
00361 extern int lexEof;
00362 void yyerror(const char* Msg) {
00363 if( lexEof == 0 )
00364 fprintf(stderr, "[Parser: %s] %s\n", Msg, yytext);
00365
00366 return;
00367 }
00368 #line 369 "dmlyacc.cxx"
00369 #define YYABORT goto yyabort
00370 #define YYREJECT goto yyabort
00371 #define YYACCEPT goto yyaccept
00372 #define YYERROR goto yyerrlab
00373 int
00374 yyparse()
00375 {
00376 register int yym, yyn, yystate;
00377 #if YYDEBUG
00378 register char *yys;
00379 extern char *getenv();
00380
00381 if (yys = getenv("YYDEBUG"))
00382 {
00383 yyn = *yys;
00384 if (yyn >= '0' && yyn <= '9')
00385 yydebug = yyn - '0';
00386 }
00387 #endif
00388
00389 yynerrs = 0;
00390 yyerrflag = 0;
00391 yychar = (-1);
00392
00393 yyssp = yyss;
00394 yyvsp = yyvs;
00395 *yyssp = yystate = 0;
00396
00397 yyloop:
00398 if (yyn = yydefred[yystate]) goto yyreduce;
00399 if (yychar < 0)
00400 {
00401 if ((yychar = yylex()) < 0) yychar = 0;
00402 #if YYDEBUG
00403 if (yydebug)
00404 {
00405 yys = 0;
00406 if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
00407 if (!yys) yys = "illegal-symbol";
00408 printf("%sdebug: state %d, reading %d (%s)\n",
00409 YYPREFIX, yystate, yychar, yys);
00410 }
00411 #endif
00412 }
00413 if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 &&
00414 yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
00415 {
00416 #if YYDEBUG
00417 if (yydebug)
00418 printf("%sdebug: state %d, shifting to state %d\n",
00419 YYPREFIX, yystate, yytable[yyn]);
00420 #endif
00421 if (yyssp >= yyss + yystacksize - 1)
00422 {
00423 goto yyoverflow;
00424 }
00425 *++yyssp = yystate = yytable[yyn];
00426 *++yyvsp = yylval;
00427 yychar = (-1);
00428 if (yyerrflag > 0) --yyerrflag;
00429 goto yyloop;
00430 }
00431 if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 &&
00432 yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
00433 {
00434 yyn = yytable[yyn];
00435 goto yyreduce;
00436 }
00437 if (yyerrflag) goto yyinrecovery;
00438 #ifdef lint
00439 goto yynewerror;
00440 #endif
00441 yynewerror:
00442 yyerror("syntax error");
00443 #ifdef lint
00444 goto yyerrlab;
00445 #endif
00446 yyerrlab:
00447 ++yynerrs;
00448 yyinrecovery:
00449 if (yyerrflag < 3)
00450 {
00451 yyerrflag = 3;
00452 for (;;)
00453 {
00454 if ((yyn = yysindex[*yyssp]) && (yyn += YYERRCODE) >= 0 &&
00455 yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)
00456 {
00457 #if YYDEBUG
00458 if (yydebug)
00459 printf("%sdebug: state %d, error recovery shifting\
00460 to state %d\n", YYPREFIX, *yyssp, yytable[yyn]);
00461 #endif
00462 if (yyssp >= yyss + yystacksize - 1)
00463 {
00464 goto yyoverflow;
00465 }
00466 *++yyssp = yystate = yytable[yyn];
00467 *++yyvsp = yylval;
00468 goto yyloop;
00469 }
00470 else
00471 {
00472 #if YYDEBUG
00473 if (yydebug)
00474 printf("%sdebug: error recovery discarding state %d\n",
00475 YYPREFIX, *yyssp);
00476 #endif
00477 if (yyssp <= yyss) goto yyabort;
00478 --yyssp;
00479 --yyvsp;
00480 }
00481 }
00482 }
00483 else
00484 {
00485 if (yychar == 0) goto yyabort;
00486 #if YYDEBUG
00487 if (yydebug)
00488 {
00489 yys = 0;
00490 if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
00491 if (!yys) yys = "illegal-symbol";
00492 printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
00493 YYPREFIX, yystate, yychar, yys);
00494 }
00495 #endif
00496 yychar = (-1);
00497 goto yyloop;
00498 }
00499 yyreduce:
00500 #if YYDEBUG
00501 if (yydebug)
00502 printf("%sdebug: state %d, reducing by rule %d (%s)\n",
00503 YYPREFIX, yystate, yyn, yyrule[yyn]);
00504 #endif
00505 yym = yylen[yyn];
00506 yyval = yyvsp[1-yym];
00507 switch (yyn)
00508 {
00509 case 1:
00510 #line 33 "dmlyacc.yxx"
00511 { YYACCEPT; }
00512 break;
00513 case 2:
00514 #line 34 "dmlyacc.yxx"
00515 { YYACCEPT; }
00516 break;
00517 case 3:
00518 #line 35 "dmlyacc.yxx"
00519 { YYACCEPT; }
00520 break;
00521 case 4:
00522 #line 36 "dmlyacc.yxx"
00523 { YYACCEPT; }
00524 break;
00525 case 5:
00526 #line 37 "dmlyacc.yxx"
00527 { YYACCEPT; }
00528 break;
00529 case 6:
00530 #line 41 "dmlyacc.yxx"
00531 {
00532 parsedData->setStmtType(SelectStatement);
00533 parsedData->setTableName(yyvsp[-2].stringval);
00534 free(yyvsp[-2].stringval);
00535 }
00536 break;
00537 case 10:
00538 #line 55 "dmlyacc.yxx"
00539 {
00540 parsedData->setStmtType(InsertStatement);
00541 parsedData->setTableName(yyvsp[-6].stringval);
00542 free(yyvsp[-6].stringval);
00543 }
00544 break;
00545 case 14:
00546 #line 68 "dmlyacc.yxx"
00547 {
00548 parsedData->insertValue((char*)yyvsp[0].stringval);
00549 free(yyvsp[0].stringval);
00550 }
00551 break;
00552 case 15:
00553 #line 74 "dmlyacc.yxx"
00554 {
00555 parsedData->insertValue((char*)yyvsp[0].stringval);
00556 free(yyvsp[0].stringval);
00557 }
00558 break;
00559 case 17:
00560 #line 82 "dmlyacc.yxx"
00561 {
00562 parsedData->insertInValue((char*)yyvsp[0].stringval);
00563 free(yyvsp[0].stringval);
00564 }
00565 break;
00566 case 18:
00567 #line 88 "dmlyacc.yxx"
00568 {
00569 parsedData->insertInValue((char*)yyvsp[0].stringval);
00570 free(yyvsp[0].stringval);
00571 }
00572 break;
00573 case 19:
00574 #line 95 "dmlyacc.yxx"
00575 {
00576 parsedData->setStmtType(DeleteStatement);
00577 parsedData->setTableName(yyvsp[-2].stringval);
00578 free(yyvsp[-2].stringval);
00579 }
00580 break;
00581 case 20:
00582 #line 103 "dmlyacc.yxx"
00583 {
00584 parsedData->setStmtType(UpdateStatement);
00585 parsedData->setTableName(yyvsp[-4].stringval);
00586 free( yyvsp[-4].stringval );
00587 }
00588 break;
00589 case 26:
00590 #line 121 "dmlyacc.yxx"
00591 {
00592 parsedData->insertUpdateValue( (char*) yyvsp[-2].stringval, (char*) yyvsp[0].stringval);
00593 free( yyvsp[-2].stringval ); free(yyvsp[-1].stringval);free( yyvsp[0].stringval );
00594 }
00595 break;
00596 case 29:
00597 #line 132 "dmlyacc.yxx"
00598 {
00599 Predicate *pred;
00600 pred = parsedData->insertPredicate((Predicate*) yyvsp[-2].predicate, OpAnd, (Predicate*) yyvsp[0].predicate);
00601 parsedData->setCondition((Predicate*)pred);
00602 yyval.predicate= pred;
00603
00604 }
00605 break;
00606 case 30:
00607 #line 140 "dmlyacc.yxx"
00608 {
00609 Predicate *pred;
00610 pred = parsedData->insertPredicate((Predicate*) yyvsp[-2].predicate, OpOr, (Predicate*) yyvsp[0].predicate);
00611 parsedData->setCondition((Predicate*)pred);
00612 yyval.predicate= pred;
00613 }
00614 break;
00615 case 31:
00616 #line 147 "dmlyacc.yxx"
00617 {
00618 Predicate *pred;
00619 pred = parsedData->insertPredicate((Predicate*) yyvsp[0].predicate, OpNot, NULL);
00620 parsedData->setCondition((Predicate*)pred);
00621 yyval.predicate= pred;
00622 }
00623 break;
00624 case 32:
00625 #line 153 "dmlyacc.yxx"
00626 { }
00627 break;
00628 case 33:
00629 #line 155 "dmlyacc.yxx"
00630 {
00631 parsedData->setCondition((Predicate*)yyvsp[0].predicate);
00632
00633 yyval.predicate=yyvsp[0].predicate;
00634 }
00635 break;
00636 case 34:
00637 #line 162 "dmlyacc.yxx"
00638 {
00639 ComparisionOp op = AllDataType::getComparisionOperator((char*)yyvsp[-1].stringval);
00640 Predicate *pred;
00641 void **ptr = parsedData->insertCondValueAndGetPtr((char*)yyvsp[-2].stringval, (char*)yyvsp[0].stringval);
00642 pred = parsedData->insertPredicate((char*) yyvsp[-2].stringval, op, ptr);
00643 free( yyvsp[-2].stringval ); free(yyvsp[-1].stringval); free( yyvsp[0].stringval );
00644 yyval.predicate=pred;
00645 }
00646 break;
00647 case 35:
00648 #line 171 "dmlyacc.yxx"
00649 {
00650 ComparisionOp op = AllDataType::getComparisionOperator((char*)yyvsp[-1].stringval);
00651 Predicate *pred;
00652 pred = parsedData->insertPredicate((char*) yyvsp[-2].stringval, op, (char*) yyvsp[0].stringval);
00653 free( yyvsp[-2].stringval ); free(yyvsp[-1].stringval); free( yyvsp[0].stringval );
00654 yyval.predicate=pred;
00655 }
00656 break;
00657 case 36:
00658 #line 180 "dmlyacc.yxx"
00659 {
00660 void **ptr1 = parsedData->insertCondValueAndGetPtr((char*)yyvsp[-5].stringval, (char*)yyvsp[-2].stringval);
00661 void **ptr2 = parsedData->insertCondValueAndGetPtr((char*)yyvsp[-5].stringval, (char*)yyvsp[0].stringval);
00662 Predicate *pred1, *pred2, *pred3, *finalPred;
00663 pred1 = parsedData->insertPredicate((char*) yyvsp[-5].stringval, OpGreaterThanEquals, ptr1);
00664 pred2 = parsedData->insertPredicate((char*) yyvsp[-5].stringval, OpLessThanEquals, ptr2);
00665 finalPred = parsedData->insertPredicate(pred1, OpAnd, pred2);
00666 if( yyvsp[-4].stringval == (char*) 1 )
00667 finalPred = parsedData->insertPredicate(finalPred, OpNot, NULL);
00668 free( yyvsp[-5].stringval ); free( yyvsp[-2].stringval ); free( yyvsp[0].stringval );
00669 yyval.predicate= finalPred;
00670 }
00671 break;
00672 case 37:
00673 #line 193 "dmlyacc.yxx"
00674 {
00675 ListIterator valIter = parsedData->getInValueList().getIterator();
00676 FieldValue *value1, *value2;
00677 Predicate *pred1, *pred2, *finalPred;
00678 void **ptr1, **ptr2;
00679 if (valIter.hasElement()) {
00680 value1 = (FieldValue*) valIter.nextElement();
00681 ptr1 = parsedData->insertCondValueAndGetPtr((char*)yyvsp[-5].stringval, value1->parsedString);
00682 pred1 = parsedData->insertPredicate((char*) yyvsp[-5].stringval, OpEquals, ptr1);
00683 finalPred=pred1;
00684 }
00685 while (valIter.hasElement()) {
00686 value2 = (FieldValue*) valIter.nextElement();
00687 ptr2 = parsedData->insertCondValueAndGetPtr((char*)yyvsp[-5].stringval, value2->parsedString);
00688 pred2 = parsedData->insertPredicate((char*) yyvsp[-5].stringval, OpEquals, ptr2);
00689 finalPred = parsedData->insertPredicate(pred1, OpOr, pred2);
00690 pred1= finalPred;
00691 }
00692 if( yyvsp[-4].stringval == (char*)1)
00693 finalPred = parsedData->insertPredicate(finalPred, OpNot, NULL);
00694
00695 free( yyvsp[-5].stringval );
00696 yyval.predicate= finalPred;
00697 }
00698 break;
00699 case 38:
00700 #line 219 "dmlyacc.yxx"
00701 { yyval.stringval=(char*) 1;
00702 }
00703 break;
00704 case 39:
00705 #line 222 "dmlyacc.yxx"
00706 { yyval.stringval=(char*) 0; }
00707 break;
00708 case 40:
00709 #line 225 "dmlyacc.yxx"
00710 {
00711 parsedData->insertField((char*)yyvsp[0].stringval);
00712 free( yyvsp[0].stringval );
00713 }
00714 break;
00715 case 41:
00716 #line 230 "dmlyacc.yxx"
00717 {
00718 parsedData->insertField((char*)yyvsp[0].stringval);
00719 free( yyvsp[0].stringval );
00720 }
00721 break;
00722 case 42:
00723 #line 235 "dmlyacc.yxx"
00724 { yyval.stringval = yyvsp[0].stringval; }
00725 break;
00726 case 43:
00727 #line 237 "dmlyacc.yxx"
00728 { yyval.stringval = yyvsp[0].stringval; }
00729 break;
00730 case 44:
00731 #line 238 "dmlyacc.yxx"
00732 { yyval.stringval = yyvsp[0].stringval; }
00733 break;
00734 case 45:
00735 #line 239 "dmlyacc.yxx"
00736 { yyval.stringval = yyvsp[0].stringval; }
00737 break;
00738 case 46:
00739 #line 240 "dmlyacc.yxx"
00740 { yyval.stringval = yyvsp[0].stringval; }
00741 break;
00742 case 47:
00743 #line 241 "dmlyacc.yxx"
00744 { yyval.stringval = yyvsp[0].stringval; }
00745 break;
00746 case 48:
00747 #line 242 "dmlyacc.yxx"
00748 { yyval.stringval = (char*) 0; }
00749 break;
00750 case 49:
00751 #line 246 "dmlyacc.yxx"
00752 {
00753 parsedData->setStmtType(CreateTableStatement);
00754 parsedData->setTableName(yyvsp[-4].stringval);
00755 free(yyvsp[-4].stringval);
00756 }
00757 break;
00758 case 50:
00759 #line 252 "dmlyacc.yxx"
00760 {
00761 parsedData->setStmtType(CreateIndexStatement);
00762 parsedData->setIndexName(yyvsp[-8].stringval);
00763 parsedData->setTableName(yyvsp[-6].stringval);
00764 free(yyvsp[-8].stringval);
00765 free(yyvsp[-6].stringval);
00766 }
00767 break;
00768 case 51:
00769 #line 260 "dmlyacc.yxx"
00770 {
00771 parsedData->setStmtType(DropTableStatement);
00772 parsedData->setTableName(yyvsp[0].stringval);
00773 free(yyvsp[0].stringval);
00774 }
00775 break;
00776 case 52:
00777 #line 266 "dmlyacc.yxx"
00778 {
00779 parsedData->setStmtType(DropIndexStatement);
00780 parsedData->setIndexName(yyvsp[0].stringval);
00781 free(yyvsp[0].stringval);
00782 }
00783 break;
00784 case 54:
00785 #line 274 "dmlyacc.yxx"
00786 {
00787 parsedData->setIndexType(hashIndex);
00788 }
00789 break;
00790 case 55:
00791 #line 278 "dmlyacc.yxx"
00792 {
00793 parsedData->setIndexType(treeIndex);
00794 }
00795 break;
00796 case 56:
00797 #line 282 "dmlyacc.yxx"
00798 {
00799 parsedData->setIndexType(hashIndex);
00800 }
00801 break;
00802 case 58:
00803 #line 288 "dmlyacc.yxx"
00804 {
00805 parsedData->setUnique(true);
00806 }
00807 break;
00808 case 59:
00809 #line 292 "dmlyacc.yxx"
00810 {
00811 parsedData->setUnique(true);
00812 parsedData->setPrimary(true);
00813 }
00814 break;
00815 case 60:
00816 #line 297 "dmlyacc.yxx"
00817 {
00818 parsedData->setUnique(false);
00819 parsedData->setPrimary(false);
00820 }
00821 break;
00822 case 64:
00823 #line 310 "dmlyacc.yxx"
00824 {
00825 parsedData->insertFldDef();
00826 }
00827 break;
00828 case 67:
00829 #line 320 "dmlyacc.yxx"
00830 {
00831 parsedData->setFldName(yyvsp[0].stringval);
00832 free(yyvsp[0].stringval);
00833 }
00834 break;
00835 case 69:
00836 #line 326 "dmlyacc.yxx"
00837 {
00838 parsedData->setFldLength(atoi(yyvsp[-1].stringval)+1);
00839 free(yyvsp[-1].stringval);
00840 }
00841 break;
00842 case 71:
00843 #line 334 "dmlyacc.yxx"
00844 {
00845 parsedData->setDefaultValue(yyvsp[0].stringval);
00846 free(yyvsp[0].stringval);
00847 }
00848 break;
00849 case 73:
00850 #line 342 "dmlyacc.yxx"
00851 {
00852 parsedData->setFldNotNull(true);
00853 }
00854 break;
00855 case 75:
00856 #line 350 "dmlyacc.yxx"
00857 {
00858 parsedData->setPrimary(true);
00859 }
00860 break;
00861 case 76:
00862 #line 356 "dmlyacc.yxx"
00863 {
00864 parsedData->setFldType(typeInt);
00865 }
00866 break;
00867 case 77:
00868 #line 360 "dmlyacc.yxx"
00869 {
00870 parsedData->setFldType(typeLong);
00871 }
00872 break;
00873 case 78:
00874 #line 364 "dmlyacc.yxx"
00875 {
00876 parsedData->setFldType(typeShort);
00877 }
00878 break;
00879 case 79:
00880 #line 368 "dmlyacc.yxx"
00881 {
00882 parsedData->setFldType(typeLongLong);
00883 }
00884 break;
00885 case 80:
00886 #line 372 "dmlyacc.yxx"
00887 {
00888 parsedData->setFldType(typeByteInt);
00889 }
00890 break;
00891 case 81:
00892 #line 376 "dmlyacc.yxx"
00893 {
00894 parsedData->setFldType(typeFloat);
00895 }
00896 break;
00897 case 82:
00898 #line 380 "dmlyacc.yxx"
00899 {
00900 parsedData->setFldType(typeDouble);
00901 }
00902 break;
00903 case 83:
00904 #line 385 "dmlyacc.yxx"
00905 {
00906 parsedData->setFldType(typeDate);
00907 }
00908 break;
00909 case 84:
00910 #line 390 "dmlyacc.yxx"
00911 {
00912 parsedData->setFldType(typeTime);
00913 }
00914 break;
00915 case 85:
00916 #line 395 "dmlyacc.yxx"
00917 {
00918 parsedData->setFldType(typeTimeStamp);
00919 }
00920 break;
00921 case 86:
00922 #line 400 "dmlyacc.yxx"
00923 {
00924 parsedData->setFldType(typeString);
00925 parsedData->setFldLength(2);
00926 }
00927 break;
00928 #line 929 "dmlyacc.cxx"
00929 }
00930 yyssp -= yym;
00931 yystate = *yyssp;
00932 yyvsp -= yym;
00933 yym = yylhs[yyn];
00934 if (yystate == 0 && yym == 0)
00935 {
00936 #if YYDEBUG
00937 if (yydebug)
00938 printf("%sdebug: after reduction, shifting from state 0 to\
00939 state %d\n", YYPREFIX, YYFINAL);
00940 #endif
00941 yystate = YYFINAL;
00942 *++yyssp = YYFINAL;
00943 *++yyvsp = yyval;
00944 if (yychar < 0)
00945 {
00946 if ((yychar = yylex()) < 0) yychar = 0;
00947 #if YYDEBUG
00948 if (yydebug)
00949 {
00950 yys = 0;
00951 if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
00952 if (!yys) yys = "illegal-symbol";
00953 printf("%sdebug: state %d, reading %d (%s)\n",
00954 YYPREFIX, YYFINAL, yychar, yys);
00955 }
00956 #endif
00957 }
00958 if (yychar == 0) goto yyaccept;
00959 goto yyloop;
00960 }
00961 if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&
00962 yyn <= YYTABLESIZE && yycheck[yyn] == yystate)
00963 yystate = yytable[yyn];
00964 else
00965 yystate = yydgoto[yym];
00966 #if YYDEBUG
00967 if (yydebug)
00968 printf("%sdebug: after reduction, shifting from state %d \
00969 to state %d\n", YYPREFIX, *yyssp, yystate);
00970 #endif
00971 if (yyssp >= yyss + yystacksize - 1)
00972 {
00973 goto yyoverflow;
00974 }
00975 *++yyssp = yystate;
00976 *++yyvsp = yyval;
00977 goto yyloop;
00978 yyoverflow:
00979 yyerror("yacc stack overflow");
00980 yyabort:
00981 return (1);
00982 yyaccept:
00983 return (0);
00984 }