47#define YYBISON_VERSION "3.0.4"
50#define YYSKELETON_NAME "yacc.c"
65#line 435 "KDbSqlParser.y"
78# define LLONG_MAX 0x7fffffffffffffffLL
81# define LLONG_MIN 0x8000000000000000LL
84# define ULLONG_MAX 0xffffffffffffffffLL
95#include "KDbConnection.h"
96#include "KDbDateTime.h"
97#include "KDbExpression.h"
99#include "KDbOrderByColumn.h"
100#include "KDbParser.h"
101#include "KDbParser_p.h"
102#include "KDbQuerySchema.h"
103#include "KDbQuerySchema_p.h"
104#include "KDbSqlTypes.h"
105#include "KDbTableSchema.h"
106#include "kdb_debug.h"
123#define YYSTACK_USE_ALLOCA 1
124#define YYMAXDEPTH 255
135#line 136 "sqlparser.cpp"
138# if defined __cplusplus && 201103L <= __cplusplus
139# define YY_NULLPTR nullptr
146#ifdef YYERROR_VERBOSE
147# undef YYERROR_VERBOSE
148# define YYERROR_VERBOSE 1
150# define YYERROR_VERBOSE 0
155#ifndef YY_YY_KDBSQLPARSER_TAB_H_INCLUDED
156# define YY_YY_KDBSQLPARSER_TAB_H_INCLUDED
174 AUTO_INCREMENT = 262,
176 BITWISE_SHIFT_LEFT = 264,
177 BITWISE_SHIFT_RIGHT = 265,
179 CHARACTER_STRING_LITERAL = 267,
184 DOUBLE_QUOTED_STRING = 272,
190 GREATER_OR_EQUAL = 278,
194 SQL_IS_NOT_NULL = 282,
203 DATETIME_CONST = 291,
207 IDENTIFIER_DOT_ASTERISK = 295,
208 QUERY_PARAMETER = 296,
230 NOT_SIMILAR_TO = 318,
233 TABS_OR_SPACES = 321,
234 DATE_TIME_INTEGER = 322,
241#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
245#line 505 "KDbSqlParser.y"
267#line 268 "sqlparser.cpp"
270typedef union YYSTYPE YYSTYPE;
271# define YYSTYPE_IS_TRIVIAL 1
272# define YYSTYPE_IS_DECLARED 1
276extern YYSTYPE yylval;
284#line 285 "sqlparser.cpp"
291typedef YYTYPE_UINT8 yytype_uint8;
293typedef unsigned char yytype_uint8;
297typedef YYTYPE_INT8 yytype_int8;
299typedef signed char yytype_int8;
303typedef YYTYPE_UINT16 yytype_uint16;
305typedef unsigned short int yytype_uint16;
309typedef YYTYPE_INT16 yytype_int16;
311typedef short int yytype_int16;
316# define YYSIZE_T __SIZE_TYPE__
318# define YYSIZE_T size_t
319# elif ! defined YYSIZE_T
321# define YYSIZE_T size_t
323# define YYSIZE_T unsigned int
327#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
330# if defined YYENABLE_NLS && YYENABLE_NLS
333# define YY_(Msgid) dgettext ("bison-runtime", Msgid)
337# define YY_(Msgid) Msgid
342# if (defined __GNUC__ \
343 && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \
344 || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
345# define YY_ATTRIBUTE(Spec) __attribute__(Spec)
347# define YY_ATTRIBUTE(Spec)
351#ifndef YY_ATTRIBUTE_PURE
352# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__))
355#ifndef YY_ATTRIBUTE_UNUSED
356# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
359#if !defined _Noreturn \
360 && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
361# if defined _MSC_VER && 1200 <= _MSC_VER
362# define _Noreturn __declspec (noreturn)
364# define _Noreturn YY_ATTRIBUTE ((__noreturn__))
369#if ! defined lint || defined __GNUC__
370# define YYUSE(E) ((void) (E))
375#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
377# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
378 _Pragma ("GCC diagnostic push") \
379 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
380 _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
381# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
382 _Pragma ("GCC diagnostic pop")
384# define YY_INITIAL_VALUE(Value) Value
386#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
387# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
388# define YY_IGNORE_MAYBE_UNINITIALIZED_END
390#ifndef YY_INITIAL_VALUE
391# define YY_INITIAL_VALUE(Value)
395#if ! defined yyoverflow || YYERROR_VERBOSE
399# ifdef YYSTACK_USE_ALLOCA
400# if YYSTACK_USE_ALLOCA
402# define YYSTACK_ALLOC __builtin_alloca
403# elif defined __BUILTIN_VA_ARG_INCR
406# define YYSTACK_ALLOC __alloca
407# elif defined _MSC_VER
409# define alloca _alloca
411# define YYSTACK_ALLOC alloca
412# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
416# define EXIT_SUCCESS 0
425# define YYSTACK_FREE(Ptr) do { ; } while (0)
426# ifndef YYSTACK_ALLOC_MAXIMUM
431# define YYSTACK_ALLOC_MAXIMUM 4032
434# define YYSTACK_ALLOC YYMALLOC
435# define YYSTACK_FREE YYFREE
436# ifndef YYSTACK_ALLOC_MAXIMUM
437# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
439# if (defined __cplusplus && ! defined EXIT_SUCCESS \
440 && ! ((defined YYMALLOC || defined malloc) \
441 && (defined YYFREE || defined free)))
444# define EXIT_SUCCESS 0
448# define YYMALLOC malloc
449# if ! defined malloc && ! defined EXIT_SUCCESS
450void *malloc (YYSIZE_T);
455# if ! defined free && ! defined EXIT_SUCCESS
463#if (! defined yyoverflow \
464 && (! defined __cplusplus \
465 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
470 yytype_int16 yyss_alloc;
475# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
479# define YYSTACK_BYTES(N) \
480 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
481 + YYSTACK_GAP_MAXIMUM)
483# define YYCOPY_NEEDED 1
490# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
493 YYSIZE_T yynewbytes; \
494 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
495 Stack = &yyptr->Stack_alloc; \
496 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
497 yyptr += yynewbytes / sizeof (*yyptr); \
503#if defined YYCOPY_NEEDED && YYCOPY_NEEDED
507# if defined __GNUC__ && 1 < __GNUC__
508# define YYCOPY(Dst, Src, Count) \
509 __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
511# define YYCOPY(Dst, Src, Count) \
515 for (yyi = 0; yyi < (Count); yyi++) \
516 (Dst)[yyi] = (Src)[yyi]; \
542#define YYTRANSLATE(YYX) \
543 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
547static const yytype_uint8 yytranslate[] =
549 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
550 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
551 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
552 2, 2, 2, 2, 2, 84, 2, 82, 78, 2,
553 86, 87, 81, 76, 71, 77, 72, 80, 2, 2,
554 2, 2, 2, 2, 2, 2, 2, 2, 85, 70,
555 74, 75, 73, 2, 2, 2, 2, 2, 2, 2,
556 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
557 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
558 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
559 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
560 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
561 2, 2, 2, 2, 79, 2, 83, 2, 2, 2,
562 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
563 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
564 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
565 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
566 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
567 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
568 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
569 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
570 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
571 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
572 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
573 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
574 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
575 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
576 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
577 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
578 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
579 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
580 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
586static const yytype_uint16 yyrline[] =
588 0, 564, 564, 574, 578, 579, 594, 693, 699, 706,
589 711, 717, 723, 729, 738, 746, 753, 759, 767, 778,
590 787, 796, 806, 814, 826, 832, 839, 846, 850, 857,
591 862, 869, 875, 882, 887, 893, 899, 905, 911, 918,
592 923, 929, 935, 941, 947, 953, 959, 965, 975, 986,
593 991, 996, 1002, 1007, 1013, 1020, 1025, 1031, 1037, 1043,
594 1049, 1056, 1061, 1067, 1073, 1080, 1086, 1091, 1096, 1101,
595 1106, 1114, 1120, 1128, 1135, 1142, 1146, 1150, 1156, 1173,
596 1179, 1185, 1191, 1198, 1202, 1210, 1218, 1229, 1235, 1241,
597 1250, 1258, 1266, 1278, 1282, 1289, 1293, 1297, 1304, 1314,
598 1323, 1327, 1334, 1340, 1349, 1394, 1400, 1409, 1437, 1447,
599 1462, 1469, 1479, 1488, 1493, 1503, 1516, 1562, 1571, 1580
603#if YYDEBUG || YYERROR_VERBOSE || 0
606static const char *
const yytname[] =
608 "$end",
"error",
"$undefined",
"SQL_TYPE",
"AS",
"AS_EMPTY",
"ASC",
609 "AUTO_INCREMENT",
"BIT",
"BITWISE_SHIFT_LEFT",
"BITWISE_SHIFT_RIGHT",
610 "BY",
"CHARACTER_STRING_LITERAL",
"CONCATENATION",
"CREATE",
"DESC",
611 "DISTINCT",
"DOUBLE_QUOTED_STRING",
"FROM",
"JOIN",
"KEY",
"LEFT",
612 "LESS_OR_EQUAL",
"GREATER_OR_EQUAL",
"SQL_NULL",
"SQL_IS",
"SQL_IS_NULL",
613 "SQL_IS_NOT_NULL",
"ORDER",
"PRIMARY",
"SELECT",
"INTEGER_CONST",
614 "REAL_CONST",
"RIGHT",
"SQL_ON",
"DATE_CONST",
"DATETIME_CONST",
615 "TIME_CONST",
"TABLE",
"IDENTIFIER",
"IDENTIFIER_DOT_ASTERISK",
616 "QUERY_PARAMETER",
"VARCHAR",
"WHERE",
"SQL",
"SQL_TRUE",
"SQL_FALSE",
617 "UNION",
"SCAN_ERROR",
"AND",
"BETWEEN",
"NOT_BETWEEN",
"EXCEPT",
618 "SQL_IN",
"INTERSECT",
"LIKE",
"ILIKE",
"NOT_LIKE",
"NOT",
"NOT_EQUAL",
619 "NOT_EQUAL2",
"OR",
"SIMILAR_TO",
"NOT_SIMILAR_TO",
"XOR",
"UMINUS",
620 "TABS_OR_SPACES",
"DATE_TIME_INTEGER",
"TIME_AM",
"TIME_PM",
"';'",
621 "','",
"'.'",
"'>'",
"'<'",
"'='",
"'+'",
"'-'",
"'&'",
"'|'",
"'/'",
622 "'*'",
"'%'",
"'~'",
"'#'",
"':'",
"'('",
"')'",
"$accept",
623 "TopLevelStatement",
"StatementList",
"Statement",
"SelectStatement",
624 "Select",
"SelectOptions",
"WhereClause",
"OrderByClause",
625 "OrderByColumnId",
"OrderByOption",
"aExpr",
"aExpr2",
"aExpr3",
626 "aExpr4",
"aExpr5",
"aExpr6",
"aExpr7",
"aExpr8",
"aExpr9",
"DateConst",
627 "DateValue",
"YearConst",
"TimeConst",
"TimeValue",
"TimeMs",
628 "TimePeriod",
"DateTimeConst",
"aExpr10",
"aExprList",
"aExprList2",
629 "Tables",
"FlatTableList",
"FlatTable",
"ColViews",
"ColItem",
630 "ColExpression",
"ColWildCard", YY_NULLPTR
637static const yytype_uint16 yytoknum[] =
639 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
640 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
641 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
642 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
643 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
644 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
645 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
646 59, 44, 46, 62, 60, 61, 43, 45, 38, 124,
647 47, 42, 37, 126, 35, 58, 40, 41
651#define YYPACT_NINF -143
653#define yypact_value_is_default(Yystate) \
654 (!!((Yystate) == (-143)))
656#define YYTABLE_NINF -1
658#define yytable_value_is_error(Yytable_value) \
663static const yytype_int16 yypact[] =
665 1, -143, 52, -143, -8, -143, 22, -143, 1, -143,
666 -27, 25, -143, -143, -143, -60, -143, -143, -143, 126,
667 126, 126, -143, 126, 44, 126, -143, -143, -16, 13,
668 163, -143, 86, 0, 64, -143, -143, -143, -143, -11,
669 29, -143, 10, -143, -143, 102, 11, -5, -143, -23,
670 -2, -143, -21, -143, -143, -143, -143, -61, 4, 26,
671 -43, 24, 20, 35, 126, 126, 126, 126, 126, 126,
672 126, 126, -143, -143, 126, 126, 126, 126, 126, 126,
673 126, 126, 126, 126, 126, 126, 126, 126, 126, 126,
674 126, 126, 126, 96, 126, -143, 84, 78, -143, -11,
675 74, -143, 38, 98, -143, 25, -143, -143, -143, 71,
676 48, 110, 89, 99, -143, -143, 101, -143, 103, -143,
677 -143, -143, -143, -143, -143, -143, -143, -143, -143, 114,
678 120, -143, -143, -143, -143, -143, -143, -143, -143, -143,
679 -143, -143, -143, -143, -143, -143, -143, -143, 58, -143,
680 172, -143, -143, -143, -143, -143, -143, 126, -143, 111,
681 -12, 112, 115, 121, 126, 126, -143, 128, 144, 12,
682 58, -143, 63, 134, 137, -48, -143, 138, -143, -143,
683 167, -143, -143, -143, 58, 136, -143, -143, -143, -143,
684 139, -143, -143, -143, -143, -143, -143, 58, -48, -143,
691static const yytype_uint8 yydefact[] =
693 0, 14, 0, 2, 4, 6, 7, 1, 5, 77,
694 0, 0, 74, 78, 79, 70, 71, 75, 76, 0,
695 0, 0, 118, 0, 0, 0, 116, 29, 33, 39,
696 49, 52, 55, 61, 65, 80, 81, 82, 83, 10,
697 8, 111, 112, 113, 3, 0, 107, 104, 106, 0,
698 0, 72, 70, 69, 67, 66, 68, 87, 0, 0,
699 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
700 0, 0, 50, 51, 0, 0, 0, 0, 0, 0,
701 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
702 0, 0, 0, 0, 0, 12, 15, 0, 11, 9,
703 0, 115, 0, 0, 108, 0, 73, 119, 101, 103,
704 0, 0, 0, 0, 88, 89, 0, 84, 0, 90,
705 99, 30, 31, 32, 37, 35, 34, 36, 38, 0,
706 0, 44, 42, 43, 40, 41, 45, 46, 53, 54,
707 57, 56, 58, 59, 60, 62, 63, 64, 0, 19,
708 0, 110, 13, 114, 117, 109, 105, 0, 100, 0,
709 94, 0, 0, 0, 0, 0, 26, 24, 16, 20,
710 0, 102, 0, 0, 0, 97, 98, 0, 47, 48,
711 0, 18, 27, 28, 0, 21, 17, 87, 86, 93,
712 94, 95, 96, 91, 85, 25, 22, 0, 97, 23,
717static const yytype_int16 yypgoto[] =
719 -143, -143, 200, -143, -143, -143, -29, 47, -142, -143,
720 -143, -25, 87, 106, -73, -143, 32, 107, 90, 108,
721 -143, -143, 45, -143, 105, 34, 21, -143, -143, -143,
722 70, 188, -143, 124, -143, 133, 186, -143
726static const yytype_int16 yydefgoto[] =
728 -1, 2, 3, 4, 5, 6, 95, 96, 168, 169,
729 185, 26, 27, 28, 29, 30, 31, 32, 33, 34,
730 35, 60, 61, 36, 62, 175, 193, 37, 38, 51,
731 110, 39, 47, 48, 40, 41, 42, 43
737static const yytype_uint8 yytable[] =
739 63, 129, 130, 131, 132, 133, 134, 135, 136, 137,
740 9, 98, 49, 85, 100, 103, 106, 93, 182, 112,
741 191, 192, 12, 116, 113, 109, 50, 183, 186, 13,
742 14, 1, 94, 64, 9, 67, 68, 52, 10, 16,
743 11, 117, 196, 17, 18, 65, 12, 11, 66, 101,
744 104, 111, 7, 13, 14, 199, 19, 93, 107, 45,
745 173, 15, 8, 16, 46, 50, 105, 17, 18, 149,
746 152, 114, 94, 174, 20, 21, 86, 87, 88, 89,
747 19, 23, 24, 184, 25, 108, 69, 70, 71, 166,
748 9, 178, 179, 115, 10, 83, 84, 167, 20, 21,
749 97, 118, 12, 22, 119, 23, 24, 148, 25, 13,
750 14, 57, 150, 153, 9, 138, 139, 15, 10, 16,
751 58, 59, 120, 17, 18, 154, 12, 53, 54, 55,
752 187, 56, 109, 13, 14, 158, 19, 155, 9, 58,
753 59, 52, 157, 16, 90, 91, 92, 17, 18, 106,
754 12, 121, 122, 123, 20, 21, 159, 13, 14, 22,
755 19, 23, 24, 164, 25, 52, 160, 16, 161, 165,
756 163, 17, 18, 124, 125, 126, 127, 128, 20, 21,
757 145, 146, 147, 170, 19, 23, 24, 94, 25, 72,
758 73, 172, 140, 141, 142, 143, 144, 113, 177, 176,
759 180, 189, 20, 21, 190, 194, 195, 197, 44, 23,
760 24, 173, 25, 74, 75, 181, 76, 188, 77, 200,
761 78, 162, 79, 80, 198, 81, 82, 171, 99, 156,
765static const yytype_uint8 yycheck[] =
767 25, 74, 75, 76, 77, 78, 79, 80, 81, 82,
768 12, 40, 72, 13, 4, 4, 39, 28, 6, 80,
769 68, 69, 24, 66, 85, 50, 86, 15, 170, 31,
770 32, 30, 43, 49, 12, 22, 23, 39, 16, 41,
771 18, 84, 184, 45, 46, 61, 24, 18, 64, 39,
772 39, 72, 0, 31, 32, 197, 58, 28, 81, 86,
773 72, 39, 70, 41, 39, 86, 71, 45, 46, 94,
774 99, 67, 43, 85, 76, 77, 76, 77, 78, 79,
775 58, 83, 84, 71, 86, 87, 73, 74, 75, 31,
776 12, 164, 165, 67, 16, 9, 10, 39, 76, 77,
777 71, 77, 24, 81, 84, 83, 84, 11, 86, 31,
778 32, 67, 28, 39, 12, 83, 84, 39, 16, 41,
779 76, 77, 87, 45, 46, 87, 24, 19, 20, 21,
780 67, 23, 157, 31, 32, 87, 58, 39, 12, 76,
781 77, 39, 71, 41, 80, 81, 82, 45, 46, 39,
782 24, 64, 65, 66, 76, 77, 67, 31, 32, 81,
783 58, 83, 84, 49, 86, 39, 67, 41, 67, 49,
784 67, 45, 46, 67, 68, 69, 70, 71, 76, 77,
785 90, 91, 92, 11, 58, 83, 84, 43, 86, 26,
786 27, 80, 85, 86, 87, 88, 89, 85, 77, 84,
787 72, 67, 76, 77, 67, 67, 39, 71, 8, 83,
788 84, 72, 86, 50, 51, 168, 53, 172, 55, 198,
789 57, 116, 59, 60, 190, 62, 63, 157, 40, 105,
795static const yytype_uint8 yystos[] =
797 0, 30, 89, 90, 91, 92, 93, 0, 70, 12,
798 16, 18, 24, 31, 32, 39, 41, 45, 46, 58,
799 76, 77, 81, 83, 84, 86, 99, 100, 101, 102,
800 103, 104, 105, 106, 107, 108, 111, 115, 116, 119,
801 122, 123, 124, 125, 90, 86, 39, 120, 121, 72,
802 86, 117, 39, 107, 107, 107, 107, 67, 76, 77,
803 109, 110, 112, 99, 49, 61, 64, 22, 23, 73,
804 74, 75, 26, 27, 50, 51, 53, 55, 57, 59,
805 60, 62, 63, 9, 10, 13, 76, 77, 78, 79,
806 80, 81, 82, 28, 43, 94, 95, 71, 94, 119,
807 4, 39, 124, 4, 39, 71, 39, 81, 87, 99,
808 118, 72, 80, 85, 67, 67, 66, 84, 77, 84,
809 87, 100, 100, 100, 101, 101, 101, 101, 101, 102,
810 102, 102, 102, 102, 102, 102, 102, 102, 104, 104,
811 105, 105, 105, 105, 105, 106, 106, 106, 11, 99,
812 28, 123, 94, 39, 87, 39, 121, 71, 87, 67,
813 67, 67, 112, 67, 49, 49, 31, 39, 96, 97,
814 11, 118, 80, 72, 85, 113, 84, 77, 102, 102,
815 72, 95, 6, 15, 71, 98, 96, 67, 110, 67,
816 67, 68, 69, 114, 67, 39, 96, 71, 113, 96,
821static const yytype_uint8 yyr1[] =
823 0, 88, 89, 90, 90, 90, 91, 92, 92, 92,
824 92, 92, 92, 92, 93, 94, 94, 94, 94, 95,
825 96, 96, 96, 96, 97, 97, 97, 98, 98, 99,
826 100, 100, 100, 100, 101, 101, 101, 101, 101, 101,
827 102, 102, 102, 102, 102, 102, 102, 102, 102, 102,
828 103, 103, 103, 104, 104, 104, 105, 105, 105, 105,
829 105, 105, 106, 106, 106, 106, 107, 107, 107, 107,
830 107, 107, 107, 107, 107, 107, 107, 107, 107, 107,
831 107, 107, 107, 107, 108, 109, 109, 110, 110, 110,
832 111, 112, 112, 113, 113, 114, 114, 114, 115, 116,
833 117, 117, 118, 118, 119, 120, 120, 121, 121, 121,
834 122, 122, 123, 123, 123, 123, 124, 124, 125, 125
838static const yytype_uint8 yyr2[] =
840 0, 2, 1, 3, 1, 2, 1, 1, 2, 3,
841 2, 3, 3, 4, 1, 1, 3, 4, 4, 2,
842 1, 2, 3, 4, 1, 3, 1, 1, 1, 1,
843 3, 3, 3, 1, 3, 3, 3, 3, 3, 1,
844 3, 3, 3, 3, 3, 3, 3, 5, 5, 1,
845 2, 2, 1, 3, 3, 1, 3, 3, 3, 3,
846 3, 1, 3, 3, 3, 1, 2, 2, 2, 2,
847 1, 1, 2, 3, 1, 1, 1, 1, 1, 1,
848 1, 1, 1, 1, 3, 5, 5, 1, 2, 2,
849 3, 5, 7, 2, 0, 1, 1, 0, 5, 3,
850 3, 2, 3, 1, 2, 3, 1, 1, 2, 3,
851 3, 1, 1, 1, 3, 2, 1, 4, 1, 3
855#define yyerrok (yyerrstatus = 0)
856#define yyclearin (yychar = YYEMPTY)
860#define YYACCEPT goto yyacceptlab
861#define YYABORT goto yyabortlab
862#define YYERROR goto yyerrorlab
865#define YYRECOVERING() (!!yyerrstatus)
867#define YYBACKUP(Token, Value) \
869 if (yychar == YYEMPTY) \
873 YYPOPSTACK (yylen); \
879 yyerror (YY_("syntax error: cannot back up")); \
895# define YYFPRINTF fprintf
898# define YYDPRINTF(Args) \
905#ifndef YY_LOCATION_PRINT
906# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
910# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
914 YYFPRINTF (stderr, "%s ", Title); \
915 yy_symbol_print (stderr, \
917 YYFPRINTF (stderr, "\n"); \
927yy_symbol_value_print (FILE *yyoutput,
int yytype, YYSTYPE
const *
const yyvaluep)
929 FILE *yyo = yyoutput;
934 if (yytype < YYNTOKENS)
935 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
946yy_symbol_print (FILE *yyoutput,
int yytype, YYSTYPE
const *
const yyvaluep)
948 YYFPRINTF (yyoutput,
"%s %s (",
949 yytype < YYNTOKENS ?
"token" :
"nterm", yytname[yytype]);
951 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
952 YYFPRINTF (yyoutput,
")");
961yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
963 YYFPRINTF (stderr,
"Stack now");
964 for (; yybottom <= yytop; yybottom++)
966 int yybot = *yybottom;
967 YYFPRINTF (stderr,
" %d", yybot);
969 YYFPRINTF (stderr,
"\n");
972# define YY_STACK_PRINT(Bottom, Top) \
975 yy_stack_print ((Bottom), (Top)); \
984yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp,
int yyrule)
986 unsigned long int yylno = yyrline[yyrule];
987 int yynrhs = yyr2[yyrule];
989 YYFPRINTF (stderr,
"Reducing stack by rule %d (line %lu):\n",
992 for (yyi = 0; yyi < yynrhs; yyi++)
994 YYFPRINTF (stderr,
" $%d = ", yyi + 1);
995 yy_symbol_print (stderr,
996 yystos[yyssp[yyi + 1 - yynrhs]],
997 &(yyvsp[(yyi + 1) - (yynrhs)])
999 YYFPRINTF (stderr,
"\n");
1003# define YY_REDUCE_PRINT(Rule) \
1006 yy_reduce_print (yyssp, yyvsp, Rule); \
1013# define YYDPRINTF(Args)
1014# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1015# define YY_STACK_PRINT(Bottom, Top)
1016# define YY_REDUCE_PRINT(Rule)
1022# define YYINITDEPTH 200
1033# define YYMAXDEPTH 10000
1040# if defined __GLIBC__ && defined _STRING_H
1041# define yystrlen strlen
1045yystrlen (
const char *yystr)
1048 for (yylen = 0; yystr[yylen]; yylen++)
1056# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1057# define yystpcpy stpcpy
1062yystpcpy (
char *yydest,
const char *yysrc)
1065 const char *yys = yysrc;
1067 while ((*yyd++ = *yys++) !=
'\0')
1084yytnamerr (
char *yyres,
const char *yystr)
1089 char const *yyp = yystr;
1096 goto do_not_strip_quotes;
1100 goto do_not_strip_quotes;
1113 do_not_strip_quotes: ;
1117 return yystrlen (yystr);
1119 return yystpcpy (yyres, yystr) - yyres;
1132yysyntax_error (YYSIZE_T *yymsg_alloc,
char **yymsg,
1133 yytype_int16 *yyssp,
int yytoken)
1135 YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
1136 YYSIZE_T yysize = yysize0;
1137 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1139 const char *yyformat = YY_NULLPTR;
1141 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1169 if (yytoken != YYEMPTY)
1171 int yyn = yypact[*yyssp];
1172 yyarg[yycount++] = yytname[yytoken];
1173 if (!yypact_value_is_default (yyn))
1178 int yyxbegin = yyn < 0 ? -yyn : 0;
1180 int yychecklim = YYLAST - yyn + 1;
1181 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1184 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1185 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
1186 && !yytable_value_is_error (yytable[yyx + yyn]))
1188 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1194 yyarg[yycount++] = yytname[yyx];
1196 YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
1197 if (! (yysize <= yysize1
1198 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1208# define YYCASE_(N, S) \
1212 YYCASE_(0, YY_(
"syntax error"));
1213 YYCASE_(1, YY_(
"syntax error, unexpected %s"));
1214 YYCASE_(2, YY_(
"syntax error, unexpected %s, expecting %s"));
1215 YYCASE_(3, YY_(
"syntax error, unexpected %s, expecting %s or %s"));
1216 YYCASE_(4, YY_(
"syntax error, unexpected %s, expecting %s or %s or %s"));
1217 YYCASE_(5, YY_(
"syntax error, unexpected %s, expecting %s or %s or %s or %s"));
1222 YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
1223 if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1228 if (*yymsg_alloc < yysize)
1230 *yymsg_alloc = 2 * yysize;
1231 if (! (yysize <= *yymsg_alloc
1232 && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
1233 *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
1243 while ((*yyp = *yyformat) !=
'\0')
1244 if (*yyp ==
'%' && yyformat[1] ==
's' && yyi < yycount)
1246 yyp += yytnamerr (yyp, yyarg[yyi++]);
1264yydestruct (
const char *yymsg,
int yytype, YYSTYPE *yyvaluep)
1269 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1271 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1273 YY_IGNORE_MAYBE_UNINITIALIZED_END
1307 yytype_int16 yyssa[YYINITDEPTH];
1309 yytype_int16 *yyssp;
1312 YYSTYPE yyvsa[YYINITDEPTH];
1316 YYSIZE_T yystacksize;
1329 char *yymsg = yymsgbuf;
1330 YYSIZE_T yymsg_alloc =
sizeof yymsgbuf;
1333#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1339 yyssp = yyss = yyssa;
1340 yyvsp = yyvs = yyvsa;
1341 yystacksize = YYINITDEPTH;
1343 YYDPRINTF ((stderr,
"Starting parse\n"));
1362 if (yyss + yystacksize - 1 <= yyssp)
1365 YYSIZE_T yysize = yyssp - yyss + 1;
1372 YYSTYPE *yyvs1 = yyvs;
1373 yytype_int16 *yyss1 = yyss;
1379 yyoverflow (YY_(
"memory exhausted"),
1380 &yyss1, yysize *
sizeof (*yyssp),
1381 &yyvs1, yysize *
sizeof (*yyvsp),
1388# ifndef YYSTACK_RELOCATE
1389 goto yyexhaustedlab;
1392 if (YYMAXDEPTH <= yystacksize)
1393 goto yyexhaustedlab;
1395 if (YYMAXDEPTH < yystacksize)
1396 yystacksize = YYMAXDEPTH;
1399 yytype_int16 *yyss1 = yyss;
1400 union yyalloc *yyptr =
1401 (
union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1403 goto yyexhaustedlab;
1404 YYSTACK_RELOCATE (yyss_alloc, yyss);
1405 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1406# undef YYSTACK_RELOCATE
1408 YYSTACK_FREE (yyss1);
1413 yyssp = yyss + yysize - 1;
1414 yyvsp = yyvs + yysize - 1;
1416 YYDPRINTF ((stderr,
"Stack size increased to %lu\n",
1417 (
unsigned long int) yystacksize));
1419 if (yyss + yystacksize - 1 <= yyssp)
1423 YYDPRINTF ((stderr,
"Entering state %d\n", yystate));
1425 if (yystate == YYFINAL)
1439 yyn = yypact[yystate];
1440 if (yypact_value_is_default (yyn))
1446 if (yychar == YYEMPTY)
1448 YYDPRINTF ((stderr,
"Reading a token: "));
1452 if (yychar <= YYEOF)
1454 yychar = yytoken = YYEOF;
1455 YYDPRINTF ((stderr,
"Now at end of input.\n"));
1459 yytoken = YYTRANSLATE (yychar);
1460 YY_SYMBOL_PRINT (
"Next token is", yytoken, &yylval, &yylloc);
1466 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1471 if (yytable_value_is_error (yyn))
1483 YY_SYMBOL_PRINT (
"Shifting", yytoken, &yylval, &yylloc);
1489 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1491 YY_IGNORE_MAYBE_UNINITIALIZED_END
1500 yyn = yydefact[yystate];
1521 yyval = yyvsp[1-yylen];
1524 YY_REDUCE_PRINT (yyn);
1528#line 565 "KDbSqlParser.y"
1533 KDbParserPrivate::get(globalParser)->setQuerySchema((yyvsp[0].querySchema));
1535#line 1536 "sqlparser.cpp"
1539#line 575 "KDbSqlParser.y"
1543#line 1544 "sqlparser.cpp"
1547#line 580 "KDbSqlParser.y"
1549 (yyval.querySchema) = (yyvsp[-1].querySchema);
1551#line 1552 "sqlparser.cpp"
1555#line 595 "KDbSqlParser.y"
1557 (yyval.querySchema) = (yyvsp[0].querySchema);
1559#line 1560 "sqlparser.cpp"
1563#line 694 "KDbSqlParser.y"
1565 sqlParserDebug() <<
"Select";
1566 if (!((yyval.querySchema) = buildSelectQuery( (yyvsp[0].querySchema),
nullptr )))
1569#line 1570 "sqlparser.cpp"
1573#line 700 "KDbSqlParser.y"
1575 sqlParserDebug() <<
"Select ColViews=" << *(yyvsp[0].exprList);
1577 if (!((yyval.querySchema) = buildSelectQuery( (yyvsp[-1].querySchema), (yyvsp[0].exprList) )))
1580#line 1581 "sqlparser.cpp"
1584#line 707 "KDbSqlParser.y"
1586 if (!((yyval.querySchema) = buildSelectQuery( (yyvsp[-2].querySchema), (yyvsp[-1].exprList), (yyvsp[0].exprList) )))
1589#line 1590 "sqlparser.cpp"
1593#line 712 "KDbSqlParser.y"
1595 sqlParserDebug() <<
"Select ColViews Tables";
1596 if (!((yyval.querySchema) = buildSelectQuery( (yyvsp[-1].querySchema),
nullptr, (yyvsp[0].exprList) )))
1599#line 1600 "sqlparser.cpp"
1603#line 718 "KDbSqlParser.y"
1605 sqlParserDebug() <<
"Select ColViews Conditions";
1606 if (!((yyval.querySchema) = buildSelectQuery( (yyvsp[-2].querySchema), (yyvsp[-1].exprList),
nullptr, (yyvsp[0].selectOptions) )))
1609#line 1610 "sqlparser.cpp"
1613#line 724 "KDbSqlParser.y"
1615 sqlParserDebug() <<
"Select Tables SelectOptions";
1616 if (!((yyval.querySchema) = buildSelectQuery( (yyvsp[-2].querySchema),
nullptr, (yyvsp[-1].exprList), (yyvsp[0].selectOptions) )))
1619#line 1620 "sqlparser.cpp"
1623#line 730 "KDbSqlParser.y"
1625 sqlParserDebug() <<
"Select ColViews Tables SelectOptions";
1626 if (!((yyval.querySchema) = buildSelectQuery( (yyvsp[-3].querySchema), (yyvsp[-2].exprList), (yyvsp[-1].exprList), (yyvsp[0].selectOptions) )))
1629#line 1630 "sqlparser.cpp"
1633#line 739 "KDbSqlParser.y"
1635 sqlParserDebug() <<
"SELECT";
1636 (yyval.querySchema) = KDbParserPrivate::get(globalParser)->createQuery();
1638#line 1639 "sqlparser.cpp"
1642#line 747 "KDbSqlParser.y"
1644 sqlParserDebug() <<
"WhereClause";
1646 (yyval.selectOptions)->whereExpr = *(yyvsp[0].expr);
1647 delete (yyvsp[0].expr);
1649#line 1650 "sqlparser.cpp"
1653#line 754 "KDbSqlParser.y"
1655 sqlParserDebug() <<
"OrderByClause";
1657 (yyval.selectOptions)->orderByColumns = (yyvsp[0].orderByColumns);
1659#line 1660 "sqlparser.cpp"
1663#line 760 "KDbSqlParser.y"
1665 sqlParserDebug() <<
"WhereClause ORDER BY OrderByClause";
1667 (yyval.selectOptions)->whereExpr = *(yyvsp[-3].expr);
1668 delete (yyvsp[-3].expr);
1669 (yyval.selectOptions)->orderByColumns = (yyvsp[0].orderByColumns);
1671#line 1672 "sqlparser.cpp"
1675#line 768 "KDbSqlParser.y"
1677 sqlParserDebug() <<
"OrderByClause WhereClause";
1679 (yyval.selectOptions)->whereExpr = *(yyvsp[0].expr);
1680 delete (yyvsp[0].expr);
1681 (yyval.selectOptions)->orderByColumns = (yyvsp[-1].orderByColumns);
1683#line 1684 "sqlparser.cpp"
1687#line 779 "KDbSqlParser.y"
1689 (yyval.expr) = (yyvsp[0].expr);
1691#line 1692 "sqlparser.cpp"
1695#line 788 "KDbSqlParser.y"
1697 sqlParserDebug() <<
"ORDER BY IDENTIFIER";
1700 orderByColumn.setColumnByNameOrNumber( *(yyvsp[0].variantValue) );
1701 (yyval.orderByColumns)->append( orderByColumn );
1702 delete (yyvsp[0].variantValue);
1704#line 1705 "sqlparser.cpp"
1708#line 797 "KDbSqlParser.y"
1710 sqlParserDebug() <<
"ORDER BY IDENTIFIER OrderByOption";
1713 orderByColumn.setColumnByNameOrNumber( *(yyvsp[-1].variantValue) );
1714 orderByColumn.order = (yyvsp[0].sortOrderValue);
1715 (yyval.orderByColumns)->append( orderByColumn );
1716 delete (yyvsp[-1].variantValue);
1718#line 1719 "sqlparser.cpp"
1722#line 807 "KDbSqlParser.y"
1724 (yyval.orderByColumns) = (yyvsp[0].orderByColumns);
1726 orderByColumn.setColumnByNameOrNumber( *(yyvsp[-2].variantValue) );
1727 (yyval.orderByColumns)->append( orderByColumn );
1728 delete (yyvsp[-2].variantValue);
1730#line 1731 "sqlparser.cpp"
1734#line 815 "KDbSqlParser.y"
1736 (yyval.orderByColumns) = (yyvsp[0].orderByColumns);
1738 orderByColumn.setColumnByNameOrNumber( *(yyvsp[-3].variantValue) );
1739 orderByColumn.order = (yyvsp[-2].sortOrderValue);
1740 (yyval.orderByColumns)->append( orderByColumn );
1741 delete (yyvsp[-3].variantValue);
1743#line 1744 "sqlparser.cpp"
1747#line 827 "KDbSqlParser.y"
1749 (yyval.variantValue) =
new QVariant( *(yyvsp[0].stringValue) );
1750 sqlParserDebug() <<
"OrderByColumnId: " << *(yyval.variantValue);
1751 delete (yyvsp[0].stringValue);
1753#line 1754 "sqlparser.cpp"
1757#line 833 "KDbSqlParser.y"
1759 (yyval.variantValue) =
new QVariant( *(yyvsp[-2].stringValue) +
QLatin1Char(
'.') + *(yyvsp[0].stringValue) );
1760 sqlParserDebug() <<
"OrderByColumnId: " << *(yyval.variantValue);
1761 delete (yyvsp[-2].stringValue);
1762 delete (yyvsp[0].stringValue);
1764#line 1765 "sqlparser.cpp"
1768#line 840 "KDbSqlParser.y"
1770 (yyval.variantValue) =
new QVariant((yyvsp[0].integerValue));
1771 sqlParserDebug() <<
"OrderByColumnId: " << *(yyval.variantValue);
1773#line 1774 "sqlparser.cpp"
1777#line 847 "KDbSqlParser.y"
1779 (yyval.sortOrderValue) = KDbOrderByColumn::SortOrder::Ascending;
1781#line 1782 "sqlparser.cpp"
1785#line 851 "KDbSqlParser.y"
1787 (yyval.sortOrderValue) = KDbOrderByColumn::SortOrder::Descending;
1789#line 1790 "sqlparser.cpp"
1793#line 863 "KDbSqlParser.y"
1796 (yyval.expr) =
new KDbBinaryExpression(*(yyvsp[-2].expr), KDbToken::AND, *(yyvsp[0].expr));
1797 delete (yyvsp[-2].expr);
1798 delete (yyvsp[0].expr);
1800#line 1801 "sqlparser.cpp"
1804#line 870 "KDbSqlParser.y"
1806 (yyval.expr) =
new KDbBinaryExpression(*(yyvsp[-2].expr), KDbToken::OR, *(yyvsp[0].expr));
1807 delete (yyvsp[-2].expr);
1808 delete (yyvsp[0].expr);
1810#line 1811 "sqlparser.cpp"
1814#line 876 "KDbSqlParser.y"
1816 (yyval.expr) =
new KDbBinaryExpression(*(yyvsp[-2].expr), KDbToken::XOR, *(yyvsp[0].expr));
1817 delete (yyvsp[-2].expr);
1818 delete (yyvsp[0].expr);
1820#line 1821 "sqlparser.cpp"
1824#line 888 "KDbSqlParser.y"
1827 delete (yyvsp[-2].expr);
1828 delete (yyvsp[0].expr);
1830#line 1831 "sqlparser.cpp"
1834#line 894 "KDbSqlParser.y"
1836 (yyval.expr) =
new KDbBinaryExpression(*(yyvsp[-2].expr), KDbToken::GREATER_OR_EQUAL, *(yyvsp[0].expr));
1837 delete (yyvsp[-2].expr);
1838 delete (yyvsp[0].expr);
1840#line 1841 "sqlparser.cpp"
1844#line 900 "KDbSqlParser.y"
1847 delete (yyvsp[-2].expr);
1848 delete (yyvsp[0].expr);
1850#line 1851 "sqlparser.cpp"
1854#line 906 "KDbSqlParser.y"
1856 (yyval.expr) =
new KDbBinaryExpression(*(yyvsp[-2].expr), KDbToken::LESS_OR_EQUAL, *(yyvsp[0].expr));
1857 delete (yyvsp[-2].expr);
1858 delete (yyvsp[0].expr);
1860#line 1861 "sqlparser.cpp"
1864#line 912 "KDbSqlParser.y"
1867 delete (yyvsp[-2].expr);
1868 delete (yyvsp[0].expr);
1870#line 1871 "sqlparser.cpp"
1874#line 924 "KDbSqlParser.y"
1876 (yyval.expr) =
new KDbBinaryExpression(*(yyvsp[-2].expr), KDbToken::NOT_EQUAL, *(yyvsp[0].expr));
1877 delete (yyvsp[-2].expr);
1878 delete (yyvsp[0].expr);
1880#line 1881 "sqlparser.cpp"
1884#line 930 "KDbSqlParser.y"
1886 (yyval.expr) =
new KDbBinaryExpression(*(yyvsp[-2].expr), KDbToken::NOT_EQUAL2, *(yyvsp[0].expr));
1887 delete (yyvsp[-2].expr);
1888 delete (yyvsp[0].expr);
1890#line 1891 "sqlparser.cpp"
1894#line 936 "KDbSqlParser.y"
1896 (yyval.expr) =
new KDbBinaryExpression(*(yyvsp[-2].expr), KDbToken::LIKE, *(yyvsp[0].expr));
1897 delete (yyvsp[-2].expr);
1898 delete (yyvsp[0].expr);
1900#line 1901 "sqlparser.cpp"
1904#line 942 "KDbSqlParser.y"
1906 (yyval.expr) =
new KDbBinaryExpression(*(yyvsp[-2].expr), KDbToken::NOT_LIKE, *(yyvsp[0].expr));
1907 delete (yyvsp[-2].expr);
1908 delete (yyvsp[0].expr);
1910#line 1911 "sqlparser.cpp"
1914#line 948 "KDbSqlParser.y"
1916 (yyval.expr) =
new KDbBinaryExpression(*(yyvsp[-2].expr), KDbToken::SQL_IN, *(yyvsp[0].expr));
1917 delete (yyvsp[-2].expr);
1918 delete (yyvsp[0].expr);
1920#line 1921 "sqlparser.cpp"
1924#line 954 "KDbSqlParser.y"
1926 (yyval.expr) =
new KDbBinaryExpression(*(yyvsp[-2].expr), KDbToken::SIMILAR_TO, *(yyvsp[0].expr));
1927 delete (yyvsp[-2].expr);
1928 delete (yyvsp[0].expr);
1930#line 1931 "sqlparser.cpp"
1934#line 960 "KDbSqlParser.y"
1936 (yyval.expr) =
new KDbBinaryExpression(*(yyvsp[-2].expr), KDbToken::NOT_SIMILAR_TO, *(yyvsp[0].expr));
1937 delete (yyvsp[-2].expr);
1938 delete (yyvsp[0].expr);
1940#line 1941 "sqlparser.cpp"
1944#line 966 "KDbSqlParser.y"
1947 (yyval.expr)->toNArg().
append( *(yyvsp[-4].expr) );
1948 (yyval.expr)->toNArg().append( *(yyvsp[-2].expr) );
1949 (yyval.expr)->toNArg().append( *(yyvsp[0].expr) );
1950 delete (yyvsp[-4].expr);
1951 delete (yyvsp[-2].expr);
1952 delete (yyvsp[0].expr);
1954#line 1955 "sqlparser.cpp"
1958#line 976 "KDbSqlParser.y"
1960 (yyval.expr) =
new KDbNArgExpression(KDb::RelationalExpression, KDbToken::NOT_BETWEEN_AND);
1961 (yyval.expr)->toNArg().
append( *(yyvsp[-4].expr) );
1962 (yyval.expr)->toNArg().append( *(yyvsp[-2].expr) );
1963 (yyval.expr)->toNArg().append( *(yyvsp[0].expr) );
1964 delete (yyvsp[-4].expr);
1965 delete (yyvsp[-2].expr);
1966 delete (yyvsp[0].expr);
1968#line 1969 "sqlparser.cpp"
1972#line 992 "KDbSqlParser.y"
1975 delete (yyvsp[-1].expr);
1977#line 1978 "sqlparser.cpp"
1981#line 997 "KDbSqlParser.y"
1983 (yyval.expr) =
new KDbUnaryExpression( KDbToken::SQL_IS_NOT_NULL, *(yyvsp[-1].expr) );
1984 delete (yyvsp[-1].expr);
1986#line 1987 "sqlparser.cpp"
1990#line 1008 "KDbSqlParser.y"
1992 (yyval.expr) =
new KDbBinaryExpression(*(yyvsp[-2].expr), KDbToken::BITWISE_SHIFT_LEFT, *(yyvsp[0].expr));
1993 delete (yyvsp[-2].expr);
1994 delete (yyvsp[0].expr);
1996#line 1997 "sqlparser.cpp"
2000#line 1014 "KDbSqlParser.y"
2002 (yyval.expr) =
new KDbBinaryExpression(*(yyvsp[-2].expr), KDbToken::BITWISE_SHIFT_RIGHT, *(yyvsp[0].expr));
2003 delete (yyvsp[-2].expr);
2004 delete (yyvsp[0].expr);
2006#line 2007 "sqlparser.cpp"
2010#line 1026 "KDbSqlParser.y"
2013 delete (yyvsp[-2].expr);
2014 delete (yyvsp[0].expr);
2016#line 2017 "sqlparser.cpp"
2020#line 1032 "KDbSqlParser.y"
2022 (yyval.expr) =
new KDbBinaryExpression(*(yyvsp[-2].expr), KDbToken::CONCATENATION, *(yyvsp[0].expr));
2023 delete (yyvsp[-2].expr);
2024 delete (yyvsp[0].expr);
2026#line 2027 "sqlparser.cpp"
2030#line 1038 "KDbSqlParser.y"
2033 delete (yyvsp[-2].expr);
2034 delete (yyvsp[0].expr);
2036#line 2037 "sqlparser.cpp"
2040#line 1044 "KDbSqlParser.y"
2043 delete (yyvsp[-2].expr);
2044 delete (yyvsp[0].expr);
2046#line 2047 "sqlparser.cpp"
2050#line 1050 "KDbSqlParser.y"
2053 delete (yyvsp[-2].expr);
2054 delete (yyvsp[0].expr);
2056#line 2057 "sqlparser.cpp"
2060#line 1062 "KDbSqlParser.y"
2063 delete (yyvsp[-2].expr);
2064 delete (yyvsp[0].expr);
2066#line 2067 "sqlparser.cpp"
2070#line 1068 "KDbSqlParser.y"
2073 delete (yyvsp[-2].expr);
2074 delete (yyvsp[0].expr);
2076#line 2077 "sqlparser.cpp"
2080#line 1074 "KDbSqlParser.y"
2083 delete (yyvsp[-2].expr);
2084 delete (yyvsp[0].expr);
2086#line 2087 "sqlparser.cpp"
2090#line 1087 "KDbSqlParser.y"
2093 delete (yyvsp[0].expr);
2095#line 2096 "sqlparser.cpp"
2099#line 1092 "KDbSqlParser.y"
2102 delete (yyvsp[0].expr);
2104#line 2105 "sqlparser.cpp"
2108#line 1097 "KDbSqlParser.y"
2111 delete (yyvsp[0].expr);
2113#line 2114 "sqlparser.cpp"
2117#line 1102 "KDbSqlParser.y"
2120 delete (yyvsp[0].expr);
2122#line 2123 "sqlparser.cpp"
2126#line 1107 "KDbSqlParser.y"
2131 sqlParserDebug() <<
" + identifier: " << *(yyvsp[0].stringValue);
2132 delete (yyvsp[0].stringValue);
2134#line 2135 "sqlparser.cpp"
2138#line 1115 "KDbSqlParser.y"
2141 sqlParserDebug() <<
" + query parameter:" << *(yyval.expr);
2142 delete (yyvsp[0].stringValue);
2144#line 2145 "sqlparser.cpp"
2148#line 1121 "KDbSqlParser.y"
2150 sqlParserDebug() <<
" + function:" << *(yyvsp[-1].stringValue) <<
"(" << *(yyvsp[0].exprList) <<
")";
2152 delete (yyvsp[-1].stringValue);
2153 delete (yyvsp[0].exprList);
2155#line 2156 "sqlparser.cpp"
2159#line 1129 "KDbSqlParser.y"
2162 sqlParserDebug() <<
" + identifier.identifier:" << *(yyvsp[-2].stringValue) <<
"." << *(yyvsp[0].stringValue);
2163 delete (yyvsp[-2].stringValue);
2164 delete (yyvsp[0].stringValue);
2166#line 2167 "sqlparser.cpp"
2170#line 1136 "KDbSqlParser.y"
2173 sqlParserDebug() <<
" + NULL";
2177#line 2178 "sqlparser.cpp"
2181#line 1143 "KDbSqlParser.y"
2185#line 2186 "sqlparser.cpp"
2189#line 1147 "KDbSqlParser.y"
2193#line 2194 "sqlparser.cpp"
2197#line 1151 "KDbSqlParser.y"
2199 (yyval.expr) =
new KDbConstExpression( KDbToken::CHARACTER_STRING_LITERAL, *(yyvsp[0].stringValue) );
2200 sqlParserDebug() <<
" + constant " << (yyvsp[0].stringValue);
2201 delete (yyvsp[0].stringValue);
2203#line 2204 "sqlparser.cpp"
2207#line 1157 "KDbSqlParser.y"
2210 if ((yyvsp[0].integerValue) <= INT_MAX && (yyvsp[0].integerValue) >= INT_MIN)
2211 val = (int)(yyvsp[0].integerValue);
2212 else if ((yyvsp[0].integerValue) <= UINT_MAX && (yyvsp[0].integerValue) >= 0)
2213 val = (uint)(yyvsp[0].integerValue);
2214 else if ((yyvsp[0].integerValue) <= LLONG_MAX && (yyvsp[0].integerValue) >= LLONG_MIN)
2215 val = (qint64)(yyvsp[0].integerValue);
2222 sqlParserDebug() <<
" + int constant: " << val.
toString();
2224#line 2225 "sqlparser.cpp"
2228#line 1174 "KDbSqlParser.y"
2230 (yyval.expr) =
new KDbConstExpression( KDbToken::REAL_CONST, *(yyvsp[0].binaryValue) );
2231 sqlParserDebug() <<
" + real constant: " << *(yyvsp[0].binaryValue);
2232 delete (yyvsp[0].binaryValue);
2234#line 2235 "sqlparser.cpp"
2238#line 1180 "KDbSqlParser.y"
2241 sqlParserDebug() <<
" + date constant:" << *(yyvsp[0].dateValue);
2242 delete (yyvsp[0].dateValue);
2244#line 2245 "sqlparser.cpp"
2248#line 1186 "KDbSqlParser.y"
2251 sqlParserDebug() <<
" + time constant:" << *(yyvsp[0].timeValue);
2252 delete (yyvsp[0].timeValue);
2254#line 2255 "sqlparser.cpp"
2258#line 1192 "KDbSqlParser.y"
2261 sqlParserDebug() <<
" + datetime constant:" << *(yyvsp[0].dateTimeValue);
2262 delete (yyvsp[0].dateTimeValue);
2264#line 2265 "sqlparser.cpp"
2268#line 1203 "KDbSqlParser.y"
2270 (yyval.dateValue) = (yyvsp[-1].dateValue);
2271 sqlParserDebug() <<
"DateConst:" << *(yyval.dateValue);
2273#line 2274 "sqlparser.cpp"
2277#line 1211 "KDbSqlParser.y"
2279 (yyval.dateValue) =
new KDbDate(*(yyvsp[-4].yearValue), *(yyvsp[-2].binaryValue), *(yyvsp[0].binaryValue));
2280 sqlParserDebug() <<
"DateValue:" << *(yyval.dateValue);
2281 delete (yyvsp[-4].yearValue);
2282 delete (yyvsp[-2].binaryValue);
2283 delete (yyvsp[0].binaryValue);
2285#line 2286 "sqlparser.cpp"
2289#line 1219 "KDbSqlParser.y"
2291 (yyval.dateValue) =
new KDbDate(*(yyvsp[0].yearValue), *(yyvsp[-4].binaryValue), *(yyvsp[-2].binaryValue));
2292 sqlParserDebug() <<
"DateValue:" << *(yyval.dateValue);
2293 delete (yyvsp[-4].binaryValue);
2294 delete (yyvsp[-2].binaryValue);
2295 delete (yyvsp[0].yearValue);
2297#line 2298 "sqlparser.cpp"
2301#line 1230 "KDbSqlParser.y"
2303 (yyval.yearValue) =
new KDbYear(KDbYear::Sign::None, *(yyvsp[0].binaryValue));
2304 sqlParserDebug() <<
"YearConst:" << *(yyval.yearValue);
2305 delete (yyvsp[0].binaryValue);
2307#line 2308 "sqlparser.cpp"
2311#line 1236 "KDbSqlParser.y"
2313 (yyval.yearValue) =
new KDbYear(KDbYear::Sign::Plus, *(yyvsp[0].binaryValue));
2314 sqlParserDebug() <<
"YearConst:" << *(yyval.yearValue);
2315 delete (yyvsp[0].binaryValue);
2317#line 2318 "sqlparser.cpp"
2321#line 1242 "KDbSqlParser.y"
2323 (yyval.yearValue) =
new KDbYear(KDbYear::Sign::Minus, *(yyvsp[0].binaryValue));
2324 sqlParserDebug() <<
"YearConst:" << *(yyval.yearValue);
2325 delete (yyvsp[0].binaryValue);
2327#line 2328 "sqlparser.cpp"
2331#line 1251 "KDbSqlParser.y"
2333 (yyval.timeValue) = (yyvsp[-1].timeValue);
2334 sqlParserDebug() <<
"TimeConst:" << *(yyval.timeValue);
2336#line 2337 "sqlparser.cpp"
2340#line 1259 "KDbSqlParser.y"
2342 (yyval.timeValue) =
new KDbTime(*(yyvsp[-4].binaryValue), *(yyvsp[-2].binaryValue), {}, *(yyvsp[-1].binaryValue), (yyvsp[0].timePeriodValue));
2343 sqlParserDebug() <<
"TimeValue:" << *(yyval.timeValue);
2344 delete (yyvsp[-4].binaryValue);
2345 delete (yyvsp[-2].binaryValue);
2346 delete (yyvsp[-1].binaryValue);
2348#line 2349 "sqlparser.cpp"
2352#line 1267 "KDbSqlParser.y"
2354 (yyval.timeValue) =
new KDbTime(*(yyvsp[-6].binaryValue), *(yyvsp[-4].binaryValue), *(yyvsp[-2].binaryValue), *(yyvsp[-1].binaryValue), (yyvsp[0].timePeriodValue));
2355 sqlParserDebug() <<
"TimeValue:" << *(yyval.timeValue);
2356 delete (yyvsp[-6].binaryValue);
2357 delete (yyvsp[-4].binaryValue);
2358 delete (yyvsp[-2].binaryValue);
2359 delete (yyvsp[-1].binaryValue);
2361#line 2362 "sqlparser.cpp"
2365#line 1279 "KDbSqlParser.y"
2367 (yyval.binaryValue) = (yyvsp[0].binaryValue);
2369#line 2370 "sqlparser.cpp"
2373#line 1283 "KDbSqlParser.y"
2377#line 2378 "sqlparser.cpp"
2381#line 1290 "KDbSqlParser.y"
2385#line 2386 "sqlparser.cpp"
2389#line 1294 "KDbSqlParser.y"
2393#line 2394 "sqlparser.cpp"
2397#line 1298 "KDbSqlParser.y"
2401#line 2402 "sqlparser.cpp"
2405#line 1305 "KDbSqlParser.y"
2407 (yyval.dateTimeValue) =
new KDbDateTime(*(yyvsp[-3].dateValue), *(yyvsp[-1].timeValue));
2408 sqlParserDebug() <<
"DateTimeConst:" << *(yyval.dateTimeValue);
2409 delete (yyvsp[-3].dateValue);
2410 delete (yyvsp[-1].timeValue);
2412#line 2413 "sqlparser.cpp"
2416#line 1315 "KDbSqlParser.y"
2418 sqlParserDebug() <<
"(expr)";
2420 delete (yyvsp[-1].expr);
2422#line 2423 "sqlparser.cpp"
2426#line 1324 "KDbSqlParser.y"
2428 (yyval.exprList) = (yyvsp[-1].exprList);
2430#line 2431 "sqlparser.cpp"
2434#line 1328 "KDbSqlParser.y"
2438#line 2439 "sqlparser.cpp"
2442#line 1335 "KDbSqlParser.y"
2444 (yyval.exprList) = (yyvsp[0].exprList);
2445 (yyval.exprList)->prepend( *(yyvsp[-2].expr) );
2446 delete (yyvsp[-2].expr);
2448#line 2449 "sqlparser.cpp"
2452#line 1341 "KDbSqlParser.y"
2455 (yyval.exprList)->append( *(yyvsp[0].expr) );
2456 delete (yyvsp[0].expr);
2458#line 2459 "sqlparser.cpp"
2462#line 1350 "KDbSqlParser.y"
2464 (yyval.exprList) = (yyvsp[0].exprList);
2466#line 2467 "sqlparser.cpp"
2470#line 1395 "KDbSqlParser.y"
2472 (yyval.exprList) = (yyvsp[-2].exprList);
2473 (yyval.exprList)->append(*(yyvsp[0].expr));
2474 delete (yyvsp[0].expr);
2476#line 2477 "sqlparser.cpp"
2480#line 1401 "KDbSqlParser.y"
2482 (yyval.exprList) =
new KDbNArgExpression(KDb::TableListExpression, KDbToken::IDENTIFIER);
2483 (yyval.exprList)->append(*(yyvsp[0].expr));
2484 delete (yyvsp[0].expr);
2486#line 2487 "sqlparser.cpp"
2490#line 1410 "KDbSqlParser.y"
2492 sqlParserDebug() <<
"FROM: '" << *(yyvsp[0].stringValue) <<
"'";
2516 delete (yyvsp[0].stringValue);
2518#line 2519 "sqlparser.cpp"
2522#line 1438 "KDbSqlParser.y"
2529 delete (yyvsp[-1].stringValue);
2530 delete (yyvsp[0].stringValue);
2532#line 2533 "sqlparser.cpp"
2536#line 1448 "KDbSqlParser.y"
2543 delete (yyvsp[-2].stringValue);
2544 delete (yyvsp[0].stringValue);
2546#line 2547 "sqlparser.cpp"
2550#line 1463 "KDbSqlParser.y"
2552 (yyval.exprList) = (yyvsp[-2].exprList);
2553 (yyval.exprList)->append(*(yyvsp[0].expr));
2554 delete (yyvsp[0].expr);
2555 sqlParserDebug() <<
"ColViews: ColViews , ColItem";
2557#line 2558 "sqlparser.cpp"
2561#line 1470 "KDbSqlParser.y"
2564 (yyval.exprList)->append(*(yyvsp[0].expr));
2565 delete (yyvsp[0].expr);
2566 sqlParserDebug() <<
"ColViews: ColItem";
2568#line 2569 "sqlparser.cpp"
2572#line 1480 "KDbSqlParser.y"
2578 (yyval.expr) = (yyvsp[0].expr);
2579 sqlParserDebug() <<
" added column expr:" << *(yyvsp[0].expr);
2581#line 2582 "sqlparser.cpp"
2585#line 1489 "KDbSqlParser.y"
2587 (yyval.expr) = (yyvsp[0].expr);
2588 sqlParserDebug() <<
" added column wildcard:" << *(yyvsp[0].expr);
2590#line 2591 "sqlparser.cpp"
2594#line 1494 "KDbSqlParser.y"
2597 *(yyvsp[-2].expr), KDbToken::AS,
2600 sqlParserDebug() <<
" added column expr:" << *(yyval.expr);
2601 delete (yyvsp[-2].expr);
2602 delete (yyvsp[0].stringValue);
2604#line 2605 "sqlparser.cpp"
2608#line 1504 "KDbSqlParser.y"
2611 *(yyvsp[-1].expr), KDbToken::AS_EMPTY,
2614 sqlParserDebug() <<
" added column expr:" << *(yyval.expr);
2615 delete (yyvsp[-1].expr);
2616 delete (yyvsp[0].stringValue);
2618#line 2619 "sqlparser.cpp"
2622#line 1517 "KDbSqlParser.y"
2624 (yyval.expr) = (yyvsp[0].expr);
2626#line 2627 "sqlparser.cpp"
2630#line 1563 "KDbSqlParser.y"
2632 (yyval.expr) = (yyvsp[-1].expr);
2636#line 2637 "sqlparser.cpp"
2640#line 1572 "KDbSqlParser.y"
2643 sqlParserDebug() <<
"all columns";
2649#line 2650 "sqlparser.cpp"
2653#line 1581 "KDbSqlParser.y"
2655 QString s( *(yyvsp[-2].stringValue) );
2658 sqlParserDebug() <<
" + all columns from " << s;
2659 delete (yyvsp[-2].stringValue);
2661#line 2662 "sqlparser.cpp"
2665#line 2666 "sqlparser.cpp"
2679 YY_SYMBOL_PRINT (
"-> $$ =", yyr1[yyn], &yyval, &yyloc);
2683 YY_STACK_PRINT (yyss, yyssp);
2693 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
2694 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
2695 yystate = yytable[yystate];
2697 yystate = yydefgoto[yyn - YYNTOKENS];
2708 yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
2714#if ! YYERROR_VERBOSE
2715 yyerror (YY_(
"syntax error"));
2717# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
2720 char const *yymsgp = YY_(
"syntax error");
2721 int yysyntax_error_status;
2722 yysyntax_error_status = YYSYNTAX_ERROR;
2723 if (yysyntax_error_status == 0)
2725 else if (yysyntax_error_status == 1)
2727 if (yymsg != yymsgbuf)
2728 YYSTACK_FREE (yymsg);
2729 yymsg = (
char *) YYSTACK_ALLOC (yymsg_alloc);
2733 yymsg_alloc =
sizeof yymsgbuf;
2734 yysyntax_error_status = 2;
2738 yysyntax_error_status = YYSYNTAX_ERROR;
2743 if (yysyntax_error_status == 2)
2744 goto yyexhaustedlab;
2746# undef YYSYNTAX_ERROR
2752 if (yyerrstatus == 3)
2757 if (yychar <= YYEOF)
2760 if (yychar == YYEOF)
2765 yydestruct (
"Error: discarding",
2791 YY_STACK_PRINT (yyss, yyssp);
2804 yyn = yypact[yystate];
2805 if (!yypact_value_is_default (yyn))
2808 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
2821 yydestruct (
"Error: popping",
2822 yystos[yystate], yyvsp);
2825 YY_STACK_PRINT (yyss, yyssp);
2828 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
2830 YY_IGNORE_MAYBE_UNINITIALIZED_END
2834 YY_SYMBOL_PRINT (
"Shifting", yystos[yyn], yyvsp, yylsp);
2854#if !defined yyoverflow || YYERROR_VERBOSE
2859 yyerror (YY_(
"memory exhausted"));
2865 if (yychar != YYEMPTY)
2869 yytoken = YYTRANSLATE (yychar);
2870 yydestruct (
"Cleanup: discarding lookahead",
2876 YY_STACK_PRINT (yyss, yyssp);
2877 while (yyssp != yyss)
2879 yydestruct (
"Cleanup: popping",
2880 yystos[*yyssp], yyvsp);
2885 YYSTACK_FREE (yyss);
2888 if (yymsg != yymsgbuf)
2889 YYSTACK_FREE (yymsg);
2893#line 1596 "KDbSqlParser.y"
2896KDB_TESTING_EXPORT
const char* g_tokenName(
unsigned int offset) {
2897 const int t = YYTRANSLATE(offset);
2898 if (t >= YYTRANSLATE(::SQL_TYPE)) {
The KDbBinaryExpression class represents binary operation.
The KDbConstExpression class represents const expression.
Generic date/time constant.
The KDbExpression class represents a base class for all expressions.
The KDbFunctionExpression class represents expression that use functional notation F(x,...
The KDbNArgExpression class represents a base class N-argument expression.
void append(const KDbExpression &expr)
Inserts expression argument expr at the end of this expression.
SortOrder
Column sort order.
The KDbQueryParameterExpression class represents query parameter expression.
KDbQuerySchema provides information about database query.
Period
Specifies hour period.
@ Pm
PM, after noon, before midnight.
A type-safe KDbSQL token It can be used in KDb expressions.
static const KDbToken BETWEEN_AND
Custom tokens are not used in parser but used as an extension in expression classes.
static const int maxCharTokenValue
Maximum character token value (253)
static const int maxTokenValue
Maximum character token value.
The KDbUnaryExpression class represents unary expression (with a single argument).
The KDbVariableExpression class represents variables such as fieldname or tablename....
Generic year constant based on extended ISO 8601 specification.
QDebug operator<<(QDebug dbg, const PerceptualColor::MultiSpinBoxSection &value)
QVariant fromValue(T &&value)
QString toString() const const