| File: | lib/MiniSQL/Select.pm |
| Coverage: | 100.0% |
| line | stmt | bran | cond | sub | pod | time | code |
|---|---|---|---|---|---|---|---|
| 1 | #################################################################### | ||||||
| 2 | # | ||||||
| 3 | # This file was generated using Parse::Yapp version 1.05. | ||||||
| 4 | # | ||||||
| 5 | # Don't edit this file, use source file instead. | ||||||
| 6 | # | ||||||
| 7 | # ANY CHANGE MADE HERE WILL BE LOST ! | ||||||
| 8 | # | ||||||
| 9 | #################################################################### | ||||||
| 10 | package MiniSQL::Select; | ||||||
| 11 | 23 23 23 | 356 84 309 | use vars qw ( @ISA ); | ||||
| 12 | 23 23 23 | 267 77 171 | use strict; | ||||
| 13 | |||||||
| 14 | @ISA= qw ( Parse::Yapp::Driver ); | ||||||
| 15 | 23 23 23 | 299 99 357 | use Parse::Yapp::Driver; | ||||
| 16 | |||||||
| 17 | #line 5 "grammar/Select.yp" | ||||||
| 18 | |||||||
| 19 | |||||||
| 20 | my ( | ||||||
| 21 | @Models, @Columns, @OutVars, | ||||||
| 22 | $InVals, %Defaults, $Quote, $QuoteIdent, | ||||||
| 23 | @Unbound, | ||||||
| 24 | ); | ||||||
| 25 | |||||||
| 26 | |||||||
| 27 | |||||||
| 28 | sub new { | ||||||
| 29 | my($class)=shift; | ||||||
| 30 | ref($class) | ||||||
| 31 | and $class=ref($class); | ||||||
| 32 | |||||||
| 33 | my($self)=$class->SUPER::new( yyversion => '1.05', | ||||||
| 34 | yystates => | ||||||
| 35 | [ | ||||||
| 36 | {#State 0 | ||||||
| 37 | ACTIONS => { | ||||||
| 38 | "select" => 3 | ||||||
| 39 | }, | ||||||
| 40 | GOTOS => { | ||||||
| 41 | 'select_stmt' => 1, | ||||||
| 42 | 'statement' => 2, | ||||||
| 43 | 'miniSQL' => 4 | ||||||
| 44 | } | ||||||
| 45 | }, | ||||||
| 46 | {#State 1 | ||||||
| 47 | ACTIONS => { | ||||||
| 48 | ";" => 5 | ||||||
| 49 | }, | ||||||
| 50 | DEFAULT => -3 | ||||||
| 51 | }, | ||||||
| 52 | {#State 2 | ||||||
| 53 | DEFAULT => -1 | ||||||
| 54 | }, | ||||||
| 55 | {#State 3 | ||||||
| 56 | ACTIONS => { | ||||||
| 57 | "sum" => 11, | ||||||
| 58 | "max" => 7, | ||||||
| 59 | "*" => 13, | ||||||
| 60 | 'VAR' => 14, | ||||||
| 61 | "count" => 15, | ||||||
| 62 | 'IDENT' => 8, | ||||||
| 63 | "min" => 19 | ||||||
| 64 | }, | ||||||
| 65 | GOTOS => { | ||||||
| 66 | 'symbol' => 6, | ||||||
| 67 | 'proc_call' => 9, | ||||||
| 68 | 'qualified_symbol' => 10, | ||||||
| 69 | 'pattern' => 12, | ||||||
| 70 | 'pattern_list' => 16, | ||||||
| 71 | 'aggregate' => 17, | ||||||
| 72 | 'func' => 18, | ||||||
| 73 | 'column' => 20 | ||||||
| 74 | } | ||||||
| 75 | }, | ||||||
| 76 | {#State 4 | ||||||
| 77 | ACTIONS => { | ||||||
| 78 | '' => 21 | ||||||
| 79 | } | ||||||
| 80 | }, | ||||||
| 81 | {#State 5 | ||||||
| 82 | DEFAULT => -2 | ||||||
| 83 | }, | ||||||
| 84 | {#State 6 | ||||||
| 85 | ACTIONS => { | ||||||
| 86 | "." => 22 | ||||||
| 87 | }, | ||||||
| 88 | DEFAULT => -33 | ||||||
| 89 | }, | ||||||
| 90 | {#State 7 | ||||||
| 91 | DEFAULT => -18 | ||||||
| 92 | }, | ||||||
| 93 | {#State 8 | ||||||
| 94 | ACTIONS => { | ||||||
| 95 | "(" => 23 | ||||||
| 96 | }, | ||||||
| 97 | DEFAULT => -35 | ||||||
| 98 | }, | ||||||
| 99 | {#State 9 | ||||||
| 100 | DEFAULT => -13 | ||||||
| 101 | }, | ||||||
| 102 | {#State 10 | ||||||
| 103 | DEFAULT => -32 | ||||||
| 104 | }, | ||||||
| 105 | {#State 11 | ||||||
| 106 | DEFAULT => -21 | ||||||
| 107 | }, | ||||||
| 108 | {#State 12 | ||||||
| 109 | ACTIONS => { | ||||||
| 110 | "," => 24 | ||||||
| 111 | }, | ||||||
| 112 | DEFAULT => -10 | ||||||
| 113 | }, | ||||||
| 114 | {#State 13 | ||||||
| 115 | DEFAULT => -15 | ||||||
| 116 | }, | ||||||
| 117 | {#State 14 | ||||||
| 118 | ACTIONS => { | ||||||
| 119 | "|" => 25 | ||||||
| 120 | }, | ||||||
| 121 | DEFAULT => -37 | ||||||
| 122 | }, | ||||||
| 123 | {#State 15 | ||||||
| 124 | DEFAULT => -20 | ||||||
| 125 | }, | ||||||
| 126 | {#State 16 | ||||||
| 127 | ACTIONS => { | ||||||
| 128 | "where" => 26, | ||||||
| 129 | "order by" => 31, | ||||||
| 130 | "limit" => 30, | ||||||
| 131 | "group by" => 34, | ||||||
| 132 | "from" => 35, | ||||||
| 133 | "offset" => 37 | ||||||
| 134 | }, | ||||||
| 135 | DEFAULT => -5, | ||||||
| 136 | GOTOS => { | ||||||
| 137 | 'postfix_clause_list' => 29, | ||||||
| 138 | 'order_by_clause' => 28, | ||||||
| 139 | 'offset_clause' => 27, | ||||||
| 140 | 'from_clause' => 36, | ||||||
| 141 | 'where_clause' => 32, | ||||||
| 142 | 'group_by_clause' => 33, | ||||||
| 143 | 'limit_clause' => 38, | ||||||
| 144 | 'postfix_clause' => 39 | ||||||
| 145 | } | ||||||
| 146 | }, | ||||||
| 147 | {#State 17 | ||||||
| 148 | ACTIONS => { | ||||||
| 149 | 'IDENT' => 41, | ||||||
| 150 | 'VAR' => 14 | ||||||
| 151 | }, | ||||||
| 152 | DEFAULT => -12, | ||||||
| 153 | GOTOS => { | ||||||
| 154 | 'symbol' => 40, | ||||||
| 155 | 'alias' => 42 | ||||||
| 156 | } | ||||||
| 157 | }, | ||||||
| 158 | {#State 18 | ||||||
| 159 | ACTIONS => { | ||||||
| 160 | "(" => 43 | ||||||
| 161 | } | ||||||
| 162 | }, | ||||||
| 163 | {#State 19 | ||||||
| 164 | DEFAULT => -19 | ||||||
| 165 | }, | ||||||
| 166 | {#State 20 | ||||||
| 167 | DEFAULT => -14 | ||||||
| 168 | }, | ||||||
| 169 | {#State 21 | ||||||
| 170 | DEFAULT => 0 | ||||||
| 171 | }, | ||||||
| 172 | {#State 22 | ||||||
| 173 | ACTIONS => { | ||||||
| 174 | 'VAR' => 14, | ||||||
| 175 | 'IDENT' => 41 | ||||||
| 176 | }, | ||||||
| 177 | GOTOS => { | ||||||
| 178 | 'symbol' => 44 | ||||||
| 179 | } | ||||||
| 180 | }, | ||||||
| 181 | {#State 23 | ||||||
| 182 | ACTIONS => { | ||||||
| 183 | 'NUM' => 47, | ||||||
| 184 | 'VAR' => 49, | ||||||
| 185 | 'STRING' => 46 | ||||||
| 186 | }, | ||||||
| 187 | GOTOS => { | ||||||
| 188 | 'parameter' => 48, | ||||||
| 189 | 'string' => 45, | ||||||
| 190 | 'parameter_list' => 50 | ||||||
| 191 | } | ||||||
| 192 | }, | ||||||
| 193 | {#State 24 | ||||||
| 194 | ACTIONS => { | ||||||
| 195 | "sum" => 11, | ||||||
| 196 | "max" => 7, | ||||||
| 197 | "*" => 13, | ||||||
| 198 | 'VAR' => 14, | ||||||
| 199 | "count" => 15, | ||||||
| 200 | 'IDENT' => 8, | ||||||
| 201 | "min" => 19 | ||||||
| 202 | }, | ||||||
| 203 | GOTOS => { | ||||||
| 204 | 'symbol' => 6, | ||||||
| 205 | 'proc_call' => 9, | ||||||
| 206 | 'qualified_symbol' => 10, | ||||||
| 207 | 'pattern' => 12, | ||||||
| 208 | 'func' => 18, | ||||||
| 209 | 'aggregate' => 17, | ||||||
| 210 | 'pattern_list' => 51, | ||||||
| 211 | 'column' => 20 | ||||||
| 212 | } | ||||||
| 213 | }, | ||||||
| 214 | {#State 25 | ||||||
| 215 | ACTIONS => { | ||||||
| 216 | 'IDENT' => 52 | ||||||
| 217 | } | ||||||
| 218 | }, | ||||||
| 219 | {#State 26 | ||||||
| 220 | ACTIONS => { | ||||||
| 221 | "(" => 56, | ||||||
| 222 | 'VAR' => 14, | ||||||
| 223 | 'IDENT' => 41 | ||||||
| 224 | }, | ||||||
| 225 | GOTOS => { | ||||||
| 226 | 'comparison' => 53, | ||||||
| 227 | 'symbol' => 6, | ||||||
| 228 | 'conjunction' => 54, | ||||||
| 229 | 'disjunction' => 55, | ||||||
| 230 | 'condition' => 58, | ||||||
| 231 | 'column' => 57, | ||||||
| 232 | 'qualified_symbol' => 10 | ||||||
| 233 | } | ||||||
| 234 | }, | ||||||
| 235 | {#State 27 | ||||||
| 236 | DEFAULT => -45 | ||||||
| 237 | }, | ||||||
| 238 | {#State 28 | ||||||
| 239 | DEFAULT => -43 | ||||||
| 240 | }, | ||||||
| 241 | {#State 29 | ||||||
| 242 | DEFAULT => -4 | ||||||
| 243 | }, | ||||||
| 244 | {#State 30 | ||||||
| 245 | ACTIONS => { | ||||||
| 246 | 'NUM' => 59 | ||||||
| 247 | } | ||||||
| 248 | }, | ||||||
| 249 | {#State 31 | ||||||
| 250 | ACTIONS => { | ||||||
| 251 | 'VAR' => 14, | ||||||
| 252 | 'IDENT' => 41 | ||||||
| 253 | }, | ||||||
| 254 | GOTOS => { | ||||||
| 255 | 'symbol' => 6, | ||||||
| 256 | 'column_list' => 60, | ||||||
| 257 | 'column' => 61, | ||||||
| 258 | 'qualified_symbol' => 10 | ||||||
| 259 | } | ||||||
| 260 | }, | ||||||
| 261 | {#State 32 | ||||||
| 262 | DEFAULT => -41 | ||||||
| 263 | }, | ||||||
| 264 | {#State 33 | ||||||
| 265 | DEFAULT => -42 | ||||||
| 266 | }, | ||||||
| 267 | {#State 34 | ||||||
| 268 | ACTIONS => { | ||||||
| 269 | 'VAR' => 14, | ||||||
| 270 | 'IDENT' => 41 | ||||||
| 271 | }, | ||||||
| 272 | GOTOS => { | ||||||
| 273 | 'symbol' => 6, | ||||||
| 274 | 'column_list' => 62, | ||||||
| 275 | 'column' => 61, | ||||||
| 276 | 'qualified_symbol' => 10 | ||||||
| 277 | } | ||||||
| 278 | }, | ||||||
| 279 | {#State 35 | ||||||
| 280 | ACTIONS => { | ||||||
| 281 | 'VAR' => 14, | ||||||
| 282 | 'IDENT' => 8 | ||||||
| 283 | }, | ||||||
| 284 | GOTOS => { | ||||||
| 285 | 'models' => 63, | ||||||
| 286 | 'symbol' => 64, | ||||||
| 287 | 'model' => 65, | ||||||
| 288 | 'proc_call' => 66 | ||||||
| 289 | } | ||||||
| 290 | }, | ||||||
| 291 | {#State 36 | ||||||
| 292 | DEFAULT => -46 | ||||||
| 293 | }, | ||||||
| 294 | {#State 37 | ||||||
| 295 | ACTIONS => { | ||||||
| 296 | 'NUM' => 67 | ||||||
| 297 | } | ||||||
| 298 | }, | ||||||
| 299 | {#State 38 | ||||||
| 300 | DEFAULT => -44 | ||||||
| 301 | }, | ||||||
| 302 | {#State 39 | ||||||
| 303 | ACTIONS => { | ||||||
| 304 | "where" => 26, | ||||||
| 305 | "order by" => 31, | ||||||
| 306 | "limit" => 30, | ||||||
| 307 | "group by" => 34, | ||||||
| 308 | "from" => 35, | ||||||
| 309 | "offset" => 37 | ||||||
| 310 | }, | ||||||
| 311 | DEFAULT => -40, | ||||||
| 312 | GOTOS => { | ||||||
| 313 | 'postfix_clause_list' => 68, | ||||||
| 314 | 'order_by_clause' => 28, | ||||||
| 315 | 'offset_clause' => 27, | ||||||
| 316 | 'from_clause' => 36, | ||||||
| 317 | 'where_clause' => 32, | ||||||
| 318 | 'group_by_clause' => 33, | ||||||
| 319 | 'limit_clause' => 38, | ||||||
| 320 | 'postfix_clause' => 39 | ||||||
| 321 | } | ||||||
| 322 | }, | ||||||
| 323 | {#State 40 | ||||||
| 324 | DEFAULT => -38 | ||||||
| 325 | }, | ||||||
| 326 | {#State 41 | ||||||
| 327 | DEFAULT => -35 | ||||||
| 328 | }, | ||||||
| 329 | {#State 42 | ||||||
| 330 | DEFAULT => -11 | ||||||
| 331 | }, | ||||||
| 332 | {#State 43 | ||||||
| 333 | ACTIONS => { | ||||||
| 334 | "*" => 69, | ||||||
| 335 | 'VAR' => 14, | ||||||
| 336 | 'IDENT' => 41 | ||||||
| 337 | }, | ||||||
| 338 | GOTOS => { | ||||||
| 339 | 'symbol' => 6, | ||||||
| 340 | 'column' => 70, | ||||||
| 341 | 'qualified_symbol' => 10 | ||||||
| 342 | } | ||||||
| 343 | }, | ||||||
| 344 | {#State 44 | ||||||
| 345 | DEFAULT => -34 | ||||||
| 346 | }, | ||||||
| 347 | {#State 45 | ||||||
| 348 | DEFAULT => -25 | ||||||
| 349 | }, | ||||||
| 350 | {#State 46 | ||||||
| 351 | DEFAULT => -29 | ||||||
| 352 | }, | ||||||
| 353 | {#State 47 | ||||||
| 354 | DEFAULT => -26 | ||||||
| 355 | }, | ||||||
| 356 | {#State 48 | ||||||
| 357 | ACTIONS => { | ||||||
| 358 | "," => 71 | ||||||
| 359 | }, | ||||||
| 360 | DEFAULT => -24 | ||||||
| 361 | }, | ||||||
| 362 | {#State 49 | ||||||
| 363 | ACTIONS => { | ||||||
| 364 | "|" => 72 | ||||||
| 365 | }, | ||||||
| 366 | DEFAULT => -31 | ||||||
| 367 | }, | ||||||
| 368 | {#State 50 | ||||||
| 369 | ACTIONS => { | ||||||
| 370 | ")" => 73 | ||||||
| 371 | } | ||||||
| 372 | }, | ||||||
| 373 | {#State 51 | ||||||
| 374 | DEFAULT => -9 | ||||||
| 375 | }, | ||||||
| 376 | {#State 52 | ||||||
| 377 | DEFAULT => -36 | ||||||
| 378 | }, | ||||||
| 379 | {#State 53 | ||||||
| 380 | ACTIONS => { | ||||||
| 381 | "and" => 74 | ||||||
| 382 | }, | ||||||
| 383 | DEFAULT => -54 | ||||||
| 384 | }, | ||||||
| 385 | {#State 54 | ||||||
| 386 | ACTIONS => { | ||||||
| 387 | "or" => 75 | ||||||
| 388 | }, | ||||||
| 389 | DEFAULT => -52 | ||||||
| 390 | }, | ||||||
| 391 | {#State 55 | ||||||
| 392 | DEFAULT => -50 | ||||||
| 393 | }, | ||||||
| 394 | {#State 56 | ||||||
| 395 | ACTIONS => { | ||||||
| 396 | "(" => 56, | ||||||
| 397 | 'VAR' => 14, | ||||||
| 398 | 'IDENT' => 41 | ||||||
| 399 | }, | ||||||
| 400 | GOTOS => { | ||||||
| 401 | 'comparison' => 53, | ||||||
| 402 | 'symbol' => 6, | ||||||
| 403 | 'conjunction' => 54, | ||||||
| 404 | 'disjunction' => 55, | ||||||
| 405 | 'condition' => 76, | ||||||
| 406 | 'column' => 57, | ||||||
| 407 | 'qualified_symbol' => 10 | ||||||
| 408 | } | ||||||
| 409 | }, | ||||||
| 410 | {#State 57 | ||||||
| 411 | ACTIONS => { | ||||||
| 412 | "<" => 77, | ||||||
| 413 | "like" => 78, | ||||||
| 414 | "<=" => 82, | ||||||
| 415 | ">" => 84, | ||||||
| 416 | "<>" => 83, | ||||||
| 417 | ">=" => 80, | ||||||
| 418 | "=" => 79 | ||||||
| 419 | }, | ||||||
| 420 | GOTOS => { | ||||||
| 421 | 'operator' => 81 | ||||||
| 422 | } | ||||||
| 423 | }, | ||||||
| 424 | {#State 58 | ||||||
| 425 | DEFAULT => -49 | ||||||
| 426 | }, | ||||||
| 427 | {#State 59 | ||||||
| 428 | DEFAULT => -71 | ||||||
| 429 | }, | ||||||
| 430 | {#State 60 | ||||||
| 431 | DEFAULT => -70 | ||||||
| 432 | }, | ||||||
| 433 | {#State 61 | ||||||
| 434 | ACTIONS => { | ||||||
| 435 | "," => 85 | ||||||
| 436 | }, | ||||||
| 437 | DEFAULT => -69 | ||||||
| 438 | }, | ||||||
| 439 | {#State 62 | ||||||
| 440 | DEFAULT => -67 | ||||||
| 441 | }, | ||||||
| 442 | {#State 63 | ||||||
| 443 | DEFAULT => -47 | ||||||
| 444 | }, | ||||||
| 445 | {#State 64 | ||||||
| 446 | DEFAULT => -8 | ||||||
| 447 | }, | ||||||
| 448 | {#State 65 | ||||||
| 449 | ACTIONS => { | ||||||
| 450 | "," => 86 | ||||||
| 451 | }, | ||||||
| 452 | DEFAULT => -7 | ||||||
| 453 | }, | ||||||
| 454 | {#State 66 | ||||||
| 455 | DEFAULT => -48 | ||||||
| 456 | }, | ||||||
| 457 | {#State 67 | ||||||
| 458 | DEFAULT => -72 | ||||||
| 459 | }, | ||||||
| 460 | {#State 68 | ||||||
| 461 | DEFAULT => -39 | ||||||
| 462 | }, | ||||||
| 463 | {#State 69 | ||||||
| 464 | ACTIONS => { | ||||||
| 465 | ")" => 87 | ||||||
| 466 | } | ||||||
| 467 | }, | ||||||
| 468 | {#State 70 | ||||||
| 469 | ACTIONS => { | ||||||
| 470 | ")" => 88 | ||||||
| 471 | } | ||||||
| 472 | }, | ||||||
| 473 | {#State 71 | ||||||
| 474 | ACTIONS => { | ||||||
| 475 | 'NUM' => 47, | ||||||
| 476 | 'VAR' => 49, | ||||||
| 477 | 'STRING' => 46 | ||||||
| 478 | }, | ||||||
| 479 | GOTOS => { | ||||||
| 480 | 'parameter' => 48, | ||||||
| 481 | 'string' => 45, | ||||||
| 482 | 'parameter_list' => 89 | ||||||
| 483 | } | ||||||
| 484 | }, | ||||||
| 485 | {#State 72 | ||||||
| 486 | ACTIONS => { | ||||||
| 487 | 'NUM' => 92, | ||||||
| 488 | 'STRING' => 91 | ||||||
| 489 | }, | ||||||
| 490 | GOTOS => { | ||||||
| 491 | 'constant' => 90 | ||||||
| 492 | } | ||||||
| 493 | }, | ||||||
| 494 | {#State 73 | ||||||
| 495 | DEFAULT => -22 | ||||||
| 496 | }, | ||||||
| 497 | {#State 74 | ||||||
| 498 | ACTIONS => { | ||||||
| 499 | "(" => 56, | ||||||
| 500 | 'VAR' => 14, | ||||||
| 501 | 'IDENT' => 41 | ||||||
| 502 | }, | ||||||
| 503 | GOTOS => { | ||||||
| 504 | 'comparison' => 93, | ||||||
| 505 | 'symbol' => 6, | ||||||
| 506 | 'column' => 57, | ||||||
| 507 | 'qualified_symbol' => 10 | ||||||
| 508 | } | ||||||
| 509 | }, | ||||||
| 510 | {#State 75 | ||||||
| 511 | ACTIONS => { | ||||||
| 512 | "(" => 56, | ||||||
| 513 | 'VAR' => 14, | ||||||
| 514 | 'IDENT' => 41 | ||||||
| 515 | }, | ||||||
| 516 | GOTOS => { | ||||||
| 517 | 'comparison' => 53, | ||||||
| 518 | 'conjunction' => 94, | ||||||
| 519 | 'symbol' => 6, | ||||||
| 520 | 'column' => 57, | ||||||
| 521 | 'qualified_symbol' => 10 | ||||||
| 522 | } | ||||||
| 523 | }, | ||||||
| 524 | {#State 76 | ||||||
| 525 | ACTIONS => { | ||||||
| 526 | ")" => 95 | ||||||
| 527 | } | ||||||
| 528 | }, | ||||||
| 529 | {#State 77 | ||||||
| 530 | DEFAULT => -61 | ||||||
| 531 | }, | ||||||
| 532 | {#State 78 | ||||||
| 533 | DEFAULT => -64 | ||||||
| 534 | }, | ||||||
| 535 | {#State 79 | ||||||
| 536 | DEFAULT => -63 | ||||||
| 537 | }, | ||||||
| 538 | {#State 80 | ||||||
| 539 | DEFAULT => -59 | ||||||
| 540 | }, | ||||||
| 541 | {#State 81 | ||||||
| 542 | ACTIONS => { | ||||||
| 543 | 'NUM' => 97, | ||||||
| 544 | 'VAR' => 99, | ||||||
| 545 | 'IDENT' => 41, | ||||||
| 546 | 'STRING' => 46 | ||||||
| 547 | }, | ||||||
| 548 | GOTOS => { | ||||||
| 549 | 'literal' => 98, | ||||||
| 550 | 'symbol' => 6, | ||||||
| 551 | 'string' => 96, | ||||||
| 552 | 'column' => 100, | ||||||
| 553 | 'qualified_symbol' => 10 | ||||||
| 554 | } | ||||||
| 555 | }, | ||||||
| 556 | {#State 82 | ||||||
| 557 | DEFAULT => -60 | ||||||
| 558 | }, | ||||||
| 559 | {#State 83 | ||||||
| 560 | DEFAULT => -62 | ||||||
| 561 | }, | ||||||
| 562 | {#State 84 | ||||||
| 563 | DEFAULT => -58 | ||||||
| 564 | }, | ||||||
| 565 | {#State 85 | ||||||
| 566 | ACTIONS => { | ||||||
| 567 | 'VAR' => 14, | ||||||
| 568 | 'IDENT' => 41 | ||||||
| 569 | }, | ||||||
| 570 | GOTOS => { | ||||||
| 571 | 'symbol' => 6, | ||||||
| 572 | 'column_list' => 101, | ||||||
| 573 | 'column' => 61, | ||||||
| 574 | 'qualified_symbol' => 10 | ||||||
| 575 | } | ||||||
| 576 | }, | ||||||
| 577 | {#State 86 | ||||||
| 578 | ACTIONS => { | ||||||
| 579 | 'VAR' => 14, | ||||||
| 580 | 'IDENT' => 41 | ||||||
| 581 | }, | ||||||
| 582 | GOTOS => { | ||||||
| 583 | 'models' => 102, | ||||||
| 584 | 'symbol' => 64, | ||||||
| 585 | 'model' => 65 | ||||||
| 586 | } | ||||||
| 587 | }, | ||||||
| 588 | {#State 87 | ||||||
| 589 | DEFAULT => -17 | ||||||
| 590 | }, | ||||||
| 591 | {#State 88 | ||||||
| 592 | DEFAULT => -16 | ||||||
| 593 | }, | ||||||
| 594 | {#State 89 | ||||||
| 595 | DEFAULT => -23 | ||||||
| 596 | }, | ||||||
| 597 | {#State 90 | ||||||
| 598 | DEFAULT => -30 | ||||||
| 599 | }, | ||||||
| 600 | {#State 91 | ||||||
| 601 | DEFAULT => -27 | ||||||
| 602 | }, | ||||||
| 603 | {#State 92 | ||||||
| 604 | DEFAULT => -28 | ||||||
| 605 | }, | ||||||
| 606 | {#State 93 | ||||||
| 607 | DEFAULT => -53 | ||||||
| 608 | }, | ||||||
| 609 | {#State 94 | ||||||
| 610 | DEFAULT => -51 | ||||||
| 611 | }, | ||||||
| 612 | {#State 95 | ||||||
| 613 | DEFAULT => -57 | ||||||
| 614 | }, | ||||||
| 615 | {#State 96 | ||||||
| 616 | DEFAULT => -65 | ||||||
| 617 | }, | ||||||
| 618 | {#State 97 | ||||||
| 619 | DEFAULT => -66 | ||||||
| 620 | }, | ||||||
| 621 | {#State 98 | ||||||
| 622 | DEFAULT => -55 | ||||||
| 623 | }, | ||||||
| 624 | {#State 99 | ||||||
| 625 | ACTIONS => { | ||||||
| 626 | "|" => 103, | ||||||
| 627 | "." => -37 | ||||||
| 628 | }, | ||||||
| 629 | DEFAULT => -31 | ||||||
| 630 | }, | ||||||
| 631 | {#State 100 | ||||||
| 632 | DEFAULT => -56 | ||||||
| 633 | }, | ||||||
| 634 | {#State 101 | ||||||
| 635 | DEFAULT => -68 | ||||||
| 636 | }, | ||||||
| 637 | {#State 102 | ||||||
| 638 | DEFAULT => -6 | ||||||
| 639 | }, | ||||||
| 640 | {#State 103 | ||||||
| 641 | ACTIONS => { | ||||||
| 642 | 'NUM' => 92, | ||||||
| 643 | 'IDENT' => 52, | ||||||
| 644 | 'STRING' => 91 | ||||||
| 645 | }, | ||||||
| 646 | GOTOS => { | ||||||
| 647 | 'constant' => 90 | ||||||
| 648 | } | ||||||
| 649 | } | ||||||
| 650 | ], | ||||||
| 651 | yyrules => | ||||||
| 652 | [ | ||||||
| 653 | [#Rule 0 | ||||||
| 654 | '$start', 2, undef | ||||||
| 655 | ], | ||||||
| 656 | [#Rule 1 | ||||||
| 657 | 'miniSQL', 1, undef | ||||||
| 658 | ], | ||||||
| 659 | [#Rule 2 | ||||||
| 660 | 'statement', 2, undef | ||||||
| 661 | ], | ||||||
| 662 | [#Rule 3 | ||||||
| 663 | 'statement', 1, undef | ||||||
| 664 | ], | ||||||
| 665 | [#Rule 4 | ||||||
| 666 | 'select_stmt', 3, | ||||||
| 667 | sub | ||||||
| 668 | #line 28 "grammar/Select.yp" | ||||||
| 669 | { join(' ', @_[1..$#_]) } | ||||||
| 670 | ], | ||||||
| 671 | [#Rule 5 | ||||||
| 672 | 'select_stmt', 2, | ||||||
| 673 | sub | ||||||
| 674 | #line 30 "grammar/Select.yp" | ||||||
| 675 | { join(' ', @_[1..$#_]) } | ||||||
| 676 | ], | ||||||
| 677 | [#Rule 6 | ||||||
| 678 | 'models', 3, | ||||||
| 679 | sub | ||||||
| 680 | #line 34 "grammar/Select.yp" | ||||||
| 681 | { join(' ', @_[1..$#_]) } | ||||||
| 682 | ], | ||||||
| 683 | [#Rule 7 | ||||||
| 684 | 'models', 1, undef | ||||||
| 685 | ], | ||||||
| 686 | [#Rule 8 | ||||||
| 687 | 'model', 1, | ||||||
| 688 | sub | ||||||
| 689 | #line 38 "grammar/Select.yp" | ||||||
| 690 | { push @Models, $_[1]; $QuoteIdent->($_[1]) } | ||||||
| 691 | ], | ||||||
| 692 | [#Rule 9 | ||||||
| 693 | 'pattern_list', 3, | ||||||
| 694 | sub | ||||||
| 695 | #line 42 "grammar/Select.yp" | ||||||
| 696 | { join(' ', @_[1..$#_]) } | ||||||
| 697 | ], | ||||||
| 698 | [#Rule 10 | ||||||
| 699 | 'pattern_list', 1, undef | ||||||
| 700 | ], | ||||||
| 701 | [#Rule 11 | ||||||
| 702 | 'pattern', 2, undef | ||||||
| 703 | ], | ||||||
| 704 | [#Rule 12 | ||||||
| 705 | 'pattern', 1, undef | ||||||
| 706 | ], | ||||||
| 707 | [#Rule 13 | ||||||
| 708 | 'pattern', 1, undef | ||||||
| 709 | ], | ||||||
| 710 | [#Rule 14 | ||||||
| 711 | 'pattern', 1, undef | ||||||
| 712 | ], | ||||||
| 713 | [#Rule 15 | ||||||
| 714 | 'pattern', 1, undef | ||||||
| 715 | ], | ||||||
| 716 | [#Rule 16 | ||||||
| 717 | 'aggregate', 4, | ||||||
| 718 | sub | ||||||
| 719 | #line 54 "grammar/Select.yp" | ||||||
| 720 | { join(' ', @_[1..$#_]) } | ||||||
| 721 | ], | ||||||
| 722 | [#Rule 17 | ||||||
| 723 | 'aggregate', 4, | ||||||
| 724 | sub | ||||||
| 725 | #line 56 "grammar/Select.yp" | ||||||
| 726 | { join(' ', @_[1..$#_]) } | ||||||
| 727 | ], | ||||||
| 728 | [#Rule 18 | ||||||
| 729 | 'func', 1, undef | ||||||
| 730 | ], | ||||||
| 731 | [#Rule 19 | ||||||
| 732 | 'func', 1, undef | ||||||
| 733 | ], | ||||||
| 734 | [#Rule 20 | ||||||
| 735 | 'func', 1, undef | ||||||
| 736 | ], | ||||||
| 737 | [#Rule 21 | ||||||
| 738 | 'func', 1, undef | ||||||
| 739 | ], | ||||||
| 740 | [#Rule 22 | ||||||
| 741 | 'proc_call', 4, | ||||||
| 742 | sub | ||||||
| 743 | #line 66 "grammar/Select.yp" | ||||||
| 744 | { join(' ', @_[1..$#_]) } | ||||||
| 745 | ], | ||||||
| 746 | [#Rule 23 | ||||||
| 747 | 'parameter_list', 3, | ||||||
| 748 | sub | ||||||
| 749 | #line 70 "grammar/Select.yp" | ||||||
| 750 | { join(' ', @_[1..$#_]) } | ||||||
| 751 | ], | ||||||
| 752 | [#Rule 24 | ||||||
| 753 | 'parameter_list', 1, undef | ||||||
| 754 | ], | ||||||
| 755 | [#Rule 25 | ||||||
| 756 | 'parameter', 1, undef | ||||||
| 757 | ], | ||||||
| 758 | [#Rule 26 | ||||||
| 759 | 'parameter', 1, undef | ||||||
| 760 | ], | ||||||
| 761 | [#Rule 27 | ||||||
| 762 | 'constant', 1, undef | ||||||
| 763 | ], | ||||||
| 764 | [#Rule 28 | ||||||
| 765 | 'constant', 1, undef | ||||||
| 766 | ], | ||||||
| 767 | [#Rule 29 | ||||||
| 768 | 'string', 1, | ||||||
| 769 | sub | ||||||
| 770 | #line 80 "grammar/Select.yp" | ||||||
| 771 | { $Quote->(parse_string($_[1])) } | ||||||
| 772 | ], | ||||||
| 773 | [#Rule 30 | ||||||
| 774 | 'string', 3, | ||||||
| 775 | sub | ||||||
| 776 | #line 82 "grammar/Select.yp" | ||||||
| 777 | { push @OutVars, $_[1]; | ||||||
| 778 | my $val = $InVals->{$_[1]}; | ||||||
| 779 | if (!defined $val) { | ||||||
| 780 | my $default; | ||||||
| 781 | $Defaults{$_[1]} = $default = parse_string($_[3]); | ||||||
| 782 | return $Quote->($default); | ||||||
| 783 | } | ||||||
| 784 | $Quote->($val); | ||||||
| 785 | } | ||||||
| 786 | ], | ||||||
| 787 | [#Rule 31 | ||||||
| 788 | 'string', 1, | ||||||
| 789 | sub | ||||||
| 790 | #line 92 "grammar/Select.yp" | ||||||
| 791 | { push @OutVars, $_[1]; | ||||||
| 792 | my $val = $InVals->{$_[1]}; | ||||||
| 793 | if (!defined $val) { | ||||||
| 794 | push @Unbound, $_[1]; | ||||||
| 795 | return $Quote->(""); | ||||||
| 796 | } | ||||||
| 797 | $Quote->($val); | ||||||
| 798 | } | ||||||
| 799 | ], | ||||||
| 800 | [#Rule 32 | ||||||
| 801 | 'column', 1, undef | ||||||
| 802 | ], | ||||||
| 803 | [#Rule 33 | ||||||
| 804 | 'column', 1, | ||||||
| 805 | sub | ||||||
| 806 | #line 103 "grammar/Select.yp" | ||||||
| 807 | { push @Columns, $_[1]; $QuoteIdent->($_[1]) } | ||||||
| 808 | ], | ||||||
| 809 | [#Rule 34 | ||||||
| 810 | 'qualified_symbol', 3, | ||||||
| 811 | sub | ||||||
| 812 | #line 107 "grammar/Select.yp" | ||||||
| 813 | { | ||||||
| 814 | push @Models, $_[1]; | ||||||
| 815 | push @Columns, $_[3]; | ||||||
| 816 | $QuoteIdent->($_[1]).'.'.$QuoteIdent->($_[3]); | ||||||
| 817 | } | ||||||
| 818 | ], | ||||||
| 819 | [#Rule 35 | ||||||
| 820 | 'symbol', 1, undef | ||||||
| 821 | ], | ||||||
| 822 | [#Rule 36 | ||||||
| 823 | 'symbol', 3, | ||||||
| 824 | sub | ||||||
| 825 | #line 116 "grammar/Select.yp" | ||||||
| 826 | { push @OutVars, $_[1]; | ||||||
| 827 | my $val = $InVals->{$_[1]}; | ||||||
| 828 | if (!defined $val) { | ||||||
| 829 | my $default; | ||||||
| 830 | $Defaults{$_[1]} = $default = $_[3]; | ||||||
| 831 | _IDENT($default) or die "Bad symbol: $default\n"; | ||||||
| 832 | return $default; | ||||||
| 833 | } | ||||||
| 834 | _IDENT($val) or die "Bad symbol: $val\n"; | ||||||
| 835 | $val; | ||||||
| 836 | } | ||||||
| 837 | ], | ||||||
| 838 | [#Rule 37 | ||||||
| 839 | 'symbol', 1, | ||||||
| 840 | sub | ||||||
| 841 | #line 128 "grammar/Select.yp" | ||||||
| 842 | { push @OutVars, $_[1]; | ||||||
| 843 | my $val = $InVals->{$_[1]}; | ||||||
| 844 | if (!defined $val) { | ||||||
| 845 | push @Unbound, $_[1]; | ||||||
| 846 | return ''; | ||||||
| 847 | } | ||||||
| 848 | #warn _IDENT($val); | ||||||
| 849 | _IDENT($val) or die "Bad symbol: $val\n"; | ||||||
| 850 | $val; | ||||||
| 851 | } | ||||||
| 852 | ], | ||||||
| 853 | [#Rule 38 | ||||||
| 854 | 'alias', 1, undef | ||||||
| 855 | ], | ||||||
| 856 | [#Rule 39 | ||||||
| 857 | 'postfix_clause_list', 2, | ||||||
| 858 | sub | ||||||
| 859 | #line 144 "grammar/Select.yp" | ||||||
| 860 | { join(' ', @_[1..$#_]) } | ||||||
| 861 | ], | ||||||
| 862 | [#Rule 40 | ||||||
| 863 | 'postfix_clause_list', 1, undef | ||||||
| 864 | ], | ||||||
| 865 | [#Rule 41 | ||||||
| 866 | 'postfix_clause', 1, undef | ||||||
| 867 | ], | ||||||
| 868 | [#Rule 42 | ||||||
| 869 | 'postfix_clause', 1, undef | ||||||
| 870 | ], | ||||||
| 871 | [#Rule 43 | ||||||
| 872 | 'postfix_clause', 1, undef | ||||||
| 873 | ], | ||||||
| 874 | [#Rule 44 | ||||||
| 875 | 'postfix_clause', 1, undef | ||||||
| 876 | ], | ||||||
| 877 | [#Rule 45 | ||||||
| 878 | 'postfix_clause', 1, undef | ||||||
| 879 | ], | ||||||
| 880 | [#Rule 46 | ||||||
| 881 | 'postfix_clause', 1, undef | ||||||
| 882 | ], | ||||||
| 883 | [#Rule 47 | ||||||
| 884 | 'from_clause', 2, | ||||||
| 885 | sub | ||||||
| 886 | #line 157 "grammar/Select.yp" | ||||||
| 887 | { join(' ', @_[1..$#_]) } | ||||||
| 888 | ], | ||||||
| 889 | [#Rule 48 | ||||||
| 890 | 'from_clause', 2, | ||||||
| 891 | sub | ||||||
| 892 | #line 159 "grammar/Select.yp" | ||||||
| 893 | { join(' ', @_[1..$#_]) } | ||||||
| 894 | ], | ||||||
| 895 | [#Rule 49 | ||||||
| 896 | 'where_clause', 2, | ||||||
| 897 | sub | ||||||
| 898 | #line 163 "grammar/Select.yp" | ||||||
| 899 | { join(' ', @_[1..$#_]) } | ||||||
| 900 | ], | ||||||
| 901 | [#Rule 50 | ||||||
| 902 | 'condition', 1, undef | ||||||
| 903 | ], | ||||||
| 904 | [#Rule 51 | ||||||
| 905 | 'disjunction', 3, | ||||||
| 906 | sub | ||||||
| 907 | #line 170 "grammar/Select.yp" | ||||||
| 908 | { join(' ', @_[1..$#_]) } | ||||||
| 909 | ], | ||||||
| 910 | [#Rule 52 | ||||||
| 911 | 'disjunction', 1, undef | ||||||
| 912 | ], | ||||||
| 913 | [#Rule 53 | ||||||
| 914 | 'conjunction', 3, | ||||||
| 915 | sub | ||||||
| 916 | #line 175 "grammar/Select.yp" | ||||||
| 917 | { join(' ', @_[1..$#_]) } | ||||||
| 918 | ], | ||||||
| 919 | [#Rule 54 | ||||||
| 920 | 'conjunction', 1, undef | ||||||
| 921 | ], | ||||||
| 922 | [#Rule 55 | ||||||
| 923 | 'comparison', 3, | ||||||
| 924 | sub | ||||||
| 925 | #line 180 "grammar/Select.yp" | ||||||
| 926 | { join(' ', @_[1..$#_]) } | ||||||
| 927 | ], | ||||||
| 928 | [#Rule 56 | ||||||
| 929 | 'comparison', 3, | ||||||
| 930 | sub | ||||||
| 931 | #line 182 "grammar/Select.yp" | ||||||
| 932 | { join(' ', @_[1..$#_]) } | ||||||
| 933 | ], | ||||||
| 934 | [#Rule 57 | ||||||
| 935 | 'comparison', 3, | ||||||
| 936 | sub | ||||||
| 937 | #line 184 "grammar/Select.yp" | ||||||
| 938 | { join(' ', @_[1..$#_]) } | ||||||
| 939 | ], | ||||||
| 940 | [#Rule 58 | ||||||
| 941 | 'operator', 1, undef | ||||||
| 942 | ], | ||||||
| 943 | [#Rule 59 | ||||||
| 944 | 'operator', 1, undef | ||||||
| 945 | ], | ||||||
| 946 | [#Rule 60 | ||||||
| 947 | 'operator', 1, undef | ||||||
| 948 | ], | ||||||
| 949 | [#Rule 61 | ||||||
| 950 | 'operator', 1, undef | ||||||
| 951 | ], | ||||||
| 952 | [#Rule 62 | ||||||
| 953 | 'operator', 1, undef | ||||||
| 954 | ], | ||||||
| 955 | [#Rule 63 | ||||||
| 956 | 'operator', 1, undef | ||||||
| 957 | ], | ||||||
| 958 | [#Rule 64 | ||||||
| 959 | 'operator', 1, undef | ||||||
| 960 | ], | ||||||
| 961 | [#Rule 65 | ||||||
| 962 | 'literal', 1, undef | ||||||
| 963 | ], | ||||||
| 964 | [#Rule 66 | ||||||
| 965 | 'literal', 1, undef | ||||||
| 966 | ], | ||||||
| 967 | [#Rule 67 | ||||||
| 968 | 'group_by_clause', 2, | ||||||
| 969 | sub | ||||||
| 970 | #line 201 "grammar/Select.yp" | ||||||
| 971 | { join(' ', @_[1..$#_]) } | ||||||
| 972 | ], | ||||||
| 973 | [#Rule 68 | ||||||
| 974 | 'column_list', 3, | ||||||
| 975 | sub | ||||||
| 976 | #line 205 "grammar/Select.yp" | ||||||
| 977 | { join(' ', @_[1..$#_]) } | ||||||
| 978 | ], | ||||||
| 979 | [#Rule 69 | ||||||
| 980 | 'column_list', 1, undef | ||||||
| 981 | ], | ||||||
| 982 | [#Rule 70 | ||||||
| 983 | 'order_by_clause', 2, | ||||||
| 984 | sub | ||||||
| 985 | #line 210 "grammar/Select.yp" | ||||||
| 986 | { join(' ', @_[1..$#_]) } | ||||||
| 987 | ], | ||||||
| 988 | [#Rule 71 | ||||||
| 989 | 'limit_clause', 2, | ||||||
| 990 | sub | ||||||
| 991 | #line 214 "grammar/Select.yp" | ||||||
| 992 | { delete $_[0]->YYData->{limit}; join(' ', @_[1..$#_]) } | ||||||
| 993 | ], | ||||||
| 994 | [#Rule 72 | ||||||
| 995 | 'offset_clause', 2, | ||||||
| 996 | sub | ||||||
| 997 | #line 217 "grammar/Select.yp" | ||||||
| 998 | { | ||||||
| 999 | delete $_[0]->YYData->{offset}; join(' ', @_[1..$#_]) } | ||||||
| 1000 | ] | ||||||
| 1001 | ], | ||||||
| 1002 | @_); | ||||||
| 1003 | bless($self,$class); | ||||||
| 1004 | } | ||||||
| 1005 | |||||||
| 1006 | #line 221 "grammar/Select.yp" | ||||||
| 1007 | |||||||
| 1008 | |||||||
| 1009 | #use Smart::Comments; | ||||||
| 1010 | |||||||
| 1011 | sub _Error { | ||||||
| 1012 | my ($value) = $_[0]->YYCurval; | ||||||
| 1013 | |||||||
| 1014 | my $token = 1; | ||||||
| 1015 | ## $value | ||||||
| 1016 | my @expect = $_[0]->YYExpect; | ||||||
| 1017 | ### expect: @expect | ||||||
| 1018 | my ($what) = $value ? "input: \"$value\"" : "end of input"; | ||||||
| 1019 | |||||||
| 1020 | map { $_ = "'$_'" if $_ ne '' and !/^\w+$/ } @expect; | ||||||
| 1021 | my $expected = join " or ", @expect; | ||||||
| 1022 | _SyntaxError(1, "Unexpected $what".($expected?" ($expected expected)":''), $.); | ||||||
| 1023 | } | ||||||
| 1024 | |||||||
| 1025 | sub _SyntaxError { | ||||||
| 1026 | my ($level, $message, $lineno) = @_; | ||||||
| 1027 | |||||||
| 1028 | $message= "line $lineno: error: $message"; | ||||||
| 1029 | die $message, ".\n"; | ||||||
| 1030 | } | ||||||
| 1031 | |||||||
| 1032 | sub _Lexer { | ||||||
| 1033 | my ($parser) = shift; | ||||||
| 1034 | |||||||
| 1035 | my $yydata = $parser->YYData; | ||||||
| 1036 | my $source = $yydata->{source}; | ||||||
| 1037 | #local $" = "\n"; | ||||||
| 1038 | defined $yydata->{input} && $yydata->{input} =~ s/^\s+//s; | ||||||
| 1039 | |||||||
| 1040 | if (!defined $yydata->{input} || $yydata->{input} eq '') { | ||||||
| 1041 | ### HERE!!! | ||||||
| 1042 | $yydata->{input} = <$source>; | ||||||
| 1043 | } | ||||||
| 1044 | if (!defined $yydata->{input}) { | ||||||
| 1045 | return ('', undef); | ||||||
| 1046 | } | ||||||
| 1047 | |||||||
| 1048 | ## other data: <$source> | ||||||
| 1049 | ### data: $yydata->{input} | ||||||
| 1050 | ### lineno: $. | ||||||
| 1051 | |||||||
| 1052 | for ($yydata->{input}) { | ||||||
| 1053 | s/^\s*(\d+(?:\.\d+)?)\b//s | ||||||
| 1054 | and return ('NUM', $1); | ||||||
| 1055 | s/^\s*('(?:\\.|''|[^'])*')// | ||||||
| 1056 | and return ('STRING', $1); | ||||||
| 1057 | s/^\s*"(\w*)"// | ||||||
| 1058 | and return ('IDENT', $1); | ||||||
| 1059 | s/^\s*(\$(\w*)\$.*?\$\2\$)// | ||||||
| 1060 | and return ('STRING', $1); | ||||||
| 1061 | s/^\s*(\*|count|sum|max|min|select|and|or|from|where|delete|update|set|order by|group by|limit|offset)\b//is | ||||||
| 1062 | and return (lc($1), lc($1)); | ||||||
| 1063 | s/^\s*(<=|>=|<>)//s | ||||||
| 1064 | and return ($1, $1); | ||||||
| 1065 | s/^\s*([A-Za-z][A-Za-z0-9_]*)\b//s | ||||||
| 1066 | and return ('IDENT', $1); | ||||||
| 1067 | s/^\$(\w+)//s | ||||||
| 1068 | and return ('VAR', $1); | ||||||
| 1069 | s/^\s*(\S)//s | ||||||
| 1070 | and return ($1, $1); | ||||||
| 1071 | } | ||||||
| 1072 | } | ||||||
| 1073 | |||||||
| 1074 | sub parse_string { | ||||||
| 1075 | my $s = $_[0]; | ||||||
| 1076 | if ($s =~ /^'(.*)'$/) { | ||||||
| 1077 | $s = $1; | ||||||
| 1078 | $s =~ s/''/'/g; | ||||||
| 1079 | $s =~ s/\\n/\n/g; | ||||||
| 1080 | $s =~ s/\\t/\t/g; | ||||||
| 1081 | $s =~ s/\\r/\r/g; | ||||||
| 1082 | $s =~ s/\\(.)/$1/g; | ||||||
| 1083 | return $s; | ||||||
| 1084 | } elsif ($s =~ /^\$(\w*)\$(.*)\$\1\$$/) { | ||||||
| 1085 | $s = $2; | ||||||
| 1086 | return $s; | ||||||
| 1087 | } elsif ($s =~ /^[\d\.]*$/) { | ||||||
| 1088 | return $s; | ||||||
| 1089 | } else { | ||||||
| 1090 | die "Unknown string literal: $s"; | ||||||
| 1091 | } | ||||||
| 1092 | } | ||||||
| 1093 | |||||||
| 1094 | sub parse { | ||||||
| 1095 | my ($self, $sql, $params) = @_; | ||||||
| 1096 | open my $source, '<', \$sql; | ||||||
| 1097 | my $yydata = $self->YYData; | ||||||
| 1098 | $yydata->{source} = $source; | ||||||
| 1099 | $yydata->{limit} = $params->{limit}; | ||||||
| 1100 | $yydata->{offset} = $params->{offset}; | ||||||
| 1101 | |||||||
| 1102 | $Quote = $params->{quote} || sub { "''" }; | ||||||
| 1103 | $QuoteIdent = $params->{quote_ident} || sub { '""' }; | ||||||
| 1104 | $InVals = $params->{vars} || {}; | ||||||
| 1105 | #$QuoteIdent = $params->{quote_ident}; | ||||||
| 1106 | |||||||
| 1107 | #$self->YYData->{INPUT} = ; | ||||||
| 1108 | ### $sql | ||||||
| 1109 | @Unbound = (); | ||||||
| 1110 | @Models = (); | ||||||
| 1111 | @Columns = (); | ||||||
| 1112 | @OutVars = (); | ||||||
| 1113 | %Defaults = (); | ||||||
| 1114 | my $sql = $self->YYParse( yydebug => 0 & 0x1F, yylex => \&_Lexer, yyerror => \&_Error ); | ||||||
| 1115 | close $source; | ||||||
| 1116 | return { | ||||||
| 1117 | limit => $yydata->{limit}, | ||||||
| 1118 | offset => $yydata->{offset}, | ||||||
| 1119 | models => [@Models], | ||||||
| 1120 | columns => [@Columns], | ||||||
| 1121 | sql => $sql, | ||||||
| 1122 | vars => [@OutVars], | ||||||
| 1123 | defaults => {%Defaults}, | ||||||
| 1124 | unbound => [@Unbound], | ||||||
| 1125 | }; | ||||||
| 1126 | } | ||||||
| 1127 | |||||||
| 1128 | sub _IDENT { | ||||||
| 1129 | (defined $_[0] && $_[0] =~ /^[A-Za-z]\w*$/) ? $_[0] : undef; | ||||||
| 1130 | } | ||||||
| 1131 | |||||||
| 1132 | #my ($select) =new Select; | ||||||
| 1133 | #my $var = $select->Run; | ||||||
| 1134 | |||||||
| 1135 | 1; | ||||||
| 1136 | |||||||
| 1137 | |||||||
| 1138 | 1; | ||||||