KDb

sqlparser.cpp
1 /* A Bison parser, made by GNU Bison 3.0.4. */
2 
3 /* Bison implementation for Yacc-like parsers in C
4 
5  Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
6 
7  This program is free software: you can redistribute it and/or modify
8  it under the terms of the GNU General Public License as published by
9  the Free Software Foundation, either version 3 of the License, or
10  (at your option) any later version.
11 
12  This program is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with this program. If not, see <http://www.gnu.org/licenses/>. */
19 
20 /* As a special exception, you may create a larger work that contains
21  part or all of the Bison parser skeleton and distribute that work
22  under terms of your choice, so long as that work isn't itself a
23  parser generator using the skeleton or a modified version thereof
24  as a parser skeleton. Alternatively, if you modify or redistribute
25  the parser skeleton itself, you may (at your option) remove this
26  special exception, which will cause the skeleton and the resulting
27  Bison output files to be licensed under the GNU General Public
28  License without this special exception.
29 
30  This special exception was added by the Free Software Foundation in
31  version 2.2 of Bison. */
32 
33 /* C LALR(1) parser skeleton written by Richard Stallman, by
34  simplifying the original so-called "semantic" parser. */
35 
36 /* All symbols defined below should begin with yy or YY, to avoid
37  infringing on user name space. This should be done even for local
38  variables, as they might otherwise be expanded by user macros.
39  There are some unavoidable exceptions within include files to
40  define necessary library symbols; they are noted "INFRINGES ON
41  USER NAME SPACE" below. */
42 
43 /* Identify Bison output. */
44 #define YYBISON 1
45 
46 /* Bison version. */
47 #define YYBISON_VERSION "3.0.4"
48 
49 /* Skeleton name. */
50 #define YYSKELETON_NAME "yacc.c"
51 
52 /* Pure parsers. */
53 #define YYPURE 0
54 
55 /* Push parsers. */
56 #define YYPUSH 0
57 
58 /* Pull parsers. */
59 #define YYPULL 1
60 
61 
62 
63 
64 /* Copy the first part of user declarations. */
65 #line 435 "KDbSqlParser.y" /* yacc.c:339 */
66 
67 #include <stdio.h>
68 #include <string.h>
69 #include <string>
70 #include <iostream>
71 #include <limits.h>
72 //! @todo OK?
73 #ifdef Q_OS_WIN
74 //workaround for bug on msvc
75 # undef LLONG_MIN
76 #endif
77 #ifndef LLONG_MAX
78 # define LLONG_MAX 0x7fffffffffffffffLL
79 #endif
80 #ifndef LLONG_MIN
81 # define LLONG_MIN 0x8000000000000000LL
82 #endif
83 #ifndef LLONG_MAX
84 # define ULLONG_MAX 0xffffffffffffffffLL
85 #endif
86 
87 #ifdef _WIN32
88 # include <malloc.h>
89 #endif
90 
91 #include <QObject>
92 #include <QVariant>
93 #include <QPoint>
94 
95 #include "KDbConnection.h"
96 #include "KDbDateTime.h"
97 #include "KDbExpression.h"
98 #include "KDbField.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"
107 
108 struct OrderByColumnInternal;
109 
110 #ifdef Q_OS_SOLARIS
111 #include <alloca.h>
112 #endif
113 
114 QDebug operator<<(QDebug dbg, const KDbExpressionPtr& expr)
115 {
116  dbg.nospace() << expr.e;
117  return dbg.space();
118 }
119 
120 int yylex();
121 
122 #define YY_NO_UNPUT
123 #define YYSTACK_USE_ALLOCA 1
124 #define YYMAXDEPTH 255
125 
126  extern "C"
127  {
128  int yywrap()
129  {
130  return 1;
131  }
132  }
133 
134 
135 #line 136 "sqlparser.cpp" /* yacc.c:339 */
136 
137 # ifndef YY_NULLPTR
138 # if defined __cplusplus && 201103L <= __cplusplus
139 # define YY_NULLPTR nullptr
140 # else
141 # define YY_NULLPTR 0
142 # endif
143 # endif
144 
145 /* Enabling verbose error messages. */
146 #ifdef YYERROR_VERBOSE
147 # undef YYERROR_VERBOSE
148 # define YYERROR_VERBOSE 1
149 #else
150 # define YYERROR_VERBOSE 0
151 #endif
152 
153 /* In a future release of Bison, this section will be replaced
154  by #include "KDbSqlParser.tab.h". */
155 #ifndef YY_YY_KDBSQLPARSER_TAB_H_INCLUDED
156 # define YY_YY_KDBSQLPARSER_TAB_H_INCLUDED
157 /* Debug traces. */
158 #ifndef YYDEBUG
159 # define YYDEBUG 0
160 #endif
161 #if YYDEBUG
162 extern int yydebug;
163 #endif
164 
165 /* Token type. */
166 #ifndef YYTOKENTYPE
167 # define YYTOKENTYPE
168  enum yytokentype
169  {
170  SQL_TYPE = 258,
171  AS = 259,
172  AS_EMPTY = 260,
173  ASC = 261,
174  AUTO_INCREMENT = 262,
175  BIT = 263,
176  BITWISE_SHIFT_LEFT = 264,
177  BITWISE_SHIFT_RIGHT = 265,
178  BY = 266,
179  CHARACTER_STRING_LITERAL = 267,
180  CONCATENATION = 268,
181  CREATE = 269,
182  DESC = 270,
183  DISTINCT = 271,
184  DOUBLE_QUOTED_STRING = 272,
185  FROM = 273,
186  JOIN = 274,
187  KEY = 275,
188  LEFT = 276,
189  LESS_OR_EQUAL = 277,
190  GREATER_OR_EQUAL = 278,
191  SQL_NULL = 279,
192  SQL_IS = 280,
193  SQL_IS_NULL = 281,
194  SQL_IS_NOT_NULL = 282,
195  ORDER = 283,
196  PRIMARY = 284,
197  SELECT = 285,
198  INTEGER_CONST = 286,
199  REAL_CONST = 287,
200  RIGHT = 288,
201  SQL_ON = 289,
202  DATE_CONST = 290,
203  DATETIME_CONST = 291,
204  TIME_CONST = 292,
205  TABLE = 293,
206  IDENTIFIER = 294,
207  IDENTIFIER_DOT_ASTERISK = 295,
208  QUERY_PARAMETER = 296,
209  VARCHAR = 297,
210  WHERE = 298,
211  SQL = 299,
212  SQL_TRUE = 300,
213  SQL_FALSE = 301,
214  UNION = 302,
215  SCAN_ERROR = 303,
216  AND = 304,
217  BETWEEN = 305,
218  NOT_BETWEEN = 306,
219  EXCEPT = 307,
220  SQL_IN = 308,
221  INTERSECT = 309,
222  LIKE = 310,
223  ILIKE = 311,
224  NOT_LIKE = 312,
225  NOT = 313,
226  NOT_EQUAL = 314,
227  NOT_EQUAL2 = 315,
228  OR = 316,
229  SIMILAR_TO = 317,
230  NOT_SIMILAR_TO = 318,
231  XOR = 319,
232  UMINUS = 320,
233  TABS_OR_SPACES = 321,
234  DATE_TIME_INTEGER = 322,
235  TIME_AM = 323,
236  TIME_PM = 324
237  };
238 #endif
239 
240 /* Value type. */
241 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
242 
243 union YYSTYPE
244 {
245 #line 505 "KDbSqlParser.y" /* yacc.c:355 */
246 
247  QString* stringValue;
248  QByteArray* binaryValue;
249  qint64 integerValue;
250  bool booleanValue;
251  KDbDate* dateValue;
252  KDbYear* yearValue;
253  KDbTime* timeValue;
254  KDbTime::Period timePeriodValue;
255  KDbDateTime* dateTimeValue;
256  KDbOrderByColumn::SortOrder sortOrderValue;
257  KDbField::Type colType;
258  KDbField *field;
259  KDbExpression *expr;
260  KDbNArgExpression *exprList;
261  KDbConstExpression *constExpression;
262  KDbQuerySchema *querySchema;
263  SelectOptionsInternal *selectOptions;
264  QList<OrderByColumnInternal> *orderByColumns;
265  QVariant *variantValue;
266 
267 #line 268 "sqlparser.cpp" /* yacc.c:355 */
268 };
269 
270 typedef union YYSTYPE YYSTYPE;
271 # define YYSTYPE_IS_TRIVIAL 1
272 # define YYSTYPE_IS_DECLARED 1
273 #endif
274 
275 
276 extern YYSTYPE yylval;
277 
278 int yyparse (void);
279 
280 #endif /* !YY_YY_KDBSQLPARSER_TAB_H_INCLUDED */
281 
282 /* Copy the second part of user declarations. */
283 
284 #line 285 "sqlparser.cpp" /* yacc.c:358 */
285 
286 #ifdef short
287 # undef short
288 #endif
289 
290 #ifdef YYTYPE_UINT8
291 typedef YYTYPE_UINT8 yytype_uint8;
292 #else
293 typedef unsigned char yytype_uint8;
294 #endif
295 
296 #ifdef YYTYPE_INT8
297 typedef YYTYPE_INT8 yytype_int8;
298 #else
299 typedef signed char yytype_int8;
300 #endif
301 
302 #ifdef YYTYPE_UINT16
303 typedef YYTYPE_UINT16 yytype_uint16;
304 #else
305 typedef unsigned short int yytype_uint16;
306 #endif
307 
308 #ifdef YYTYPE_INT16
309 typedef YYTYPE_INT16 yytype_int16;
310 #else
311 typedef short int yytype_int16;
312 #endif
313 
314 #ifndef YYSIZE_T
315 # ifdef __SIZE_TYPE__
316 # define YYSIZE_T __SIZE_TYPE__
317 # elif defined size_t
318 # define YYSIZE_T size_t
319 # elif ! defined YYSIZE_T
320 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
321 # define YYSIZE_T size_t
322 # else
323 # define YYSIZE_T unsigned int
324 # endif
325 #endif
326 
327 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
328 
329 #ifndef YY_
330 # if defined YYENABLE_NLS && YYENABLE_NLS
331 # if ENABLE_NLS
332 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
333 # define YY_(Msgid) dgettext ("bison-runtime", Msgid)
334 # endif
335 # endif
336 # ifndef YY_
337 # define YY_(Msgid) Msgid
338 # endif
339 #endif
340 
341 #ifndef YY_ATTRIBUTE
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)
346 # else
347 # define YY_ATTRIBUTE(Spec) /* empty */
348 # endif
349 #endif
350 
351 #ifndef YY_ATTRIBUTE_PURE
352 # define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__))
353 #endif
354 
355 #ifndef YY_ATTRIBUTE_UNUSED
356 # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
357 #endif
358 
359 #if !defined _Noreturn \
360  && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
361 # if defined _MSC_VER && 1200 <= _MSC_VER
362 # define _Noreturn __declspec (noreturn)
363 # else
364 # define _Noreturn YY_ATTRIBUTE ((__noreturn__))
365 # endif
366 #endif
367 
368 /* Suppress unused-variable warnings by "using" E. */
369 #if ! defined lint || defined __GNUC__
370 # define YYUSE(E) ((void) (E))
371 #else
372 # define YYUSE(E) /* empty */
373 #endif
374 
375 #if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
376 /* Suppress an incorrect diagnostic about yylval being uninitialized. */
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")
383 #else
384 # define YY_INITIAL_VALUE(Value) Value
385 #endif
386 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
387 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
388 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
389 #endif
390 #ifndef YY_INITIAL_VALUE
391 # define YY_INITIAL_VALUE(Value) /* Nothing. */
392 #endif
393 
394 
395 #if ! defined yyoverflow || YYERROR_VERBOSE
396 
397 /* The parser invokes alloca or malloc; define the necessary symbols. */
398 
399 # ifdef YYSTACK_USE_ALLOCA
400 # if YYSTACK_USE_ALLOCA
401 # ifdef __GNUC__
402 # define YYSTACK_ALLOC __builtin_alloca
403 # elif defined __BUILTIN_VA_ARG_INCR
404 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
405 # elif defined _AIX
406 # define YYSTACK_ALLOC __alloca
407 # elif defined _MSC_VER
408 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
409 # define alloca _alloca
410 # else
411 # define YYSTACK_ALLOC alloca
412 # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
413 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
414  /* Use EXIT_SUCCESS as a witness for stdlib.h. */
415 # ifndef EXIT_SUCCESS
416 # define EXIT_SUCCESS 0
417 # endif
418 # endif
419 # endif
420 # endif
421 # endif
422 
423 # ifdef YYSTACK_ALLOC
424  /* Pacify GCC's 'empty if-body' warning. */
425 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
426 # ifndef YYSTACK_ALLOC_MAXIMUM
427  /* The OS might guarantee only one guard page at the bottom of the stack,
428  and a page size can be as small as 4096 bytes. So we cannot safely
429  invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
430  to allow for a few compiler-allocated temporary stack slots. */
431 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
432 # endif
433 # else
434 # define YYSTACK_ALLOC YYMALLOC
435 # define YYSTACK_FREE YYFREE
436 # ifndef YYSTACK_ALLOC_MAXIMUM
437 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
438 # endif
439 # if (defined __cplusplus && ! defined EXIT_SUCCESS \
440  && ! ((defined YYMALLOC || defined malloc) \
441  && (defined YYFREE || defined free)))
442 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
443 # ifndef EXIT_SUCCESS
444 # define EXIT_SUCCESS 0
445 # endif
446 # endif
447 # ifndef YYMALLOC
448 # define YYMALLOC malloc
449 # if ! defined malloc && ! defined EXIT_SUCCESS
450 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
451 # endif
452 # endif
453 # ifndef YYFREE
454 # define YYFREE free
455 # if ! defined free && ! defined EXIT_SUCCESS
456 void free (void *); /* INFRINGES ON USER NAME SPACE */
457 # endif
458 # endif
459 # endif
460 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
461 
462 
463 #if (! defined yyoverflow \
464  && (! defined __cplusplus \
465  || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
466 
467 /* A type that is properly aligned for any stack member. */
468 union yyalloc
469 {
470  yytype_int16 yyss_alloc;
471  YYSTYPE yyvs_alloc;
472 };
473 
474 /* The size of the maximum gap between one aligned stack and the next. */
475 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
476 
477 /* The size of an array large to enough to hold all stacks, each with
478  N elements. */
479 # define YYSTACK_BYTES(N) \
480  ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
481  + YYSTACK_GAP_MAXIMUM)
482 
483 # define YYCOPY_NEEDED 1
484 
485 /* Relocate STACK from its old location to the new one. The
486  local variables YYSIZE and YYSTACKSIZE give the old and new number of
487  elements in the stack, and YYPTR gives the new location of the
488  stack. Advance YYPTR to a properly aligned location for the next
489  stack. */
490 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
491  do \
492  { \
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); \
498  } \
499  while (0)
500 
501 #endif
502 
503 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
504 /* Copy COUNT objects from SRC to DST. The source and destination do
505  not overlap. */
506 # ifndef YYCOPY
507 # if defined __GNUC__ && 1 < __GNUC__
508 # define YYCOPY(Dst, Src, Count) \
509  __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
510 # else
511 # define YYCOPY(Dst, Src, Count) \
512  do \
513  { \
514  YYSIZE_T yyi; \
515  for (yyi = 0; yyi < (Count); yyi++) \
516  (Dst)[yyi] = (Src)[yyi]; \
517  } \
518  while (0)
519 # endif
520 # endif
521 #endif /* !YYCOPY_NEEDED */
522 
523 /* YYFINAL -- State number of the termination state. */
524 #define YYFINAL 7
525 /* YYLAST -- Last index in YYTABLE. */
526 #define YYLAST 231
527 
528 /* YYNTOKENS -- Number of terminals. */
529 #define YYNTOKENS 88
530 /* YYNNTS -- Number of nonterminals. */
531 #define YYNNTS 38
532 /* YYNRULES -- Number of rules. */
533 #define YYNRULES 119
534 /* YYNSTATES -- Number of states. */
535 #define YYNSTATES 201
536 
537 /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
538  by yylex, with out-of-bounds checking. */
539 #define YYUNDEFTOK 2
540 #define YYMAXUTOK 324
541 
542 #define YYTRANSLATE(YYX) \
543  ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
544 
545 /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
546  as returned by yylex, without out-of-bounds checking. */
547 static const yytype_uint8 yytranslate[] =
548 {
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,
581  65, 66, 67, 68, 69
582 };
583 
584 #if YYDEBUG
585  /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
586 static const yytype_uint16 yyrline[] =
587 {
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
600 };
601 #endif
602 
603 #if YYDEBUG || YYERROR_VERBOSE || 0
604 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
605  First, the terminals, then, starting at YYNTOKENS, nonterminals. */
606 static const char *const yytname[] =
607 {
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
631 };
632 #endif
633 
634 # ifdef YYPRINT
635 /* YYTOKNUM[NUM] -- (External) token number corresponding to the
636  (internal) symbol number NUM (which must be that of a token). */
637 static const yytype_uint16 yytoknum[] =
638 {
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
648 };
649 # endif
650 
651 #define YYPACT_NINF -143
652 
653 #define yypact_value_is_default(Yystate) \
654  (!!((Yystate) == (-143)))
655 
656 #define YYTABLE_NINF -1
657 
658 #define yytable_value_is_error(Yytable_value) \
659  0
660 
661  /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
662  STATE-NUM. */
663 static const yytype_int16 yypact[] =
664 {
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,
685  -143
686 };
687 
688  /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
689  Performed when YYTABLE does not specify something else to do. Zero
690  means the default is an error. */
691 static const yytype_uint8 yydefact[] =
692 {
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,
713  92
714 };
715 
716  /* YYPGOTO[NTERM-NUM]. */
717 static const yytype_int16 yypgoto[] =
718 {
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
723 };
724 
725  /* YYDEFGOTO[NTERM-NUM]. */
726 static const yytype_int16 yydefgoto[] =
727 {
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
732 };
733 
734  /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
735  positive, shift that token. If negative, reduce the rule whose
736  number is the opposite. If YYTABLE_NINF, syntax error. */
737 static const yytype_uint8 yytable[] =
738 {
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,
762  151, 102
763 };
764 
765 static const yytype_uint8 yycheck[] =
766 {
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,
790  97, 45
791 };
792 
793  /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
794  symbol of state STATE-NUM. */
795 static const yytype_uint8 yystos[] =
796 {
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,
817  114
818 };
819 
820  /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
821 static const yytype_uint8 yyr1[] =
822 {
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
835 };
836 
837  /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
838 static const yytype_uint8 yyr2[] =
839 {
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
852 };
853 
854 
855 #define yyerrok (yyerrstatus = 0)
856 #define yyclearin (yychar = YYEMPTY)
857 #define YYEMPTY (-2)
858 #define YYEOF 0
859 
860 #define YYACCEPT goto yyacceptlab
861 #define YYABORT goto yyabortlab
862 #define YYERROR goto yyerrorlab
863 
864 
865 #define YYRECOVERING() (!!yyerrstatus)
866 
867 #define YYBACKUP(Token, Value) \
868 do \
869  if (yychar == YYEMPTY) \
870  { \
871  yychar = (Token); \
872  yylval = (Value); \
873  YYPOPSTACK (yylen); \
874  yystate = *yyssp; \
875  goto yybackup; \
876  } \
877  else \
878  { \
879  yyerror (YY_("syntax error: cannot back up")); \
880  YYERROR; \
881  } \
882 while (0)
883 
884 /* Error token number */
885 #define YYTERROR 1
886 #define YYERRCODE 256
887 
888 
889 
890 /* Enable debugging if requested. */
891 #if YYDEBUG
892 
893 # ifndef YYFPRINTF
894 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
895 # define YYFPRINTF fprintf
896 # endif
897 
898 # define YYDPRINTF(Args) \
899 do { \
900  if (yydebug) \
901  YYFPRINTF Args; \
902 } while (0)
903 
904 /* This macro is provided for backward compatibility. */
905 #ifndef YY_LOCATION_PRINT
906 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
907 #endif
908 
909 
910 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
911 do { \
912  if (yydebug) \
913  { \
914  YYFPRINTF (stderr, "%s ", Title); \
915  yy_symbol_print (stderr, \
916  Type, Value); \
917  YYFPRINTF (stderr, "\n"); \
918  } \
919 } while (0)
920 
921 
922 /*----------------------------------------.
923 | Print this symbol's value on YYOUTPUT. |
924 `----------------------------------------*/
925 
926 static void
927 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
928 {
929  FILE *yyo = yyoutput;
930  YYUSE (yyo);
931  if (!yyvaluep)
932  return;
933 # ifdef YYPRINT
934  if (yytype < YYNTOKENS)
935  YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
936 # endif
937  YYUSE (yytype);
938 }
939 
940 
941 /*--------------------------------.
942 | Print this symbol on YYOUTPUT. |
943 `--------------------------------*/
944 
945 static void
946 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
947 {
948  YYFPRINTF (yyoutput, "%s %s (",
949  yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
950 
951  yy_symbol_value_print (yyoutput, yytype, yyvaluep);
952  YYFPRINTF (yyoutput, ")");
953 }
954 
955 /*------------------------------------------------------------------.
956 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
957 | TOP (included). |
958 `------------------------------------------------------------------*/
959 
960 static void
961 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
962 {
963  YYFPRINTF (stderr, "Stack now");
964  for (; yybottom <= yytop; yybottom++)
965  {
966  int yybot = *yybottom;
967  YYFPRINTF (stderr, " %d", yybot);
968  }
969  YYFPRINTF (stderr, "\n");
970 }
971 
972 # define YY_STACK_PRINT(Bottom, Top) \
973 do { \
974  if (yydebug) \
975  yy_stack_print ((Bottom), (Top)); \
976 } while (0)
977 
978 
979 /*------------------------------------------------.
980 | Report that the YYRULE is going to be reduced. |
981 `------------------------------------------------*/
982 
983 static void
984 yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule)
985 {
986  unsigned long int yylno = yyrline[yyrule];
987  int yynrhs = yyr2[yyrule];
988  int yyi;
989  YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
990  yyrule - 1, yylno);
991  /* The symbols being reduced. */
992  for (yyi = 0; yyi < yynrhs; yyi++)
993  {
994  YYFPRINTF (stderr, " $%d = ", yyi + 1);
995  yy_symbol_print (stderr,
996  yystos[yyssp[yyi + 1 - yynrhs]],
997  &(yyvsp[(yyi + 1) - (yynrhs)])
998  );
999  YYFPRINTF (stderr, "\n");
1000  }
1001 }
1002 
1003 # define YY_REDUCE_PRINT(Rule) \
1004 do { \
1005  if (yydebug) \
1006  yy_reduce_print (yyssp, yyvsp, Rule); \
1007 } while (0)
1008 
1009 /* Nonzero means print parse trace. It is left uninitialized so that
1010  multiple parsers can coexist. */
1011 int yydebug;
1012 #else /* !YYDEBUG */
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)
1017 #endif /* !YYDEBUG */
1018 
1019 
1020 /* YYINITDEPTH -- initial size of the parser's stacks. */
1021 #ifndef YYINITDEPTH
1022 # define YYINITDEPTH 200
1023 #endif
1024 
1025 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1026  if the built-in stack extension method is used).
1027 
1028  Do not make this value too large; the results are undefined if
1029  YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1030  evaluated with infinite-precision integer arithmetic. */
1031 
1032 #ifndef YYMAXDEPTH
1033 # define YYMAXDEPTH 10000
1034 #endif
1035 
1036 
1037 #if YYERROR_VERBOSE
1038 
1039 # ifndef yystrlen
1040 # if defined __GLIBC__ && defined _STRING_H
1041 # define yystrlen strlen
1042 # else
1043 /* Return the length of YYSTR. */
1044 static YYSIZE_T
1045 yystrlen (const char *yystr)
1046 {
1047  YYSIZE_T yylen;
1048  for (yylen = 0; yystr[yylen]; yylen++)
1049  continue;
1050  return yylen;
1051 }
1052 # endif
1053 # endif
1054 
1055 # ifndef yystpcpy
1056 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1057 # define yystpcpy stpcpy
1058 # else
1059 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1060  YYDEST. */
1061 static char *
1062 yystpcpy (char *yydest, const char *yysrc)
1063 {
1064  char *yyd = yydest;
1065  const char *yys = yysrc;
1066 
1067  while ((*yyd++ = *yys++) != '\0')
1068  continue;
1069 
1070  return yyd - 1;
1071 }
1072 # endif
1073 # endif
1074 
1075 # ifndef yytnamerr
1076 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1077  quotes and backslashes, so that it's suitable for yyerror. The
1078  heuristic is that double-quoting is unnecessary unless the string
1079  contains an apostrophe, a comma, or backslash (other than
1080  backslash-backslash). YYSTR is taken from yytname. If YYRES is
1081  null, do not copy; instead, return the length of what the result
1082  would have been. */
1083 static YYSIZE_T
1084 yytnamerr (char *yyres, const char *yystr)
1085 {
1086  if (*yystr == '"')
1087  {
1088  YYSIZE_T yyn = 0;
1089  char const *yyp = yystr;
1090 
1091  for (;;)
1092  switch (*++yyp)
1093  {
1094  case '\'':
1095  case ',':
1096  goto do_not_strip_quotes;
1097 
1098  case '\\':
1099  if (*++yyp != '\\')
1100  goto do_not_strip_quotes;
1101  /* Fall through. */
1102  default:
1103  if (yyres)
1104  yyres[yyn] = *yyp;
1105  yyn++;
1106  break;
1107 
1108  case '"':
1109  if (yyres)
1110  yyres[yyn] = '\0';
1111  return yyn;
1112  }
1113  do_not_strip_quotes: ;
1114  }
1115 
1116  if (! yyres)
1117  return yystrlen (yystr);
1118 
1119  return yystpcpy (yyres, yystr) - yyres;
1120 }
1121 # endif
1122 
1123 /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
1124  about the unexpected token YYTOKEN for the state stack whose top is
1125  YYSSP.
1126 
1127  Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
1128  not large enough to hold the message. In that case, also set
1129  *YYMSG_ALLOC to the required number of bytes. Return 2 if the
1130  required number of bytes is too large to store. */
1131 static int
1132 yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
1133  yytype_int16 *yyssp, int yytoken)
1134 {
1135  YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
1136  YYSIZE_T yysize = yysize0;
1137  enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1138  /* Internationalized format string. */
1139  const char *yyformat = YY_NULLPTR;
1140  /* Arguments of yyformat. */
1141  char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1142  /* Number of reported tokens (one for the "unexpected", one per
1143  "expected"). */
1144  int yycount = 0;
1145 
1146  /* There are many possibilities here to consider:
1147  - If this state is a consistent state with a default action, then
1148  the only way this function was invoked is if the default action
1149  is an error action. In that case, don't check for expected
1150  tokens because there are none.
1151  - The only way there can be no lookahead present (in yychar) is if
1152  this state is a consistent state with a default action. Thus,
1153  detecting the absence of a lookahead is sufficient to determine
1154  that there is no unexpected or expected token to report. In that
1155  case, just report a simple "syntax error".
1156  - Don't assume there isn't a lookahead just because this state is a
1157  consistent state with a default action. There might have been a
1158  previous inconsistent state, consistent state with a non-default
1159  action, or user semantic action that manipulated yychar.
1160  - Of course, the expected token list depends on states to have
1161  correct lookahead information, and it depends on the parser not
1162  to perform extra reductions after fetching a lookahead from the
1163  scanner and before detecting a syntax error. Thus, state merging
1164  (from LALR or IELR) and default reductions corrupt the expected
1165  token list. However, the list is correct for canonical LR with
1166  one exception: it will still contain any token that will not be
1167  accepted due to an error action in a later state.
1168  */
1169  if (yytoken != YYEMPTY)
1170  {
1171  int yyn = yypact[*yyssp];
1172  yyarg[yycount++] = yytname[yytoken];
1173  if (!yypact_value_is_default (yyn))
1174  {
1175  /* Start YYX at -YYN if negative to avoid negative indexes in
1176  YYCHECK. In other words, skip the first -YYN actions for
1177  this state because they are default actions. */
1178  int yyxbegin = yyn < 0 ? -yyn : 0;
1179  /* Stay within bounds of both yycheck and yytname. */
1180  int yychecklim = YYLAST - yyn + 1;
1181  int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1182  int yyx;
1183 
1184  for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1185  if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
1186  && !yytable_value_is_error (yytable[yyx + yyn]))
1187  {
1188  if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1189  {
1190  yycount = 1;
1191  yysize = yysize0;
1192  break;
1193  }
1194  yyarg[yycount++] = yytname[yyx];
1195  {
1196  YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
1197  if (! (yysize <= yysize1
1198  && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1199  return 2;
1200  yysize = yysize1;
1201  }
1202  }
1203  }
1204  }
1205 
1206  switch (yycount)
1207  {
1208 # define YYCASE_(N, S) \
1209  case N: \
1210  yyformat = S; \
1211  break
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"));
1218 # undef YYCASE_
1219  }
1220 
1221  {
1222  YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
1223  if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1224  return 2;
1225  yysize = yysize1;
1226  }
1227 
1228  if (*yymsg_alloc < yysize)
1229  {
1230  *yymsg_alloc = 2 * yysize;
1231  if (! (yysize <= *yymsg_alloc
1232  && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
1233  *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
1234  return 1;
1235  }
1236 
1237  /* Avoid sprintf, as that infringes on the user's name space.
1238  Don't have undefined behavior even if the translation
1239  produced a string with the wrong number of "%s"s. */
1240  {
1241  char *yyp = *yymsg;
1242  int yyi = 0;
1243  while ((*yyp = *yyformat) != '\0')
1244  if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
1245  {
1246  yyp += yytnamerr (yyp, yyarg[yyi++]);
1247  yyformat += 2;
1248  }
1249  else
1250  {
1251  yyp++;
1252  yyformat++;
1253  }
1254  }
1255  return 0;
1256 }
1257 #endif /* YYERROR_VERBOSE */
1258 
1259 /*-----------------------------------------------.
1260 | Release the memory associated to this symbol. |
1261 `-----------------------------------------------*/
1262 
1263 static void
1264 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
1265 {
1266  YYUSE (yyvaluep);
1267  if (!yymsg)
1268  yymsg = "Deleting";
1269  YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1270 
1271  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1272  YYUSE (yytype);
1273  YY_IGNORE_MAYBE_UNINITIALIZED_END
1274 }
1275 
1276 
1277 
1278 
1279 /* The lookahead symbol. */
1280 int yychar;
1281 
1282 /* The semantic value of the lookahead symbol. */
1283 YYSTYPE yylval;
1284 /* Number of syntax errors so far. */
1285 int yynerrs;
1286 
1287 
1288 /*----------.
1289 | yyparse. |
1290 `----------*/
1291 
1292 int
1293 yyparse (void)
1294 {
1295  int yystate;
1296  /* Number of tokens to shift before error messages enabled. */
1297  int yyerrstatus;
1298 
1299  /* The stacks and their tools:
1300  'yyss': related to states.
1301  'yyvs': related to semantic values.
1302 
1303  Refer to the stacks through separate pointers, to allow yyoverflow
1304  to reallocate them elsewhere. */
1305 
1306  /* The state stack. */
1307  yytype_int16 yyssa[YYINITDEPTH];
1308  yytype_int16 *yyss;
1309  yytype_int16 *yyssp;
1310 
1311  /* The semantic value stack. */
1312  YYSTYPE yyvsa[YYINITDEPTH];
1313  YYSTYPE *yyvs;
1314  YYSTYPE *yyvsp;
1315 
1316  YYSIZE_T yystacksize;
1317 
1318  int yyn;
1319  int yyresult;
1320  /* Lookahead token as an internal (translated) token number. */
1321  int yytoken = 0;
1322  /* The variables used to return semantic value and location from the
1323  action routines. */
1324  YYSTYPE yyval;
1325 
1326 #if YYERROR_VERBOSE
1327  /* Buffer for error messages, and its allocated size. */
1328  char yymsgbuf[128];
1329  char *yymsg = yymsgbuf;
1330  YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1331 #endif
1332 
1333 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1334 
1335  /* The number of symbols on the RHS of the reduced rule.
1336  Keep to zero when no symbol should be popped. */
1337  int yylen = 0;
1338 
1339  yyssp = yyss = yyssa;
1340  yyvsp = yyvs = yyvsa;
1341  yystacksize = YYINITDEPTH;
1342 
1343  YYDPRINTF ((stderr, "Starting parse\n"));
1344 
1345  yystate = 0;
1346  yyerrstatus = 0;
1347  yynerrs = 0;
1348  yychar = YYEMPTY; /* Cause a token to be read. */
1349  goto yysetstate;
1350 
1351 /*------------------------------------------------------------.
1352 | yynewstate -- Push a new state, which is found in yystate. |
1353 `------------------------------------------------------------*/
1354  yynewstate:
1355  /* In all cases, when you get here, the value and location stacks
1356  have just been pushed. So pushing a state here evens the stacks. */
1357  yyssp++;
1358 
1359  yysetstate:
1360  *yyssp = yystate;
1361 
1362  if (yyss + yystacksize - 1 <= yyssp)
1363  {
1364  /* Get the current used size of the three stacks, in elements. */
1365  YYSIZE_T yysize = yyssp - yyss + 1;
1366 
1367 #ifdef yyoverflow
1368  {
1369  /* Give user a chance to reallocate the stack. Use copies of
1370  these so that the &'s don't force the real ones into
1371  memory. */
1372  YYSTYPE *yyvs1 = yyvs;
1373  yytype_int16 *yyss1 = yyss;
1374 
1375  /* Each stack pointer address is followed by the size of the
1376  data in use in that stack, in bytes. This used to be a
1377  conditional around just the two extra args, but that might
1378  be undefined if yyoverflow is a macro. */
1379  yyoverflow (YY_("memory exhausted"),
1380  &yyss1, yysize * sizeof (*yyssp),
1381  &yyvs1, yysize * sizeof (*yyvsp),
1382  &yystacksize);
1383 
1384  yyss = yyss1;
1385  yyvs = yyvs1;
1386  }
1387 #else /* no yyoverflow */
1388 # ifndef YYSTACK_RELOCATE
1389  goto yyexhaustedlab;
1390 # else
1391  /* Extend the stack our own way. */
1392  if (YYMAXDEPTH <= yystacksize)
1393  goto yyexhaustedlab;
1394  yystacksize *= 2;
1395  if (YYMAXDEPTH < yystacksize)
1396  yystacksize = YYMAXDEPTH;
1397 
1398  {
1399  yytype_int16 *yyss1 = yyss;
1400  union yyalloc *yyptr =
1401  (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1402  if (! yyptr)
1403  goto yyexhaustedlab;
1404  YYSTACK_RELOCATE (yyss_alloc, yyss);
1405  YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1406 # undef YYSTACK_RELOCATE
1407  if (yyss1 != yyssa)
1408  YYSTACK_FREE (yyss1);
1409  }
1410 # endif
1411 #endif /* no yyoverflow */
1412 
1413  yyssp = yyss + yysize - 1;
1414  yyvsp = yyvs + yysize - 1;
1415 
1416  YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1417  (unsigned long int) yystacksize));
1418 
1419  if (yyss + yystacksize - 1 <= yyssp)
1420  YYABORT;
1421  }
1422 
1423  YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1424 
1425  if (yystate == YYFINAL)
1426  YYACCEPT;
1427 
1428  goto yybackup;
1429 
1430 /*-----------.
1431 | yybackup. |
1432 `-----------*/
1433 yybackup:
1434 
1435  /* Do appropriate processing given the current state. Read a
1436  lookahead token if we need one and don't already have one. */
1437 
1438  /* First try to decide what to do without reference to lookahead token. */
1439  yyn = yypact[yystate];
1440  if (yypact_value_is_default (yyn))
1441  goto yydefault;
1442 
1443  /* Not known => get a lookahead token if don't already have one. */
1444 
1445  /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1446  if (yychar == YYEMPTY)
1447  {
1448  YYDPRINTF ((stderr, "Reading a token: "));
1449  yychar = yylex ();
1450  }
1451 
1452  if (yychar <= YYEOF)
1453  {
1454  yychar = yytoken = YYEOF;
1455  YYDPRINTF ((stderr, "Now at end of input.\n"));
1456  }
1457  else
1458  {
1459  yytoken = YYTRANSLATE (yychar);
1460  YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1461  }
1462 
1463  /* If the proper action on seeing token YYTOKEN is to reduce or to
1464  detect an error, take that action. */
1465  yyn += yytoken;
1466  if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1467  goto yydefault;
1468  yyn = yytable[yyn];
1469  if (yyn <= 0)
1470  {
1471  if (yytable_value_is_error (yyn))
1472  goto yyerrlab;
1473  yyn = -yyn;
1474  goto yyreduce;
1475  }
1476 
1477  /* Count tokens shifted since error; after three, turn off error
1478  status. */
1479  if (yyerrstatus)
1480  yyerrstatus--;
1481 
1482  /* Shift the lookahead token. */
1483  YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1484 
1485  /* Discard the shifted token. */
1486  yychar = YYEMPTY;
1487 
1488  yystate = yyn;
1489  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1490  *++yyvsp = yylval;
1491  YY_IGNORE_MAYBE_UNINITIALIZED_END
1492 
1493  goto yynewstate;
1494 
1495 
1496 /*-----------------------------------------------------------.
1497 | yydefault -- do the default action for the current state. |
1498 `-----------------------------------------------------------*/
1499 yydefault:
1500  yyn = yydefact[yystate];
1501  if (yyn == 0)
1502  goto yyerrlab;
1503  goto yyreduce;
1504 
1505 
1506 /*-----------------------------.
1507 | yyreduce -- Do a reduction. |
1508 `-----------------------------*/
1509 yyreduce:
1510  /* yyn is the number of a rule to reduce with. */
1511  yylen = yyr2[yyn];
1512 
1513  /* If YYLEN is nonzero, implement the default value of the action:
1514  '$$ = $1'.
1515 
1516  Otherwise, the following line sets YYVAL to garbage.
1517  This behavior is undocumented and Bison
1518  users should not rely upon it. Assigning to YYVAL
1519  unconditionally makes the parser a bit smaller, and it avoids a
1520  GCC warning that YYVAL may be used uninitialized. */
1521  yyval = yyvsp[1-yylen];
1522 
1523 
1524  YY_REDUCE_PRINT (yyn);
1525  switch (yyn)
1526  {
1527  case 2:
1528 #line 565 "KDbSqlParser.y" /* yacc.c:1646 */
1529  {
1530 //todo: multiple statements
1531 //todo: not only "select" statements
1532  KDbParserPrivate::get(globalParser)->setStatementType(KDbParser::Select);
1533  KDbParserPrivate::get(globalParser)->setQuerySchema((yyvsp[0].querySchema));
1534 }
1535 #line 1536 "sqlparser.cpp" /* yacc.c:1646 */
1536  break;
1537 
1538  case 3:
1539 #line 575 "KDbSqlParser.y" /* yacc.c:1646 */
1540  {
1541 //todo: multiple statements
1542 }
1543 #line 1544 "sqlparser.cpp" /* yacc.c:1646 */
1544  break;
1545 
1546  case 5:
1547 #line 580 "KDbSqlParser.y" /* yacc.c:1646 */
1548  {
1549  (yyval.querySchema) = (yyvsp[-1].querySchema);
1550 }
1551 #line 1552 "sqlparser.cpp" /* yacc.c:1646 */
1552  break;
1553 
1554  case 6:
1555 #line 595 "KDbSqlParser.y" /* yacc.c:1646 */
1556  {
1557  (yyval.querySchema) = (yyvsp[0].querySchema);
1558 }
1559 #line 1560 "sqlparser.cpp" /* yacc.c:1646 */
1560  break;
1561 
1562  case 7:
1563 #line 694 "KDbSqlParser.y" /* yacc.c:1646 */
1564  {
1565  sqlParserDebug() << "Select";
1566  if (!((yyval.querySchema) = buildSelectQuery( (yyvsp[0].querySchema), nullptr )))
1567  YYABORT;
1568 }
1569 #line 1570 "sqlparser.cpp" /* yacc.c:1646 */
1570  break;
1571 
1572  case 8:
1573 #line 700 "KDbSqlParser.y" /* yacc.c:1646 */
1574  {
1575  sqlParserDebug() << "Select ColViews=" << *(yyvsp[0].exprList);
1576 
1577  if (!((yyval.querySchema) = buildSelectQuery( (yyvsp[-1].querySchema), (yyvsp[0].exprList) )))
1578  YYABORT;
1579 }
1580 #line 1581 "sqlparser.cpp" /* yacc.c:1646 */
1581  break;
1582 
1583  case 9:
1584 #line 707 "KDbSqlParser.y" /* yacc.c:1646 */
1585  {
1586  if (!((yyval.querySchema) = buildSelectQuery( (yyvsp[-2].querySchema), (yyvsp[-1].exprList), (yyvsp[0].exprList) )))
1587  YYABORT;
1588 }
1589 #line 1590 "sqlparser.cpp" /* yacc.c:1646 */
1590  break;
1591 
1592  case 10:
1593 #line 712 "KDbSqlParser.y" /* yacc.c:1646 */
1594  {
1595  sqlParserDebug() << "Select ColViews Tables";
1596  if (!((yyval.querySchema) = buildSelectQuery( (yyvsp[-1].querySchema), nullptr, (yyvsp[0].exprList) )))
1597  YYABORT;
1598 }
1599 #line 1600 "sqlparser.cpp" /* yacc.c:1646 */
1600  break;
1601 
1602  case 11:
1603 #line 718 "KDbSqlParser.y" /* yacc.c:1646 */
1604  {
1605  sqlParserDebug() << "Select ColViews Conditions";
1606  if (!((yyval.querySchema) = buildSelectQuery( (yyvsp[-2].querySchema), (yyvsp[-1].exprList), nullptr, (yyvsp[0].selectOptions) )))
1607  YYABORT;
1608 }
1609 #line 1610 "sqlparser.cpp" /* yacc.c:1646 */
1610  break;
1611 
1612  case 12:
1613 #line 724 "KDbSqlParser.y" /* yacc.c:1646 */
1614  {
1615  sqlParserDebug() << "Select Tables SelectOptions";
1616  if (!((yyval.querySchema) = buildSelectQuery( (yyvsp[-2].querySchema), nullptr, (yyvsp[-1].exprList), (yyvsp[0].selectOptions) )))
1617  YYABORT;
1618 }
1619 #line 1620 "sqlparser.cpp" /* yacc.c:1646 */
1620  break;
1621 
1622  case 13:
1623 #line 730 "KDbSqlParser.y" /* yacc.c:1646 */
1624  {
1625  sqlParserDebug() << "Select ColViews Tables SelectOptions";
1626  if (!((yyval.querySchema) = buildSelectQuery( (yyvsp[-3].querySchema), (yyvsp[-2].exprList), (yyvsp[-1].exprList), (yyvsp[0].selectOptions) )))
1627  YYABORT;
1628 }
1629 #line 1630 "sqlparser.cpp" /* yacc.c:1646 */
1630  break;
1631 
1632  case 14:
1633 #line 739 "KDbSqlParser.y" /* yacc.c:1646 */
1634  {
1635  sqlParserDebug() << "SELECT";
1636  (yyval.querySchema) = KDbParserPrivate::get(globalParser)->createQuery();
1637 }
1638 #line 1639 "sqlparser.cpp" /* yacc.c:1646 */
1639  break;
1640 
1641  case 15:
1642 #line 747 "KDbSqlParser.y" /* yacc.c:1646 */
1643  {
1644  sqlParserDebug() << "WhereClause";
1645  (yyval.selectOptions) = new SelectOptionsInternal;
1646  (yyval.selectOptions)->whereExpr = *(yyvsp[0].expr);
1647  delete (yyvsp[0].expr);
1648 }
1649 #line 1650 "sqlparser.cpp" /* yacc.c:1646 */
1650  break;
1651 
1652  case 16:
1653 #line 754 "KDbSqlParser.y" /* yacc.c:1646 */
1654  {
1655  sqlParserDebug() << "OrderByClause";
1656  (yyval.selectOptions) = new SelectOptionsInternal;
1657  (yyval.selectOptions)->orderByColumns = (yyvsp[0].orderByColumns);
1658 }
1659 #line 1660 "sqlparser.cpp" /* yacc.c:1646 */
1660  break;
1661 
1662  case 17:
1663 #line 760 "KDbSqlParser.y" /* yacc.c:1646 */
1664  {
1665  sqlParserDebug() << "WhereClause ORDER BY OrderByClause";
1666  (yyval.selectOptions) = new SelectOptionsInternal;
1667  (yyval.selectOptions)->whereExpr = *(yyvsp[-3].expr);
1668  delete (yyvsp[-3].expr);
1669  (yyval.selectOptions)->orderByColumns = (yyvsp[0].orderByColumns);
1670 }
1671 #line 1672 "sqlparser.cpp" /* yacc.c:1646 */
1672  break;
1673 
1674  case 18:
1675 #line 768 "KDbSqlParser.y" /* yacc.c:1646 */
1676  {
1677  sqlParserDebug() << "OrderByClause WhereClause";
1678  (yyval.selectOptions) = new SelectOptionsInternal;
1679  (yyval.selectOptions)->whereExpr = *(yyvsp[0].expr);
1680  delete (yyvsp[0].expr);
1681  (yyval.selectOptions)->orderByColumns = (yyvsp[-1].orderByColumns);
1682 }
1683 #line 1684 "sqlparser.cpp" /* yacc.c:1646 */
1684  break;
1685 
1686  case 19:
1687 #line 779 "KDbSqlParser.y" /* yacc.c:1646 */
1688  {
1689  (yyval.expr) = (yyvsp[0].expr);
1690 }
1691 #line 1692 "sqlparser.cpp" /* yacc.c:1646 */
1692  break;
1693 
1694  case 20:
1695 #line 788 "KDbSqlParser.y" /* yacc.c:1646 */
1696  {
1697  sqlParserDebug() << "ORDER BY IDENTIFIER";
1698  (yyval.orderByColumns) = new QList<OrderByColumnInternal>;
1699  OrderByColumnInternal orderByColumn;
1700  orderByColumn.setColumnByNameOrNumber( *(yyvsp[0].variantValue) );
1701  (yyval.orderByColumns)->append( orderByColumn );
1702  delete (yyvsp[0].variantValue);
1703 }
1704 #line 1705 "sqlparser.cpp" /* yacc.c:1646 */
1705  break;
1706 
1707  case 21:
1708 #line 797 "KDbSqlParser.y" /* yacc.c:1646 */
1709  {
1710  sqlParserDebug() << "ORDER BY IDENTIFIER OrderByOption";
1711  (yyval.orderByColumns) = new QList<OrderByColumnInternal>;
1712  OrderByColumnInternal orderByColumn;
1713  orderByColumn.setColumnByNameOrNumber( *(yyvsp[-1].variantValue) );
1714  orderByColumn.order = (yyvsp[0].sortOrderValue);
1715  (yyval.orderByColumns)->append( orderByColumn );
1716  delete (yyvsp[-1].variantValue);
1717 }
1718 #line 1719 "sqlparser.cpp" /* yacc.c:1646 */
1719  break;
1720 
1721  case 22:
1722 #line 807 "KDbSqlParser.y" /* yacc.c:1646 */
1723  {
1724  (yyval.orderByColumns) = (yyvsp[0].orderByColumns);
1725  OrderByColumnInternal orderByColumn;
1726  orderByColumn.setColumnByNameOrNumber( *(yyvsp[-2].variantValue) );
1727  (yyval.orderByColumns)->append( orderByColumn );
1728  delete (yyvsp[-2].variantValue);
1729 }
1730 #line 1731 "sqlparser.cpp" /* yacc.c:1646 */
1731  break;
1732 
1733  case 23:
1734 #line 815 "KDbSqlParser.y" /* yacc.c:1646 */
1735  {
1736  (yyval.orderByColumns) = (yyvsp[0].orderByColumns);
1737  OrderByColumnInternal orderByColumn;
1738  orderByColumn.setColumnByNameOrNumber( *(yyvsp[-3].variantValue) );
1739  orderByColumn.order = (yyvsp[-2].sortOrderValue);
1740  (yyval.orderByColumns)->append( orderByColumn );
1741  delete (yyvsp[-3].variantValue);
1742 }
1743 #line 1744 "sqlparser.cpp" /* yacc.c:1646 */
1744  break;
1745 
1746  case 24:
1747 #line 827 "KDbSqlParser.y" /* yacc.c:1646 */
1748  {
1749  (yyval.variantValue) = new QVariant( *(yyvsp[0].stringValue) );
1750  sqlParserDebug() << "OrderByColumnId: " << *(yyval.variantValue);
1751  delete (yyvsp[0].stringValue);
1752 }
1753 #line 1754 "sqlparser.cpp" /* yacc.c:1646 */
1754  break;
1755 
1756  case 25:
1757 #line 833 "KDbSqlParser.y" /* yacc.c:1646 */
1758  {
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);
1763 }
1764 #line 1765 "sqlparser.cpp" /* yacc.c:1646 */
1765  break;
1766 
1767  case 26:
1768 #line 840 "KDbSqlParser.y" /* yacc.c:1646 */
1769  {
1770  (yyval.variantValue) = new QVariant((yyvsp[0].integerValue));
1771  sqlParserDebug() << "OrderByColumnId: " << *(yyval.variantValue);
1772 }
1773 #line 1774 "sqlparser.cpp" /* yacc.c:1646 */
1774  break;
1775 
1776  case 27:
1777 #line 847 "KDbSqlParser.y" /* yacc.c:1646 */
1778  {
1779  (yyval.sortOrderValue) = KDbOrderByColumn::SortOrder::Ascending;
1780 }
1781 #line 1782 "sqlparser.cpp" /* yacc.c:1646 */
1782  break;
1783 
1784  case 28:
1785 #line 851 "KDbSqlParser.y" /* yacc.c:1646 */
1786  {
1787  (yyval.sortOrderValue) = KDbOrderByColumn::SortOrder::Descending;
1788 }
1789 #line 1790 "sqlparser.cpp" /* yacc.c:1646 */
1790  break;
1791 
1792  case 30:
1793 #line 863 "KDbSqlParser.y" /* yacc.c:1646 */
1794  {
1795 // sqlParserDebug() << "AND " << $3.debugString();
1796  (yyval.expr) = new KDbBinaryExpression(*(yyvsp[-2].expr), KDbToken::AND, *(yyvsp[0].expr));
1797  delete (yyvsp[-2].expr);
1798  delete (yyvsp[0].expr);
1799 }
1800 #line 1801 "sqlparser.cpp" /* yacc.c:1646 */
1801  break;
1802 
1803  case 31:
1804 #line 870 "KDbSqlParser.y" /* yacc.c:1646 */
1805  {
1806  (yyval.expr) = new KDbBinaryExpression(*(yyvsp[-2].expr), KDbToken::OR, *(yyvsp[0].expr));
1807  delete (yyvsp[-2].expr);
1808  delete (yyvsp[0].expr);
1809 }
1810 #line 1811 "sqlparser.cpp" /* yacc.c:1646 */
1811  break;
1812 
1813  case 32:
1814 #line 876 "KDbSqlParser.y" /* yacc.c:1646 */
1815  {
1816  (yyval.expr) = new KDbBinaryExpression(*(yyvsp[-2].expr), KDbToken::XOR, *(yyvsp[0].expr));
1817  delete (yyvsp[-2].expr);
1818  delete (yyvsp[0].expr);
1819 }
1820 #line 1821 "sqlparser.cpp" /* yacc.c:1646 */
1821  break;
1822 
1823  case 34:
1824 #line 888 "KDbSqlParser.y" /* yacc.c:1646 */
1825  {
1826  (yyval.expr) = new KDbBinaryExpression(*(yyvsp[-2].expr), '>', *(yyvsp[0].expr));
1827  delete (yyvsp[-2].expr);
1828  delete (yyvsp[0].expr);
1829 }
1830 #line 1831 "sqlparser.cpp" /* yacc.c:1646 */
1831  break;
1832 
1833  case 35:
1834 #line 894 "KDbSqlParser.y" /* yacc.c:1646 */
1835  {
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);
1839 }
1840 #line 1841 "sqlparser.cpp" /* yacc.c:1646 */
1841  break;
1842 
1843  case 36:
1844 #line 900 "KDbSqlParser.y" /* yacc.c:1646 */
1845  {
1846  (yyval.expr) = new KDbBinaryExpression(*(yyvsp[-2].expr), '<', *(yyvsp[0].expr));
1847  delete (yyvsp[-2].expr);
1848  delete (yyvsp[0].expr);
1849 }
1850 #line 1851 "sqlparser.cpp" /* yacc.c:1646 */
1851  break;
1852 
1853  case 37:
1854 #line 906 "KDbSqlParser.y" /* yacc.c:1646 */
1855  {
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);
1859 }
1860 #line 1861 "sqlparser.cpp" /* yacc.c:1646 */
1861  break;
1862 
1863  case 38:
1864 #line 912 "KDbSqlParser.y" /* yacc.c:1646 */
1865  {
1866  (yyval.expr) = new KDbBinaryExpression(*(yyvsp[-2].expr), '=', *(yyvsp[0].expr));
1867  delete (yyvsp[-2].expr);
1868  delete (yyvsp[0].expr);
1869 }
1870 #line 1871 "sqlparser.cpp" /* yacc.c:1646 */
1871  break;
1872 
1873  case 40:
1874 #line 924 "KDbSqlParser.y" /* yacc.c:1646 */
1875  {
1876  (yyval.expr) = new KDbBinaryExpression(*(yyvsp[-2].expr), KDbToken::NOT_EQUAL, *(yyvsp[0].expr));
1877  delete (yyvsp[-2].expr);
1878  delete (yyvsp[0].expr);
1879 }
1880 #line 1881 "sqlparser.cpp" /* yacc.c:1646 */
1881  break;
1882 
1883  case 41:
1884 #line 930 "KDbSqlParser.y" /* yacc.c:1646 */
1885  {
1886  (yyval.expr) = new KDbBinaryExpression(*(yyvsp[-2].expr), KDbToken::NOT_EQUAL2, *(yyvsp[0].expr));
1887  delete (yyvsp[-2].expr);
1888  delete (yyvsp[0].expr);
1889 }
1890 #line 1891 "sqlparser.cpp" /* yacc.c:1646 */
1891  break;
1892 
1893  case 42:
1894 #line 936 "KDbSqlParser.y" /* yacc.c:1646 */
1895  {
1896  (yyval.expr) = new KDbBinaryExpression(*(yyvsp[-2].expr), KDbToken::LIKE, *(yyvsp[0].expr));
1897  delete (yyvsp[-2].expr);
1898  delete (yyvsp[0].expr);
1899 }
1900 #line 1901 "sqlparser.cpp" /* yacc.c:1646 */
1901  break;
1902 
1903  case 43:
1904 #line 942 "KDbSqlParser.y" /* yacc.c:1646 */
1905  {
1906  (yyval.expr) = new KDbBinaryExpression(*(yyvsp[-2].expr), KDbToken::NOT_LIKE, *(yyvsp[0].expr));
1907  delete (yyvsp[-2].expr);
1908  delete (yyvsp[0].expr);
1909 }
1910 #line 1911 "sqlparser.cpp" /* yacc.c:1646 */
1911  break;
1912 
1913  case 44:
1914 #line 948 "KDbSqlParser.y" /* yacc.c:1646 */
1915  {
1916  (yyval.expr) = new KDbBinaryExpression(*(yyvsp[-2].expr), KDbToken::SQL_IN, *(yyvsp[0].expr));
1917  delete (yyvsp[-2].expr);
1918  delete (yyvsp[0].expr);
1919 }
1920 #line 1921 "sqlparser.cpp" /* yacc.c:1646 */
1921  break;
1922 
1923  case 45:
1924 #line 954 "KDbSqlParser.y" /* yacc.c:1646 */
1925  {
1926  (yyval.expr) = new KDbBinaryExpression(*(yyvsp[-2].expr), KDbToken::SIMILAR_TO, *(yyvsp[0].expr));
1927  delete (yyvsp[-2].expr);
1928  delete (yyvsp[0].expr);
1929 }
1930 #line 1931 "sqlparser.cpp" /* yacc.c:1646 */
1931  break;
1932 
1933  case 46:
1934 #line 960 "KDbSqlParser.y" /* yacc.c:1646 */
1935  {
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);
1939 }
1940 #line 1941 "sqlparser.cpp" /* yacc.c:1646 */
1941  break;
1942 
1943  case 47:
1944 #line 966 "KDbSqlParser.y" /* yacc.c:1646 */
1945  {
1946  (yyval.expr) = new KDbNArgExpression(KDb::RelationalExpression, KDbToken::BETWEEN_AND);
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);
1953 }
1954 #line 1955 "sqlparser.cpp" /* yacc.c:1646 */
1955  break;
1956 
1957  case 48:
1958 #line 976 "KDbSqlParser.y" /* yacc.c:1646 */
1959  {
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);
1967 }
1968 #line 1969 "sqlparser.cpp" /* yacc.c:1646 */
1969  break;
1970 
1971  case 50:
1972 #line 992 "KDbSqlParser.y" /* yacc.c:1646 */
1973  {
1974  (yyval.expr) = new KDbUnaryExpression( KDbToken::SQL_IS_NULL, *(yyvsp[-1].expr) );
1975  delete (yyvsp[-1].expr);
1976 }
1977 #line 1978 "sqlparser.cpp" /* yacc.c:1646 */
1978  break;
1979 
1980  case 51:
1981 #line 997 "KDbSqlParser.y" /* yacc.c:1646 */
1982  {
1983  (yyval.expr) = new KDbUnaryExpression( KDbToken::SQL_IS_NOT_NULL, *(yyvsp[-1].expr) );
1984  delete (yyvsp[-1].expr);
1985 }
1986 #line 1987 "sqlparser.cpp" /* yacc.c:1646 */
1987  break;
1988 
1989  case 53:
1990 #line 1008 "KDbSqlParser.y" /* yacc.c:1646 */
1991  {
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);
1995 }
1996 #line 1997 "sqlparser.cpp" /* yacc.c:1646 */
1997  break;
1998 
1999  case 54:
2000 #line 1014 "KDbSqlParser.y" /* yacc.c:1646 */
2001  {
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);
2005 }
2006 #line 2007 "sqlparser.cpp" /* yacc.c:1646 */
2007  break;
2008 
2009  case 56:
2010 #line 1026 "KDbSqlParser.y" /* yacc.c:1646 */
2011  {
2012  (yyval.expr) = new KDbBinaryExpression(*(yyvsp[-2].expr), '+', *(yyvsp[0].expr));
2013  delete (yyvsp[-2].expr);
2014  delete (yyvsp[0].expr);
2015 }
2016 #line 2017 "sqlparser.cpp" /* yacc.c:1646 */
2017  break;
2018 
2019  case 57:
2020 #line 1032 "KDbSqlParser.y" /* yacc.c:1646 */
2021  {
2022  (yyval.expr) = new KDbBinaryExpression(*(yyvsp[-2].expr), KDbToken::CONCATENATION, *(yyvsp[0].expr));
2023  delete (yyvsp[-2].expr);
2024  delete (yyvsp[0].expr);
2025 }
2026 #line 2027 "sqlparser.cpp" /* yacc.c:1646 */
2027  break;
2028 
2029  case 58:
2030 #line 1038 "KDbSqlParser.y" /* yacc.c:1646 */
2031  {
2032  (yyval.expr) = new KDbBinaryExpression(*(yyvsp[-2].expr), '-', *(yyvsp[0].expr));
2033  delete (yyvsp[-2].expr);
2034  delete (yyvsp[0].expr);
2035 }
2036 #line 2037 "sqlparser.cpp" /* yacc.c:1646 */
2037  break;
2038 
2039  case 59:
2040 #line 1044 "KDbSqlParser.y" /* yacc.c:1646 */
2041  {
2042  (yyval.expr) = new KDbBinaryExpression(*(yyvsp[-2].expr), '&', *(yyvsp[0].expr));
2043  delete (yyvsp[-2].expr);
2044  delete (yyvsp[0].expr);
2045 }
2046 #line 2047 "sqlparser.cpp" /* yacc.c:1646 */
2047  break;
2048 
2049  case 60:
2050 #line 1050 "KDbSqlParser.y" /* yacc.c:1646 */
2051  {
2052  (yyval.expr) = new KDbBinaryExpression(*(yyvsp[-2].expr), '|', *(yyvsp[0].expr));
2053  delete (yyvsp[-2].expr);
2054  delete (yyvsp[0].expr);
2055 }
2056 #line 2057 "sqlparser.cpp" /* yacc.c:1646 */
2057  break;
2058 
2059  case 62:
2060 #line 1062 "KDbSqlParser.y" /* yacc.c:1646 */
2061  {
2062  (yyval.expr) = new KDbBinaryExpression(*(yyvsp[-2].expr), '/', *(yyvsp[0].expr));
2063  delete (yyvsp[-2].expr);
2064  delete (yyvsp[0].expr);
2065 }
2066 #line 2067 "sqlparser.cpp" /* yacc.c:1646 */
2067  break;
2068 
2069  case 63:
2070 #line 1068 "KDbSqlParser.y" /* yacc.c:1646 */
2071  {
2072  (yyval.expr) = new KDbBinaryExpression(*(yyvsp[-2].expr), '*', *(yyvsp[0].expr));
2073  delete (yyvsp[-2].expr);
2074  delete (yyvsp[0].expr);
2075 }
2076 #line 2077 "sqlparser.cpp" /* yacc.c:1646 */
2077  break;
2078 
2079  case 64:
2080 #line 1074 "KDbSqlParser.y" /* yacc.c:1646 */
2081  {
2082  (yyval.expr) = new KDbBinaryExpression(*(yyvsp[-2].expr), '%', *(yyvsp[0].expr));
2083  delete (yyvsp[-2].expr);
2084  delete (yyvsp[0].expr);
2085 }
2086 #line 2087 "sqlparser.cpp" /* yacc.c:1646 */
2087  break;
2088 
2089  case 66:
2090 #line 1087 "KDbSqlParser.y" /* yacc.c:1646 */
2091  {
2092  (yyval.expr) = new KDbUnaryExpression( '-', *(yyvsp[0].expr) );
2093  delete (yyvsp[0].expr);
2094 }
2095 #line 2096 "sqlparser.cpp" /* yacc.c:1646 */
2096  break;
2097 
2098  case 67:
2099 #line 1092 "KDbSqlParser.y" /* yacc.c:1646 */
2100  {
2101  (yyval.expr) = new KDbUnaryExpression( '+', *(yyvsp[0].expr) );
2102  delete (yyvsp[0].expr);
2103 }
2104 #line 2105 "sqlparser.cpp" /* yacc.c:1646 */
2105  break;
2106 
2107  case 68:
2108 #line 1097 "KDbSqlParser.y" /* yacc.c:1646 */
2109  {
2110  (yyval.expr) = new KDbUnaryExpression( '~', *(yyvsp[0].expr) );
2111  delete (yyvsp[0].expr);
2112 }
2113 #line 2114 "sqlparser.cpp" /* yacc.c:1646 */
2114  break;
2115 
2116  case 69:
2117 #line 1102 "KDbSqlParser.y" /* yacc.c:1646 */
2118  {
2119  (yyval.expr) = new KDbUnaryExpression( KDbToken::NOT, *(yyvsp[0].expr) );
2120  delete (yyvsp[0].expr);
2121 }
2122 #line 2123 "sqlparser.cpp" /* yacc.c:1646 */
2123  break;
2124 
2125  case 70:
2126 #line 1107 "KDbSqlParser.y" /* yacc.c:1646 */
2127  {
2128  (yyval.expr) = new KDbVariableExpression( *(yyvsp[0].stringValue) );
2129 
2130  //! @todo simplify this later if that's 'only one field name' expression
2131  sqlParserDebug() << " + identifier: " << *(yyvsp[0].stringValue);
2132  delete (yyvsp[0].stringValue);
2133 }
2134 #line 2135 "sqlparser.cpp" /* yacc.c:1646 */
2135  break;
2136 
2137  case 71:
2138 #line 1115 "KDbSqlParser.y" /* yacc.c:1646 */
2139  {
2140  (yyval.expr) = new KDbQueryParameterExpression( *(yyvsp[0].stringValue) );
2141  sqlParserDebug() << " + query parameter:" << *(yyval.expr);
2142  delete (yyvsp[0].stringValue);
2143 }
2144 #line 2145 "sqlparser.cpp" /* yacc.c:1646 */
2145  break;
2146 
2147  case 72:
2148 #line 1121 "KDbSqlParser.y" /* yacc.c:1646 */
2149  {
2150  sqlParserDebug() << " + function:" << *(yyvsp[-1].stringValue) << "(" << *(yyvsp[0].exprList) << ")";
2151  (yyval.expr) = new KDbFunctionExpression(*(yyvsp[-1].stringValue), *(yyvsp[0].exprList));
2152  delete (yyvsp[-1].stringValue);
2153  delete (yyvsp[0].exprList);
2154 }
2155 #line 2156 "sqlparser.cpp" /* yacc.c:1646 */
2156  break;
2157 
2158  case 73:
2159 #line 1129 "KDbSqlParser.y" /* yacc.c:1646 */
2160  {
2161  (yyval.expr) = new KDbVariableExpression( *(yyvsp[-2].stringValue) + QLatin1Char('.') + *(yyvsp[0].stringValue) );
2162  sqlParserDebug() << " + identifier.identifier:" << *(yyvsp[-2].stringValue) << "." << *(yyvsp[0].stringValue);
2163  delete (yyvsp[-2].stringValue);
2164  delete (yyvsp[0].stringValue);
2165 }
2166 #line 2167 "sqlparser.cpp" /* yacc.c:1646 */
2167  break;
2168 
2169  case 74:
2170 #line 1136 "KDbSqlParser.y" /* yacc.c:1646 */
2171  {
2172  (yyval.expr) = new KDbConstExpression( KDbToken::SQL_NULL, QVariant() );
2173  sqlParserDebug() << " + NULL";
2174 // $$ = new KDbField();
2175  //$$->setName(QString::null);
2176 }
2177 #line 2178 "sqlparser.cpp" /* yacc.c:1646 */
2178  break;
2179 
2180  case 75:
2181 #line 1143 "KDbSqlParser.y" /* yacc.c:1646 */
2182  {
2183  (yyval.expr) = new KDbConstExpression( KDbToken::SQL_TRUE, true );
2184 }
2185 #line 2186 "sqlparser.cpp" /* yacc.c:1646 */
2186  break;
2187 
2188  case 76:
2189 #line 1147 "KDbSqlParser.y" /* yacc.c:1646 */
2190  {
2191  (yyval.expr) = new KDbConstExpression( KDbToken::SQL_FALSE, false );
2192 }
2193 #line 2194 "sqlparser.cpp" /* yacc.c:1646 */
2194  break;
2195 
2196  case 77:
2197 #line 1151 "KDbSqlParser.y" /* yacc.c:1646 */
2198  {
2199  (yyval.expr) = new KDbConstExpression( KDbToken::CHARACTER_STRING_LITERAL, *(yyvsp[0].stringValue) );
2200  sqlParserDebug() << " + constant " << (yyvsp[0].stringValue);
2201  delete (yyvsp[0].stringValue);
2202 }
2203 #line 2204 "sqlparser.cpp" /* yacc.c:1646 */
2204  break;
2205 
2206  case 78:
2207 #line 1157 "KDbSqlParser.y" /* yacc.c:1646 */
2208  {
2209  QVariant val;
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);
2216 
2217 // if ($1 < ULLONG_MAX)
2218 // val = (quint64)$1;
2219 //! @todo ok?
2220 
2221  (yyval.expr) = new KDbConstExpression( KDbToken::INTEGER_CONST, val );
2222  sqlParserDebug() << " + int constant: " << val.toString();
2223 }
2224 #line 2225 "sqlparser.cpp" /* yacc.c:1646 */
2225  break;
2226 
2227  case 79:
2228 #line 1174 "KDbSqlParser.y" /* yacc.c:1646 */
2229  {
2230  (yyval.expr) = new KDbConstExpression( KDbToken::REAL_CONST, *(yyvsp[0].binaryValue) );
2231  sqlParserDebug() << " + real constant: " << *(yyvsp[0].binaryValue);
2232  delete (yyvsp[0].binaryValue);
2233 }
2234 #line 2235 "sqlparser.cpp" /* yacc.c:1646 */
2235  break;
2236 
2237  case 80:
2238 #line 1180 "KDbSqlParser.y" /* yacc.c:1646 */
2239  {
2240  (yyval.expr) = new KDbConstExpression(KDbToken::DATE_CONST, QVariant::fromValue(*(yyvsp[0].dateValue)));
2241  sqlParserDebug() << " + date constant:" << *(yyvsp[0].dateValue);
2242  delete (yyvsp[0].dateValue);
2243 }
2244 #line 2245 "sqlparser.cpp" /* yacc.c:1646 */
2245  break;
2246 
2247  case 81:
2248 #line 1186 "KDbSqlParser.y" /* yacc.c:1646 */
2249  {
2250  (yyval.expr) = new KDbConstExpression(KDbToken::TIME_CONST, QVariant::fromValue(*(yyvsp[0].timeValue)));
2251  sqlParserDebug() << " + time constant:" << *(yyvsp[0].timeValue);
2252  delete (yyvsp[0].timeValue);
2253 }
2254 #line 2255 "sqlparser.cpp" /* yacc.c:1646 */
2255  break;
2256 
2257  case 82:
2258 #line 1192 "KDbSqlParser.y" /* yacc.c:1646 */
2259  {
2260  (yyval.expr) = new KDbConstExpression(KDbToken::DATETIME_CONST, QVariant::fromValue(*(yyvsp[0].dateTimeValue)));
2261  sqlParserDebug() << " + datetime constant:" << *(yyvsp[0].dateTimeValue);
2262  delete (yyvsp[0].dateTimeValue);
2263 }
2264 #line 2265 "sqlparser.cpp" /* yacc.c:1646 */
2265  break;
2266 
2267  case 84:
2268 #line 1203 "KDbSqlParser.y" /* yacc.c:1646 */
2269  {
2270  (yyval.dateValue) = (yyvsp[-1].dateValue);
2271  sqlParserDebug() << "DateConst:" << *(yyval.dateValue);
2272 }
2273 #line 2274 "sqlparser.cpp" /* yacc.c:1646 */
2274  break;
2275 
2276  case 85:
2277 #line 1211 "KDbSqlParser.y" /* yacc.c:1646 */
2278  {
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);
2284 }
2285 #line 2286 "sqlparser.cpp" /* yacc.c:1646 */
2286  break;
2287 
2288  case 86:
2289 #line 1219 "KDbSqlParser.y" /* yacc.c:1646 */
2290  {
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);
2296 }
2297 #line 2298 "sqlparser.cpp" /* yacc.c:1646 */
2298  break;
2299 
2300  case 87:
2301 #line 1230 "KDbSqlParser.y" /* yacc.c:1646 */
2302  {
2303  (yyval.yearValue) = new KDbYear(KDbYear::Sign::None, *(yyvsp[0].binaryValue));
2304  sqlParserDebug() << "YearConst:" << *(yyval.yearValue);
2305  delete (yyvsp[0].binaryValue);
2306 }
2307 #line 2308 "sqlparser.cpp" /* yacc.c:1646 */
2308  break;
2309 
2310  case 88:
2311 #line 1236 "KDbSqlParser.y" /* yacc.c:1646 */
2312  {
2313  (yyval.yearValue) = new KDbYear(KDbYear::Sign::Plus, *(yyvsp[0].binaryValue));
2314  sqlParserDebug() << "YearConst:" << *(yyval.yearValue);
2315  delete (yyvsp[0].binaryValue);
2316 }
2317 #line 2318 "sqlparser.cpp" /* yacc.c:1646 */
2318  break;
2319 
2320  case 89:
2321 #line 1242 "KDbSqlParser.y" /* yacc.c:1646 */
2322  {
2323  (yyval.yearValue) = new KDbYear(KDbYear::Sign::Minus, *(yyvsp[0].binaryValue));
2324  sqlParserDebug() << "YearConst:" << *(yyval.yearValue);
2325  delete (yyvsp[0].binaryValue);
2326 }
2327 #line 2328 "sqlparser.cpp" /* yacc.c:1646 */
2328  break;
2329 
2330  case 90:
2331 #line 1251 "KDbSqlParser.y" /* yacc.c:1646 */
2332  {
2333  (yyval.timeValue) = (yyvsp[-1].timeValue);
2334  sqlParserDebug() << "TimeConst:" << *(yyval.timeValue);
2335 }
2336 #line 2337 "sqlparser.cpp" /* yacc.c:1646 */
2337  break;
2338 
2339  case 91:
2340 #line 1259 "KDbSqlParser.y" /* yacc.c:1646 */
2341  {
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);
2347 }
2348 #line 2349 "sqlparser.cpp" /* yacc.c:1646 */
2349  break;
2350 
2351  case 92:
2352 #line 1267 "KDbSqlParser.y" /* yacc.c:1646 */
2353  {
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);
2360 }
2361 #line 2362 "sqlparser.cpp" /* yacc.c:1646 */
2362  break;
2363 
2364  case 93:
2365 #line 1279 "KDbSqlParser.y" /* yacc.c:1646 */
2366  {
2367  (yyval.binaryValue) = (yyvsp[0].binaryValue);
2368 }
2369 #line 2370 "sqlparser.cpp" /* yacc.c:1646 */
2370  break;
2371 
2372  case 94:
2373 #line 1283 "KDbSqlParser.y" /* yacc.c:1646 */
2374  {
2375  (yyval.binaryValue) = new QByteArray;
2376 }
2377 #line 2378 "sqlparser.cpp" /* yacc.c:1646 */
2378  break;
2379 
2380  case 95:
2381 #line 1290 "KDbSqlParser.y" /* yacc.c:1646 */
2382  {
2383  (yyval.timePeriodValue) = KDbTime::Period::Am;
2384 }
2385 #line 2386 "sqlparser.cpp" /* yacc.c:1646 */
2386  break;
2387 
2388  case 96:
2389 #line 1294 "KDbSqlParser.y" /* yacc.c:1646 */
2390  {
2391  (yyval.timePeriodValue) = KDbTime::Period::Pm;
2392 }
2393 #line 2394 "sqlparser.cpp" /* yacc.c:1646 */
2394  break;
2395 
2396  case 97:
2397 #line 1298 "KDbSqlParser.y" /* yacc.c:1646 */
2398  {
2399  (yyval.timePeriodValue) = KDbTime::Period::None;
2400 }
2401 #line 2402 "sqlparser.cpp" /* yacc.c:1646 */
2402  break;
2403 
2404  case 98:
2405 #line 1305 "KDbSqlParser.y" /* yacc.c:1646 */
2406  {
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);
2411 }
2412 #line 2413 "sqlparser.cpp" /* yacc.c:1646 */
2413  break;
2414 
2415  case 99:
2416 #line 1315 "KDbSqlParser.y" /* yacc.c:1646 */
2417  {
2418  sqlParserDebug() << "(expr)";
2419  (yyval.expr) = new KDbUnaryExpression('(', *(yyvsp[-1].expr));
2420  delete (yyvsp[-1].expr);
2421 }
2422 #line 2423 "sqlparser.cpp" /* yacc.c:1646 */
2423  break;
2424 
2425  case 100:
2426 #line 1324 "KDbSqlParser.y" /* yacc.c:1646 */
2427  {
2428  (yyval.exprList) = (yyvsp[-1].exprList);
2429 }
2430 #line 2431 "sqlparser.cpp" /* yacc.c:1646 */
2431  break;
2432 
2433  case 101:
2434 #line 1328 "KDbSqlParser.y" /* yacc.c:1646 */
2435  {
2436  (yyval.exprList) = new KDbNArgExpression(KDb::ArgumentListExpression, ',');
2437 }
2438 #line 2439 "sqlparser.cpp" /* yacc.c:1646 */
2439  break;
2440 
2441  case 102:
2442 #line 1335 "KDbSqlParser.y" /* yacc.c:1646 */
2443  {
2444  (yyval.exprList) = (yyvsp[0].exprList);
2445  (yyval.exprList)->prepend( *(yyvsp[-2].expr) );
2446  delete (yyvsp[-2].expr);
2447 }
2448 #line 2449 "sqlparser.cpp" /* yacc.c:1646 */
2449  break;
2450 
2451  case 103:
2452 #line 1341 "KDbSqlParser.y" /* yacc.c:1646 */
2453  {
2454  (yyval.exprList) = new KDbNArgExpression(KDb::ArgumentListExpression, ',');
2455  (yyval.exprList)->append( *(yyvsp[0].expr) );
2456  delete (yyvsp[0].expr);
2457 }
2458 #line 2459 "sqlparser.cpp" /* yacc.c:1646 */
2459  break;
2460 
2461  case 104:
2462 #line 1350 "KDbSqlParser.y" /* yacc.c:1646 */
2463  {
2464  (yyval.exprList) = (yyvsp[0].exprList);
2465 }
2466 #line 2467 "sqlparser.cpp" /* yacc.c:1646 */
2467  break;
2468 
2469  case 105:
2470 #line 1395 "KDbSqlParser.y" /* yacc.c:1646 */
2471  {
2472  (yyval.exprList) = (yyvsp[-2].exprList);
2473  (yyval.exprList)->append(*(yyvsp[0].expr));
2474  delete (yyvsp[0].expr);
2475 }
2476 #line 2477 "sqlparser.cpp" /* yacc.c:1646 */
2477  break;
2478 
2479  case 106:
2480 #line 1401 "KDbSqlParser.y" /* yacc.c:1646 */
2481  {
2482  (yyval.exprList) = new KDbNArgExpression(KDb::TableListExpression, KDbToken::IDENTIFIER); //ok?
2483  (yyval.exprList)->append(*(yyvsp[0].expr));
2484  delete (yyvsp[0].expr);
2485 }
2486 #line 2487 "sqlparser.cpp" /* yacc.c:1646 */
2487  break;
2488 
2489  case 107:
2490 #line 1410 "KDbSqlParser.y" /* yacc.c:1646 */
2491  {
2492  sqlParserDebug() << "FROM: '" << *(yyvsp[0].stringValue) << "'";
2493  (yyval.expr) = new KDbVariableExpression(*(yyvsp[0].stringValue));
2494 
2495  //! @todo this isn't ok for more tables:
2496  /*
2497  KDbField::ListIterator it = globalParser->query()->fieldsIterator();
2498  for(KDbField *item; (item = it.current()); ++it)
2499  {
2500  if(item->table() == dummy)
2501  {
2502  item->setTable(schema);
2503  }
2504 
2505  if(item->table() && !item->isQueryAsterisk())
2506  {
2507  KDbField *f = item->table()->field(item->name());
2508  if(!f)
2509  {
2510  KDbParserError err(KDbParser::tr("Field List Error"), KDbParser::tr("Unknown column '%1' in table '%2'",item->name(),schema->name()), ctoken, current);
2511  globalParser->setError(err);
2512  yyerror("fieldlisterror");
2513  }
2514  }
2515  }*/
2516  delete (yyvsp[0].stringValue);
2517 }
2518 #line 2519 "sqlparser.cpp" /* yacc.c:1646 */
2519  break;
2520 
2521  case 108:
2522 #line 1438 "KDbSqlParser.y" /* yacc.c:1646 */
2523  {
2524  //table + alias
2525  (yyval.expr) = new KDbBinaryExpression(
2526  KDbVariableExpression(*(yyvsp[-1].stringValue)), KDbToken::AS_EMPTY,
2527  KDbVariableExpression(*(yyvsp[0].stringValue))
2528  );
2529  delete (yyvsp[-1].stringValue);
2530  delete (yyvsp[0].stringValue);
2531 }
2532 #line 2533 "sqlparser.cpp" /* yacc.c:1646 */
2533  break;
2534 
2535  case 109:
2536 #line 1448 "KDbSqlParser.y" /* yacc.c:1646 */
2537  {
2538  //table + alias
2539  (yyval.expr) = new KDbBinaryExpression(
2540  KDbVariableExpression(*(yyvsp[-2].stringValue)), KDbToken::AS,
2541  KDbVariableExpression(*(yyvsp[0].stringValue))
2542  );
2543  delete (yyvsp[-2].stringValue);
2544  delete (yyvsp[0].stringValue);
2545 }
2546 #line 2547 "sqlparser.cpp" /* yacc.c:1646 */
2547  break;
2548 
2549  case 110:
2550 #line 1463 "KDbSqlParser.y" /* yacc.c:1646 */
2551  {
2552  (yyval.exprList) = (yyvsp[-2].exprList);
2553  (yyval.exprList)->append(*(yyvsp[0].expr));
2554  delete (yyvsp[0].expr);
2555  sqlParserDebug() << "ColViews: ColViews , ColItem";
2556 }
2557 #line 2558 "sqlparser.cpp" /* yacc.c:1646 */
2558  break;
2559 
2560  case 111:
2561 #line 1470 "KDbSqlParser.y" /* yacc.c:1646 */
2562  {
2563  (yyval.exprList) = new KDbNArgExpression(KDb::FieldListExpression, KDbToken());
2564  (yyval.exprList)->append(*(yyvsp[0].expr));
2565  delete (yyvsp[0].expr);
2566  sqlParserDebug() << "ColViews: ColItem";
2567 }
2568 #line 2569 "sqlparser.cpp" /* yacc.c:1646 */
2569  break;
2570 
2571  case 112:
2572 #line 1480 "KDbSqlParser.y" /* yacc.c:1646 */
2573  {
2574 // $$ = new KDbField();
2575 // dummy->addField($$);
2576 // $$->setExpression( $1 );
2577 // globalParser->query()->addField($$);
2578  (yyval.expr) = (yyvsp[0].expr);
2579  sqlParserDebug() << " added column expr:" << *(yyvsp[0].expr);
2580 }
2581 #line 2582 "sqlparser.cpp" /* yacc.c:1646 */
2582  break;
2583 
2584  case 113:
2585 #line 1489 "KDbSqlParser.y" /* yacc.c:1646 */
2586  {
2587  (yyval.expr) = (yyvsp[0].expr);
2588  sqlParserDebug() << " added column wildcard:" << *(yyvsp[0].expr);
2589 }
2590 #line 2591 "sqlparser.cpp" /* yacc.c:1646 */
2591  break;
2592 
2593  case 114:
2594 #line 1494 "KDbSqlParser.y" /* yacc.c:1646 */
2595  {
2596  (yyval.expr) = new KDbBinaryExpression(
2597  *(yyvsp[-2].expr), KDbToken::AS,
2598  KDbVariableExpression(*(yyvsp[0].stringValue))
2599  );
2600  sqlParserDebug() << " added column expr:" << *(yyval.expr);
2601  delete (yyvsp[-2].expr);
2602  delete (yyvsp[0].stringValue);
2603 }
2604 #line 2605 "sqlparser.cpp" /* yacc.c:1646 */
2605  break;
2606 
2607  case 115:
2608 #line 1504 "KDbSqlParser.y" /* yacc.c:1646 */
2609  {
2610  (yyval.expr) = new KDbBinaryExpression(
2611  *(yyvsp[-1].expr), KDbToken::AS_EMPTY,
2612  KDbVariableExpression(*(yyvsp[0].stringValue))
2613  );
2614  sqlParserDebug() << " added column expr:" << *(yyval.expr);
2615  delete (yyvsp[-1].expr);
2616  delete (yyvsp[0].stringValue);
2617 }
2618 #line 2619 "sqlparser.cpp" /* yacc.c:1646 */
2619  break;
2620 
2621  case 116:
2622 #line 1517 "KDbSqlParser.y" /* yacc.c:1646 */
2623  {
2624  (yyval.expr) = (yyvsp[0].expr);
2625 }
2626 #line 2627 "sqlparser.cpp" /* yacc.c:1646 */
2627  break;
2628 
2629  case 117:
2630 #line 1563 "KDbSqlParser.y" /* yacc.c:1646 */
2631  {
2632  (yyval.expr) = (yyvsp[-1].expr);
2633 //! @todo DISTINCT '(' ColExpression ')'
2634 // $$->setName("DISTINCT(" + $3->name() + ")");
2635 }
2636 #line 2637 "sqlparser.cpp" /* yacc.c:1646 */
2637  break;
2638 
2639  case 118:
2640 #line 1572 "KDbSqlParser.y" /* yacc.c:1646 */
2641  {
2642  (yyval.expr) = new KDbVariableExpression(QLatin1String("*"));
2643  sqlParserDebug() << "all columns";
2644 
2645 // KDbQueryAsterisk *ast = new KDbQueryAsterisk(globalParser->query(), dummy);
2646 // globalParser->query()->addAsterisk(ast);
2647 // requiresTable = true;
2648 }
2649 #line 2650 "sqlparser.cpp" /* yacc.c:1646 */
2650  break;
2651 
2652  case 119:
2653 #line 1581 "KDbSqlParser.y" /* yacc.c:1646 */
2654  {
2655  QString s( *(yyvsp[-2].stringValue) );
2656  s += QLatin1String(".*");
2657  (yyval.expr) = new KDbVariableExpression(s);
2658  sqlParserDebug() << " + all columns from " << s;
2659  delete (yyvsp[-2].stringValue);
2660 }
2661 #line 2662 "sqlparser.cpp" /* yacc.c:1646 */
2662  break;
2663 
2664 
2665 #line 2666 "sqlparser.cpp" /* yacc.c:1646 */
2666  default: break;
2667  }
2668  /* User semantic actions sometimes alter yychar, and that requires
2669  that yytoken be updated with the new translation. We take the
2670  approach of translating immediately before every use of yytoken.
2671  One alternative is translating here after every semantic action,
2672  but that translation would be missed if the semantic action invokes
2673  YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
2674  if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
2675  incorrect destructor might then be invoked immediately. In the
2676  case of YYERROR or YYBACKUP, subsequent parser actions might lead
2677  to an incorrect destructor call or verbose syntax error message
2678  before the lookahead is translated. */
2679  YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
2680 
2681  YYPOPSTACK (yylen);
2682  yylen = 0;
2683  YY_STACK_PRINT (yyss, yyssp);
2684 
2685  *++yyvsp = yyval;
2686 
2687  /* Now 'shift' the result of the reduction. Determine what state
2688  that goes to, based on the state we popped back to and the rule
2689  number reduced by. */
2690 
2691  yyn = yyr1[yyn];
2692 
2693  yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
2694  if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
2695  yystate = yytable[yystate];
2696  else
2697  yystate = yydefgoto[yyn - YYNTOKENS];
2698 
2699  goto yynewstate;
2700 
2701 
2702 /*--------------------------------------.
2703 | yyerrlab -- here on detecting error. |
2704 `--------------------------------------*/
2705 yyerrlab:
2706  /* Make sure we have latest lookahead translation. See comments at
2707  user semantic actions for why this is necessary. */
2708  yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
2709 
2710  /* If not already recovering from an error, report this error. */
2711  if (!yyerrstatus)
2712  {
2713  ++yynerrs;
2714 #if ! YYERROR_VERBOSE
2715  yyerror (YY_("syntax error"));
2716 #else
2717 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
2718  yyssp, yytoken)
2719  {
2720  char const *yymsgp = YY_("syntax error");
2721  int yysyntax_error_status;
2722  yysyntax_error_status = YYSYNTAX_ERROR;
2723  if (yysyntax_error_status == 0)
2724  yymsgp = yymsg;
2725  else if (yysyntax_error_status == 1)
2726  {
2727  if (yymsg != yymsgbuf)
2728  YYSTACK_FREE (yymsg);
2729  yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
2730  if (!yymsg)
2731  {
2732  yymsg = yymsgbuf;
2733  yymsg_alloc = sizeof yymsgbuf;
2734  yysyntax_error_status = 2;
2735  }
2736  else
2737  {
2738  yysyntax_error_status = YYSYNTAX_ERROR;
2739  yymsgp = yymsg;
2740  }
2741  }
2742  yyerror (yymsgp);
2743  if (yysyntax_error_status == 2)
2744  goto yyexhaustedlab;
2745  }
2746 # undef YYSYNTAX_ERROR
2747 #endif
2748  }
2749 
2750 
2751 
2752  if (yyerrstatus == 3)
2753  {
2754  /* If just tried and failed to reuse lookahead token after an
2755  error, discard it. */
2756 
2757  if (yychar <= YYEOF)
2758  {
2759  /* Return failure if at end of input. */
2760  if (yychar == YYEOF)
2761  YYABORT;
2762  }
2763  else
2764  {
2765  yydestruct ("Error: discarding",
2766  yytoken, &yylval);
2767  yychar = YYEMPTY;
2768  }
2769  }
2770 
2771  /* Else will try to reuse lookahead token after shifting the error
2772  token. */
2773  goto yyerrlab1;
2774 
2775 
2776 /*---------------------------------------------------.
2777 | yyerrorlab -- error raised explicitly by YYERROR. |
2778 `---------------------------------------------------*/
2779 yyerrorlab:
2780 
2781  /* Pacify compilers like GCC when the user code never invokes
2782  YYERROR and the label yyerrorlab therefore never appears in user
2783  code. */
2784  if (/*CONSTCOND*/ 0)
2785  goto yyerrorlab;
2786 
2787  /* Do not reclaim the symbols of the rule whose action triggered
2788  this YYERROR. */
2789  YYPOPSTACK (yylen);
2790  yylen = 0;
2791  YY_STACK_PRINT (yyss, yyssp);
2792  yystate = *yyssp;
2793  goto yyerrlab1;
2794 
2795 
2796 /*-------------------------------------------------------------.
2797 | yyerrlab1 -- common code for both syntax error and YYERROR. |
2798 `-------------------------------------------------------------*/
2799 yyerrlab1:
2800  yyerrstatus = 3; /* Each real token shifted decrements this. */
2801 
2802  for (;;)
2803  {
2804  yyn = yypact[yystate];
2805  if (!yypact_value_is_default (yyn))
2806  {
2807  yyn += YYTERROR;
2808  if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
2809  {
2810  yyn = yytable[yyn];
2811  if (0 < yyn)
2812  break;
2813  }
2814  }
2815 
2816  /* Pop the current state because it cannot handle the error token. */
2817  if (yyssp == yyss)
2818  YYABORT;
2819 
2820 
2821  yydestruct ("Error: popping",
2822  yystos[yystate], yyvsp);
2823  YYPOPSTACK (1);
2824  yystate = *yyssp;
2825  YY_STACK_PRINT (yyss, yyssp);
2826  }
2827 
2828  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
2829  *++yyvsp = yylval;
2830  YY_IGNORE_MAYBE_UNINITIALIZED_END
2831 
2832 
2833  /* Shift the error token. */
2834  YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
2835 
2836  yystate = yyn;
2837  goto yynewstate;
2838 
2839 
2840 /*-------------------------------------.
2841 | yyacceptlab -- YYACCEPT comes here. |
2842 `-------------------------------------*/
2843 yyacceptlab:
2844  yyresult = 0;
2845  goto yyreturn;
2846 
2847 /*-----------------------------------.
2848 | yyabortlab -- YYABORT comes here. |
2849 `-----------------------------------*/
2850 yyabortlab:
2851  yyresult = 1;
2852  goto yyreturn;
2853 
2854 #if !defined yyoverflow || YYERROR_VERBOSE
2855 /*-------------------------------------------------.
2856 | yyexhaustedlab -- memory exhaustion comes here. |
2857 `-------------------------------------------------*/
2858 yyexhaustedlab:
2859  yyerror (YY_("memory exhausted"));
2860  yyresult = 2;
2861  /* Fall through. */
2862 #endif
2863 
2864 yyreturn:
2865  if (yychar != YYEMPTY)
2866  {
2867  /* Make sure we have latest lookahead translation. See comments at
2868  user semantic actions for why this is necessary. */
2869  yytoken = YYTRANSLATE (yychar);
2870  yydestruct ("Cleanup: discarding lookahead",
2871  yytoken, &yylval);
2872  }
2873  /* Do not reclaim the symbols of the rule whose action triggered
2874  this YYABORT or YYACCEPT. */
2875  YYPOPSTACK (yylen);
2876  YY_STACK_PRINT (yyss, yyssp);
2877  while (yyssp != yyss)
2878  {
2879  yydestruct ("Cleanup: popping",
2880  yystos[*yyssp], yyvsp);
2881  YYPOPSTACK (1);
2882  }
2883 #ifndef yyoverflow
2884  if (yyss != yyssa)
2885  YYSTACK_FREE (yyss);
2886 #endif
2887 #if YYERROR_VERBOSE
2888  if (yymsg != yymsgbuf)
2889  YYSTACK_FREE (yymsg);
2890 #endif
2891  return yyresult;
2892 }
2893 #line 1596 "KDbSqlParser.y" /* yacc.c:1906 */
2894 
2895 
2896 KDB_TESTING_EXPORT const char* g_tokenName(unsigned int offset) {
2897  const int t = YYTRANSLATE(offset);
2898  if (t >= YYTRANSLATE(::SQL_TYPE)) {
2899  return yytname[t];
2900  }
2901  return nullptr;
2902 }
2903 
2904 //static
2905 const int KDbToken::maxCharTokenValue = 253;
2906 
2907 //static
2908 const int KDbToken::maxTokenValue = YYMAXUTOK;
QVariant fromValue(const T &value)
A type-safe KDbSQL token It can be used in KDb expressions.
Definition: KDbToken.h:36
The KDbBinaryExpression class represents binary operation.
The KDbVariableExpression class represents variables such as fieldname or tablename....
QDebug & nospace()
@ Select
Query-statement.
Definition: KDbParser.h:113
QDebug & space()
QDataStream & operator<<(QDataStream &out, const KDateTime &dateTime)
The KDbQueryParameterExpression class represents query parameter expression.
static const KDbToken BETWEEN_AND
Custom tokens are not used in parser but used as an extension in expression classes.
Definition: KDbToken.h:170
@ None
2-hour time
@ Am
AM, before noon.
The KDbUnaryExpression class represents unary expression (with a single argument).
Generic time constant.
Definition: KDbDateTime.h:260
void append(const KDbExpression &expr)
Inserts expression argument expr at the end of this expression.
The KDbNArgExpression class represents a base class N-argument expression.
Generic date/time constant.
Definition: KDbDateTime.h:403
Generic year constant based on extended ISO 8601 specification.
Definition: KDbDateTime.h:42
Period
Specifies hour period.
Definition: KDbDateTime.h:266
KDbQuerySchema provides information about database query.
static const int maxTokenValue
Maximum character token value.
Definition: KDbToken.h:77
static const int maxCharTokenValue
Maximum character token value (253)
Definition: KDbToken.h:74
Meta-data for a field.
Definition: KDbField.h:71
@ Pm
PM, after noon, before midnight.
SortOrder
Column sort order.
Generic date constant.
Definition: KDbDateTime.h:157
The KDbConstExpression class represents const expression.
The KDbExpression class represents a base class for all expressions.
Definition: KDbExpression.h:51
The KDbFunctionExpression class represents expression that use functional notation F(x,...
virtual QVariant get(ScriptableExtension *callerPrincipal, quint64 objId, const QString &propName)
QString toString() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Sat Jun 25 2022 06:21:34 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.