Kexi API Documentation (2.0 alpha)

sqlparser.cpp

Go to the documentation of this file.
00001 /* A Bison parser, made by GNU Bison 2.2.  */
00002 
00003 /* Skeleton implementation for Bison's Yacc-like parsers in C
00004 
00005    Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
00006    Free Software Foundation, Inc.
00007 
00008    This program is free software; you can redistribute it and/or modify
00009    it under the terms of the GNU General Public License as published by
00010    the Free Software Foundation; either version 2, or (at your option)
00011    any later version.
00012 
00013    This program is distributed in the hope that it will be useful,
00014    but WITHOUT ANY WARRANTY; without even the implied warranty of
00015    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016    GNU General Public License for more details.
00017 
00018    You should have received a copy of the GNU General Public License
00019    along with this program; if not, write to the Free Software
00020    Foundation, Inc., 51 Franklin Street, Fifth Floor,
00021    Boston, MA 02110-1301, USA.  */
00022 
00023 /* As a special exception, you may create a larger work that contains
00024    part or all of the Bison parser skeleton and distribute that work
00025    under terms of your choice, so long as that work isn't itself a
00026    parser generator using the skeleton or a modified version thereof
00027    as a parser skeleton.  Alternatively, if you modify or redistribute
00028    the parser skeleton itself, you may (at your option) remove this
00029    special exception, which will cause the skeleton and the resulting
00030    Bison output files to be licensed under the GNU General Public
00031    License without this special exception.
00032 
00033    This special exception was added by the Free Software Foundation in
00034    version 2.2 of Bison.  */
00035 
00036 /* C LALR(1) parser skeleton written by Richard Stallman, by
00037    simplifying the original so-called "semantic" parser.  */
00038 
00039 /* All symbols defined below should begin with yy or YY, to avoid
00040    infringing on user name space.  This should be done even for local
00041    variables, as they might otherwise be expanded by user macros.
00042    There are some unavoidable exceptions within include files to
00043    define necessary library symbols; they are noted "INFRINGES ON
00044    USER NAME SPACE" below.  */
00045 
00046 /* Identify Bison output.  */
00047 #define YYBISON 1
00048 
00049 /* Bison version.  */
00050 #define YYBISON_VERSION "2.2"
00051 
00052 /* Skeleton name.  */
00053 #define YYSKELETON_NAME "yacc.c"
00054 
00055 /* Pure parsers.  */
00056 #define YYPURE 0
00057 
00058 /* Using locations.  */
00059 #define YYLSP_NEEDED 0
00060 
00061 
00062 
00063 /* Tokens.  */
00064 #ifndef YYTOKENTYPE
00065 # define YYTOKENTYPE
00066    /* Put the tokens into the symbol table, so that GDB and other debuggers
00067       know about them.  */
00068    enum yytokentype {
00069      UMINUS = 258,
00070      SQL_TYPE = 259,
00071      SQL_ABS = 260,
00072      ACOS = 261,
00073      AMPERSAND = 262,
00074      SQL_ABSOLUTE = 263,
00075      ADA = 264,
00076      ADD = 265,
00077      ADD_DAYS = 266,
00078      ADD_HOURS = 267,
00079      ADD_MINUTES = 268,
00080      ADD_MONTHS = 269,
00081      ADD_SECONDS = 270,
00082      ADD_YEARS = 271,
00083      ALL = 272,
00084      ALLOCATE = 273,
00085      ALTER = 274,
00086      AND = 275,
00087      ANY = 276,
00088      ARE = 277,
00089      AS = 278,
00090      ASIN = 279,
00091      ASC = 280,
00092      ASCII = 281,
00093      ASSERTION = 282,
00094      ATAN = 283,
00095      ATAN2 = 284,
00096      AUTHORIZATION = 285,
00097      AUTO_INCREMENT = 286,
00098      AVG = 287,
00099      BEFORE = 288,
00100      SQL_BEGIN = 289,
00101      BETWEEN = 290,
00102      BIGINT = 291,
00103      BINARY = 292,
00104      BIT = 293,
00105      BIT_LENGTH = 294,
00106      BITWISE_SHIFT_LEFT = 295,
00107      BITWISE_SHIFT_RIGHT = 296,
00108      BREAK = 297,
00109      BY = 298,
00110      CASCADE = 299,
00111      CASCADED = 300,
00112      CASE = 301,
00113      CAST = 302,
00114      CATALOG = 303,
00115      CEILING = 304,
00116      CENTER = 305,
00117      SQL_CHAR = 306,
00118      CHAR_LENGTH = 307,
00119      CHARACTER_STRING_LITERAL = 308,
00120      CHECK = 309,
00121      CLOSE = 310,
00122      COALESCE = 311,
00123      COBOL = 312,
00124      COLLATE = 313,
00125      COLLATION = 314,
00126      COLUMN = 315,
00127      COMMIT = 316,
00128      COMPUTE = 317,
00129      CONCAT = 318,
00130      CONCATENATION = 319,
00131      CONNECT = 320,
00132      CONNECTION = 321,
00133      CONSTRAINT = 322,
00134      CONSTRAINTS = 323,
00135      CONTINUE = 324,
00136      CONVERT = 325,
00137      CORRESPONDING = 326,
00138      COS = 327,
00139      COT = 328,
00140      COUNT = 329,
00141      CREATE = 330,
00142      CURDATE = 331,
00143      CURRENT = 332,
00144      CURRENT_DATE = 333,
00145      CURRENT_TIME = 334,
00146      CURRENT_TIMESTAMP = 335,
00147      CURTIME = 336,
00148      CURSOR = 337,
00149      DATABASE = 338,
00150      SQL_DATE = 339,
00151      DATE_FORMAT = 340,
00152      DATE_REMAINDER = 341,
00153      DATE_VALUE = 342,
00154      DAY = 343,
00155      DAYOFMONTH = 344,
00156      DAYOFWEEK = 345,
00157      DAYOFYEAR = 346,
00158      DAYS_BETWEEN = 347,
00159      DEALLOCATE = 348,
00160      DEC = 349,
00161      DECLARE = 350,
00162      DEFAULT = 351,
00163      DEFERRABLE = 352,
00164      DEFERRED = 353,
00165      SQL_DELETE = 354,
00166      DESC = 355,
00167      DESCRIBE = 356,
00168      DESCRIPTOR = 357,
00169      DIAGNOSTICS = 358,
00170      DICTIONARY = 359,
00171      DIRECTORY = 360,
00172      DISCONNECT = 361,
00173      DISPLACEMENT = 362,
00174      DISTINCT = 363,
00175      DOMAIN_TOKEN = 364,
00176      SQL_DOUBLE = 365,
00177      DOUBLE_QUOTED_STRING = 366,
00178      DROP = 367,
00179      ELSE = 368,
00180      END = 369,
00181      END_EXEC = 370,
00182      EQUAL = 371,
00183      ESCAPE = 372,
00184      EXCEPT = 373,
00185      SQL_EXCEPTION = 374,
00186      EXEC = 375,
00187      EXECUTE = 376,
00188      EXISTS = 377,
00189      EXP = 378,
00190      EXPONENT = 379,
00191      EXTERNAL = 380,
00192      EXTRACT = 381,
00193      SQL_FALSE = 382,
00194      FETCH = 383,
00195      FIRST = 384,
00196      SQL_FLOAT = 385,
00197      FLOOR = 386,
00198      FN = 387,
00199      FOR = 388,
00200      FOREIGN = 389,
00201      FORTRAN = 390,
00202      FOUND = 391,
00203      FOUR_DIGITS = 392,
00204      FROM = 393,
00205      FULL = 394,
00206      GET = 395,
00207      GLOBAL = 396,
00208      GO = 397,
00209      GOTO = 398,
00210      GRANT = 399,
00211      GREATER_OR_EQUAL = 400,
00212      HAVING = 401,
00213      HOUR = 402,
00214      HOURS_BETWEEN = 403,
00215      IDENTITY = 404,
00216      IFNULL = 405,
00217      SQL_IGNORE = 406,
00218      IMMEDIATE = 407,
00219      SQL_IN = 408,
00220      INCLUDE = 409,
00221      INDEX = 410,
00222      INDICATOR = 411,
00223      INITIALLY = 412,
00224      INNER = 413,
00225      INPUT = 414,
00226      INSENSITIVE = 415,
00227      INSERT = 416,
00228      INTEGER = 417,
00229      INTERSECT = 418,
00230      INTERVAL = 419,
00231      INTO = 420,
00232      IS = 421,
00233      ISOLATION = 422,
00234      JOIN = 423,
00235      JUSTIFY = 424,
00236      KEY = 425,
00237      LANGUAGE = 426,
00238      LAST = 427,
00239      LCASE = 428,
00240      LEFT = 429,
00241      LENGTH = 430,
00242      LESS_OR_EQUAL = 431,
00243      LEVEL = 432,
00244      LIKE = 433,
00245      LINE_WIDTH = 434,
00246      LOCAL = 435,
00247      LOCATE = 436,
00248      LOG = 437,
00249      SQL_LONG = 438,
00250      LOWER = 439,
00251      LTRIM = 440,
00252      LTRIP = 441,
00253      MATCH = 442,
00254      SQL_MAX = 443,
00255      MICROSOFT = 444,
00256      SQL_MIN = 445,
00257      MINUS = 446,
00258      MINUTE = 447,
00259      MINUTES_BETWEEN = 448,
00260      MOD = 449,
00261      MODIFY = 450,
00262      MODULE = 451,
00263      MONTH = 452,
00264      MONTHS_BETWEEN = 453,
00265      MUMPS = 454,
00266      NAMES = 455,
00267      NATIONAL = 456,
00268      NCHAR = 457,
00269      NEXT = 458,
00270      NODUP = 459,
00271      NONE = 460,
00272      NOT = 461,
00273      NOT_EQUAL = 462,
00274      NOT_EQUAL2 = 463,
00275      NOW = 464,
00276      SQL_NULL = 465,
00277      SQL_IS = 466,
00278      SQL_IS_NULL = 467,
00279      SQL_IS_NOT_NULL = 468,
00280      NULLIF = 469,
00281      NUMERIC = 470,
00282      OCTET_LENGTH = 471,
00283      ODBC = 472,
00284      OF = 473,
00285      SQL_OFF = 474,
00286      SQL_ON = 475,
00287      ONLY = 476,
00288      OPEN = 477,
00289      OPTION = 478,
00290      OR = 479,
00291      ORDER = 480,
00292      OUTER = 481,
00293      OUTPUT = 482,
00294      OVERLAPS = 483,
00295      PAGE = 484,
00296      PARTIAL = 485,
00297      SQL_PASCAL = 486,
00298      PERSISTENT = 487,
00299      CQL_PI = 488,
00300      PLI = 489,
00301      POSITION = 490,
00302      PRECISION = 491,
00303      PREPARE = 492,
00304      PRESERVE = 493,
00305      PRIMARY = 494,
00306      PRIOR = 495,
00307      PRIVILEGES = 496,
00308      PROCEDURE = 497,
00309      PRODUCT = 498,
00310      PUBLIC = 499,
00311      QUARTER = 500,
00312      QUIT = 501,
00313      RAND = 502,
00314      READ_ONLY = 503,
00315      REAL = 504,
00316      REFERENCES = 505,
00317      REPEAT = 506,
00318      REPLACE = 507,
00319      RESTRICT = 508,
00320      REVOKE = 509,
00321      RIGHT = 510,
00322      ROLLBACK = 511,
00323      ROWS = 512,
00324      RPAD = 513,
00325      RTRIM = 514,
00326      SCHEMA = 515,
00327      SCREEN_WIDTH = 516,
00328      SCROLL = 517,
00329      SECOND = 518,
00330      SECONDS_BETWEEN = 519,
00331      SELECT = 520,
00332      SEQUENCE = 521,
00333      SETOPT = 522,
00334      SET = 523,
00335      SHOWOPT = 524,
00336      SIGN = 525,
00337      SIMILAR_TO = 526,
00338      NOT_SIMILAR_TO = 527,
00339      INTEGER_CONST = 528,
00340      REAL_CONST = 529,
00341      DATE_CONST = 530,
00342      DATETIME_CONST = 531,
00343      TIME_CONST = 532,
00344      SIN = 533,
00345      SQL_SIZE = 534,
00346      SMALLINT = 535,
00347      SOME = 536,
00348      SPACE = 537,
00349      SQL = 538,
00350      SQL_TRUE = 539,
00351      SQLCA = 540,
00352      SQLCODE = 541,
00353      SQLERROR = 542,
00354      SQLSTATE = 543,
00355      SQLWARNING = 544,
00356      SQRT = 545,
00357      STDEV = 546,
00358      SUBSTRING = 547,
00359      SUM = 548,
00360      SYSDATE = 549,
00361      SYSDATE_FORMAT = 550,
00362      SYSTEM = 551,
00363      TABLE = 552,
00364      TAN = 553,
00365      TEMPORARY = 554,
00366      THEN = 555,
00367      THREE_DIGITS = 556,
00368      TIME = 557,
00369      TIMESTAMP = 558,
00370      TIMEZONE_HOUR = 559,
00371      TIMEZONE_MINUTE = 560,
00372      TINYINT = 561,
00373      TO = 562,
00374      TO_CHAR = 563,
00375      TO_DATE = 564,
00376      TRANSACTION = 565,
00377      TRANSLATE = 566,
00378      TRANSLATION = 567,
00379      TRUNCATE = 568,
00380      GENERAL_TITLE = 569,
00381      TWO_DIGITS = 570,
00382      UCASE = 571,
00383      UNION = 572,
00384      UNIQUE = 573,
00385      SQL_UNKNOWN = 574,
00386      UPDATE = 575,
00387      UPPER = 576,
00388      USAGE = 577,
00389      USER = 578,
00390      IDENTIFIER = 579,
00391      IDENTIFIER_DOT_ASTERISK = 580,
00392      QUERY_PARAMETER = 581,
00393      USING = 582,
00394      VALUE = 583,
00395      VALUES = 584,
00396      VARBINARY = 585,
00397      VARCHAR = 586,
00398      VARYING = 587,
00399      VENDOR = 588,
00400      VIEW = 589,
00401      WEEK = 590,
00402      WHEN = 591,
00403      WHENEVER = 592,
00404      WHERE = 593,
00405      WHERE_CURRENT_OF = 594,
00406      WITH = 595,
00407      WORD_WRAPPED = 596,
00408      WORK = 597,
00409      WRAPPED = 598,
00410      XOR = 599,
00411      YEAR = 600,
00412      YEARS_BETWEEN = 601,
00413      SCAN_ERROR = 602,
00414      __LAST_TOKEN = 603,
00415      ILIKE = 604
00416    };
00417 #endif
00418 /* Tokens.  */
00419 #define UMINUS 258
00420 #define SQL_TYPE 259
00421 #define SQL_ABS 260
00422 #define ACOS 261
00423 #define AMPERSAND 262
00424 #define SQL_ABSOLUTE 263
00425 #define ADA 264
00426 #define ADD 265
00427 #define ADD_DAYS 266
00428 #define ADD_HOURS 267
00429 #define ADD_MINUTES 268
00430 #define ADD_MONTHS 269
00431 #define ADD_SECONDS 270
00432 #define ADD_YEARS 271
00433 #define ALL 272
00434 #define ALLOCATE 273
00435 #define ALTER 274
00436 #define AND 275
00437 #define ANY 276
00438 #define ARE 277
00439 #define AS 278
00440 #define ASIN 279
00441 #define ASC 280
00442 #define ASCII 281
00443 #define ASSERTION 282
00444 #define ATAN 283
00445 #define ATAN2 284
00446 #define AUTHORIZATION 285
00447 #define AUTO_INCREMENT 286
00448 #define AVG 287
00449 #define BEFORE 288
00450 #define SQL_BEGIN 289
00451 #define BETWEEN 290
00452 #define BIGINT 291
00453 #define BINARY 292
00454 #define BIT 293
00455 #define BIT_LENGTH 294
00456 #define BITWISE_SHIFT_LEFT 295
00457 #define BITWISE_SHIFT_RIGHT 296
00458 #define BREAK 297
00459 #define BY 298
00460 #define CASCADE 299
00461 #define CASCADED 300
00462 #define CASE 301
00463 #define CAST 302
00464 #define CATALOG 303
00465 #define CEILING 304
00466 #define CENTER 305
00467 #define SQL_CHAR 306
00468 #define CHAR_LENGTH 307
00469 #define CHARACTER_STRING_LITERAL 308
00470 #define CHECK 309
00471 #define CLOSE 310
00472 #define COALESCE 311
00473 #define COBOL 312
00474 #define COLLATE 313
00475 #define COLLATION 314
00476 #define COLUMN 315
00477 #define COMMIT 316
00478 #define COMPUTE 317
00479 #define CONCAT 318
00480 #define CONCATENATION 319
00481 #define CONNECT 320
00482 #define CONNECTION 321
00483 #define CONSTRAINT 322
00484 #define CONSTRAINTS 323
00485 #define CONTINUE 324
00486 #define CONVERT 325
00487 #define CORRESPONDING 326
00488 #define COS 327
00489 #define COT 328
00490 #define COUNT 329
00491 #define CREATE 330
00492 #define CURDATE 331
00493 #define CURRENT 332
00494 #define CURRENT_DATE 333
00495 #define CURRENT_TIME 334
00496 #define CURRENT_TIMESTAMP 335
00497 #define CURTIME 336
00498 #define CURSOR 337
00499 #define DATABASE 338
00500 #define SQL_DATE 339
00501 #define DATE_FORMAT 340
00502 #define DATE_REMAINDER 341
00503 #define DATE_VALUE 342
00504 #define DAY 343
00505 #define DAYOFMONTH 344
00506 #define DAYOFWEEK 345
00507 #define DAYOFYEAR 346
00508 #define DAYS_BETWEEN 347
00509 #define DEALLOCATE 348
00510 #define DEC 349
00511 #define DECLARE 350
00512 #define DEFAULT 351
00513 #define DEFERRABLE 352
00514 #define DEFERRED 353
00515 #define SQL_DELETE 354
00516 #define DESC 355
00517 #define DESCRIBE 356
00518 #define DESCRIPTOR 357
00519 #define DIAGNOSTICS 358
00520 #define DICTIONARY 359
00521 #define DIRECTORY 360
00522 #define DISCONNECT 361
00523 #define DISPLACEMENT 362
00524 #define DISTINCT 363
00525 #define DOMAIN_TOKEN 364
00526 #define SQL_DOUBLE 365
00527 #define DOUBLE_QUOTED_STRING 366
00528 #define DROP 367
00529 #define ELSE 368
00530 #define END 369
00531 #define END_EXEC 370
00532 #define EQUAL 371
00533 #define ESCAPE 372
00534 #define EXCEPT 373
00535 #define SQL_EXCEPTION 374
00536 #define EXEC 375
00537 #define EXECUTE 376
00538 #define EXISTS 377
00539 #define EXP 378
00540 #define EXPONENT 379
00541 #define EXTERNAL 380
00542 #define EXTRACT 381
00543 #define SQL_FALSE 382
00544 #define FETCH 383
00545 #define FIRST 384
00546 #define SQL_FLOAT 385
00547 #define FLOOR 386
00548 #define FN 387
00549 #define FOR 388
00550 #define FOREIGN 389
00551 #define FORTRAN 390
00552 #define FOUND 391
00553 #define FOUR_DIGITS 392
00554 #define FROM 393
00555 #define FULL 394
00556 #define GET 395
00557 #define GLOBAL 396
00558 #define GO 397
00559 #define GOTO 398
00560 #define GRANT 399
00561 #define GREATER_OR_EQUAL 400
00562 #define HAVING 401
00563 #define HOUR 402
00564 #define HOURS_BETWEEN 403
00565 #define IDENTITY 404
00566 #define IFNULL 405
00567 #define SQL_IGNORE 406
00568 #define IMMEDIATE 407
00569 #define SQL_IN 408
00570 #define INCLUDE 409
00571 #define INDEX 410
00572 #define INDICATOR 411
00573 #define INITIALLY 412
00574 #define INNER 413
00575 #define INPUT 414
00576 #define INSENSITIVE 415
00577 #define INSERT 416
00578 #define INTEGER 417
00579 #define INTERSECT 418
00580 #define INTERVAL 419
00581 #define INTO 420
00582 #define IS 421
00583 #define ISOLATION 422
00584 #define JOIN 423
00585 #define JUSTIFY 424
00586 #define KEY 425
00587 #define LANGUAGE 426
00588 #define LAST 427
00589 #define LCASE 428
00590 #define LEFT 429
00591 #define LENGTH 430
00592 #define LESS_OR_EQUAL 431
00593 #define LEVEL 432
00594 #define LIKE 433
00595 #define LINE_WIDTH 434
00596 #define LOCAL 435
00597 #define LOCATE 436
00598 #define LOG 437
00599 #define SQL_LONG 438
00600 #define LOWER 439
00601 #define LTRIM 440
00602 #define LTRIP 441
00603 #define MATCH 442
00604 #define SQL_MAX 443
00605 #define MICROSOFT 444
00606 #define SQL_MIN 445
00607 #define MINUS 446
00608 #define MINUTE 447
00609 #define MINUTES_BETWEEN 448
00610 #define MOD 449
00611 #define MODIFY 450
00612 #define MODULE 451
00613 #define MONTH 452
00614 #define MONTHS_BETWEEN 453
00615 #define MUMPS 454
00616 #define NAMES 455
00617 #define NATIONAL 456
00618 #define NCHAR 457
00619 #define NEXT 458
00620 #define NODUP 459
00621 #define NONE 460
00622 #define NOT 461
00623 #define NOT_EQUAL 462
00624 #define NOT_EQUAL2 463
00625 #define NOW 464
00626 #define SQL_NULL 465
00627 #define SQL_IS 466
00628 #define SQL_IS_NULL 467
00629 #define SQL_IS_NOT_NULL 468
00630 #define NULLIF 469
00631 #define NUMERIC 470
00632 #define OCTET_LENGTH 471
00633 #define ODBC 472
00634 #define OF 473
00635 #define SQL_OFF 474
00636 #define SQL_ON 475
00637 #define ONLY 476
00638 #define OPEN 477
00639 #define OPTION 478
00640 #define OR 479
00641 #define ORDER 480
00642 #define OUTER 481
00643 #define OUTPUT 482
00644 #define OVERLAPS 483
00645 #define PAGE 484
00646 #define PARTIAL 485
00647 #define SQL_PASCAL 486
00648 #define PERSISTENT 487
00649 #define CQL_PI 488
00650 #define PLI 489
00651 #define POSITION 490
00652 #define PRECISION 491
00653 #define PREPARE 492
00654 #define PRESERVE 493
00655 #define PRIMARY 494
00656 #define PRIOR 495
00657 #define PRIVILEGES 496
00658 #define PROCEDURE 497
00659 #define PRODUCT 498
00660 #define PUBLIC 499
00661 #define QUARTER 500
00662 #define QUIT 501
00663 #define RAND 502
00664 #define READ_ONLY 503
00665 #define REAL 504
00666 #define REFERENCES 505
00667 #define REPEAT 506
00668 #define REPLACE 507
00669 #define RESTRICT 508
00670 #define REVOKE 509
00671 #define RIGHT 510
00672 #define ROLLBACK 511
00673 #define ROWS 512
00674 #define RPAD 513
00675 #define RTRIM 514
00676 #define SCHEMA 515
00677 #define SCREEN_WIDTH 516
00678 #define SCROLL 517
00679 #define SECOND 518
00680 #define SECONDS_BETWEEN 519
00681 #define SELECT 520
00682 #define SEQUENCE 521
00683 #define SETOPT 522
00684 #define SET 523
00685 #define SHOWOPT 524
00686 #define SIGN 525
00687 #define SIMILAR_TO 526
00688 #define NOT_SIMILAR_TO 527
00689 #define INTEGER_CONST 528
00690 #define REAL_CONST 529
00691 #define DATE_CONST 530
00692 #define DATETIME_CONST 531
00693 #define TIME_CONST 532
00694 #define SIN 533
00695 #define SQL_SIZE 534
00696 #define SMALLINT 535
00697 #define SOME 536
00698 #define SPACE 537
00699 #define SQL 538
00700 #define SQL_TRUE 539
00701 #define SQLCA 540
00702 #define SQLCODE 541
00703 #define SQLERROR 542
00704 #define SQLSTATE 543
00705 #define SQLWARNING 544
00706 #define SQRT 545
00707 #define STDEV 546
00708 #define SUBSTRING 547
00709 #define SUM 548
00710 #define SYSDATE 549
00711 #define SYSDATE_FORMAT 550
00712 #define SYSTEM 551
00713 #define TABLE 552
00714 #define TAN 553
00715 #define TEMPORARY 554
00716 #define THEN 555
00717 #define THREE_DIGITS 556
00718 #define TIME 557
00719 #define TIMESTAMP 558
00720 #define TIMEZONE_HOUR 559
00721 #define TIMEZONE_MINUTE 560
00722 #define TINYINT 561
00723 #define TO 562
00724 #define TO_CHAR 563
00725 #define TO_DATE 564
00726 #define TRANSACTION 565
00727 #define TRANSLATE 566
00728 #define TRANSLATION 567
00729 #define TRUNCATE 568
00730 #define GENERAL_TITLE 569
00731 #define TWO_DIGITS 570
00732 #define UCASE 571
00733 #define UNION 572
00734 #define UNIQUE 573
00735 #define SQL_UNKNOWN 574
00736 #define UPDATE 575
00737 #define UPPER 576
00738 #define USAGE 577
00739 #define USER 578
00740 #define IDENTIFIER 579
00741 #define IDENTIFIER_DOT_ASTERISK 580
00742 #define QUERY_PARAMETER 581
00743 #define USING 582
00744 #define VALUE 583
00745 #define VALUES 584
00746 #define VARBINARY 585
00747 #define VARCHAR 586
00748 #define VARYING 587
00749 #define VENDOR 588
00750 #define VIEW 589
00751 #define WEEK 590
00752 #define WHEN 591
00753 #define WHENEVER 592
00754 #define WHERE 593
00755 #define WHERE_CURRENT_OF 594
00756 #define WITH 595
00757 #define WORD_WRAPPED 596
00758 #define WORK 597
00759 #define WRAPPED 598
00760 #define XOR 599
00761 #define YEAR 600
00762 #define YEARS_BETWEEN 601
00763 #define SCAN_ERROR 602
00764 #define __LAST_TOKEN 603
00765 #define ILIKE 604
00766 
00767 
00768 
00769 
00770 /* Copy the first part of user declarations.  */
00771 #line 438 "sqlparser.y"
00772 
00773 #ifndef YYDEBUG /* compat. */
00774 # define YYDEBUG 0
00775 #endif
00776 #include <stdio.h>
00777 #include <string.h>
00778 #include <string>
00779 #include <iostream>
00780 #include <assert.h>
00781 #include <limits.h>
00782 //TODO OK?
00783 #ifdef Q_WS_WIN
00784 //workaround for bug on msvc
00785 # undef LLONG_MIN
00786 #endif
00787 #ifndef LLONG_MAX
00788 # define LLONG_MAX     0x7fffffffffffffffLL
00789 #endif
00790 #ifndef LLONG_MIN
00791 # define LLONG_MIN     0x8000000000000000LL
00792 #endif
00793 #ifndef LLONG_MAX
00794 # define ULLONG_MAX    0xffffffffffffffffLL
00795 #endif
00796 
00797 #ifdef _WIN32
00798 # include <malloc.h>
00799 #endif
00800 
00801 #include <qobject.h>
00802 #include <kdebug.h>
00803 #include <klocale.h>
00804 #include <qptrlist.h>
00805 #include <qcstring.h>
00806 #include <qvariant.h>
00807 
00808 #include <connection.h>
00809 #include <queryschema.h>
00810 #include <field.h>
00811 #include <tableschema.h>
00812 
00813 #include "parser.h"
00814 #include "parser_p.h"
00815 #include "sqltypes.h"
00816 
00817 int yylex();
00818 
00819 //  using namespace std;
00820 using namespace KexiDB;
00821 
00822 #define YY_NO_UNPUT
00823 #define YYSTACK_USE_ALLOCA 1
00824 #define YYMAXDEPTH 255
00825 
00826     extern "C"
00827     {
00828         int yywrap()
00829         {
00830             return 1;
00831         }
00832     }
00833 
00834 #if 0
00835     struct yyval
00836     {
00837         QString parserUserName;
00838         int integerValue;
00839         KexiDBField::ColumnType coltype;
00840     }
00841 #endif
00842 
00843 
00844 
00845 /* Enabling traces.  */
00846 #ifndef YYDEBUG
00847 # define YYDEBUG 0
00848 #endif
00849 
00850 /* Enabling verbose error messages.  */
00851 #ifdef YYERROR_VERBOSE
00852 # undef YYERROR_VERBOSE
00853 # define YYERROR_VERBOSE 1
00854 #else
00855 # define YYERROR_VERBOSE 0
00856 #endif
00857 
00858 /* Enabling the token table.  */
00859 #ifndef YYTOKEN_TABLE
00860 # define YYTOKEN_TABLE 0
00861 #endif
00862 
00863 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
00864 typedef union YYSTYPE
00865 #line 511 "sqlparser.y"
00866 {
00867     QString* stringValue;
00868     Q_LLONG integerValue;
00869     bool booleanValue;
00870     struct realType realValue;
00871     KexiDB::Field::Type colType;
00872     KexiDB::Field *field;
00873     KexiDB::BaseExpr *expr;
00874     KexiDB::NArgExpr *exprList;
00875     KexiDB::ConstExpr *constExpr;
00876     KexiDB::QuerySchema *querySchema;
00877     SelectOptionsInternal *selectOptions;
00878     OrderByColumnInternal::List *orderByColumns;
00879     QVariant *variantValue;
00880 }
00881 /* Line 193 of yacc.c.  */
00882 #line 883 "sqlparser.tab.c"
00883     YYSTYPE;
00884 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
00885 # define YYSTYPE_IS_DECLARED 1
00886 # define YYSTYPE_IS_TRIVIAL 1
00887 #endif
00888 
00889 
00890 
00891 /* Copy the second part of user declarations.  */
00892 
00893 
00894 /* Line 216 of yacc.c.  */
00895 #line 896 "sqlparser.tab.c"
00896 
00897 #ifdef short
00898 # undef short
00899 #endif
00900 
00901 #ifdef YYTYPE_UINT8
00902 typedef YYTYPE_UINT8 yytype_uint8;
00903 #else
00904 typedef unsigned char yytype_uint8;
00905 #endif
00906 
00907 #ifdef YYTYPE_INT8
00908 typedef YYTYPE_INT8 yytype_int8;
00909 #elif (defined __STDC__ || defined __C99__FUNC__ \
00910      || defined __cplusplus || defined _MSC_VER)
00911 typedef signed char yytype_int8;
00912 #else
00913 typedef short int yytype_int8;
00914 #endif
00915 
00916 #ifdef YYTYPE_UINT16
00917 typedef YYTYPE_UINT16 yytype_uint16;
00918 #else
00919 typedef unsigned short int yytype_uint16;
00920 #endif
00921 
00922 #ifdef YYTYPE_INT16
00923 typedef YYTYPE_INT16 yytype_int16;
00924 #else
00925 typedef short int yytype_int16;
00926 #endif
00927 
00928 #ifndef YYSIZE_T
00929 # ifdef __SIZE_TYPE__
00930 #  define YYSIZE_T __SIZE_TYPE__
00931 # elif defined size_t
00932 #  define YYSIZE_T size_t
00933 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
00934      || defined __cplusplus || defined _MSC_VER)
00935 #  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
00936 #  define YYSIZE_T size_t
00937 # else
00938 #  define YYSIZE_T unsigned int
00939 # endif
00940 #endif
00941 
00942 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
00943 
00944 #ifndef YY_
00945 # if YYENABLE_NLS
00946 #  if ENABLE_NLS
00947 #   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
00948 #   define YY_(msgid) dgettext ("bison-runtime", msgid)
00949 #  endif
00950 # endif
00951 # ifndef YY_
00952 #  define YY_(msgid) msgid
00953 # endif
00954 #endif
00955 
00956 /* Suppress unused-variable warnings by "using" E.  */
00957 #if ! defined lint || defined __GNUC__
00958 # define YYUSE(e) ((void) (e))
00959 #else
00960 # define YYUSE(e) /* empty */
00961 #endif
00962 
00963 /* Identity function, used to suppress warnings about constant conditions.  */
00964 #ifndef lint
00965 # define YYID(n) (n)
00966 #else
00967 #if (defined __STDC__ || defined __C99__FUNC__ \
00968      || defined __cplusplus || defined _MSC_VER)
00969 static int
00970 YYID (int i)
00971 #else
00972 static int
00973 YYID (i)
00974     int i;
00975 #endif
00976 {
00977   return i;
00978 }
00979 #endif
00980 
00981 #if ! defined yyoverflow || YYERROR_VERBOSE
00982 
00983 /* The parser invokes alloca or malloc; define the necessary symbols.  */
00984 
00985 # ifdef YYSTACK_USE_ALLOCA
00986 #  if YYSTACK_USE_ALLOCA
00987 #   ifdef __GNUC__
00988 #    define YYSTACK_ALLOC __builtin_alloca
00989 #   elif defined __BUILTIN_VA_ARG_INCR
00990 #    include <alloca.h> /* INFRINGES ON USER NAME SPACE */
00991 #   elif defined _AIX
00992 #    define YYSTACK_ALLOC __alloca
00993 #   elif defined _MSC_VER
00994 #    include <malloc.h> /* INFRINGES ON USER NAME SPACE */
00995 #    define alloca _alloca
00996 #   else
00997 #    define YYSTACK_ALLOC alloca
00998 #    if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
00999      || defined __cplusplus || defined _MSC_VER)
01000 #     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
01001 #     ifndef _STDLIB_H
01002 #      define _STDLIB_H 1
01003 #     endif
01004 #    endif
01005 #   endif
01006 #  endif
01007 # endif
01008 
01009 # ifdef YYSTACK_ALLOC
01010    /* Pacify GCC's `empty if-body' warning.  */
01011 #  define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
01012 #  ifndef YYSTACK_ALLOC_MAXIMUM
01013     /* The OS might guarantee only one guard page at the bottom of the stack,
01014        and a page size can be as small as 4096 bytes.  So we cannot safely
01015        invoke alloca (N) if N exceeds 4096.  Use a slightly smaller number
01016        to allow for a few compiler-allocated temporary stack slots.  */
01017 #   define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
01018 #  endif
01019 # else
01020 #  define YYSTACK_ALLOC YYMALLOC
01021 #  define YYSTACK_FREE YYFREE
01022 #  ifndef YYSTACK_ALLOC_MAXIMUM
01023 #   define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
01024 #  endif
01025 #  if (defined __cplusplus && ! defined _STDLIB_H \
01026        && ! ((defined YYMALLOC || defined malloc) \
01027          && (defined YYFREE || defined free)))
01028 #   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
01029 #   ifndef _STDLIB_H
01030 #    define _STDLIB_H 1
01031 #   endif
01032 #  endif
01033 #  ifndef YYMALLOC
01034 #   define YYMALLOC malloc
01035 #   if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
01036      || defined __cplusplus || defined _MSC_VER)
01037 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
01038 #   endif
01039 #  endif
01040 #  ifndef YYFREE
01041 #   define YYFREE free
01042 #   if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
01043      || defined __cplusplus || defined _MSC_VER)
01044 void free (void *); /* INFRINGES ON USER NAME SPACE */
01045 #   endif
01046 #  endif
01047 # endif
01048 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
01049 
01050 
01051 #if (! defined yyoverflow \
01052      && (! defined __cplusplus \
01053      || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
01054 
01055 /* A type that is properly aligned for any stack member.  */
01056 union yyalloc
01057 {
01058   yytype_int16 yyss;
01059   YYSTYPE yyvs;
01060   };
01061 
01062 /* The size of the maximum gap between one aligned stack and the next.  */
01063 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
01064 
01065 /* The size of an array large to enough to hold all stacks, each with
01066    N elements.  */
01067 # define YYSTACK_BYTES(N) \
01068      ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
01069       + YYSTACK_GAP_MAXIMUM)
01070 
01071 /* Copy COUNT objects from FROM to TO.  The source and destination do
01072    not overlap.  */
01073 # ifndef YYCOPY
01074 #  if defined __GNUC__ && 1 < __GNUC__
01075 #   define YYCOPY(To, From, Count) \
01076       __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
01077 #  else
01078 #   define YYCOPY(To, From, Count)      \
01079       do                    \
01080     {                   \
01081       YYSIZE_T yyi;             \
01082       for (yyi = 0; yyi < (Count); yyi++)   \
01083         (To)[yyi] = (From)[yyi];        \
01084     }                   \
01085       while (YYID (0))
01086 #  endif
01087 # endif
01088 
01089 /* Relocate STACK from its old location to the new one.  The
01090    local variables YYSIZE and YYSTACKSIZE give the old and new number of
01091    elements in the stack, and YYPTR gives the new location of the
01092    stack.  Advance YYPTR to a properly aligned location for the next
01093    stack.  */
01094 # define YYSTACK_RELOCATE(Stack)                    \
01095     do                                  \
01096       {                                 \
01097     YYSIZE_T yynewbytes;                        \
01098     YYCOPY (&yyptr->Stack, Stack, yysize);              \
01099     Stack = &yyptr->Stack;                      \
01100     yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
01101     yyptr += yynewbytes / sizeof (*yyptr);              \
01102       }                                 \
01103     while (YYID (0))
01104 
01105 #endif
01106 
01107 /* YYFINAL -- State number of the termination state.  */
01108 #define YYFINAL  10
01109 /* YYLAST -- Last index in YYTABLE.  */
01110 #define YYLAST   335
01111 
01112 /* YYNTOKENS -- Number of terminals.  */
01113 #define YYNTOKENS  373
01114 /* YYNNTS -- Number of nonterminals.  */
01115 #define YYNNTS  37
01116 /* YYNRULES -- Number of rules.  */
01117 #define YYNRULES  108
01118 /* YYNRULES -- Number of states.  */
01119 #define YYNSTATES  176
01120 
01121 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
01122 #define YYUNDEFTOK  2
01123 #define YYMAXUTOK   604
01124 
01125 #define YYTRANSLATE(YYX)                        \
01126   ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
01127 
01128 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX.  */
01129 static const yytype_uint16 yytranslate[] =
01130 {
01131        0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
01132        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
01133        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
01134        2,     2,     2,     2,     2,     2,   357,   352,   370,   361,
01135      358,   359,   351,   350,   355,   349,   356,   362,     2,     2,
01136        2,     2,     2,     2,     2,     2,     2,     2,     2,   354,
01137      364,   363,   365,   360,   353,     2,     2,     2,     2,     2,
01138        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
01139        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
01140        2,   368,     2,   369,   367,     2,     2,     2,     2,     2,
01141        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
01142        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
01143        2,     2,     2,     2,   371,     2,   372,     2,     2,     2,
01144        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
01145        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
01146        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
01147        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
01148        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
01149        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
01150        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
01151        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
01152        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
01153        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
01154        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
01155        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
01156        2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
01157        5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
01158       15,    16,    17,    18,    19,    20,    21,    22,    23,    24,
01159       25,    26,    27,    28,    29,    30,    31,    32,    33,    34,
01160       35,    36,    37,    38,    39,    40,    41,    42,    43,    44,
01161       45,    46,    47,    48,    49,    50,    51,    52,    53,    54,
01162       55,    56,    57,    58,    59,    60,    61,    62,    63,    64,
01163       65,    66,    67,    68,    69,    70,    71,    72,    73,    74,
01164       75,    76,    77,    78,    79,    80,    81,    82,    83,    84,
01165       85,    86,    87,    88,    89,    90,    91,    92,    93,    94,
01166       95,    96,    97,    98,    99,   100,   101,   102,   103,   104,
01167      105,   106,   107,   108,   109,   110,   111,   112,   113,   114,
01168      115,   116,   117,   118,   119,   120,   121,   122,   123,   124,
01169      125,   126,   127,   128,   129,   130,   131,   132,   133,   134,
01170      135,   136,   137,   138,   139,   140,   141,   142,   143,   144,
01171      145,   146,   147,   148,   149,   150,   151,   152,   153,   154,
01172      155,   156,   157,   158,   159,   160,   161,   162,   163,   164,
01173      165,   166,   167,   168,   169,   170,   171,   172,   173,   174,
01174      175,   176,   177,   178,   179,   180,   181,   182,   183,   184,
01175      185,   186,   187,   188,   189,   190,   191,   192,   193,   194,
01176      195,   196,   197,   198,   199,   200,   201,   202,   203,   204,
01177      205,   206,   207,   208,   209,   210,   211,   212,   213,   214,
01178      215,   216,   217,   218,   219,   220,   221,   222,   223,   224,
01179      225,   226,   227,   228,   229,   230,   231,   232,   233,   234,
01180      235,   236,   237,   238,   239,   240,   241,   242,   243,   244,
01181      245,   246,   247,   248,   249,   250,   251,   252,   253,   254,
01182      255,   256,   257,   258,   259,   260,   261,   262,   263,   264,
01183      265,   266,   267,   268,   269,   270,   271,   272,   273,   274,
01184      275,   276,   277,   278,   279,   280,   281,   282,   283,   284,
01185      285,   286,   287,   288,   289,   290,   291,   292,   293,   294,
01186      295,   296,   297,   298,   299,   300,   301,   302,   303,   304,
01187      305,   306,   307,   308,   309,   310,   311,   312,   313,   314,
01188      315,   316,   317,   318,   319,   320,   321,   322,   323,   324,
01189      325,   326,   327,   328,   329,   330,   331,   332,   333,   334,
01190      335,   336,   337,   338,   339,   340,   341,   342,   343,   344,
01191      345,   346,   347,   348,   366
01192 };
01193 
01194 #if YYDEBUG
01195 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
01196    YYRHS.  */
01197 static const yytype_uint16 yyprhs[] =
01198 {
01199        0,     0,     3,     5,     9,    11,    14,    16,    18,    19,
01200       27,    31,    33,    36,    40,    43,    45,    48,    51,    53,
01201       55,    60,    65,    66,    69,    73,    76,    80,    85,    87,
01202       89,    93,    98,   103,   106,   108,   111,   115,   120,   122,
01203      126,   128,   130,   132,   134,   138,   142,   146,   148,   152,
01204      156,   160,   164,   168,   170,   174,   178,   182,   186,   190,
01205      194,   196,   199,   202,   204,   208,   212,   214,   218,   222,
01206      226,   230,   232,   236,   240,   244,   246,   249,   252,   255,
01207      258,   260,   262,   265,   269,   271,   273,   275,   277,   279,
01208      283,   287,   291,   295,   298,   302,   304,   306,   309,   313,
01209      317,   319,   321,   323,   327,   330,   332,   337,   339
01210 };
01211 
01212 /* YYRHS -- A `-1'-separated list of the rules' RHS.  */
01213 static const yytype_int16 yyrhs[] =
01214 {
01215      374,     0,    -1,   375,    -1,   376,   354,   375,    -1,   376,
01216       -1,   376,   354,    -1,   377,    -1,   384,    -1,    -1,    75,
01217      297,   324,   378,   358,   379,   359,    -1,   379,   355,   380,
01218       -1,   380,    -1,   324,   383,    -1,