KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > derby > impl > sql > compile > SQLParser


1 /* Generated By:JavaCC: Do not edit this line. SQLParser.java */
2 /*
3
4    Derby - File org.apache.derby.impl.sql.compile.sqlgrammar.jj
5
6    Licensed to the Apache Software Foundation (ASF) under one or more
7    contributor license agreements. See the NOTICE file distributed with
8    this work for additional information regarding copyright ownership.
9    The ASF licenses this file to you under the Apache License, Version 2.0
10    (the "License"); you may not use this file except in compliance with
11    the License. You may obtain a copy of the License at
12
13       http://www.apache.org/licenses/LICENSE-2.0
14
15    Unless required by applicable law or agreed to in writing, software
16    distributed under the License is distributed on an "AS IS" BASIS,
17    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18    See the License for the specific language governing permissions and
19    limitations under the License.
20
21 */

22
23 package org.apache.derby.impl.sql.compile;
24
25 import org.apache.derby.iapi.sql.Statement;
26 import org.apache.derby.iapi.sql.StatementType;
27
28 /* aggregates */
29 import org.apache.derby.impl.sql.compile.CountAggregateDefinition;
30 import org.apache.derby.impl.sql.compile.MaxMinAggregateDefinition;
31 import org.apache.derby.impl.sql.compile.SumAvgAggregateDefinition;
32
33 import org.apache.derby.impl.sql.compile.AggregateNode;
34 import org.apache.derby.impl.sql.compile.BinaryOperatorNode;
35 import org.apache.derby.impl.sql.compile.CallStatementNode;
36 import org.apache.derby.impl.sql.compile.CharConstantNode;
37 import org.apache.derby.impl.sql.compile.CastNode;
38 import org.apache.derby.impl.sql.compile.ColumnDefinitionNode;
39 import org.apache.derby.impl.sql.compile.ColumnReference;
40 import org.apache.derby.impl.sql.compile.CursorNode;
41 import org.apache.derby.impl.sql.compile.FromBaseTable;
42 import org.apache.derby.impl.sql.compile.FromList;
43 import org.apache.derby.impl.sql.compile.FromSubquery;
44 import org.apache.derby.impl.sql.compile.FromTable;
45 import org.apache.derby.impl.sql.compile.GroupByList;
46 import org.apache.derby.impl.sql.compile.HasNodeVisitor;
47 import org.apache.derby.impl.sql.compile.JavaToSQLValueNode;
48 import org.apache.derby.impl.sql.compile.JoinNode;
49 import org.apache.derby.impl.sql.compile.MethodCallNode;
50 import org.apache.derby.impl.sql.compile.QueryTreeNode;
51 import org.apache.derby.impl.sql.compile.ReplaceAggregatesWithCRVisitor;
52 import org.apache.derby.impl.sql.compile.ResultColumnList;
53 import org.apache.derby.impl.sql.compile.ResultColumn;
54 import org.apache.derby.impl.sql.compile.OrderByList;
55 import org.apache.derby.impl.sql.compile.OrderByColumn;
56 import org.apache.derby.impl.sql.compile.ResultSetNode;
57 import org.apache.derby.impl.sql.compile.SelectNode;
58 import org.apache.derby.impl.sql.compile.SubqueryNode;
59 import org.apache.derby.impl.sql.compile.TableName;
60 import org.apache.derby.impl.sql.compile.TernaryOperatorNode;
61 import org.apache.derby.impl.sql.compile.ParameterNode;
62 import org.apache.derby.impl.sql.compile.PrivilegeNode;
63 import org.apache.derby.impl.sql.compile.ConstraintDefinitionNode;
64 import org.apache.derby.impl.sql.compile.DMLModStatementNode;
65 import org.apache.derby.impl.sql.compile.RoutineDesignator;
66 import org.apache.derby.impl.sql.compile.StatementNode;
67 import org.apache.derby.impl.sql.compile.TableElementList;
68 import org.apache.derby.impl.sql.compile.TableElementNode;
69 import org.apache.derby.impl.sql.compile.TableOperatorNode;
70 import org.apache.derby.impl.sql.compile.TablePrivilegesNode;
71 import org.apache.derby.impl.sql.compile.TransactionStatementNode;
72 import org.apache.derby.impl.sql.compile.TriggerReferencingStruct;
73 import org.apache.derby.impl.sql.compile.UnionNode;
74 import org.apache.derby.impl.sql.compile.IntersectOrExceptNode;
75 import org.apache.derby.impl.sql.compile.UnaryOperatorNode;
76 import org.apache.derby.impl.sql.compile.UntypedNullConstantNode;
77 import org.apache.derby.impl.sql.compile.UpdateNode;
78 import org.apache.derby.impl.sql.compile.UserTypeConstantNode;
79 import org.apache.derby.impl.sql.compile.ValueNode;
80 import org.apache.derby.impl.sql.compile.ValueNodeList;
81 import org.apache.derby.impl.sql.compile.GroupByColumn;
82 import org.apache.derby.impl.sql.compile.CurrentDatetimeOperatorNode;
83 import org.apache.derby.impl.sql.compile.DDLStatementNode;
84 import org.apache.derby.impl.sql.compile.AlterTableNode;
85
86 import org.apache.derby.impl.sql.compile.ParseException;
87 import org.apache.derby.impl.sql.compile.Token;
88 import org.apache.derby.impl.sql.compile.TokenMgrError;
89 import org.apache.derby.impl.sql.compile.SQLParserConstants;
90 import org.apache.derby.impl.sql.compile.CharStream;
91 import org.apache.derby.impl.sql.execute.TablePrivilegeInfo;
92 import org.apache.derby.iapi.sql.dictionary.DataDictionary;
93 import org.apache.derby.iapi.sql.dictionary.TableDescriptor;
94 import org.apache.derby.iapi.sql.dictionary.TriggerDescriptor;
95 import org.apache.derby.iapi.sql.dictionary.ViewDescriptor;
96 import org.apache.derby.iapi.sql.dictionary.SchemaDescriptor;
97
98 import org.apache.derby.iapi.sql.conn.Authorizer;
99 import org.apache.derby.iapi.sql.execute.ConstantAction;
100 import org.apache.derby.iapi.sql.execute.ExecutionContext;
101
102 import org.apache.derby.iapi.types.DataTypeDescriptor;
103 import org.apache.derby.iapi.types.TypeId;
104 import org.apache.derby.iapi.sql.compile.TypeCompiler;
105 import org.apache.derby.iapi.sql.conn.LanguageConnectionContext;
106
107 import org.apache.derby.iapi.types.DateTimeDataValue;
108 import org.apache.derby.iapi.types.DataTypeDescriptor;
109 import org.apache.derby.iapi.types.DataTypeUtilities;
110 import org.apache.derby.iapi.types.StringDataValue;
111 import org.apache.derby.iapi.types.DataValueDescriptor;
112
113 import org.apache.derby.iapi.error.StandardException;
114
115 import org.apache.derby.iapi.reference.Property;
116 import org.apache.derby.iapi.reference.SQLState;
117 import org.apache.derby.iapi.reference.JDBC30Translation;
118 import org.apache.derby.iapi.reference.Limits;
119
120 import org.apache.derby.iapi.sql.compile.CompilerContext;
121 import org.apache.derby.iapi.sql.compile.C_NodeTypes;
122
123 import org.apache.derby.iapi.services.context.ContextManager;
124
125 import org.apache.derby.iapi.sql.compile.NodeFactory;
126
127 import org.apache.derby.iapi.services.sanity.SanityManager;
128
129 import org.apache.derby.catalog.AliasInfo;
130 import org.apache.derby.catalog.TypeDescriptor;
131 import org.apache.derby.catalog.types.RoutineAliasInfo;
132
133 import org.apache.derby.iapi.services.io.FormatableProperties;
134 import org.apache.derby.iapi.services.io.StoredFormatIds;
135 import org.apache.derby.iapi.util.ReuseFactory;
136 import org.apache.derby.iapi.services.io.FormatableBitSet;
137 import org.apache.derby.iapi.util.StringUtil;
138
139 import java.sql.Types JavaDoc;
140 import java.util.List JavaDoc;
141 import java.util.ArrayList JavaDoc;
142 import java.util.Hashtable JavaDoc;
143 import java.util.Properties JavaDoc;
144 import java.util.StringTokenizer JavaDoc;
145 import java.util.Vector JavaDoc;
146 import java.lang.Character JavaDoc;
147
148 public class SQLParser implements SQLParserConstants {
149         private static final String JavaDoc[] SAVEPOINT_CLAUSE_NAMES = {"UNIQUE", "ON ROLLBACK RETAIN LOCKS", "ON ROLLBACK RETAIN CURSORS"};
150         private static final String JavaDoc[] ROUTINE_CLAUSE_NAMES =
151                 {null, "SPECIFIC", "RESULT SET", "LANGUAGE", "EXTERNAL NAME", "PARAMETER STYLE", "SQL", "ON NULL INPUT"};
152         /**
153        Clauses required for Java routines. Numbers correspond
154        to offsets in ROUTINE_CLAUSE_NAMES.
155        3 - "LANGUAGE"
156        4 - "EXTERNAL NAME"
157        5 - "PARAMETER STYLE"
158     */

159         private static final int[] JAVA_ROUTINE_CLAUSES = {3,4,5};
160         private static final String JavaDoc[] TEMPORARY_TABLE_CLAUSE_NAMES = {"NOT LOGGED", "ON COMMIT", "ON ROLLBACK"};
161         /* The default length of a char or bit if the length is omitted */
162         private static final int DEFAULT_STRING_COLUMN_LENGTH = 1;
163
164         // Defines for ON or USING clauses
165
private static final int ON_OR_USING_CLAUSE_SIZE = 2;
166         private static final int ON_CLAUSE = 0;
167         private static final int USING_CLAUSE = 1;
168
169         // Defines for optional table clauses
170
private static final int OPTIONAL_TABLE_CLAUSES_SIZE = 3;
171         private static final int OPTIONAL_TABLE_CLAUSES_TABLE_PROPERTIES = 0;
172         private static final int OPTIONAL_TABLE_CLAUSES_DERIVED_RCL = 1;
173         private static final int OPTIONAL_TABLE_CLAUSES_CORRELATION_NAME = 2;
174
175         // Define for UTF8 max
176
private static final int MAX_UTF8_LENGTH = 65535;
177
178     // Constants for set operator types
179
private static final int NO_SET_OP = 0;
180     private static final int UNION_OP = 1;
181     private static final int UNION_ALL_OP = 2;
182     private static final int EXCEPT_OP = 3;
183     private static final int EXCEPT_ALL_OP = 4;
184     private static final int INTERSECT_OP = 5;
185     private static final int INTERSECT_ALL_OP = 6;
186
187         private Object JavaDoc[] paramDefaults;
188         private String JavaDoc statementSQLText;
189         private NodeFactory nodeFactory;
190         private ContextManager cm;
191         private CompilerContext compilerContext;
192
193         /* The number of the next ? parameter */
194         private int parameterNumber;
195
196         /* The list of ? parameters */
197         private Vector JavaDoc parameterList;
198
199         /* Remember if the last identifier or keyword was a
200      * delimited identifier. This is used for remembering
201      * if the xxx in SERIALIZE(xxx) was a delimited identifier
202      * because we need to know whether or not we can convert
203      * xxx to upper case if we try to resolve it as a class
204      * alias at bind time.
205      */

206         private Boolean JavaDoc lastTokenDelimitedIdentifier = Boolean.FALSE;
207         private Boolean JavaDoc nextToLastTokenDelimitedIdentifier = Boolean.FALSE;
208
209
210         /*
211     ** Remember the last token we got that was an identifier
212     */

213         private Token lastIdentifierToken;
214         private Token nextToLastIdentifierToken;
215
216         static final String JavaDoc SINGLEQUOTES = "\'\'";
217         static final String JavaDoc DOUBLEQUOTES = "\"\"";
218
219         static final String JavaDoc DEFAULT_INDEX_TYPE = "BTREE";
220
221         //the following 2 booleans are used to make sure only null or not null is
222
//defined for a column while creating a table or altering a table. Defining
223
//both at the same time will be an error case.
224
boolean explicitNotNull = false;
225         boolean explicitNull = false;
226
227         //this vector keeps a list of explicitly nullable columns, so that if they
228
//get used in the table level primary key constraint, it will result in an
229
//exception.
230
Vector JavaDoc explicitlyNullableColumnsList = new Vector JavaDoc();
231
232
233         final void setCompilerContext(CompilerContext cc) {
234                 this.compilerContext = cc;
235                 this.cm = cc.getContextManager();
236         }
237
238         /**
239       * Get the NodeFactory for this database.
240       *
241       * @return The NodeFactory for this database.
242       * @exception StandardException Thrown on error
243       */

244         private final NodeFactory getNodeFactory() throws StandardException
245         {
246                 if ( nodeFactory == null )
247                 {
248                         nodeFactory = getCompilerContext().getNodeFactory();
249                 }
250
251                 return nodeFactory;
252         }
253
254         private final CompilerContext getCompilerContext()
255         {
256                 return compilerContext;
257         }
258
259         private DataTypeDescriptor getDataTypeServices(int type, int precision, int scale,
260                         int length)
261         {
262                 return new DataTypeDescriptor(
263                                         TypeId.getBuiltInTypeId(type),
264                                         precision,
265                                         scale,
266                                         true, /* assume nullable for now, change it if not nullable */
267                                         length
268                                 );
269         }
270
271         private DataTypeDescriptor getJavaClassDataTypeDescriptor(String JavaDoc javaClassName)
272         {
273                 return new DataTypeDescriptor(
274                                         TypeId.getUserDefinedTypeId(
275                                                                 javaClassName,
276                                                                 lastTokenDelimitedIdentifier.booleanValue()),
277                                         true);
278         }
279         private LanguageConnectionContext getLanguageConnectionContext()
280         {
281                 return (LanguageConnectionContext) getContextManager().getContext(
282                                                                                 LanguageConnectionContext.CONTEXT_ID);
283         }
284
285         /**
286         Utility method for checking that the underlying database has been
287         upgraded to the required level to use this functionality. Used to
288         disallow SQL statements that would leave on-disk formats that would
289         not be understood by a engine that matches the current upgrade level
290         of the database. Throws an exception if the database is not a the required level.
291         <P>
292         Typically used for CREATE statements at the parser level. Called usually just
293         before the node is created, or can be called in just a partial syntax fragment
294         
295         @param version Data Dictionary major version (DataDictionary.DD_ constant)
296         @param feature SQL Feature name, for error text.
297     */

298         private void checkVersion(int version, String JavaDoc feature) throws StandardException
299         {
300                 getLanguageConnectionContext().getDataDictionary().checkVersion(
301                                 version, feature);
302         }
303
304     /**
305         Utility method for checking that the underlying database uses SQL standard
306         permission checking (GRANT/REVOKE).
307
308         @param command "GRANT" or "REVOKE"
309     */

310         private void checkSqlStandardAccess( String JavaDoc command) throws StandardException
311         {
312                 if( getLanguageConnectionContext().usesSqlAuthorization())
313                         return;
314
315                 throw StandardException.newException(SQLState.LANG_GRANT_REVOKE_WITH_LEGACY_ACCESS,
316                                                                                         command,
317                                                                                         Property.SQL_AUTHORIZATION_PROPERTY,
318                                                                                         "TRUE");
319         }
320
321         /*
322     ** Make sure that a select list in a parser-rewritten tree does
323     ** not contain two columns by the same name. This is the patch
324     ** to bug 280. In this case, the bind phase cannot tell the
325     ** difference between the two columns and so the query may
326     ** return wrong results.
327     **
328     ** This issue is caused by parser rewriting of group by/having clauses
329     ** into table expressions. (See function tableExpression() in this file)
330     ** There is an improvement request filed under DERBY-681 to eliminate this
331     ** rewrite, after which it should be possible to allow multiple columns to
332     ** have same name in the select list.
333     */

334         private void vetSelectList280( ResultColumnList selectList )
335                 throws StandardException
336         {
337                 Hashtable JavaDoc allNames = new Hashtable JavaDoc();
338                 int count = selectList.size();
339
340                 for ( int i = 0; i < count; i++ )
341                 {
342                         ResultColumn rc = (ResultColumn) selectList.elementAt( i );
343                         String JavaDoc duplicateName = ambiguousDuplicateName( allNames, rc );
344
345                         if ( duplicateName != null )
346                         {
347                                 throw StandardException.newException
348                                 ( SQLState.LANG_UNBINDABLE_REWRITE, duplicateName );
349                         }
350
351                 }
352         }
353
354         // allow two references to the same column. disallow aliasing
355
// two different expressions to the same name. returns the
356
// ambiguous column name if two result columns cannot be distinguished.
357
private String JavaDoc ambiguousDuplicateName( Hashtable JavaDoc allNames, ResultColumn rc )
358                 throws StandardException
359         {
360                 String JavaDoc columnName = rc.getName();
361                 ValueNode newExpression = rc.getExpression();
362
363                 // no column name means that the compiler will generate a
364
// unique name. that's ok and avoids bug 280
365
if ( columnName == null ) { return null; }
366
367                 ValueNode oldExpression = (ValueNode) allNames.get( columnName );
368
369                 // no problem yet if we haven't seen this column
370
if ( oldExpression == null )
371                 {
372                         allNames.put( columnName, newExpression );
373                         return null;
374                 }
375
376                 // if the two identically named references aren't both the
377
// same table column, then the bug occurs
378
if (
379                                 !(newExpression instanceof ColumnReference) ||
380                                 !(oldExpression instanceof ColumnReference)
381                    )
382                 { return columnName; }
383
384                 ColumnReference newCR = (ColumnReference) newExpression;
385                 ColumnReference oldCR = (ColumnReference) oldExpression;
386                 TableName newTableName = newCR.getTableNameNode();
387                 TableName oldTableName = oldCR.getTableNameNode();
388
389                 if (
390                                 ( (newTableName == null) && (oldTableName == null) ) ||
391                                 ( (newTableName != null) && (newTableName.equals( oldTableName )) )
392                    )
393                 {
394                         // same table but different column aliased to same column name
395
if ( !newCR.getColumnName().equals( oldCR.getColumnName() ) )
396                         { return columnName; }
397                         else { return null; }
398                 }
399
400                 // different tables
401
return null;
402         }
403
404         /**
405         Check that the current mode supports internal extensions.
406
407         @param feature Description of feature for exception.
408
409         @exception StandardException current mode does not support statement
410     */

411         private void checkInternalFeature(String JavaDoc feature) throws StandardException
412         {
413                 CompilerContext cc = getCompilerContext();
414                 if ((cc.getReliability() & CompilerContext.INTERNAL_SQL_ILLEGAL) != 0)
415                         throw StandardException.newException(SQLState.LANG_SYNTAX_ERROR, feature);
416         }
417
418         /**
419      * check if the type length is ok for the given type.
420      */

421         private void checkTypeLimits(int type, int length)
422                 throws StandardException
423         {
424         boolean valid = true;
425
426
427         switch (type) {
428                 case Types.BINARY:
429                 case Types.CHAR:
430                         if (length > Limits.DB2_CHAR_MAXWIDTH)
431                                 valid = false;
432                         break;
433
434                 case Types.VARBINARY:
435                 case Types.VARCHAR:
436                         if (length > Limits.DB2_VARCHAR_MAXWIDTH)
437                                 valid = false;
438
439                         break;
440                 default:
441                         break;
442         }
443         if (!valid) // If these limits are too big
444
{
445                         DataTypeDescriptor charDTD =
446                                 DataTypeDescriptor.getBuiltInDataTypeDescriptor(type, length);
447
448                         throw StandardException.newException(SQLState.LANG_DB2_LENGTH_PRECISION_SCALE_VIOLATION, charDTD.getSQLstring());
449                 }
450         }
451
452
453
454         // Get the current ContextManager
455
private final ContextManager getContextManager()
456         {
457                 return cm;
458         }
459
460         /*
461     ** Compress 2 adjacent (single or double) quotes into a single (s or d) quote when
462     ** found in the middle of a String.
463     ** NOTE: """" or '''' will be compressed into "" or ''.
464     ** This function assumes that the leading and trailing quote from a
465     ** string or delimited identifier have already been removed.
466     */

467         private static String JavaDoc compressQuotes(String JavaDoc source, String JavaDoc quotes)
468         {
469                 String JavaDoc result = source;
470                 int index;
471
472                 /* Find the first occurrence of adjacent quotes. */
473                 index = result.indexOf(quotes);
474
475                 /* Replace each occurrence with a single quote and begin the
476          * search for the next occurrence from where we left off.
477          */

478                 while (index != -1)
479                 {
480                         result = result.substring(0, index + 1) + result.substring(index + 2);
481
482                         index = result.indexOf(quotes, index + 1);
483                 }
484
485                 return result;
486         }
487
488         private static void verifyImageLength(String JavaDoc image) throws StandardException
489                 {
490                 // beetle 2758. For right now throw an error for literals > 64K
491
if (image.length() > MAX_UTF8_LENGTH)
492                         {
493                 throw StandardException.newException(SQLState.LANG_INVALID_LITERAL_LENGTH);
494                         }
495                 }
496
497         /*
498     ** Converts a delimited id to a canonical form.
499     ** Post process delimited identifiers to eliminate leading and
500     ** trailing " and convert all occurrences of "" to ".
501     */

502         private static String JavaDoc normalizeDelimitedID(String JavaDoc str)
503         {
504                 str = compressQuotes(str, DOUBLEQUOTES);
505                 return str;
506         }
507         private static boolean isDATETIME(int val)
508         {
509                 if (val == DATE || val == TIME || val == TIMESTAMP)
510                         return true;
511                 else
512                         return false;
513         }
514
515         /*
516      * Generate a multiplicative operator node, if necessary.
517      *
518      * If there are two operands, generate the multiplicative operator
519      * that corresponds to the multiplicativeOperator parameter. If there
520      * is no left operand, just return the right operand.
521      *
522      * @param leftOperand The left operand, null if no operator
523      * @param rightOperand The right operand
524      * @param multiplicativeOperator An identifier from BinaryOperatorNode
525      * telling what operator to generate.
526      *
527      * @return The multiplicative operator, or the right operand if there is
528      * no operator.
529      *
530      * @exception StandardException Thrown on error
531      */

532
533         ValueNode multOp(ValueNode leftOperand,
534                                                         ValueNode rightOperand,
535                                                         int multiplicativeOperator)
536                                         throws StandardException
537         {
538                 if (leftOperand == null)
539                 {
540                         return rightOperand;
541                 }
542
543                 switch (multiplicativeOperator)
544                 {
545                   case BinaryOperatorNode.TIMES:
546                         return (ValueNode) nodeFactory.getNode(
547                                                                         C_NodeTypes.BINARY_TIMES_OPERATOR_NODE,
548                                                                         leftOperand,
549                                                                         rightOperand,
550                                                                         getContextManager());
551
552                   case BinaryOperatorNode.DIVIDE:
553                         return (ValueNode) nodeFactory.getNode(
554                                                                         C_NodeTypes.BINARY_DIVIDE_OPERATOR_NODE,
555                                                                         leftOperand,
556                                                                         rightOperand,
557                                                                         getContextManager());
558                   case BinaryOperatorNode.CONCATENATE:
559                         return (ValueNode) nodeFactory.getNode(
560                                                                         C_NodeTypes.CONCATENATION_OPERATOR_NODE,
561                                                                         leftOperand,
562                                                                         rightOperand,
563                                                                         getContextManager());
564
565                   default:
566                         if (SanityManager.DEBUG)
567                         SanityManager.THROWASSERT("Unexpected multiplicative operator " +
568                                                                                 multiplicativeOperator);
569                         return null;
570                 }
571         }
572
573         /**
574      * Set up and like the parameters to the descriptors.
575      * Set all the ParameterNodes to point to the array of
576      * parameter descriptors.
577      *
578      * @exception StandardException
579      */

580          private void setUpAndLinkParameters()
581                         throws StandardException
582          {
583                 CompilerContext cc = getCompilerContext();
584                 cc.setParameterList(parameterList);
585                 /* Link the untyped parameters to the array of parameter descriptors */
586
587                 DataTypeDescriptor[] descriptors = cc.getParameterTypes();
588
589                 ParameterNode newNode;
590                 ParameterNode oldNode;
591                 int paramCount;
592
593                 /*
594         ** Iterate through the list of untyped parameter nodes, set each one
595         ** to point to the array of parameter descriptors.
596         */

597                 paramCount = -1;
598                 int plSize = parameterList.size();
599                 for (int index = 0; index < plSize; index++)
600                 {
601                         paramCount++;
602
603                         newNode = (ParameterNode) parameterList.elementAt(index);
604                         newNode.setDescriptors(descriptors );
605                 }
606         }
607
608         /**
609      * Initializes the list of unnamed parameters, i.e., "?" parameters
610      *
611      * Usually, this routine just gets an empty list for the unnamed parameters.
612      *
613      *
614      */

615         void initUnnamedParameterList()
616         {
617                 parameterList = new Vector JavaDoc();
618         }
619
620         /**
621      * Makes a new unnamed ParameterNode and chains it onto parameterList.
622      *
623      * @return new unnamed parameter.
624      *
625      * @exception StandardException
626      */

627         ParameterNode makeParameterNode( )
628                                         throws StandardException
629         {
630                 ParameterNode parm;
631                 DataValueDescriptor sdv = null;
632
633                 if ((paramDefaults != null) && (parameterNumber < paramDefaults.length))
634                 {
635                         sdv = (DataValueDescriptor) paramDefaults[parameterNumber];
636                 }
637
638                 parm = (ParameterNode) nodeFactory.getNode(
639                                                                 C_NodeTypes.PARAMETER_NODE,
640                                                                 ReuseFactory.getInteger(parameterNumber),
641                                                                 sdv,
642                                                                 getContextManager());
643
644                 parameterNumber++;
645                 parameterList.addElement(parm);
646
647                 return parm;
648         }
649
650         /**
651      * Looks up an unnamed parameter given its parameter number.
652      *
653      * @param paramNumber Number of parameter in unnamed
654      * parameter list.
655      *
656      * @return corresponding unnamed parameter.
657      *
658      */

659         ParameterNode lookupUnnamedParameter( int paramNumber )
660         {
661                 ParameterNode unnamedParameter;
662
663                 unnamedParameter = (ParameterNode) parameterList.elementAt( paramNumber );
664                 return unnamedParameter;
665         }
666
667         /**
668      * Translate a String containing a number into the appropriate type
669      * of Numeric node.
670      *
671      * @exception StandardException Thrown on error
672      */

673         ValueNode getNumericNode(String JavaDoc num) throws StandardException
674         {
675                 ContextManager cm = getContextManager();
676
677                 // first, see if it might be an integer
678
try
679                 {
680                         return (ValueNode) nodeFactory.getNode(
681                                                                                 C_NodeTypes.INT_CONSTANT_NODE,
682                                                                                 new Integer JavaDoc(num),
683                                                                                 cm);
684                 }
685                 catch (NumberFormatException JavaDoc nfe)
686                 {
687                         // we catch because we want to continue on below
688
}
689
690                 // next, see if it might be a long
691
try
692                 {
693                         return (ValueNode) nodeFactory.getNode(
694                                                                                 C_NodeTypes.LONGINT_CONSTANT_NODE,
695                                                                                 new Long JavaDoc(num),
696                                                                                 cm);
697                 }
698                 catch (NumberFormatException JavaDoc nfe)
699                 {
700                         // we catch because we want to continue on below
701
}
702
703                 return (ValueNode) nodeFactory.getNode(
704                                                                         C_NodeTypes.DECIMAL_CONSTANT_NODE,
705                                                                         num,
706                                                                         cm);
707         }
708         /**
709      * Determine whether the current token represents one of
710      * the built-in aliases.
711      *
712      * @return TRUE iff the current token names a built-in alias
713      */

714         private boolean isBuiltInAlias()
715         {
716                 boolean retval = false;
717
718                 switch (token.kind)
719                 {
720                   case UCASE:
721                   case LCASE:
722                   case SQRT:
723                   case LOCATE:
724                   case ABS:
725                   case ABSVAL:
726                   case SUBSTR:
727                   case MOD:
728                         retval = true;
729                         break;
730
731                   default:
732                         retval = false;
733                         break;
734                 }
735
736
737                 return retval;
738         }
739
740
741         /**
742      * Determine whether the next sequence of tokens represents one of
743      * the common (built-in) datatypes.
744      *
745      * @return TRUE iff the next set of tokens names a common datatype
746      */

747         boolean commonDatatypeName(boolean checkFollowingToken)
748         {
749                 boolean retval = false;
750
751                 switch (getToken(1).kind)
752                 {
753                   case CHARACTER:
754                   case CHAR:
755                   case VARCHAR:
756                   case NVARCHAR:
757                   case NCHAR:
758                   case BIT:
759                   case NUMERIC:
760                   case DECIMAL:
761                   case DEC:
762                   case INTEGER:
763                   case INT:
764                   case SMALLINT:
765                   case LONGINT:
766                   case FLOAT:
767                   case REAL:
768                   case DATE:
769                   case TIME:
770                   case TIMESTAMP:
771                   case BOOLEAN:
772                   case DOUBLE:
773                   case BLOB:
774                   case CLOB:
775                   case NCLOB:
776                   case BINARY: // LARGE OBJECT
777
case XML:
778                         retval = true;
779                         break;
780
781                   case LONG:
782                         if (checkFollowingToken == true)
783                         {
784                                 switch (getToken(2).kind)
785                                 {
786                                   case VARCHAR:
787                                   case NVARCHAR:
788                                   case BINARY:
789                                   case VARBINARY:
790                                   case BIT:
791                                         retval = true;
792                                         break;
793                                 }
794                                 break;
795                         }
796                         else
797                         {
798                                 retval = true;
799                                 break;
800                         }
801
802                   case NATIONAL:
803                         if (checkFollowingToken == true)
804                         {
805                                 switch (getToken(2).kind)
806                                 {
807                                   case CHAR:
808                                   case CHARACTER:
809                                         retval = true;
810                                         break;
811                                 }
812                                 break;
813                         }
814                         else
815                         {
816                                 retval = true;
817                                 break;
818                         }
819                 }
820
821                 return retval;
822         }
823
824         /**
825      * Get a DELETE node given the pieces.
826      *
827      *
828      * @exception StandardException
829      */

830          private QueryTreeNode getDeleteNode(FromTable fromTable,
831                                                                                  TableName tableName,
832                                                                                  ValueNode whereClause)
833                 throws StandardException
834         {
835                 FromList fromList = (FromList) nodeFactory.getNode(
836                                                                 C_NodeTypes.FROM_LIST,
837                                                                 getContextManager());
838                 QueryTreeNode retval;
839                 SelectNode resultSet;
840
841                 fromList.addFromTable(fromTable);
842
843                 resultSet = (SelectNode) nodeFactory.getNode(
844                                                                                 C_NodeTypes.SELECT_NODE,
845                                                                                 null,
846                                                                                 null, /* AGGREGATE list */
847                                                                                 fromList, /* FROM list */
848                                                                                 whereClause, /* WHERE clause */
849                                                                                 null, /* GROUP BY list */
850                                                                                 getContextManager());
851
852                 retval =
853                         (QueryTreeNode) nodeFactory.getNode(
854                                                         C_NodeTypes.DELETE_NODE,
855                                                         tableName,
856                                                         resultSet,
857                                                         getContextManager());
858
859                 setUpAndLinkParameters();
860
861                 return retval;
862         }
863
864         /**
865      * Get an UPDATE node given the pieces.
866      *
867      *
868      * @exception StandardException
869      */

870          private QueryTreeNode getUpdateNode(FromTable fromTable,
871                                                                                  TableName tableName,
872                                                                                  ResultColumnList setClause,
873                                                                                  ValueNode whereClause)
874                 throws StandardException
875         {
876                 FromList fromList = (FromList) nodeFactory.getNode(
877                                                                 C_NodeTypes.FROM_LIST,
878                                                                 getContextManager());
879                 QueryTreeNode retval;
880                 SelectNode resultSet;
881
882                 fromList.addFromTable(fromTable);
883
884                 resultSet = (SelectNode) nodeFactory.getNode(
885                                                                                 C_NodeTypes.SELECT_NODE,
886                                                                                 setClause,
887                                                                                 null, /* AGGREGATE list */
888                                                                                 fromList, /* FROM list */
889                                                                                 whereClause, /* WHERE clause */
890                                                                                 null, /* GROUP BY list */
891                                                                                 getContextManager());
892
893                 retval =
894                         (QueryTreeNode) nodeFactory.getNode(
895                                                         C_NodeTypes.UPDATE_NODE,
896                                                         tableName,
897                                                         resultSet,
898                                                         getContextManager());
899
900                 setUpAndLinkParameters();
901
902                 return retval;
903         }
904
905         /**
906      * Determine whether the next sequence of tokens can be the beginning
907      * of a remainingPredicate() rule.
908      *
909      * @return TRUE iff the next set of tokens is the beginning of a
910      * remainingPredicate()
911      */

912         private boolean remainingPredicateFollows()
913         {
914                 boolean retval = false;
915
916                 switch (getToken(1).kind)
917                 {
918                   case EQUALS_OPERATOR:
919                   case NOT_EQUALS_OPERATOR:
920                   case NOT_EQUALS_OPERATOR2: // !=
921
case LESS_THAN_OPERATOR:
922                   case GREATER_THAN_OPERATOR:
923                   case LESS_THAN_OR_EQUALS_OPERATOR:
924                   case GREATER_THAN_OR_EQUALS_OPERATOR:
925                   case IN:
926                   case LIKE:
927                   case BETWEEN:
928                         retval = true;
929                         break;
930
931                   case NOT:
932                         switch (getToken(2).kind)
933                         {
934                           case IN:
935                           case LIKE:
936                           case BETWEEN:
937                                 retval = true;
938                         }
939                         break;
940                 }
941
942                 return retval;
943         }
944
945
946         /**
947      * Determine whether the next token is a DROP
948      *
949      * @return TRUE iff the next token is DROP
950      */

951         private boolean dropFollows()
952         {
953                 if (getToken(1).kind == DROP)
954                 { return true; }
955                 else { return false; }
956         }
957
958         /**
959      * Determine whether the next sequence of tokens can be the beginning
960      * of a escapedValueFunction().
961      *
962      * We check only for the punctuation here, because identifiers are
963      * very hard to check for in semantic lookahead.
964      *
965      * @return TRUE iff the next set of tokens is the beginning of a
966      * escapedValueFunction()
967      */

968         private boolean escapedValueFunctionFollows()
969         {
970                 if (getToken(1).kind != LEFT_BRACE)
971                 {
972                         return false;
973                 }
974
975                 return getToken(2).kind == FN;
976         }
977
978
979     /**
980        List of JDBC escape functions that map directly onto
981        a function in the SYSFUN schema.
982     */

983         private static final String JavaDoc[] ESCAPED_SYSFUN_FUNCTIONS =
984         {"ACOS", "ASIN", "ATAN", "COS", "SIN", "TAN", "PI",
985          "DEGREES", "RADIANS", "EXP", "LOG", "LOG10", "CEILING", "FLOOR" };
986
987     /**
988        Convert a JDBC escaped function name to a function
989        name in the SYSFUC schema. Returns null if no such
990        function exists.
991     */

992         private String JavaDoc getEscapedSYSFUN(String JavaDoc name)
993         {
994             name = StringUtil.SQLToUpperCase(name);
995
996             for (int i = 0; i < ESCAPED_SYSFUN_FUNCTIONS.length; i++)
997             {
998                 if (ESCAPED_SYSFUN_FUNCTIONS[i].equals(name))
999                     return name;
1000            }
1001            return null;
1002        }
1003
1004        /**
1005     * Determine whether the next sequence of tokens can be the beginning
1006     * of a columnInvocation() rule. columnInvocations start with
1007     * [ [ id . ] id . ] id . id (
1008     *
1009     * We check only for the punctuation here, because identifiers are
1010     * very hard to check for in semantic lookahead.
1011     *
1012     * @return TRUE iff the next set of tokens is the beginning of a
1013     * columnInvocation()
1014     */

1015        private boolean columnMethodInvocationFollows()
1016        {
1017                int tokKind;
1018
1019                // First token must not be a built-in function name that can be
1020
// followed immediately by a PERIOD. There are only a few of
1021
// these - most built-in functions have a LEFT_PAREN following
1022
// the function name.
1023

1024                // if we run out of token, it's probably a syntax error,
1025
// in fact
1026
tokKind = getToken(1).kind;
1027                if ( tokKind == EOF ) { return false; }
1028
1029                // disambiguate from named parameter reference
1030
if ( getToken(1).image.charAt(0) == '?' ) { return false; }
1031
1032                if (tokKind == CURRENT_DATE ||
1033                        tokKind == CURRENT_TIME ||
1034                        tokKind == CURRENT_TIMESTAMP ||
1035                        tokKind == CURRENT && (isDATETIME(getToken(2).kind)) )
1036                {
1037                        return false;
1038                }
1039
1040                // Second token must be a PERIOD
1041
if (getToken(2).kind != PERIOD)
1042                {
1043                        return false;
1044                }
1045
1046                // We have established that we start with " id . "
1047
tokKind = getToken(4).kind;
1048                if (tokKind == LEFT_PAREN)
1049                {
1050                        // id.id(
1051
return true;
1052                }
1053
1054                // Not id.id(, so 4th token must be PERIOD
1055
if (tokKind != PERIOD)
1056                {
1057                        return false;
1058                }
1059
1060                tokKind = getToken(6).kind;
1061                if (tokKind == LEFT_PAREN)
1062                {
1063                        // id.id.id(
1064
return true;
1065                }
1066
1067                // Not id.id.id(, so 6th token must be PERIOD
1068
if (tokKind != PERIOD)
1069                {
1070                        return false;
1071                }
1072
1073                tokKind = getToken(8).kind;
1074                if (tokKind == LEFT_PAREN)
1075                {
1076                        // id.id.id.id(
1077
return true;
1078                }
1079
1080                return false;
1081        }
1082
1083        /**
1084     * Determine whether the next sequence of tokens can be the beginning
1085     * of an aggregateNode()() rule. aggregateNodes() start with one
1086     * of the built-in aggregate names, or with an identifier followed
1087     * by "( DISTINCT". A non-distinct user-defined aggregate invocation
1088     * is treated as a staticMethodInvocationAlias() by the parser,
1089     * and the binding phase figures out what it really is by looking
1090     * at the data dictionary.
1091     *
1092     * We check only for the punctuation here, because identifiers are
1093     * very hard to check for in semantic lookahead.
1094     *
1095     * @return TRUE iff the next set of tokens is the beginning of a
1096     * aggregateNode()
1097     */

1098        private boolean aggregateFollows()
1099        {
1100                boolean retval = false;
1101
1102                switch (getToken(1).kind)
1103                {
1104                  case MAX:
1105                  case AVG:
1106                  case MIN:
1107                  case SUM:
1108                        // This is a built-in aggregate
1109
retval = true;
1110                        break;
1111
1112                  case COUNT:
1113                        // COUNT is not a reserved word
1114
// This may eclipse use of COUNT as a function or a procedure that is probably what we want
1115
if (getToken(2).kind == LEFT_PAREN)
1116                                retval = true;
1117                  default:
1118                        // Not a built-in aggregate - assume the first token is an
1119
// identifier, and see whether it is followed by " ( DISTINCT "
1120
if (getToken(2).kind == LEFT_PAREN && getToken(3).kind == DISTINCT)
1121                                retval = true;
1122                        break;
1123                }
1124
1125                return retval;
1126        }
1127
1128        /**
1129     * Determine whether the next sequence of tokens can be the beginning
1130     * of a miscBuiltins().
1131     *
1132     * We check only for the punctuation here, because identifiers are
1133     * very hard to check for in semantic lookahead.
1134     *
1135     * @return TRUE iff the next set of tokens is the beginning of a
1136     * aggregateNode()
1137     */

1138        private boolean miscBuiltinFollows()
1139        {
1140                boolean retval = false;
1141                int tokKind = getToken(1).kind;
1142
1143                if (getToken(0).kind == CALL)
1144                        retval = true;
1145
1146                switch (tokKind)
1147                {
1148                  case GET_CURRENT_CONNECTION:
1149                  case CURRENT_DATE:
1150                  case CURRENT_TIME:
1151                  case CURRENT_TIMESTAMP:
1152                        retval = true;
1153                        break;
1154
1155                  case CURRENT:
1156                        if (isDATETIME(getToken(2).kind))
1157                                retval = true;
1158                        break;
1159
1160                  case CAST:
1161                  case LEFT_PAREN:
1162                        retval = false;
1163                        break;
1164
1165                  default:
1166                    if (getToken(2).kind == LEFT_PAREN)
1167                                retval = true;
1168                        break;
1169                }
1170
1171                return retval;
1172        }
1173
1174        /**
1175     * Determine whether the next sequence of tokens can be the beginning
1176     * of a subquery. A subquery can begin with an arbitrary number of
1177     * left parentheses, followed by either SELECT or VALUES.
1178     *
1179     * @return TRUE iff the next set of tokens is the beginning of a
1180     * subquery.
1181     */

1182        private boolean subqueryFollows()
1183        {
1184                int tokKind;
1185                boolean retval = false;
1186
1187                for (int i = 1; true; i++)
1188                {
1189                        tokKind = getToken(i).kind;
1190                        if (tokKind == LEFT_PAREN)
1191                        {
1192                                // A subquery can start with an arbitrary number of left
1193
// parentheses.
1194
continue;
1195                        }
1196                        else if (tokKind == SELECT || tokKind == VALUES)
1197                        {
1198                                // If the first token we find after all the left parentheses
1199
// is SELECT or VALUES, it's a subquery.
1200
retval = true;
1201                                break;
1202                        }
1203                        else
1204                        {
1205                                // If the first token we find after all the left parentheses
1206
// is neither SELECT nor VALUES, it's not a subquery.
1207
break;
1208                        }
1209                }
1210
1211                return retval;
1212        }
1213
1214
1215        /**
1216     * Determine whether the next sequence of tokens can be the beginning
1217     * of a rowValueConstructorList. A rowValueConstructorList is a comma-
1218     * separated list of expressions enclosed in parentheses. This presents
1219     * special problems, because an expression be nested within an
1220     * arbitrary number of parentheses. To determine whether a left
1221     * parenthesis introduces a rowValueConstructorList or an expression,
1222     * we need to find the closing parenthesis, and determine whether
1223     * the next token is a comma.
1224     *
1225     * For example, the following is a rowValueConstructorList:
1226     *
1227     * (((1)), 2)
1228     *
1229     * and the following is just an expression:
1230     *
1231     * (((1)))
1232     *
1233     * @return TRUE iff the next set of tokens is the beginning of a
1234     * subquery.
1235     */

1236        private boolean rowValueConstructorListFollows()
1237        {
1238                int nesting;
1239                boolean retval = false;
1240
1241                // A rowValueConstructorList starts with a left parenthesis
1242
if (getToken(1).kind == LEFT_PAREN)
1243                {
1244                        // Keep track of the nesting of parens while looking ahead
1245
nesting = 1;
1246                        for (int i = 2; true; i++)
1247                        {
1248                                int tokKind = getToken(i).kind;
1249
1250                                // Special case for NULL/DEFAULT because they are not allowed in
1251
// a parenthesized expression, so (null)/(default) must be seen
1252
// as a rowValueConstructorList with one element.
1253
if (i == 2 && (tokKind == NULL || tokKind == _DEFAULT))
1254                                {
1255                                        retval = true;
1256                                        break;
1257                                }
1258
1259                                // There must be a COMMA at nesting level 1 (i.e. outside of
1260
// the first expression) for it to be a rowValueConstructorList
1261
if (nesting == 1 && tokKind == COMMA)
1262                                {
1263                                        retval = true;
1264                                        break;
1265                                }
1266
1267                                // If we run out of tokens before finding the last closing
1268
// parenthesis, it's not a rowValueConstructorList (it's
1269
// probably a syntax error, in fact)
1270
if (tokKind == EOF)
1271                                {
1272                                        break;
1273                                }
1274
1275                                // Increase the nesting for each (, and decrease it for each )
1276
if (tokKind == LEFT_PAREN)
1277                                {
1278                                        nesting++;
1279                                }
1280                                else if (tokKind == RIGHT_PAREN)
1281                                {
1282                                        nesting--;
1283                                }
1284
1285                                // Don't look any farther than the last closing parenthesis
1286
if (nesting == 0)
1287                                {
1288                                        break;
1289                                }
1290                        }
1291                }
1292
1293                return retval;
1294        }
1295
1296        /**
1297     * Determine whether the next token is the beginning of a propertyList().
1298     * A properties list is the comment "--derby-properties" followed by a
1299     * dot-separated list, followed by an =, followed by a value all on that
1300     * comment line. This means that the comment should start with the word
1301     * "derby-properties".
1302     *
1303     * @return TRUE iff the next token is derby-properties
1304     */

1305        private boolean derbyPropertiesListFollows()
1306        {
1307                return
1308                        getToken(1).kind == DERBYDASHPROPERTIES;
1309        }
1310
1311        /**
1312     * Determine whether the next sequence of tokens can be the beginning
1313     * of a newInvocation(). A newInvocation() begins with the word "new"
1314     * followed by a dot-separated list of identifiers, followed
1315     * by a left parenthesis.
1316     *
1317     * @param startToken Token to look for new at
1318     *
1319     * @return TRUE iff the next set of tokens is the beginning of a
1320     * newInvocation().
1321     */

1322        private boolean newInvocationFollows(int startToken)
1323        {
1324                boolean retval = false;
1325
1326                // newInvocation() starts with the word "new"
1327
if (getToken(startToken).kind == NEW)
1328                {
1329                        // Look at every other token. Ignore the identifiers, because
1330
// they are hard to test for.
1331
for (int i = 2 + startToken; true; i += 2)
1332                        {
1333                                int tokKind = getToken(i).kind;
1334
1335                                // If we find a left parenthesis without any intervening
1336
// cruft, we have found a newInvocation()
1337
if (tokKind == LEFT_PAREN)
1338                                {
1339                                        retval = true;
1340                                        break;
1341                                }
1342                                else if (tokKind != PERIOD)
1343                                {
1344                                        // Anything other than a PERIOD is "cruft"
1345
break;
1346                                }
1347                        }
1348                }
1349
1350                return retval;
1351        }
1352        /**
1353     * Determine whether the next sequence of tokens is a class name
1354     *
1355     * @return TRUE iff the next set of tokens is the java class name
1356     */

1357        boolean javaClassFollows()
1358        {
1359                boolean retval = false;
1360
1361                // Look at every other token. Ignore the identifiers, because
1362
// they are hard to test for.
1363
for (int i = 2; true; i += 2)
1364                {
1365                        int tokKind = getToken(i).kind;
1366
1367                        // If we find a '::' without any intervening
1368
// cruft, we have found a javaClass
1369
if (tokKind == DOUBLE_COLON)
1370                        {
1371                                retval = true;
1372                                break;
1373                        }
1374                        else if (tokKind != PERIOD)
1375                        {
1376                                // Anything other than a PERIOD is "cruft"
1377
break;
1378                        }
1379                }
1380
1381                return retval;
1382        }
1383
1384        /**
1385     * Determine whether the next sequence of tokens can be the beginning
1386     * of a FROM newInvocation(). A FROM newInvocation() begins with the words "from new"
1387     * followed by a dot-separated list of identifiers, followed
1388     * by a left parenthesis.
1389     *
1390     * @return TRUE iff the next set of tokens is the beginning of a
1391     * FROM newInvocation().
1392     */

1393        private boolean fromNewInvocationFollows()
1394        {
1395                boolean retval = false;
1396
1397                // FROM newInvocation() starts with the words "from new"
1398
return (getToken(1).kind == FROM && newInvocationFollows(2));
1399        }
1400
1401        /**
1402     * Determine whether the next sequence of tokens can be the beginning
1403     * of a joinedTableExpression(). A joinedTableExpression() begins
1404     * with one of:
1405     *
1406     * JOIN
1407     * INNER JOIN
1408     * LEFT OUTER JOIN
1409     * RIGHT OUTER JOIN
1410     *
1411     * @return TRUE iff the next set of tokens is the beginning of a
1412     * joinedTableExpression().
1413     */

1414        private boolean joinedTableExpressionFollows()
1415        {
1416                boolean retval = false;
1417
1418                int tokKind1 = getToken(1).kind;
1419                int tokKind2 = getToken(2).kind;
1420
1421                if (tokKind1 == JOIN)
1422                {
1423                        retval = true;
1424                }
1425                else if (tokKind1 == INNER && tokKind2 == JOIN)
1426                {
1427                        retval = true;
1428                }
1429                else if ((tokKind1 == LEFT || tokKind1 == RIGHT) && tokKind2 == OUTER)
1430                {
1431                        if (getToken(3).kind == JOIN)
1432                        {
1433                                retval = true;
1434                        }
1435                }
1436                else if ((tokKind1 == LEFT || tokKind1 == RIGHT) && tokKind2 == JOIN)
1437                {
1438                        retval = true;
1439                }
1440
1441                return retval;
1442        }
1443
1444        /**
1445     * Translate a token for the name of a built-in aggregate to a String
1446     * containing an aggregate name.
1447     */

1448        private static String JavaDoc aggName(Token token)
1449        {
1450                String JavaDoc retval = null;
1451
1452                switch (token.kind)
1453                {
1454                  case MAX:
1455                        retval = "MAX";
1456                        break;
1457
1458                  case AVG:
1459                    retval = "AVG";
1460                        break;
1461
1462                  case MIN:
1463                    retval = "MIN";
1464                        break;
1465
1466                  case SUM:
1467                    retval = "SUM";
1468                        break;
1469
1470                  case COUNT:
1471                    retval = "COUNT";
1472                        break;
1473
1474                  default:
1475                        if (SanityManager.DEBUG)
1476                        {
1477                                SanityManager.THROWASSERT("Unexpected token type in aggName: " +
1478                                                                                        token.kind);
1479                        }
1480                        break;
1481                }
1482
1483                return retval;
1484        }
1485
1486        /**
1487     * Translate a token for the name of a built-in aggregate to an
1488     * aggregate definition class.
1489     */

1490        private static Class JavaDoc aggClass(Token token)
1491        {
1492                Class JavaDoc retval = null;
1493
1494                switch (token.kind)
1495                {
1496                  case MAX:
1497                  case MIN:
1498                        retval = MaxMinAggregateDefinition.class;
1499                        break;
1500
1501                  case AVG:
1502                  case SUM:
1503                        retval = SumAvgAggregateDefinition.class;
1504                        break;
1505
1506                  case COUNT:
1507                    retval = CountAggregateDefinition.class;
1508                        break;
1509
1510                  default:
1511                        if (SanityManager.DEBUG)
1512                        {
1513                                SanityManager.THROWASSERT("Unexpected token type in aggClass: "
1514                                                                                        + token.kind);
1515                        }
1516                        break;
1517                }
1518
1519                return retval;
1520        }
1521
1522        /**
1523     * Determine whether the next sequence of tokens can be the beginning
1524     * of another element in a PROPERTY list. These elements are of the
1525     * form:
1526     *
1527     * COMMA dot.separated.list = ...
1528     *
1529     * Look for the COMMA, the dots in the dot-separated list, and the =
1530     *
1531     * @return TRUE iff the next set of tokens is the beginning of a
1532     * another element in a PROPERTY list.
1533     */

1534        private boolean anotherPropertyFollows()
1535        {
1536                boolean retval = false;
1537
1538                // Element must start with COMMA
1539
if (getToken(1).kind == COMMA)
1540                {
1541                        // Rest of element is dot-separated list with = at end
1542
int i = 3;
1543                        int tokKind;
1544                        do
1545                        {
1546                                tokKind = getToken(i).kind;
1547
1548                                // If we've found nothing but PERIODs until the EQUALS_OPERATOR
1549
// it is the beginning of another property list element.
1550
if (tokKind == EQUALS_OPERATOR)
1551                                {
1552                                        retval = true;
1553                                        break;
1554                                }
1555
1556                                i += 2;
1557                        } while (tokKind == PERIOD);
1558                }
1559
1560                return retval;
1561        }
1562
1563        /**
1564     * Get one of the several types of create alias nodes.
1565     *
1566     * @param aliasName The name of the alias
1567     * @param fullStaticMethodName The full path/method name
1568     * @param aliasSpecificInfo Information specific to the type of alias being created.
1569     * @param aliasType The type of alias to create
1570     * @param delimitedIdentifier Whether or not to treat the class name
1571     * as a delimited identifier if trying to
1572     * resolve it as a class alias.
1573     *
1574     * @return A CreateAliasNode matching the given parameters
1575     *
1576     * @exception StandardException Thrown on error
1577     */

1578        QueryTreeNode
1579        getCreateAliasNode(
1580                Object JavaDoc aliasName,
1581                String JavaDoc fullStaticMethodName,
1582                Object JavaDoc aliasSpecificInfo,
1583                char aliasType,
1584                Boolean JavaDoc delimitedIdentifier)
1585                throws StandardException
1586        {
1587
1588                StatementNode aliasNode = (StatementNode) getNodeFactory().getCreateAliasNode
1589                        (
1590                                aliasName,
1591                                fullStaticMethodName,
1592                                aliasSpecificInfo,
1593                                aliasType,
1594                                delimitedIdentifier,
1595                                getContextManager()
1596                        );
1597
1598                return aliasNode;
1599        }
1600
1601        /**
1602        Create a node for the drop alias/procedure call.
1603    */

1604        QueryTreeNode
1605        dropAliasNode(Object JavaDoc aliasName, char type) throws StandardException
1606        {
1607
1608                StatementNode stmt = (StatementNode) nodeFactory.getNode(
1609                                                                C_NodeTypes.DROP_ALIAS_NODE,
1610                                                                aliasName,
1611                                                                new Character JavaDoc(type),
1612                                                                getContextManager());
1613
1614                return stmt;
1615        }
1616
1617    /**
1618     * Get a substring node from
1619     * - the string
1620     * - the start position
1621     * - the length
1622     * - a boolean values for specifying the kind of substring function
1623     * @exception StandardException Thrown on error
1624     */

1625    ValueNode getSubstringNode( ValueNode stringValue, ValueNode startPosition,
1626                         ValueNode length, Boolean JavaDoc boolVal ) throws StandardException
1627    {
1628        return (ValueNode) nodeFactory.getNode(
1629                                                C_NodeTypes.SUBSTRING_OPERATOR_NODE,
1630                                                stringValue,
1631                                                startPosition,
1632                                                length,
1633                                                ReuseFactory.getInteger(TernaryOperatorNode.SUBSTRING),
1634                                                null,
1635                                                    getContextManager());
1636    }
1637
1638    final public TableName
1639    qualifiedName(int id_length_limit) throws ParseException, StandardException
1640    {
1641        return qualifiedName( C_NodeTypes.TABLE_NAME, id_length_limit);
1642    }
1643
1644    private void initStatement( String JavaDoc statementSQLText, Object JavaDoc[] paramDefaults)
1645        throws StandardException
1646    {
1647        /* Do per-statement initialization here */
1648        parameterNumber = 0;
1649       this.statementSQLText = statementSQLText;
1650        this.paramDefaults = paramDefaults;
1651        nodeFactory = getNodeFactory();
1652        initUnnamedParameterList();
1653    } // End of initStatement
1654

1655    private void checkIdentifierLengthLimit( String JavaDoc identifier, int identifier_length_limit)
1656        throws StandardException
1657    {
1658        if (identifier.length() > identifier_length_limit)
1659                throw StandardException.newException(SQLState.LANG_IDENTIFIER_TOO_LONG, identifier, String.valueOf(identifier_length_limit));
1660    }
1661
1662    private ValueNode getJdbcIntervalNode( int intervalType) throws StandardException
1663    {
1664        return (ValueNode) nodeFactory.getNode( C_NodeTypes.INT_CONSTANT_NODE,
1665                                                ReuseFactory.getInteger( intervalType),
1666                                                getContextManager());
1667    }
1668
1669        private void checkAuthorizationLength( String JavaDoc authorization)
1670                throws StandardException
1671        {
1672                checkIdentifierLengthLimit( authorization, Limits.DB2_MAX_USERID_LENGTH);
1673        }
1674
1675    /**
1676        Check to see if the required claues have been added
1677        to a procedure or function defintion.
1678        
1679        @param required int array of require clauses
1680        @param clauses the array of declared clauses.
1681    */

1682    void checkRequiredRoutineClause(int[] required, Object JavaDoc[] clauses)
1683        throws StandardException
1684    {
1685        for (int i = 0; i < required.length; i++)
1686        {
1687            int re = required[i];
1688            if (clauses[re] == null)
1689            {
1690                throw StandardException.newException(SQLState.LANG_SYNTAX_ERROR,
1691                                 ROUTINE_CLAUSE_NAMES[re]);
1692                    }
1693                }
1694    }
1695
1696/*
1697 * <A NAME="Statement">Statement</A>
1698 */

1699  final public QueryTreeNode Statement(String JavaDoc statementSQLText, Object JavaDoc[] paramDefaults) throws ParseException, StandardException {
1700        QueryTreeNode statementNode;
1701
1702        initStatement(statementSQLText, paramDefaults);
1703    statementNode = StatementPart(null);
1704    jj_consume_token(0);
1705                {if (true) return statementNode;}
1706    throw new Error JavaDoc("Missing return statement in function");
1707  }
1708
1709  final public QueryTreeNode proceduralStatement(Token[] tokenHolder) throws ParseException, StandardException {
1710        QueryTreeNode statementNode;
1711        tokenHolder[0] = getToken(1);
1712    switch (jj_nt.kind) {
1713    case INSERT:
1714      statementNode = insertStatement();
1715      break;
1716    case UPDATE:
1717      statementNode = preparableUpdateStatement();
1718      break;
1719    case DELETE:
1720      statementNode = preparableDeleteStatement();
1721      break;
1722    case SELECT:
1723    case VALUES:
1724    case LEFT_PAREN:
1725      statementNode = preparableSelectStatement(true);
1726      break;
1727    case CALL:
1728    case LEFT_BRACE:
1729    case QUESTION_MARK:
1730      statementNode = callStatement();
1731      break;
1732    default:
1733      jj_la1[0] = jj_gen;
1734      jj_consume_token(-1);
1735      throw new ParseException();
1736    }
1737                {if (true) return statementNode;}
1738    throw new Error JavaDoc("Missing return statement in function");
1739  }
1740
1741/*
1742 * <A NAME="StatementPart">StatementPart</A>
1743 *
1744 * @param tokenHolder returns the token that starts
1745 * the statement. If null, ignored.
1746 */

1747  final public QueryTreeNode StatementPart(Token[] tokenHolder) throws ParseException, StandardException {
1748        QueryTreeNode statementNode;
1749        //before starting new statements, initialize this variables. Otherwise, the left
1750
//over values from previously failed sql will affect the next sql.
1751
explicitNotNull = false;
1752        explicitNull = false;
1753        explicitlyNullableColumnsList = new Vector JavaDoc();
1754
1755        /*
1756    ** Grab the token preceding this production
1757    */

1758        if (tokenHolder != null)
1759        {
1760                tokenHolder[0] = getToken(1);
1761        }
1762    switch (jj_nt.kind) {
1763    case LOCK:
1764    case RENAME:
1765      switch (jj_nt.kind) {
1766      case RENAME:
1767        statementNode = spsRenameStatement();
1768        break;
1769      case LOCK:
1770        // statementNode = SQLTransactionStatement() |
1771
statementNode = lockStatement();
1772        break;
1773      default:
1774        jj_la1[1] = jj_gen;
1775        jj_consume_token(-1);
1776        throw new ParseException();
1777      }
1778        {if (true) return statementNode;}
1779      break;
1780    default:
1781      jj_la1[4] = jj_gen;
1782      if (jj_2_2(1)) {
1783        switch (jj_nt.kind) {
1784        case CREATE:
1785          statementNode = createStatements();
1786          break;
1787        case DROP:
1788          statementNode = dropStatements();
1789          break;
1790        case ALTER:
1791          statementNode = spsAlterStatement();
1792          break;
1793        case DECLARE:
1794          statementNode = globalTemporaryTableDeclaration();
1795          break;
1796        case DELETE:
1797        case INSERT:
1798        case ROLLBACK:
1799        case SELECT:
1800        case UPDATE:
1801        case VALUES:
1802        case RELEASE:
1803        case SAVEPOINT:
1804        case CALL:
1805        case LEFT_BRACE:
1806        case LEFT_PAREN:
1807        case QUESTION_MARK:
1808          statementNode = preparableSQLDataStatement();
1809          break;
1810        default:
1811          jj_la1[2] = jj_gen;
1812          if (jj_2_1(1)) {
1813            statementNode = spsSetStatement();
1814          } else {
1815            switch (jj_nt.kind) {
1816            case TRUNCATE:
1817              statementNode = truncateTableStatement();
1818              break;
1819            case GRANT:
1820              statementNode = grantStatement();
1821              break;
1822            case REVOKE:
1823              statementNode = revokeStatement();
1824              break;
1825            case EXECUTE:
1826              statementNode = execStatement();
1827              break;
1828            default:
1829              jj_la1[3] = jj_gen;
1830              jj_consume_token(-1);
1831              throw new ParseException();
1832            }
1833          }
1834        }
1835        {if (true) return statementNode;}
1836      } else {
1837        jj_consume_token(-1);
1838        throw new ParseException();
1839      }
1840    }
1841    throw new Error JavaDoc("Missing return statement in function");
1842  }
1843
1844/*
1845 * <A NAME="createStatements">spsCreateStatement</A>
1846 */

1847  final public QueryTreeNode createStatements() throws ParseException, StandardException {
1848        QueryTreeNode statementNode;
1849        Token beginToken;
1850        int tokKind;
1851    beginToken = jj_consume_token(CREATE);
1852    switch (jj_nt.kind) {
1853    case SCHEMA:
1854    case VIEW:
1855    case SYNONYM:
1856    case TRIGGER:
1857      switch (jj_nt.kind) {
1858      case SCHEMA:
1859        statementNode = schemaDefinition();
1860        break;
1861      case VIEW:
1862        statementNode = viewDefinition(beginToken);
1863        break;
1864      case TRIGGER:
1865        statementNode = triggerDefinition();
1866        break;
1867      case SYNONYM:
1868        statementNode = synonymDefinition();
1869        break;
1870      default:
1871        jj_la1[5] = jj_gen;
1872        jj_consume_token(-1);
1873        throw new ParseException();
1874      }
1875
1876      break;
1877    case TABLE:
1878      statementNode = tableDefinition();
1879
1880      break;
1881    case PROCEDURE:
1882      statementNode = procedureDefinition();
1883      break;
1884    case FUNCTION:
1885      statementNode = functionDefinition();
1886      break;
1887    case UNIQUE:
1888    case INDEX:
1889      statementNode = indexDefinition();
1890
1891      break;
1892    default:
1893      jj_la1[6] = jj_gen;
1894      jj_consume_token(-1);
1895      throw new ParseException();
1896    }
1897                {if (true) return statementNode;}
1898    throw new Error JavaDoc("Missing return statement in function");
1899  }
1900
1901/*
1902 * <A NAME="dropStatements">spsDropStatement</A>
1903 */

1904  final public QueryTreeNode dropStatements() throws ParseException, StandardException {
1905        QueryTreeNode statementNode;
1906    jj_consume_token(DROP);
1907    switch (jj_nt.kind) {
1908    case SCHEMA:
1909      statementNode = dropSchemaStatement();
1910      break;
1911    case TABLE:
1912      statementNode = dropTableStatement();
1913      break;
1914    case INDEX:
1915      statementNode = dropIndexStatement();
1916      break;
1917    case FUNCTION:
1918    case PROCEDURE:
1919    case SYNONYM:
1920      statementNode = dropAliasStatement();
1921      break;
1922    case VIEW:
1923      statementNode = dropViewStatement();
1924      break;
1925    case TRIGGER:
1926      statementNode = dropTriggerStatement();
1927      break;
1928    default:
1929      jj_la1[7] = jj_gen;
1930      jj_consume_token(-1);
1931      throw new ParseException();
1932    }
1933                {if (true) return statementNode;}
1934    throw new Error JavaDoc("Missing return statement in function");
1935  }
1936
1937/*
1938 * <A NAME="spsAlterStatement">spsAlterStatement</A>
1939 */

1940  final public QueryTreeNode spsAlterStatement() throws ParseException, StandardException {
1941        QueryTreeNode statementNode;
1942    jj_consume_token(ALTER);
1943    statementNode = alterTableStatement();
1944                {if (true) return statementNode;}
1945    throw new Error JavaDoc("Missing return statement in function");
1946  }
1947
1948/*
1949 * <A NAME="spsSetStatement">spsSetStatement</A>
1950 */

1951  final public QueryTreeNode spsSetStatement() throws ParseException, StandardException {
1952        QueryTreeNode statementNode;
1953    if (getToken(1).kind == SET && getToken(2).kind != CURRENT) {
1954      jj_consume_token(SET);
1955      if (jj_2_3(1)) {
1956        statementNode = setIsolationStatement();
1957      } else if (jj_2_4(1)) {
1958        statementNode = setSchemaStatement();
1959      } else {
1960        switch (jj_nt.kind) {
1961        case MESSAGE_LOCALE:
1962          statementNode = setMessageLocaleStatement();
1963          break;
1964        default:
1965          jj_la1[8] = jj_gen;
1966          jj_consume_token(-1);
1967          throw new ParseException();
1968        }
1969      }
1970                {if (true) return statementNode;}
1971    } else if (getToken(1).kind == SET && getToken(2).kind == CURRENT) {
1972      jj_consume_token(SET);
1973      if (jj_2_5(1)) {
1974        statementNode = setSchemaStatement();
1975      } else if (jj_2_6(1)) {
1976        statementNode = setIsolationStatement();
1977      } else {
1978        jj_consume_token(-1);
1979        throw new ParseException();
1980      }
1981                {if (true) return statementNode;}
1982    } else {
1983      jj_consume_token(-1);
1984      throw new ParseException();
1985    }
1986    throw new Error JavaDoc("Missing return statement in function");
1987  }
1988
1989/*
1990 * <A NAME="preparableSQLDataStatement">preparableSQLDataStatement</A>
1991 *
1992 * preparableSQLDataStatement differs from
1993 * directSQLDataStatement in that it
1994 * supports positioned update and delete
1995 * and a preparable select (with FOR UPDATE)
1996 * instead of a direct select (without FOR UPDATE)
1997 */

1998  final public QueryTreeNode preparableSQLDataStatement() throws ParseException, StandardException {
1999        QueryTreeNode dmlStatement;
2000    switch (jj_nt.kind) {
2001    case DELETE:
2002      /*
2003        ** RESOLVE: Ignoring temporary table declarations for now.
2004        */

2005              dmlStatement = preparableDeleteStatement();
2006                {if (true) return dmlStatement;}
2007      break;
2008    case SELECT:
2009    case VALUES:
2010    case LEFT_PAREN:
2011      dmlStatement = preparableSelectStatement(true);
2012                {if (true) return dmlStatement;}
2013      break;
2014    case INSERT:
2015      dmlStatement = insertStatement();
2016                {if (true) return dmlStatement;}
2017      break;
2018    case UPDATE:
2019      dmlStatement = preparableUpdateStatement();
2020                {if (true) return dmlStatement;}
2021      break;
2022    case CALL:
2023    case LEFT_BRACE:
2024    case QUESTION_MARK:
2025      dmlStatement = callStatement();
2026                {if (true) return dmlStatement;}
2027      break;
2028    case ROLLBACK:
2029    case RELEASE:
2030    case SAVEPOINT:
2031      dmlStatement = savepointStatement();
2032                {if (true) return dmlStatement;}
2033      break;
2034    default:
2035      jj_la1[9] = jj_gen;
2036      jj_consume_token(-1);
2037      throw new ParseException();
2038    }
2039    throw new Error JavaDoc("Missing return statement in function");
2040  }
2041
2042/*
2043 * <A NAME="preparableDeleteStatement">preparableDeleteStatement</A>
2044 *
2045 * This may be a search or positioned delete statement.
2046 */

2047  final public QueryTreeNode preparableDeleteStatement() throws ParseException, StandardException {
2048        QueryTreeNode qtn;
2049    jj_consume_token(DELETE);
2050    qtn = deleteBody();
2051                {if (true) return qtn;}
2052    throw new Error JavaDoc("Missing return statement in function");
2053  }
2054
2055  final public QueryTreeNode deleteBody() throws ParseException, StandardException {
2056        JavaToSQLValueNode javaToSQLNode = null;
2057        String JavaDoc correlationName = null;
2058        TableName tableName = null;
2059        ValueNode whereClause = null;
2060        FromTable fromTable = null;
2061        QueryTreeNode retval;
2062        Properties targetProperties = null;
2063        Token whereToken = null;
2064    if (fromNewInvocationFollows()) {
2065      jj_consume_token(FROM);
2066      javaToSQLNode = newInvocation();
2067      switch (jj_nt.kind) {
2068      case WHERE:
2069        whereToken = jj_consume_token(WHERE);
2070        whereClause = whereClause(whereToken);
2071        break;
2072      default:
2073        jj_la1[10] = jj_gen;
2074        ;
2075      }
2076                fromTable = (FromTable) nodeFactory.getNode(
2077                                                                        C_NodeTypes.FROM_VTI,
2078                                                                        javaToSQLNode.getJavaValueNode(),
2079                                                                        (String JavaDoc) null,
2080                                                                        null,
2081                                                                        (Properties) null,
2082                                                                        getContextManager());
2083
2084                {if (true) return getDeleteNode(fromTable, tableName, whereClause);}
2085    } else {
2086      switch (jj_nt.kind) {
2087      case FROM:
2088        jj_consume_token(FROM);
2089        tableName = qualifiedName(Limits.MAX_IDENTIFIER_LENGTH);
2090        if ((getToken(1).kind != EOF) && (getToken(1).kind != WHERE) && !derbyPropertiesListFollows()) {
2091          switch (jj_nt.kind) {
2092          case AS:
2093            jj_consume_token(AS);
2094            break;
2095          default:
2096            jj_la1[11] = jj_gen;
2097            ;
2098          }
2099          correlationName = identifier(Limits.MAX_IDENTIFIER_LENGTH, true);
2100        } else {
2101          ;
2102        }
2103        switch (jj_nt.kind) {
2104        case DERBYDASHPROPERTIES:
2105          targetProperties = propertyList(false);
2106          jj_consume_token(CHECK_PROPERTIES);
2107          break;
2108        default:
2109          jj_la1[12] = jj_gen;
2110          ;
2111        }
2112        switch (jj_nt.kind) {
2113        case WHERE:
2114          whereToken = jj_consume_token(WHERE);
2115          if ((getToken(1).kind == CURRENT) &&
2116                                                   (getToken(2).kind == OF)) {
2117            fromTable = currentOfClause(correlationName);
2118          } else if (jj_2_7(1)) {
2119            whereClause = whereClause(whereToken);
2120          } else {
2121            jj_consume_token(-1);
2122            throw new ParseException();
2123          }
2124          break;
2125        default:
2126          jj_la1[13] = jj_gen;
2127          ;
2128        }
2129                /* Fabricate a ResultSetNode (SelectNode) under the DeleteNode.
2130         * For a searched delete,
2131         * The FromList is simply the table that we are deleting from.
2132         * (NOTE - we mark the table as the one that we are deleting from.)
2133         * For a positioned delete,
2134         * the FromList is a CurrentOfNode holding the cursor name.
2135         * The select list will be null for now. We will generate it at
2136         * bind time, in keeping with the design decision that the parser's
2137         * output should look like the language.
2138         */

2139                if (fromTable == null)
2140                        fromTable = (FromTable) nodeFactory.getNode(
2141                                                                                C_NodeTypes.FROM_BASE_TABLE,
2142                                                                                tableName,
2143                                                                                correlationName,
2144                                                                                ReuseFactory.getInteger(
2145                                                                                                FromBaseTable.DELETE),
2146                                                                                null,
2147                                                                                getContextManager());
2148
2149                /* Update the FromTable with any properties, if non-null */
2150                if (targetProperties != null)
2151                {
2152                        if (SanityManager.DEBUG)
2153                        {
2154                                if (((FromBaseTable) fromTable).getProperties() != null)
2155                                {
2156                                        SanityManager.THROWASSERT(
2157                                                "Overwriting existing properties");
2158                                }
2159                        }
2160                        ((FromBaseTable) fromTable).setTableProperties(targetProperties);
2161                }
2162
2163                {if (true) return getDeleteNode(fromTable, tableName, whereClause);}
2164        break;
2165      default:
2166        jj_la1[14] = jj_gen;
2167        jj_consume_token(-1);
2168        throw new ParseException();
2169      }
2170    }
2171    throw new Error JavaDoc("Missing return statement in function");
2172  }
2173
2174/*
2175 * <A NAME="currentOfClause">currentOfClause</A>
2176 */

2177  final public FromTable currentOfClause(String JavaDoc correlationName) throws ParseException, StandardException {
2178        String JavaDoc cursorName = null;
2179    jj_consume_token(CURRENT);
2180    jj_consume_token(OF);
2181    cursorName = identifier(Limits.MAX_IDENTIFIER_LENGTH, true);
2182                {if (true) return (FromTable) nodeFactory.getNode(
2183                                                                C_NodeTypes.CURRENT_OF_NODE,
2184                                                                correlationName,
2185                                                                cursorName,
2186                                                                null,
2187                                                                getContextManager());}
2188    throw new Error JavaDoc("Missing return statement in function");
2189  }
2190
2191/*
2192 * <A NAME="preparableSelectStatement">preparableSelectStatement</A>
2193 *
2194 *
2195 * The preparable select statement is a superset of
2196 * the directSelectStatementMultipleRows in that it
2197 * allows both the preparable single row select statement
2198 * (a query expression that returns one row, although it
2199 * is also handled like a cursor) and the preparable
2200 * multiple row select statement, which allows not only
2201 * an order by clause but also a for update clause.
2202 */

2203  final public CursorNode preparableSelectStatement(boolean checkParams) throws ParseException, StandardException {
2204        ResultSetNode queryExpression;
2205        Vector JavaDoc updateColumns = new Vector JavaDoc();
2206        int forUpdateState = CursorNode.UNSPECIFIED;
2207        int isolationLevel = ExecutionContext.UNSPECIFIED_ISOLATION_LEVEL;
2208        CursorNode retval;
2209        OrderByList orderCols = null;
2210    queryExpression = queryExpression(null, NO_SET_OP);
2211    switch (jj_nt.kind) {
2212    case ORDER:
2213      orderCols = orderByClause();
2214      break;
2215    default:
2216      jj_la1[15] = jj_gen;
2217      ;
2218    }
2219    switch (jj_nt.kind) {
2220    case FOR:
2221      jj_consume_token(FOR);
2222      forUpdateState = forUpdateClause(updateColumns);
2223      break;
2224    default:
2225      jj_la1[16] = jj_gen;
2226      ;
2227    }
2228    switch (jj_nt.kind) {
2229    case WITH:
2230      isolationLevel = atIsolationLevel();
2231      break;
2232    default:
2233      jj_la1[17] = jj_gen;
2234      ;
2235    }
2236                // Note: if order by is specified, the for update clause
2237
// must be READ ONLY or empty, and the cursor
2238
// is implicitly READ_ONLY.
2239

2240                retval = (CursorNode) nodeFactory.getNode(
2241                                C_NodeTypes.CURSOR_NODE,
2242                                "SELECT",
2243                                queryExpression,
2244                                null,
2245                                orderCols,
2246                                ReuseFactory.getInteger(forUpdateState),
2247                                (forUpdateState == CursorNode.READ_ONLY ? null : updateColumns ),
2248                                getContextManager());
2249
2250                if (checkParams)
2251                {
2252                        setUpAndLinkParameters();
2253                }
2254
2255                /* Set the isolation levels for the scans if specified */
2256                if (isolationLevel != ExecutionContext.UNSPECIFIED_ISOLATION_LEVEL)
2257                {
2258                        getCompilerContext().setScanIsolationLevel(isolationLevel);
2259                }
2260
2261                {if (true) return retval;}
2262    throw new Error JavaDoc("Missing return statement in function");
2263  }
2264
2265/*
2266 * <A NAME="insertStatement">insertStatement</A>
2267 */

2268  final public QueryTreeNode insertStatement() throws ParseException, StandardException {
2269        QueryTreeNode insertNode;
2270        QueryTreeNode targetTable;
2271    jj_consume_token(INSERT);
2272    jj_consume_token(INTO);
2273    targetTable = targetTable();
2274    insertNode = insertColumnsAndSource(targetTable);
2275                setUpAndLinkParameters();
2276
2277                {if (true) return insertNode;}
2278    throw new Error JavaDoc("Missing return statement in function");
2279  }
2280
2281  final public QueryTreeNode targetTable() throws ParseException, StandardException {
2282        JavaToSQLValueNode javaToSQLNode = null;
2283        String JavaDoc correlationName = null;
2284        TableName tableName;
2285    if (newInvocationFollows(1)) {
2286      javaToSQLNode = newInvocation();
2287                {if (true) return (QueryTreeNode) nodeFactory.getNode(
2288                                                                C_NodeTypes.FROM_VTI,
2289                                                                javaToSQLNode.getJavaValueNode(),
2290                                                                correlationName,
2291                                                                null,
2292                                                                (Properties) null,
2293                                                                getContextManager());}
2294    } else {
2295      switch (jj_nt.kind) {
2296      case BINARY:
2297      case COALESCE:
2298      case COUNT:
2299      case D:
2300      case MODULE:
2301      case T:
2302      case TS:
2303      case VALUE:
2304      case VARBINARY:
2305      case ABS:
2306      case ABSVAL:
2307      case ACTION:
2308      case ALWAYS:
2309      case BLOB:
2310      case C:
2311      case CALLED:
2312      case CLOB:
2313      case COBOL:
2314      case COMMITTED:
2315      case CONCAT:
2316      case CONTAINS:
2317      case DATA:
2318      case DATE:
2319      case DAY:
2320      case DYNAMIC:
2321      case FORTRAN:
2322      case GENERATED:
2323      case IDENTITY_VAL_LOCAL:
2324      case INCREMENT:
2325      case INITIAL:
2326      case INTERVAL:
2327      case LANGUAGE:
2328      case LARGE:
2329      case LENGTH:
2330      case LEVEL:
2331      case LOCKS:
2332      case LOCKSIZE:
2333      case LOGGED:
2334      case MOD:
2335      case MODIFIES:
2336      case MODIFY:
2337      case MONTH:
2338      case _MORE:
2339      case MUMPS:
2340      case NAME:
2341      case NCLOB:
2342      case NULLABLE:
2343      case NUMBER:
2344      case OBJECT:
2345      case PASCAL:
2346      case PLI:
2347      case PRECISION:
2348      case RELEASE:
2349      case REPEATABLE:
2350      case RESTART:
2351      case RETURNS:
2352      case ROW:
2353      case SAVEPOINT:
2354      case SCALE:
2355      case SERIALIZABLE:
2356      case SQL_TSI_FRAC_SECOND:
2357      case SQL_TSI_SECOND:
2358      case SQL_TSI_MINUTE:
2359      case SQL_TSI_HOUR:
2360      case SQL_TSI_DAY:
2361      case SQL_TSI_WEEK:
2362      case SQL_TSI_MONTH:
2363      case SQL_TSI_QUARTER:
2364      case SQL_TSI_YEAR:
2365      case START:
2366      case STATEMENT:
2367      case SYNONYM:
2368      case THEN:
2369      case TIME:
2370      case TIMESTAMP:
2371      case TIMESTAMPADD:
2372      case TIMESTAMPDIFF:
2373      case TRUNCATE:
2374      case TYPE:
2375      case UNCOMMITTED:
2376      case USAGE:
2377      case WHEN:
2378      case CURDATE:
2379      case CURTIME:
2380      case DATABASE:
2381      case LONG:
2382      case AFTER:
2383      case BEFORE:
2384      case CLASS:
2385      case COMPRESS:
2386      case CONTENT:
2387      case CS:
2388      case DB2SQL:
2389      case DIRTY:
2390      case DOCUMENT:
2391      case EACH:
2392      case EMPTY:
2393      case EXCLUSIVE:
2394      case FN:
2395      case INDEX:
2396      case JAVA:
2397      case LCASE:
2398      case LOCATE:
2399      case LOCK:
2400      case MESSAGE_LOCALE:
2401      case METHOD:
2402      case MODE:
2403      case NEW:
2404      case NEW_TABLE:
2405      case OJ:
2406      case OFF:
2407      case OLD:
2408      case OLD_TABLE:
2409      case PARAMETER:
2410      case PASSING:
2411      case PROPERTIES:
2412      case READS:
2413      case REF:
2414      case REFERENCING:
2415      case RENAME:
2416      case RESET:
2417      case RESULT:
2418      case RETAIN:
2419      case RETURNING:
2420      case RR:
2421      case RS:
2422      case SEQUENCE:
2423      case SEQUENTIAL:
2424      case SETS:
2425      case SHARE:
2426      case SQLID:
2427      case SPECIFIC:
2428      case SQRT:
2429      case STABILITY:
2430      case STRIP:
2431      case STYLE:
2432      case TRIGGER:
2433      case UCASE:
2434      case UR:
2435      case WHITESPACE:
2436      case IDENTIFIER:
2437      case DELIMITED_IDENTIFIER:
2438        tableName = qualifiedName(Limits.MAX_IDENTIFIER_LENGTH);
2439                {if (true) return (QueryTreeNode) tableName;}
2440        break;
2441      default:
2442        jj_la1[18] = jj_gen;
2443        jj_consume_token(-1);
2444        throw new ParseException();
2445      }
2446    }
2447    throw new Error JavaDoc("Missing return statement in function");
2448  }
2449
2450/*
2451 * <A NAME="preparableUpdateStatement">preparableUpdateStatement</A>
2452 */

2453  final public QueryTreeNode preparableUpdateStatement() throws ParseException, StandardException {
2454        QueryTreeNode qtn;
2455    jj_consume_token(UPDATE);
2456    qtn = updateBody();
2457                {if (true) return qtn;}
2458    throw new Error JavaDoc("Missing return statement in function");
2459  }
2460
2461  final public boolean tableOrIndex() throws ParseException {
2462    switch (jj_nt.kind) {
2463    case TABLE:
2464      jj_consume_token(TABLE);
2465                {if (true) return true;}
2466      break;
2467    case INDEX:
2468      jj_consume_token(INDEX);
2469                {if (true) return false;}
2470      break;
2471    default:
2472      jj_la1[19] = jj_gen;
2473      jj_consume_token(-1);
2474      throw new ParseException();
2475    }
2476    throw new Error JavaDoc("Missing return statement in function");
2477  }
2478
2479  final public QueryTreeNode updateBody() throws ParseException, StandardException {
2480        ResultColumnList columnList;
2481        String JavaDoc correlationName = null;
2482        JavaToSQLValueNode javaToSQLNode = null;
2483        TableName tableName = null;
2484        ValueNode whereClause = null;
2485        FromTable fromTable = null;
2486        Properties targetProperties = null;
2487        Token whereToken = null;
2488    if (newInvocationFollows(1)) {
2489      javaToSQLNode = newInvocation();
2490      jj_consume_token(SET);
2491      columnList = setClauseList();
2492      switch (jj_nt.kind) {
2493      case WHERE:
2494        whereToken = jj_consume_token(WHERE);
2495        whereClause = whereClause(whereToken);
2496        break;
2497      default:
2498        jj_la1[20] = jj_gen;
2499        ;
2500      }
2501                fromTable = (FromTable) nodeFactory.getNode(
2502                                                                        C_NodeTypes.FROM_VTI,
2503                                                                        javaToSQLNode.getJavaValueNode(),
2504                                                                        (String JavaDoc) null,
2505                                                                        null,
2506                                                                        (Properties) null,
2507                                                                        getContextManager());
2508
2509                {if (true) return getUpdateNode(fromTable, tableName, columnList, whereClause);}
2510    } else {
2511      switch (jj_nt.kind) {
2512      case BINARY:
2513      case COALESCE:
2514      case COUNT:
2515      case D:
2516      case MODULE:
2517      case T:
2518      case TS:
2519      case VALUE:
2520      case VARBINARY:
2521      case ABS:
2522      case ABSVAL:
2523      case ACTION:
2524      case ALWAYS:
2525      case BLOB:
2526      case C:
2527      case CALLED:
2528      case CLOB:
2529      case COBOL:
2530      case COMMITTED:
2531      case CONCAT:
2532      case CONTAINS:
2533      case DATA:
2534      case DATE:
2535      case DAY:
2536      case DYNAMIC:
2537      case FORTRAN:
2538      case GENERATED:
2539      case IDENTITY_VAL_LOCAL:
2540      case INCREMENT:
2541      case INITIAL:
2542      case INTERVAL:
2543      case LANGUAGE:
2544      case LARGE:
2545      case LENGTH:
2546      case LEVEL:
2547      case LOCKS:
2548      case LOCKSIZE:
2549      case LOGGED:
2550      case MOD:
2551      case MODIFIES:
2552      case MODIFY:
2553      case MONTH:
2554      case _MORE:
2555      case MUMPS:
2556      case NAME:
2557      case NCLOB:
2558      case NULLABLE:
2559      case NUMBER:
2560      case OBJECT:
2561      case PASCAL:
2562      case PLI:
2563      case PRECISION:
2564      case RELEASE:
2565      case REPEATABLE:
2566      case RESTART:
2567      case RETURNS:
2568      case ROW:
2569      case SAVEPOINT:
2570      case SCALE:
2571      case SERIALIZABLE:
2572      case SQL_TSI_FRAC_SECOND:
2573      case SQL_TSI_SECOND:
2574      case SQL_TSI_MINUTE:
2575      case SQL_TSI_HOUR:
2576      case SQL_TSI_DAY:
2577      case SQL_TSI_WEEK:
2578      case SQL_TSI_MONTH:
2579      case SQL_TSI_QUARTER:
2580      case SQL_TSI_YEAR:
2581      case START:
2582      case STATEMENT:
2583      case SYNONYM:
2584      case THEN:
2585      case TIME:
2586      case TIMESTAMP:
2587      case TIMESTAMPADD:
2588      case TIMESTAMPDIFF:
2589      case TRUNCATE:
2590      case TYPE:
2591      case UNCOMMITTED:
2592      case USAGE:
2593      case WHEN:
2594      case CURDATE:
2595      case CURTIME:
2596      case DATABASE:
2597      case LONG:
2598      case AFTER:
2599      case BEFORE:
2600      case CLASS:
2601      case COMPRESS:
2602      case CONTENT:
2603      case CS:
2604      case DB2SQL:
2605      case DIRTY:
2606      case DOCUMENT:
2607      case EACH:
2608      case EMPTY:
2609      case EXCLUSIVE:
2610      case FN:
2611      case INDEX:
2612      case JAVA:
2613      case LCASE:
2614      case LOCATE:
2615      case LOCK:
2616      case MESSAGE_LOCALE:
2617      case METHOD:
2618      case MODE:
2619      case NEW:
2620      case NEW_TABLE:
2621      case OJ:
2622      case OFF:
2623      case OLD:
2624      case OLD_TABLE:
2625      case PARAMETER:
2626      case PASSING:
2627      case PROPERTIES:
2628      case READS:
2629      case REF:
2630      case REFERENCING:
2631      case RENAME:
2632      case RESET:
2633      case RESULT:
2634      case RETAIN:
2635      case RETURNING:
2636      case RR:
2637      case RS:
2638      case SEQUENCE:
2639      case SEQUENTIAL:
2640      case SETS:
2641      case SHARE:
2642      case SQLID:
2643      case SPECIFIC:
2644      case SQRT:
2645      case STABILITY:
2646      case STRIP:
2647      case STYLE:
2648      case TRIGGER:
2649      case UCASE:
2650      case UR:
2651      case WHITESPACE:
2652      case IDENTIFIER:
2653      case DELIMITED_IDENTIFIER:
2654        tableName = qualifiedName(Limits.MAX_IDENTIFIER_LENGTH);
2655        if ((getToken(1).kind != SET) && !derbyPropertiesListFollows()) {
2656          switch (jj_nt.kind) {
2657          case AS:
2658            jj_consume_token(AS);
2659            break;
2660          default:
2661            jj_la1[21] = jj_gen;
2662            ;
2663          }
2664          correlationName = identifier(Limits.MAX_IDENTIFIER_LENGTH, true);
2665        } else {
2666          ;
2667        }
2668        switch (jj_nt.kind) {
2669        case DERBYDASHPROPERTIES:
2670          targetProperties = propertyList(false);
2671          jj_consume_token(CHECK_PROPERTIES);
2672          break;
2673        default:
2674          jj_la1[22] = jj_gen;
2675          ;
2676        }
2677        jj_consume_token(SET);
2678        columnList = setClauseList();
2679        switch (jj_nt.kind) {
2680        case WHERE:
2681          whereToken = jj_consume_token(WHERE);
2682          if (jj_2_8(1)) {
2683            whereClause = whereClause(whereToken);
2684          } else {
2685            switch (jj_nt.kind) {
2686            case CURRENT:
2687              fromTable = currentOfClause(correlationName);
2688              break;
2689            default:
2690              jj_la1[23] = jj_gen;
2691              jj_consume_token(-1);
2692              throw new ParseException();
2693            }
2694          }
2695          break;
2696        default:
2697          jj_la1[24] = jj_gen;
2698          ;
2699        }
2700                /* Fabricate a ResultSetNode (SelectNode) under the UpdateNode.
2701         * For a searched update,
2702         * The FromList is simply the table that we are updating.
2703         * For a positioned update,
2704         * the FromList is a CurrentOfNode holding the cursor name.
2705         * (NOTE - we mark the table as the one that we are updating.)
2706         * The select list is the columns in the SET clause. At bind time,
2707         * we will prepend the CurrentRowLocation() in keeping with the design
2708         * decision that the parser's output should look like the language.
2709         */

2710                if (fromTable == null)
2711                        fromTable = (FromTable) nodeFactory.getNode(
2712                                                                                C_NodeTypes.FROM_BASE_TABLE,
2713                                                                                tableName,
2714                                                                                correlationName,
2715                                                                                ReuseFactory.getInteger(
2716                                                                                                                FromBaseTable.UPDATE),
2717                                                                                null,
2718                                                                                getContextManager());
2719
2720                /* Update the FromTable with any properties, if non-null */
2721                if (targetProperties != null)
2722                {
2723                        if (SanityManager.DEBUG)
2724                        {
2725                                if (((FromBaseTable) fromTable).getProperties() != null)
2726                                {
2727                                        SanityManager.THROWASSERT(
2728                                                "Overwriting existing properties");
2729                                }
2730                        }
2731                        ((FromBaseTable) fromTable).setTableProperties(targetProperties);
2732                }
2733                {if (true) return getUpdateNode(fromTable, tableName, columnList, whereClause);}
2734        break;
2735      default:
2736        jj_la1[25] = jj_gen;
2737        jj_consume_token(-1);
2738        throw new ParseException();
2739      }
2740    }
2741    throw new Error JavaDoc("Missing return statement in function");
2742  }
2743
2744/*
2745 * <A NAME="callStatement">callStatement</A>
2746 */

2747  final public QueryTreeNode callStatement() throws ParseException, StandardException {
2748        QueryTreeNode retval;
2749    switch (jj_nt.kind) {
2750    case CALL:
2751    case QUESTION_MARK:
2752      retval = bareCallStatement();
2753      break;
2754    case LEFT_BRACE:
2755      jj_consume_token(LEFT_BRACE);
2756      retval = bareCallStatement();
2757      jj_consume_token(RIGHT_BRACE);
2758      break;
2759    default:
2760      jj_la1[26] = jj_gen;
2761      jj_consume_token(-1);
2762      throw new ParseException();
2763    }
2764                {if (true) return retval;}
2765    throw new Error JavaDoc("Missing return statement in function");
2766  }
2767
2768/*
2769 * <A NAME="bareCallStatement">baseCallStatement</A>
2770 */

2771  final public QueryTreeNode bareCallStatement() throws ParseException, StandardException {
2772        ParameterNode returnParam = null;
2773
2774        ValueNode value = null;
2775
2776        ResultSetNode resultSetNode = null;
2777    switch (jj_nt.kind) {
2778    case CALL:
2779      jj_consume_token(CALL);
2780      value = primaryExpression(true);
2781                if (! (value instanceof JavaToSQLValueNode) ||
2782                        ! (((JavaToSQLValueNode) value).getJavaValueNode() instanceof MethodCallNode))
2783                {
2784                        {if (true) throw StandardException.newException(SQLState.LANG_INVALID_CALL_STATEMENT);}
2785                }
2786
2787                QueryTreeNode callStatement =
2788                                                                        (QueryTreeNode) nodeFactory.getNode(
2789                                                                                                C_NodeTypes.CALL_STATEMENT_NODE,
2790                                                                                                value,
2791                                                                                                getContextManager());
2792
2793                setUpAndLinkParameters();
2794
2795                {if (true) return callStatement;}
2796      break;
2797    case QUESTION_MARK:
2798      returnParam = dynamicParameterSpecification();
2799                getCompilerContext().setReturnParameterFlag(); //bug4450
2800

2801      jj_consume_token(EQUALS_OPERATOR);
2802      jj_consume_token(CALL);
2803      resultSetNode = rowValueConstructor(null);
2804                // validate that we have something that is an appropriate call statement
2805
ResultColumnList rcl = resultSetNode.getResultColumns();
2806
2807                // we can have only 1 return value/column
2808
if (rcl == null || rcl.size() > 1)
2809                {
2810                        {if (true) throw StandardException.newException(SQLState.LANG_INVALID_CALL_STATEMENT);}
2811                }
2812
2813                // we must have a method call node
2814
value = ((ResultColumn) rcl.elementAt(0)).getExpression();
2815                if (! (value instanceof JavaToSQLValueNode) ||
2816                        ! (((JavaToSQLValueNode) value).getJavaValueNode() instanceof MethodCallNode))
2817                {
2818                        {if (true) throw StandardException.newException(SQLState.LANG_INVALID_CALL_STATEMENT);}
2819                }
2820
2821                // wrap the row result set in a cursor node
2822
QueryTreeNode cursorNode =
2823                                        (QueryTreeNode) nodeFactory.getNode(
2824                                                C_NodeTypes.CURSOR_NODE,
2825                                                "SELECT",
2826                                                resultSetNode,
2827                                                null,
2828                                                null,
2829                                                ReuseFactory.getInteger(CursorNode.READ_ONLY),
2830                                                null,
2831                                                getContextManager());
2832
2833                // set the 0th param to be a RETURN param
2834
returnParam.setReturnOutputParam(value);
2835
2836                setUpAndLinkParameters();
2837
2838                {if (true) return cursorNode;}
2839      break;
2840    default:
2841      jj_la1[27] = jj_gen;
2842      jj_consume_token(-1);
2843      throw new ParseException();
2844    }
2845    throw new Error JavaDoc("Missing return statement in function");
2846  }
2847
2848/*
2849 * <A NAME="primaryExpression">primaryExpression</A>
2850 *
2851 * @param inSelectClause will be true if this method got called while parsing the select or values clause
2852 * If in select or values clause, we do not want to allow boolean values.
2853 */

2854  final public ValueNode primaryExpression(boolean inSelectClause) throws ParseException, StandardException {
2855        ValueNode value = null;
2856    if (getToken(2).kind == PERIOD &&
2857                    getToken(4).kind == LEFT_PAREN) {
2858      value = routineInvocation();
2859                {if (true) return value;}
2860    } else if (jj_2_9(1)) {
2861      value = primaryExpressionXX(inSelectClause);
2862                {if (true) return value;}
2863    } else {
2864      jj_consume_token(-1);
2865      throw new ParseException();
2866    }
2867    throw new Error JavaDoc("Missing return statement in function");
2868  }
2869
2870/*
2871 * <A NAME="savepointStatement">savepointStatement</A>
2872
2873    savepointStatementClauses contains the UNIQUE, ON ROLLBACK RETAIN LOCKS, ON ROLLBACK RETAIN CURSORS clauses.
2874
2875    0 - Boolean - UNIQUE clause
2876    1 - Boolean - ON ROLLBACK RETAIN LOCKS clause
2877    2 - Boolean - ON ROLLBACK RETAIN CURSORS clause
2878 */

2879  final public QueryTreeNode savepointStatement() throws ParseException, StandardException {
2880        String JavaDoc savepointName = null;
2881        int savepointStatementType;
2882        Object JavaDoc[] savepointStatementClauses = new Object JavaDoc[3];
2883    switch (jj_nt.kind) {
2884    case SAVEPOINT:
2885      jj_consume_token(SAVEPOINT);
2886      savepointName = identifier(Limits.MAX_IDENTIFIER_LENGTH, true);
2887      label_1:
2888      while (true) {
2889        savepointStatementClause(savepointStatementClauses);
2890        switch (jj_nt.kind) {
2891        case ON:
2892        case UNIQUE:
2893          ;
2894          break;
2895        default:
2896          jj_la1[28] = jj_gen;
2897          break label_1;
2898        }
2899      }
2900                //ON ROLLBACK RETAIN CURSORS is mandatory
2901
if (savepointStatementClauses[2] == null)
2902                                {if (true) throw StandardException.newException(SQLState.LANG_SYNTAX_ERROR, "MISSING ON ROLLBACK RETAIN CURSORS");}
2903                savepointStatementType = 1;
2904      break;
2905    case ROLLBACK:
2906      jj_consume_token(ROLLBACK);
2907      switch (jj_nt.kind) {
2908      case WORK:
2909        jj_consume_token(WORK);
2910        break;
2911      default:
2912        jj_la1[29] = jj_gen;
2913        ;
2914      }
2915      jj_consume_token(TO);
2916      jj_consume_token(SAVEPOINT);
2917      switch (jj_nt.kind) {
2918      case BINARY:
2919      case COALESCE:
2920      case COUNT:
2921      case D:
2922      case MODULE:
2923      case T:
2924      case TS:
2925      case VALUE:
2926      case VARBINARY:
2927      case ABS:
2928      case ABSVAL:
2929      case ACTION:
2930      case ALWAYS:
2931      case BLOB:
2932      case C:
2933      case CALLED:
2934      case CLOB:
2935      case COBOL:
2936      case COMMITTED:
2937      case CONCAT:
2938      case CONTAINS:
2939      case DATA:
2940      case DATE:
2941      case DAY:
2942      case DYNAMIC:
2943      case FORTRAN:
2944      case GENERATED:
2945      case IDENTITY_VAL_LOCAL:
2946      case INCREMENT:
2947      case INITIAL:
2948      case INTERVAL:
2949      case LANGUAGE:
2950      case LARGE:
2951      case LENGTH:
2952      case LEVEL:
2953      case LOCKS:
2954      case LOCKSIZE:
2955      case LOGGED:
2956      case MOD:
2957      case MODIFIES:
2958      case MODIFY:
2959      case MONTH:
2960      case _MORE:
2961      case MUMPS:
2962      case NAME:
2963      case NCLOB:
2964      case NULLABLE:
2965      case NUMBER:
2966      case OBJECT:
2967      case PASCAL:
2968      case PLI:
2969      case PRECISION:
2970      case RELEASE:
2971      case REPEATABLE:
2972      case RESTART:
2973      case RETURNS:
2974      case ROW:
2975      case SAVEPOINT:
2976      case SCALE:
2977      case SERIALIZABLE:
2978      case SQL_TSI_FRAC_SECOND:
2979      case SQL_TSI_SECOND:
2980      case SQL_TSI_MINUTE:
2981      case SQL_TSI_HOUR:
2982      case SQL_TSI_DAY:
2983      case SQL_TSI_WEEK:
2984      case SQL_TSI_MONTH:
2985      case SQL_TSI_QUARTER:
2986      case SQL_TSI_YEAR:
2987      case START:
2988      case STATEMENT:
2989      case SYNONYM:
2990      case THEN:
2991      case TIME:
2992      case TIMESTAMP:
2993      case TIMESTAMPADD:
2994      case TIMESTAMPDIFF:
2995      case TRUNCATE:
2996      case TYPE:
2997      case UNCOMMITTED:
2998      case USAGE:
2999      case WHEN:
3000      case CURDATE:
3001      case CURTIME:
3002      case DATABASE:
3003      case LONG:
3004      case AFTER:
3005      case BEFORE:
3006      case CLASS:
3007      case COMPRESS:
3008      case CONTENT:
3009      case CS:
3010      case DB2SQL:
3011      case DIRTY:
3012      case DOCUMENT:
3013      case EACH:
3014      case EMPTY:
3015      case EXCLUSIVE:
3016      case FN:
3017      case INDEX:
3018      case JAVA:
3019      case LCASE:
3020      case LOCATE:
3021      case LOCK:
3022      case MESSAGE_LOCALE:
3023      case METHOD:
3024      case MODE:
3025      case NEW:
3026      case NEW_TABLE:
3027      case OJ:
3028      case OFF:
3029      case OLD:
3030      case OLD_TABLE:
3031      case PARAMETER:
3032      case PASSING:
3033      case PROPERTIES:
3034      case READS:
3035      case REF:
3036      case REFERENCING:
3037      case RENAME:
3038      case RESET:
3039      case RESULT:
3040      case RETAIN:
3041      case RETURNING:
3042      case RR:
3043      case RS:
3044      case SEQUENCE:
3045      case SEQUENTIAL:
3046      case SETS:
3047      case SHARE:
3048      case SQLID:
3049      case SPECIFIC:
3050      case SQRT:
3051      case STABILITY:
3052      case STRIP:
3053      case STYLE:
3054      case TRIGGER:
3055      case UCASE:
3056      case UR:
3057      case WHITESPACE:
3058      case IDENTIFIER:
3059      case DELIMITED_IDENTIFIER:
3060        savepointName = identifier(Limits.MAX_IDENTIFIER_LENGTH, true);
3061        break;
3062      default:
3063        jj_la1[30] = jj_gen;
3064        ;
3065      }
3066                savepointStatementType = 2;
3067      break;
3068    case RELEASE:
3069      jj_consume_token(RELEASE);
3070      switch (jj_nt.kind) {
3071      case TO:
3072        jj_consume_token(TO);
3073        break;
3074      default:
3075        jj_la1[31] = jj_gen;
3076        ;
3077      }
3078      jj_consume_token(SAVEPOINT);
3079      savepointName = identifier(Limits.MAX_IDENTIFIER_LENGTH, true);
3080                savepointStatementType = 3;
3081      break;
3082    default:
3083      jj_la1[32] = jj_gen;
3084      jj_consume_token(-1);
3085      throw new ParseException();
3086    }
3087                {if (true) return (QueryTreeNode) nodeFactory.getNode(
3088                                                                C_NodeTypes.SAVEPOINT_NODE,
3089                                                                savepointName,
3090                                                                ReuseFactory.getInteger(savepointStatementType),
3091                                                                getContextManager());}
3092    throw new Error JavaDoc("Missing return statement in function");
3093  }
3094
3095  final public void savepointStatementClause(Object JavaDoc[] savepointStatementClauses) throws ParseException, StandardException {
3096        int clausePosition = -1;
3097    switch (jj_nt.kind) {
3098    case UNIQUE:
3099      jj_consume_token(UNIQUE);
3100                          clausePosition = 0;
3101      break;
3102    case ON:
3103      jj_consume_token(ON);
3104      jj_consume_token(ROLLBACK);
3105      jj_consume_token(RETAIN);
3106      clausePosition = LocksOrCursors();
3107      break;
3108    default:
3109      jj_la1[33] = jj_gen;
3110      jj_consume_token(-1);
3111      throw new ParseException();
3112    }
3113                if (clausePosition != -1) {
3114                        // check for repeated clause
3115
if (savepointStatementClauses[clausePosition] != null) {
3116
3117                                String JavaDoc which = SAVEPOINT_CLAUSE_NAMES[clausePosition];
3118                                {if (true) throw StandardException.newException(SQLState.LANG_DB2_MULTIPLE_ELEMENTS, which);}
3119                        }
3120
3121                        savepointStatementClauses[clausePosition] = Boolean.TRUE;
3122                }
3123  }
3124
3125/*
3126 * <A NAME="LocksOrCursors">LocksOrCursors</A>
3127 */

3128  final public int LocksOrCursors() throws ParseException {
3129    switch (jj_nt.kind) {
3130    case LOCKS:
3131      jj_consume_token(LOCKS);
3132                {if (true) return (1);}
3133      break;
3134    case CURSORS:
3135      jj_consume_token(CURSORS);
3136                {if (true) return (2);}
3137      break;
3138    default:
3139      jj_la1[34] = jj_gen;
3140      jj_consume_token(-1);
3141      throw new ParseException();
3142    }
3143    throw new Error JavaDoc("Missing return statement in function");
3144  }
3145
3146/*
3147 * <A NAME="globalTemporaryTableDeclaration">globalTemporaryTableDeclaration</A>
3148
3149    declareTableClauses contains the NOT LOGGED, on commit and on rollback clauses.
3150
3151    0 - Boolean - NOT LOGGED clause
3152    1 - Boolean - on commit behavior
3153    2 - Boolean - on rollback behavior
3154 */

3155  final public QueryTreeNode globalTemporaryTableDeclaration() throws ParseException, StandardException {
3156        TableName tableName;
3157        TableElementList tableElementList;
3158        Object JavaDoc[] declareTableClauses = new Object JavaDoc[3];
3159    jj_consume_token(DECLARE);
3160    jj_consume_token(GLOBAL);
3161    jj_consume_token(TEMPORARY);
3162    jj_consume_token(TABLE);
3163    tableName = qualifiedName(Limits.MAX_IDENTIFIER_LENGTH);
3164    tableElementList = tableElementList();
3165    label_2:
3166    while (true) {
3167      declareTableClause(declareTableClauses);
3168      if (jj_2_10(1)) {
3169        ;
3170      } else {
3171        break label_2;
3172      }
3173    }
3174                // NOT LOGGED is mandatory
3175
if (declareTableClauses[0] == null)
3176                                {if (true) throw StandardException.newException(SQLState.LANG_SYNTAX_ERROR, "MISSING NOT LOGGED");}
3177                // if ON COMMIT behavior not explicitly specified in DECLARE command, resort to default ON COMMIT DELETE ROWS
3178
if (declareTableClauses[1] == null)
3179                                declareTableClauses[1] = Boolean.TRUE;
3180                // if ON ROLLBACK behavior not explicitly specified in DECLARE command, resort to default ON ROLLBACK DELETE ROWS
3181
if (declareTableClauses[2] == null)
3182                                declareTableClauses[2] = Boolean.TRUE;
3183                {if (true) return (QueryTreeNode) nodeFactory.getNode(
3184                                                                C_NodeTypes.CREATE_TABLE_NODE,
3185                                                                tableName,
3186                                                                tableElementList,
3187                                                                (Properties)null,
3188                                                                (Boolean JavaDoc) declareTableClauses[1],
3189                                                                (Boolean JavaDoc) declareTableClauses[2],
3190                                                                getContextManager());}
3191    throw new Error JavaDoc("Missing return statement in function");
3192  }
3193
3194  final public void declareTableClause(Object JavaDoc[] declareTableClauses) throws ParseException, StandardException {
3195        int clausePosition = -1;
3196        Object JavaDoc clauseValue = null;
3197    switch (jj_nt.kind) {
3198    case NOT:
3199      jj_consume_token(NOT);
3200      jj_consume_token(LOGGED);
3201                                clauseValue = Boolean.TRUE; clausePosition = 0;
3202      break;
3203    default:
3204      jj_la1[35] = jj_gen;
3205      if (getToken(1).kind == ON && getToken(2).kind == COMMIT) {
3206        jj_consume_token(ON);
3207        jj_consume_token(COMMIT);
3208        clauseValue = onCommit();
3209        jj_consume_token(ROWS);
3210                                                                    clausePosition = 1;
3211      } else if (getToken(1).kind == ON && getToken(2).kind == ROLLBACK) {
3212        jj_consume_token(ON);
3213        jj_consume_token(ROLLBACK);
3214        jj_consume_token(DELETE);
3215        jj_consume_token(ROWS);
3216                                                  clauseValue = Boolean.TRUE; clausePosition = 2;
3217      } else {
3218        jj_consume_token(-1);
3219        throw new ParseException();
3220      }
3221    }
3222                if (clausePosition != -1) {
3223                        // check for repeated clause
3224
if (declareTableClauses[clausePosition] != null) {
3225
3226                                String JavaDoc which = TEMPORARY_TABLE_CLAUSE_NAMES[clausePosition];
3227                                {if (true) throw StandardException.newException(SQLState.LANG_DB2_MULTIPLE_ELEMENTS, which);}
3228                        }
3229
3230                        declareTableClauses[clausePosition] = clauseValue;
3231                }
3232  }
3233
3234/*
3235 * <A NAME="onCommit">onCommit</A>
3236 */

3237  final public Boolean JavaDoc onCommit() throws ParseException {
3238    switch (jj_nt.kind) {
3239    case PRESERVE:
3240      jj_consume_token(PRESERVE);
3241                {if (true) return (Boolean.FALSE);}
3242      break;
3243    case DELETE:
3244      jj_consume_token(DELETE);
3245                {if (true) return (Boolean.TRUE);}
3246      break;
3247    default:
3248      jj_la1[36] = jj_gen;
3249      jj_consume_token(-1);
3250      throw new ParseException();
3251    }
3252    throw new Error JavaDoc("Missing return statement in function");
3253  }
3254
3255/*
3256 * <A NAME="tableElementList">tableElementList</A>
3257 */

3258  final public TableElementList tableElementList() throws ParseException, StandardException {
3259        TableElementList tableElementList =
3260                                        (TableElementList) nodeFactory.getNode(
3261                                                                        C_NodeTypes.TABLE_ELEMENT_LIST,
3262                                                                        getContextManager());
3263    jj_consume_token(LEFT_PAREN);
3264    tableElement(tableElementList);
3265    label_3:
3266    while (true) {
3267      switch (jj_nt.kind) {
3268      case COMMA:
3269        ;
3270        break;
3271      default:
3272        jj_la1[37] = jj_gen;
3273        break label_3;
3274      }
3275      jj_consume_token(COMMA);
3276      tableElement(tableElementList);
3277    }
3278    jj_consume_token(RIGHT_PAREN);
3279                {if (true) return tableElementList;}
3280    throw new Error JavaDoc("Missing return statement in function");
3281  }
3282
3283/*
3284 * <A NAME="tableElement">tableElement</A>
3285 */

3286  final public void tableElement(TableElementList tableElementList) throws ParseException, StandardException {
3287        TableElementNode tableElement;
3288        //initialize following two booleans for every new table element so that the
3289
//values from previous tableElement doesn't impact the next tableElement
3290
explicitNotNull = false;
3291        explicitNull = false;
3292    switch (jj_nt.kind) {
3293    case BINARY:
3294    case COALESCE:
3295    case COUNT:
3296    case D:
3297    case MODULE:
3298    case T:
3299    case TS:
3300    case VALUE:
3301    case VARBINARY:
3302    case ABS:
3303    case ABSVAL:
3304    case ACTION:
3305    case ALWAYS:
3306    case BLOB:
3307    case C:
3308    case CALLED:
3309    case CLOB:
3310    case COBOL:
3311    case COMMITTED:
3312    case CONCAT:
3313    case CONTAINS:
3314    case DATA:
3315    case DATE:
3316    case DAY:
3317    case DYNAMIC:
3318    case FORTRAN:
3319    case GENERATED:
3320    case IDENTITY_VAL_LOCAL:
3321    case INCREMENT:
3322    case INITIAL:
3323    case INTERVAL:
3324    case LANGUAGE:
3325    case LARGE:
3326    case LENGTH:
3327    case LEVEL:
3328    case LOCKS:
3329    case LOCKSIZE:
3330    case LOGGED:
3331    case MOD:
3332    case MODIFIES:
3333    case MODIFY:
3334    case MONTH:
3335    case _MORE:
3336    case MUMPS:
3337    case NAME:
3338    case NCLOB:
3339    case NULLABLE:
3340    case NUMBER:
3341    case OBJECT:
3342    case PASCAL:
3343    case PLI:
3344    case PRECISION:
3345    case RELEASE:
3346    case REPEATABLE:
3347    case RESTART:
3348    case RETURNS:
3349    case ROW:
3350    case SAVEPOINT:
3351    case SCALE:
3352    case SERIALIZABLE:
3353    case SQL_TSI_FRAC_SECOND:
3354    case SQL_TSI_SECOND:
3355    case SQL_TSI_MINUTE:
3356    case SQL_TSI_HOUR:
3357    case SQL_TSI_DAY:
3358    case SQL_TSI_WEEK:
3359    case SQL_TSI_MONTH:
3360    case SQL_TSI_QUARTER:
3361    case SQL_TSI_YEAR:
3362    case START:
3363    case STATEMENT:
3364    case SYNONYM:
3365    case THEN:
3366    case TIME:
3367    case TIMESTAMP:
3368    case TIMESTAMPADD:
3369    case TIMESTAMPDIFF:
3370    case TRUNCATE:
3371    case TYPE:
3372    case UNCOMMITTED:
3373    case USAGE:
3374    case WHEN:
3375    case CURDATE:
3376    case CURTIME:
3377    case DATABASE:
3378    case LONG:
3379    case AFTER:
3380    case BEFORE:
3381    case CLASS:
3382    case COMPRESS:
3383    case CONTENT:
3384    case CS:
3385    case DB2SQL:
3386    case DIRTY:
3387    case DOCUMENT:
3388    case EACH:
3389    case EMPTY:
3390    case EXCLUSIVE:
3391    case FN:
3392    case INDEX:
3393    case JAVA:
3394    case LCASE:
3395    case LOCATE:
3396    case LOCK:
3397    case MESSAGE_LOCALE:
3398    case METHOD:
3399    case MODE:
3400    case NEW:
3401    case NEW_TABLE:
3402    case OJ:
3403    case OFF:
3404    case OLD:
3405    case OLD_TABLE:
3406    case PARAMETER:
3407    case PASSING:
3408    case PROPERTIES:
3409    case READS:
3410    case REF:
3411    case REFERENCING:
3412    case RENAME:
3413    case RESET:
3414    case RESULT:
3415    case RETAIN:
3416    case RETURNING:
3417    case RR:
3418    case RS:
3419    case SEQUENCE:
3420    case SEQUENTIAL:
3421    case SETS:
3422    case SHARE:
3423    case SQLID:
3424    case SPECIFIC:
3425    case SQRT:
3426    case STABILITY:
3427    case STRIP:
3428    case STYLE:
3429    case TRIGGER:
3430    case UCASE:
3431    case UR:
3432    case WHITESPACE:
3433    case IDENTIFIER:
3434    case DELIMITED_IDENTIFIER:
3435      tableElement = columnDefinition(tableElementList);
3436                tableElementList.addTableElement(tableElement);
3437      break;
3438    case CHECK:
3439    case CONSTRAINT:
3440    case FOREIGN:
3441    case PRIMARY:
3442    case UNIQUE:
3443      tableElement = tableConstraintDefinition();
3444                tableElementList.addTableElement(tableElement);
3445      break;
3446    default:
3447      jj_la1[38] = jj_gen;
3448      jj_consume_token(-1);
3449      throw new ParseException();
3450    }
3451  }
3452
3453/*
3454 * <A NAME="columnDefinition">columnDefinition</A>
3455 */

3456  final public TableElementNode columnDefinition(TableElementList tableElementList) throws ParseException, StandardException {
3457        DataTypeDescriptor typeDescriptor = null;
3458        ValueNode defaultNode = null;
3459        String JavaDoc columnName;
3460        long[] autoIncrementInfo = new long[4];
3461    /*
3462        ** RESOLVE: We are ignoring domains and collation.
3463        */

3464    
3465            /* identifier() used to be columnName() */
3466            columnName = identifier(Limits.MAX_IDENTIFIER_LENGTH, true);
3467    typeDescriptor = dataTypeDDL();
3468    switch (jj_nt.kind) {
3469    case CHECK:
3470    case CONSTRAINT:
3471    case _DEFAULT:
3472    case NOT:
3473    case PRIMARY:
3474    case REFERENCES:
3475    case UNIQUE:
3476    case WITH:
3477    case GENERATED:
3478      defaultNode = defaultAndConstraints(typeDescriptor, tableElementList, columnName, autoIncrementInfo);
3479      break;
3480    default:
3481      jj_la1[39] = jj_gen;
3482      ;
3483    }
3484                // Only pass autoincrement info for autoincrement columns
3485
if (autoIncrementInfo[QueryTreeNode.AUTOINCREMENT_IS_AUTOINCREMENT_INDEX] == 0)
3486                {
3487                        autoIncrementInfo = null;
3488                }
3489
3490                {if (true) return (TableElementNode) nodeFactory.getNode(
3491                                                                C_NodeTypes.COLUMN_DEFINITION_NODE,
3492                                                                columnName,
3493                                                                defaultNode,
3494                                                                typeDescriptor,
3495                                                                autoIncrementInfo,
3496                                                                getContextManager());}
3497    throw new Error JavaDoc("Missing return statement in function");
3498  }
3499
3500/*
3501 * <A NAME="defaultAndConstraints">defaultAndConstraints</A>
3502 */

3503  final public ValueNode defaultAndConstraints(DataTypeDescriptor typeDescriptor,
3504                                          TableElementList tableElementList,
3505                                          String JavaDoc columnName,
3506                                          long[] autoIncrementInfo) throws ParseException, StandardException {
3507        ValueNode defaultNode = null;
3508    switch (jj_nt.kind) {
3509    case CHECK:
3510    case CONSTRAINT:
3511    case NOT:
3512    case PRIMARY:
3513    case REFERENCES:
3514    case UNIQUE:
3515      columnConstraintDefinition(typeDescriptor, tableElementList, columnName);
3516      label_4:
3517      while (true) {
3518        switch (jj_nt.kind) {
3519        case CHECK:
3520        case CONSTRAINT:
3521        case NOT:
3522        case PRIMARY:
3523        case REFERENCES:
3524        case UNIQUE:
3525          ;
3526          break;
3527        default:
3528          jj_la1[40] = jj_gen;
3529          break label_4;
3530        }
3531        columnConstraintDefinition(typeDescriptor, tableElementList, columnName);
3532      }
3533      switch (jj_nt.kind) {
3534      case _DEFAULT:
3535      case WITH:
3536      case GENERATED:
3537        defaultNode = defaultClause(autoIncrementInfo, columnName);
3538        label_5:
3539        while (true) {
3540          switch (jj_nt.kind) {
3541          case CHECK:
3542          case CONSTRAINT:
3543          case NOT:
3544          case PRIMARY:
3545          case REFERENCES:
3546          case UNIQUE:
3547            ;
3548            break;
3549          default:
3550            jj_la1[41] = jj_gen;
3551            break label_5;
3552          }
3553          columnConstraintDefinition(typeDescriptor, tableElementList, columnName);
3554        }
3555        break;
3556      default:
3557        jj_la1[42] = jj_gen;
3558        ;
3559      }
3560                {if (true) return defaultNode;}
3561      break;
3562    case _DEFAULT:
3563    case WITH:
3564    case GENERATED:
3565      defaultNode = defaultClause(autoIncrementInfo, columnName);
3566      label_6:
3567      while (true) {
3568        switch (jj_nt.kind) {
3569        case CHECK:
3570        case CONSTRAINT:
3571        case NOT:
3572        case PRIMARY:
3573        case REFERENCES:
3574        case UNIQUE:
3575          ;
3576          break;
3577        default:
3578          jj_la1[43] = jj_gen;
3579          break label_6;
3580        }
3581        columnConstraintDefinition(typeDescriptor, tableElementList, columnName);
3582      }
3583                {if (true) return defaultNode;}
3584      break;
3585    default:
3586      jj_la1[44] = jj_gen;
3587      jj_consume_token(-1);
3588      throw new ParseException();
3589    }
3590    throw new Error JavaDoc("Missing return statement in function");
3591  }
3592
3593/*
3594 * <A NAME="dataTypeDDL">dataTypeDDL</A>
3595 */

3596  final public DataTypeDescriptor dataTypeDDL() throws ParseException, StandardException {
3597        DataTypeDescriptor typeDescriptor;
3598    if (commonDatatypeName(false)) {
3599
3600    } else {
3601      jj_consume_token(-1);
3602      throw new ParseException();
3603    }
3604    typeDescriptor = dataTypeCommon();
3605                {if (true) return typeDescriptor;}
3606    throw new Error JavaDoc("Missing return statement in function");
3607  }
3608
3609/*
3610 * <A NAME="dataTypeCast">dataTypeCast</A>
3611 */

3612  final public DataTypeDescriptor dataTypeCast() throws ParseException, StandardException {
3613        DataTypeDescriptor typeDescriptor;
3614    if (commonDatatypeName(true)) {
3615
3616    } else {
3617      jj_consume_token(-1);
3618      throw new ParseException();
3619    }
3620    typeDescriptor = dataTypeCommon();
3621                {if (true) return typeDescriptor;}
3622    throw new Error JavaDoc("Missing return statement in function");
3623  }
3624
3625/*
3626 * <A NAME="dataTypeCommon">dataTypeCommon</A>
3627 */

3628  final public DataTypeDescriptor dataTypeCommon() throws ParseException, StandardException {
3629        DataTypeDescriptor typeDescriptor;
3630        boolean checkCS = false;
3631    if (jj_2_11(1)) {
3632      if (getToken(2).kind != LARGE) {
3633
3634      } else {
3635        jj_consume_token(-1);
3636        throw new ParseException();
3637      }
3638      typeDescriptor = characterStringType();
3639    } else if (jj_2_12(1)) {
3640      if (getToken(3).kind != LARGE) {
3641
3642      } else {
3643        jj_consume_token(-1);
3644        throw new ParseException();
3645      }
3646      typeDescriptor = nationalCharacterStringType();
3647    } else if (jj_2_13(1)) {
3648      typeDescriptor = numericType();
3649    } else {
3650      switch (jj_nt.kind) {
3651      case DATE:
3652      case TIME:
3653      case TIMESTAMP:
3654        typeDescriptor = datetimeType();
3655        break;
3656      case BOOLEAN:
3657        jj_consume_token(BOOLEAN);
3658        checkInternalFeature(TypeId.BOOLEAN_NAME);
3659        typeDescriptor = new DataTypeDescriptor(TypeId.BOOLEAN_ID, true);
3660        break;
3661      case LONG:
3662        typeDescriptor = longType();
3663        break;
3664      case BINARY:
3665      case CHAR:
3666      case CHARACTER:
3667      case NATIONAL:
3668      case BLOB:
3669      case CLOB:
3670      case NCLOB:
3671        typeDescriptor = LOBType();
3672        break;
3673      case XML:
3674        typeDescriptor = XMLType();
3675        break;
3676      default:
3677        jj_la1[45] = jj_gen;
3678        jj_consume_token(-1);
3679        throw new ParseException();
3680      }
3681    }
3682                {if (true) return typeDescriptor;}
3683    throw new Error JavaDoc("Missing return statement in function");
3684  }
3685
3686/*
3687 * <A NAME="characterStringType">characterStringType</A>
3688 */

3689  final public DataTypeDescriptor characterStringType() throws ParseException, StandardException {
3690        int length = DEFAULT_STRING_COLUMN_LENGTH;
3691        Token varyingToken = null;
3692        int type;
3693    switch (jj_nt.kind) {
3694    case VARCHAR:
3695      jj_consume_token(VARCHAR);
3696      length = charLength();
3697                type = Types.VARCHAR;
3698      break;
3699    case CHAR:
3700    case CHARACTER:
3701      charOrCharacter();
3702      switch (jj_nt.kind) {
3703      case VARYING:
3704        // Length is optional for CHARACTER, not for plain CHARACTER VARYING
3705
varyingToken = jj_consume_token(VARYING);
3706        length = charLength();
3707        break;
3708      default:
3709        jj_la1[47] = jj_gen;
3710        switch (jj_nt.kind) {
3711        case LEFT_PAREN:
3712          length = charLength();
3713          break;
3714        default:
3715          jj_la1[46] = jj_gen;
3716          ;
3717        }
3718      }
3719                // If the user says CHARACTER VARYING, it's really VARCHAR
3720
type = (varyingToken == null ? Types.CHAR : Types.VARCHAR);
3721      break;
3722    default:
3723      jj_la1[48] = jj_gen;
3724      jj_consume_token(-1);
3725      throw new ParseException();
3726    }
3727    switch (jj_nt.kind) {
3728    case FOR:
3729      type = forBitData(type);
3730      break;
3731    default:
3732      jj_la1[49] = jj_gen;
3733      ;
3734    }
3735                checkTypeLimits(type,length);
3736                DataTypeDescriptor charDTD = DataTypeDescriptor.getBuiltInDataTypeDescriptor(type, length);
3737                {if (true) return charDTD;}
3738    throw new Error JavaDoc("Missing return statement in function");
3739  }
3740
3741/*
3742 * <A NAME="charOrCharacter">charOrCharacter</A>
3743 */

3744  final public void charOrCharacter() throws ParseException {
3745    switch (jj_nt.kind) {
3746    case CHAR:
3747      jj_consume_token(CHAR);
3748      break;
3749    case CHARACTER:
3750      jj_consume_token(CHARACTER);
3751      break;
3752    default:
3753      jj_la1[50] = jj_gen;
3754      jj_consume_token(-1);
3755      throw new ParseException();
3756    }
3757  }
3758
3759/*
3760 * <A NAME="charType">charType</A>
3761 */

3762  final public int charLength() throws ParseException, StandardException {
3763        int length;
3764    jj_consume_token(LEFT_PAREN);
3765    length = length();
3766    jj_consume_token(RIGHT_PAREN);
3767                {if (true) return length;}
3768    throw new Error JavaDoc("Missing return statement in function");
3769  }
3770
3771/*
3772** <A NAME="forBitData">forBitData</A>
3773*/

3774  final public int forBitData(int charType) throws ParseException {
3775    jj_consume_token(FOR);
3776    jj_consume_token(BIT);
3777    jj_consume_token(DATA);
3778                if (charType == Types.CHAR)
3779                        charType = Types.BINARY;
3780                else if (charType == Types.VARCHAR)
3781                        charType = Types.VARBINARY;
3782                else if (charType == Types.LONGVARCHAR)
3783                        charType = Types.LONGVARBINARY;
3784
3785                {if (true) return charType;}
3786    throw new Error JavaDoc("Missing return statement in function");
3787  }
3788
3789/*
3790 * <A NAME="nationalCharacterStringType">nationalCharacterStringType</A>
3791 */

3792  final public DataTypeDescriptor nationalCharacterStringType() throws ParseException, StandardException {
3793        DataTypeDescriptor dataTypeDescriptor;
3794        int length = DEFAULT_STRING_COLUMN_LENGTH;
3795        String JavaDoc type = null;
3796        Token varyingToken = null;
3797    switch (jj_nt.kind) {
3798    case NATIONAL:
3799      jj_consume_token(NATIONAL);
3800      charOrCharacter();
3801      switch (jj_nt.kind) {
3802      case VARYING:
3803        // Length is optional for NATIONAL CHARACTER , not for NATIONAL CHARACTER VARYING
3804
varyingToken = jj_consume_token(VARYING);
3805        length = charLength();
3806        break;
3807      default:
3808        jj_la1[52] = jj_gen;
3809        switch (jj_nt.kind) {
3810        case LEFT_PAREN:
3811          length = charLength();
3812          break;
3813        default:
3814          jj_la1[51] = jj_gen;
3815          ;
3816        }
3817      }
3818                // If the user says NATIONAL CHARACTER VARYING, it's really NATIONALVARCHAR
3819
type = (varyingToken == null ? TypeId.NATIONAL_CHAR_NAME :
3820                                TypeId.NATIONAL_VARCHAR_NAME);
3821      break;
3822    case NCHAR:
3823      jj_consume_token(NCHAR);
3824      switch (jj_nt.kind) {
3825      case VARYING:
3826        // Length is optional for NCHAR, not for NCHAR VARYING
3827
varyingToken = jj_consume_token(VARYING);
3828        length = charLength();
3829        break;
3830      default:
3831        jj_la1[54] = jj_gen;
3832        switch (jj_nt.kind) {
3833        case LEFT_PAREN:
3834          length = charLength();
3835          break;
3836        default:
3837          jj_la1[53] = jj_gen;
3838          ;
3839        }
3840      }
3841                // If the user says NCHAR VARYING, it's really NATIONALVARCHAR
3842
type = (varyingToken == null ? TypeId.NATIONAL_CHAR_NAME :
3843                                TypeId.NATIONAL_VARCHAR_NAME);
3844      break;
3845    case NVARCHAR:
3846      jj_consume_token(NVARCHAR);
3847      length = charLength();
3848                type = TypeId.NATIONAL_VARCHAR_NAME;
3849      break;
3850    default:
3851      jj_la1[55] = jj_gen;
3852      jj_consume_token(-1);
3853      throw new ParseException();
3854    }
3855                // need to re-enable according to SQL standard
3856
{if (true) throw StandardException.newException(SQLState.NOT_IMPLEMENTED, type);}
3857                // return DataTypeDescriptor.getBuiltInDataTypeDescriptor(type, length);
3858

3859    throw new Error JavaDoc("Missing return statement in function");
3860  }
3861
3862/*
3863 * <A NAME="LOBType">lobType</A>
3864 */

3865  final public DataTypeDescriptor LOBType() throws ParseException, StandardException {
3866        int length = 2147483647; // default to 2GB-1 if no length specified
3867
String JavaDoc type;
3868    switch (jj_nt.kind) {
3869    case BLOB:
3870      jj_consume_token(BLOB);
3871      switch (jj_nt.kind) {
3872      case LEFT_PAREN:
3873        length = lengthAndModifier();
3874        break;
3875      default:
3876        jj_la1[56] = jj_gen;
3877        ;
3878      }
3879                        type = TypeId.BLOB_NAME;
3880      break;
3881    case CLOB:
3882      jj_consume_token(CLOB);
3883      switch (jj_nt.kind) {
3884      case LEFT_PAREN:
3885        length = lengthAndModifier();
3886        break;
3887      default:
3888        jj_la1[57] = jj_gen;
3889        ;
3890      }
3891                        type = TypeId.CLOB_NAME;
3892      break;
3893    case NCLOB:
3894      jj_consume_token(NCLOB);
3895      length = lengthAndModifier();
3896                        type = TypeId.NCLOB_NAME;
3897                        // need to re-enable according to SQL standard
3898
{if (true) throw StandardException.newException(SQLState.NOT_IMPLEMENTED, type);}
3899      break;
3900    case BINARY:
3901      jj_consume_token(BINARY);
3902      jj_consume_token(LARGE);
3903      jj_consume_token(OBJECT);
3904      switch (jj_nt.kind) {
3905      case LEFT_PAREN:
3906        length = lengthAndModifier();
3907        break;
3908      default:
3909        jj_la1[58] = jj_gen;
3910        ;
3911      }
3912                        type = TypeId.BLOB_NAME;
3913      break;
3914    case CHAR:
3915    case CHARACTER:
3916      charOrCharacter();
3917      jj_consume_token(LARGE);
3918      jj_consume_token(OBJECT);
3919      switch (jj_nt.kind) {
3920      case LEFT_PAREN:
3921        length = lengthAndModifier();
3922        break;
3923      default:
3924        jj_la1[59] = jj_gen;
3925        ;
3926      }
3927                        type = TypeId.CLOB_NAME;
3928      break;
3929    case NATIONAL:
3930      jj_consume_token(NATIONAL);
3931      jj_consume_token(CHARACTER);
3932      jj_consume_token(LARGE);
3933      jj_consume_token(OBJECT);
3934      length = lengthAndModifier();
3935                        type = TypeId.NCLOB_NAME;
3936                        // need to re-enable according to SQL standard
3937
{if (true) throw StandardException.newException(SQLState.NOT_IMPLEMENTED, type);}
3938      break;
3939    default:
3940      jj_la1[60] = jj_gen;
3941      jj_consume_token(-1);
3942      throw new ParseException();
3943    }
3944                DataTypeDescriptor dtd = DataTypeDescriptor.getBuiltInDataTypeDescriptor(type, length);
3945
3946                {if (true) return dtd;}
3947    throw new Error JavaDoc("Missing return statement in function");
3948  }
3949
3950/*
3951 * <A NAME="numericType">numericType</A>
3952 */

3953  final public DataTypeDescriptor numericType() throws ParseException, StandardException {
3954        DataTypeDescriptor typeDescriptor;
3955    switch (jj_nt.kind) {
3956    case DEC:
3957    case DECIMAL:
3958    case INT:
3959    case INTEGER:
3960    case NUMERIC:
3961    case SMALLINT:
3962    case LONGINT:
3963      typeDescriptor = exactNumericType();
3964                {if (true) return typeDescriptor;}
3965      break;
3966    default:
3967      jj_la1[61] = jj_gen;
3968      if (jj_2_14(1)) {
3969        typeDescriptor = approximateNumericType();
3970                {if (true) return typeDescriptor;}
3971      } else {
3972        jj_consume_token(-1);
3973        throw new ParseException();
3974      }
3975    }
3976    throw new Error JavaDoc("Missing return statement in function");
3977  }
3978
3979/*
3980 * <A NAME="exactNumericType">exactNumericType</A>
3981 */

3982  final public DataTypeDescriptor exactNumericType() throws ParseException, StandardException {
3983        int precision = TypeCompiler.DEFAULT_DECIMAL_PRECISION;
3984        int scale = TypeCompiler.DEFAULT_DECIMAL_SCALE;
3985        int type = Types.DECIMAL;
3986        String JavaDoc typeStr = "DECIMAL";
3987        int maxWidth;
3988        DataTypeDescriptor dtd = null;
3989    switch (jj_nt.kind) {
3990    case DEC:
3991    case DECIMAL:
3992    case NUMERIC:
3993      switch (jj_nt.kind) {
3994      case NUMERIC:
3995        jj_consume_token(NUMERIC);
3996                type = Types.NUMERIC;
3997                typeStr = "NUMERIC";
3998        break;
3999      case DECIMAL:
4000        jj_consume_token(DECIMAL);
4001        break;
4002      case DEC:
4003        jj_consume_token(DEC);
4004        break;
4005      default:
4006        jj_la1[62] = jj_gen;
4007        jj_consume_token(-1);
4008        throw new ParseException();
4009      }
4010      switch (jj_nt.kind) {
4011      case LEFT_PAREN:
4012        jj_consume_token(LEFT_PAREN);
4013        precision = precision();
4014        switch (jj_nt.kind) {
4015        case COMMA:
4016          jj_consume_token(COMMA);
4017          scale = scale();
4018          break;
4019        default:
4020          jj_la1[63] = jj_gen;
4021          ;
4022        }
4023        jj_consume_token(RIGHT_PAREN);
4024        break;
4025      default:
4026        jj_la1[64] = jj_gen;
4027        ;
4028      }
4029                if ((precision <= 0) ||
4030                        (precision > TypeCompiler.MAX_DECIMAL_PRECISION_SCALE))
4031                {
4032                        {if (true) throw StandardException.newException(SQLState.LANG_INVALID_PRECISION,
4033                                typeStr, String.valueOf(precision));}
4034                }
4035                else if ((scale < 0) ||
4036                                 (scale > TypeCompiler.MAX_DECIMAL_PRECISION_SCALE))
4037                {
4038                        {if (true) throw StandardException.newException(SQLState.LANG_INVALID_DECIMAL_SCALE,
4039                                typeStr, String.valueOf(scale));}
4040                }
4041                else if (scale > precision)
4042                {
4043                        {if (true) throw StandardException.newException(SQLState.LANG_INVALID_DECIMAL_PRECISION_SCALE,
4044                                String.valueOf(scale),
4045                                String.valueOf(precision));}
4046                }
4047                /*
4048        ** If we have a decimal point, need to count it
4049        ** towards maxwidth. Max width needs to account
4050        ** for the possible leading '0' and '-' and the
4051        ** decimal point. e.g., DEC(1,1) has a maxwidth
4052        ** of 4 (to handle "-0.1").
4053        */

4054                maxWidth = DataTypeUtilities.computeMaxWidth( precision, scale);
4055                {if (true) return getDataTypeServices(type, precision, scale, maxWidth);}
4056      break;
4057    case INT:
4058    case INTEGER:
4059    case SMALLINT:
4060    case LONGINT:
4061      dtd = exactIntegerType();
4062                        {if (true) return dtd;}
4063      break;
4064    default:
4065      jj_la1[65] = jj_gen;
4066      jj_consume_token(-1);
4067      throw new ParseException();
4068    }
4069    throw new Error JavaDoc("Missing return statement in function");
4070  }
4071
4072/*
4073 * <A NAME="exactNumericType">exactNumericType</A>
4074 */

4075  final public DataTypeDescriptor exactIntegerType() throws ParseException, StandardException {
4076    switch (jj_nt.kind) {
4077    case INT:
4078    case INTEGER:
4079      switch (jj_nt.kind) {
4080      case INTEGER:
4081        jj_consume_token(INTEGER);
4082        break;
4083      case INT:
4084        jj_consume_token(INT);
4085        break;
4086      default:
4087        jj_la1[66] = jj_gen;
4088        jj_consume_token(-1);
4089        throw new ParseException();
4090      }
4091                {if (true) return DataTypeDescriptor.getBuiltInDataTypeDescriptor(Types.INTEGER);}
4092      break;
4093    case SMALLINT:
4094      jj_consume_token(SMALLINT);
4095                {if (true) return DataTypeDescriptor.getBuiltInDataTypeDescriptor(Types.SMALLINT);}
4096      break;
4097    case LONGINT:
4098      jj_consume_token(LONGINT);
4099                {if (true) return DataTypeDescriptor.getBuiltInDataTypeDescriptor(Types.BIGINT);}
4100      break;
4101    default:
4102      jj_la1[67] = jj_gen;
4103      jj_consume_token(-1);
4104      throw new ParseException();
4105    }
4106    throw new Error JavaDoc("Missing return statement in function");
4107  }
4108
4109/*
4110 * <A NAME="approximateNumericType">approximateNumericType</A>
4111 */

4112  final public DataTypeDescriptor approximateNumericType() throws ParseException, StandardException {
4113        int type = 0, scale = 0, width = 0;
4114        int prec = -1;
4115        DataTypeDescriptor dts = null;
4116    switch (jj_nt.kind) {
4117    case FLOAT:
4118      jj_consume_token(FLOAT);
4119      switch (jj_nt.kind) {
4120      case LEFT_PAREN:
4121        jj_consume_token(LEFT_PAREN);
4122        prec = precision();
4123        jj_consume_token(RIGHT_PAREN);
4124        break;
4125      default:
4126        jj_la1[68] = jj_gen;
4127        ;
4128      }
4129                /*
4130            When not specified, default is DOUBLE_PRECISION
4131         */

4132                if (prec == -1)
4133                        prec = TypeId.DOUBLE_PRECISION;
4134
4135                if (prec > 0 && prec <= TypeId.REAL_PRECISION)
4136                {
4137                        type = Types.REAL;
4138                        prec = TypeId.REAL_PRECISION;
4139                        scale = TypeId.REAL_SCALE;
4140                        width = TypeId.REAL_MAXWIDTH;
4141                }
4142                else if (prec > TypeId.REAL_PRECISION &&
4143                                 prec <= TypeId.DOUBLE_PRECISION)
4144                {
4145                        type = Types.DOUBLE;
4146                        prec = TypeId.DOUBLE_PRECISION;
4147                        scale = TypeId.DOUBLE_SCALE;
4148                        width = TypeId.DOUBLE_MAXWIDTH;
4149                }
4150                else
4151                        {if (true) throw StandardException.newException(SQLState.LANG_INVALID_PRECISION, "FLOAT", String.valueOf(prec));}
4152
4153                /*
4154            REMIND: this is a slight hack, in that exacting reading of
4155            the InformationSchema requires that the type the user typed
4156            in be visible to them in the InformationSchema views. But
4157            most implementations use synonyms or mappings at some point,
4158            and this is one of those places, for us.
4159         */

4160                {if (true) return getDataTypeServices(type, prec, scale, width);}
4161      break;
4162    case REAL:
4163      jj_consume_token(REAL);
4164                {if (true) return DataTypeDescriptor.getBuiltInDataTypeDescriptor(Types.REAL);}
4165      break;
4166    default:
4167      jj_la1[69] = jj_gen;
4168      if (jj_2_15(1)) {
4169        dts = doubleType();
4170                {if (true) return dts;}
4171      } else {
4172        jj_consume_token(-1);
4173        throw new ParseException();
4174      }
4175    }
4176    throw new Error JavaDoc("Missing return statement in function");
4177  }
4178
4179/*
4180 * <A NAME="doubleType">doubleType</A>
4181 */

4182  final public DataTypeDescriptor doubleType() throws ParseException, StandardException {
4183    if (getToken(2).kind == PRECISION) {
4184      jj_consume_token(DOUBLE);
4185      jj_consume_token(PRECISION);
4186    } else {
4187      switch (jj_nt.kind) {
4188      case DOUBLE:
4189        jj_consume_token(DOUBLE);
4190        break;
4191      default:
4192        jj_la1[70] = jj_gen;
4193        jj_consume_token(-1);
4194        throw new ParseException();
4195      }
4196    }
4197                {if (true) return DataTypeDescriptor.getBuiltInDataTypeDescriptor(Types.DOUBLE);}
4198    throw new Error JavaDoc("Missing return statement in function");
4199  }
4200
4201/*
4202 * <A NAME="longType">longType</A>
4203 */

4204  final public DataTypeDescriptor longType() throws ParseException, StandardException {
4205        DataTypeDescriptor dataTypeDescriptor;
4206    jj_consume_token(LONG);
4207    dataTypeDescriptor = longSubType();
4208                {if (true) return dataTypeDescriptor;}
4209    throw new Error JavaDoc("Missing return statement in function");
4210  }
4211
4212  final public DataTypeDescriptor longSubType() throws ParseException, StandardException {
4213        int lvcType = Types.LONGVARCHAR;
4214    switch (jj_nt.kind) {
4215    case VARCHAR:
4216      jj_consume_token(VARCHAR);
4217      switch (jj_nt.kind) {
4218      case FOR:
4219        lvcType = forBitData(lvcType);
4220        break;
4221      default:
4222        jj_la1[71] = jj_gen;
4223        ;
4224      }
4225                {if (true) return DataTypeDescriptor.getBuiltInDataTypeDescriptor(lvcType);}
4226      break;
4227    case NVARCHAR:
4228      jj_consume_token(NVARCHAR);
4229                // need to re-enable according to SQL standard
4230
{if (true) throw StandardException.newException(SQLState.NOT_IMPLEMENTED, TypeId.NATIONAL_LONGVARCHAR_NAME);}
4231                // return DataTypeDescriptor.getBuiltInDataTypeDescriptor(TypeId.NATIONAL_LONGVARCHAR_NAME);
4232

4233      break;
4234    default:
4235      jj_la1[72] = jj_gen;
4236      jj_consume_token(-1);
4237      throw new ParseException();
4238    }
4239    throw new Error JavaDoc("Missing return statement in function");
4240  }
4241
4242/*
4243 * <A NAME="XMLType">XMLType</A>
4244 */

4245  final public DataTypeDescriptor XMLType() throws ParseException, StandardException {
4246        DataTypeDescriptor value;
4247    jj_consume_token(XML);
4248                checkVersion(DataDictionary.DD_VERSION_DERBY_10_1, "XML");
4249                {if (true) return DataTypeDescriptor.getBuiltInDataTypeDescriptor(
4250                        StoredFormatIds.XML_TYPE_ID);}
4251    throw new Error JavaDoc("Missing return statement in function");
4252  }
4253
4254/*
4255 * <A NAME="xmlDocOrContent">xmlDocOrContent</A>
4256 *
4257 * Parse the XML keywords DOCUMENT and CONTENT. We don't
4258 * support CONTENT yet, so we throw an appropriate error
4259 * if we see it.
4260 *
4261 */

4262  final public void xmlDocOrContent() throws ParseException, StandardException {
4263    if ((getToken(1).kind != DOCUMENT) &&
4264                    (getToken(1).kind != CONTENT)) {
4265                {if (true) throw StandardException.newException(
4266                        SQLState.LANG_XML_KEYWORD_MISSING, "DOCUMENT",
4267                        ReuseFactory.getInteger(getToken(1).beginLine),
4268                        ReuseFactory.getInteger(getToken(1).beginColumn));}
4269    } else if (getToken(1).kind == CONTENT) {
4270      jj_consume_token(CONTENT);
4271                {if (true) throw StandardException.newException(
4272                        SQLState.LANG_UNSUPPORTED_XML_FEATURE, "CONTENT");}
4273    } else if (getToken(1).kind == DOCUMENT) {
4274      jj_consume_token(DOCUMENT);
4275                {if (true) return;}
4276    } else {
4277      jj_consume_token(-1);
4278      throw new ParseException();
4279    }
4280  }
4281
4282/*
4283 * <A NAME="javaType">javaType</A>
4284 */

4285  final public DataTypeDescriptor javaType() throws ParseException, StandardException {
4286        String JavaDoc javaClassName;
4287    javaClassName = javaClassName();
4288                {if (true) return getJavaClassDataTypeDescriptor(javaClassName);}
4289    throw new Error JavaDoc("Missing return statement in function");
4290  }
4291
4292/*
4293 * <A NAME = "javaDSL">javaDSL</A>
4294 *
4295 * A Java dot-separated list.
4296 */

4297  final public String JavaDoc javaDSL() throws ParseException {
4298        String JavaDoc dotSeparatedList;
4299    dotSeparatedList = caseSensitiveIdentifierPlusReservedWords();
4300    label_7:
4301    while (true) {
4302      switch (jj_nt.kind) {
4303      case PERIOD:
4304        ;
4305        break;
4306      default:
4307        jj_la1[73] = jj_gen;
4308        break label_7;
4309      }
4310      dotSeparatedList = javaDSLNameExtender(dotSeparatedList);
4311    }
4312                {if (true) return dotSeparatedList;}
4313    throw new Error JavaDoc("Missing return statement in function");
4314  }
4315
4316/*
4317 * <A NAME="javaClassName">javaClassName</A>
4318 */

4319  final public String JavaDoc javaClassName() throws ParseException {
4320        String JavaDoc javaClassName;
4321    javaClassName = javaDSL();
4322                {if (true) return javaClassName;}
4323    throw new Error JavaDoc("Missing return statement in function");
4324  }
4325
4326/*
4327 * <A NAME="javaDSLNameExtender">javaDSLNameExtender</A>
4328 */

4329  final public String JavaDoc javaDSLNameExtender(String JavaDoc dotSeparatedList) throws ParseException {
4330        String JavaDoc extender;
4331    jj_consume_token(PERIOD);
4332    extender = caseSensitiveIdentifierPlusReservedWords();
4333                {if (true) return dotSeparatedList + "." + extender;}
4334    throw new Error JavaDoc("Missing return statement in function");
4335  }
4336
4337/*
4338 * <A NAME="length">lengthAndModifier</A>
4339 */

4340  final public int lengthAndModifier() throws ParseException, StandardException {
4341        Token tok;
4342        Token tokmod = null;
4343    jj_consume_token(LEFT_PAREN);
4344    switch (jj_nt.kind) {
4345    case LENGTH_MODIFIER:
4346      tok = jj_consume_token(LENGTH_MODIFIER);
4347      break;
4348    case EXACT_NUMERIC:
4349      tok = jj_consume_token(EXACT_NUMERIC);
4350      switch (jj_nt.kind) {
4351      case IDENTIFIER:
4352        tokmod = jj_consume_token(IDENTIFIER);
4353        break;
4354      default:
4355        jj_la1[74] = jj_gen;
4356        ;
4357      }
4358      break;
4359    default:
4360      jj_la1[75] = jj_gen;
4361      jj_consume_token(-1);
4362      throw new ParseException();
4363    }
4364    jj_consume_token(RIGHT_PAREN);
4365                String JavaDoc s = tok.image + (tokmod==null ? "" : tokmod.image); // colapse cases;
4366
try
4367                {
4368                        char modifier = s.charAt(s.length()-1);
4369                        String JavaDoc number = s.substring(0, s.length()-1); // in case of ending w. letter
4370
long mul;
4371                        switch (modifier) {
4372                        case 'G':
4373                        case 'g':
4374                                mul =1073741824L; //1 Giga
4375
break;
4376                        case 'M':
4377                        case 'm':
4378                                mul=1048576L; // 1 Mega
4379
break;
4380                        case 'K':
4381                        case 'k':
4382                                mul=1024L; // 1 Kilo
4383
break;
4384                        default:
4385                                mul=1;
4386                                number = s; // no letter in end, need whole string
4387
break;
4388                        }
4389                        long specifiedLength = Long.parseLong(number) * mul;
4390
4391                        // match DB2 limits of 1 to 2147483647
4392
if ((specifiedLength > 0L) &&
4393                (specifiedLength <= Limits.DB2_LOB_MAXWIDTH))
4394            {
4395                                {if (true) return (int)specifiedLength;}
4396            }
4397
4398                        // DB2 allows 2G or 2048M or 2097152k that calculate out to
4399
// 2147483648, but sets the length to be one less.
4400
if (mul != 1 && specifiedLength == 2147483648L)
4401                                {if (true) return Limits.DB2_LOB_MAXWIDTH;}
4402
4403                }
4404                catch (NumberFormatException JavaDoc nfe)
4405                {
4406                }
4407
4408                {if (true) throw StandardException.newException(
4409            SQLState.LANG_INVALID_COLUMN_LENGTH, s);}
4410    throw new Error JavaDoc("Missing return statement in function");
4411  }
4412
4413/*
4414 * <A NAME="length">length</A>
4415 */

4416  final public int length() throws ParseException, StandardException {
4417        Token tok;
4418        int retval;
4419    tok = jj_consume_token(EXACT_NUMERIC);
4420                try
4421                {
4422                        retval = Integer.parseInt(tok.image);
4423
4424                        if (retval > 0)
4425                                {if (true) return retval;}
4426                }
4427                catch (NumberFormatException JavaDoc nfe)
4428                {
4429                }
4430                {if (true) throw StandardException.newException(SQLState.LANG_INVALID_COLUMN_LENGTH, tok.image);}
4431    throw new Error JavaDoc("Missing return statement in function");
4432  }
4433
4434/*
4435 * <A NAME="exactNumber">exactNumber</A>
4436*/

4437  final public long exactNumber() throws ParseException, StandardException {
4438        Token longToken;
4439        String JavaDoc sign = "";
4440    switch (jj_nt.kind) {
4441    case PLUS_SIGN:
4442    case MINUS_SIGN:
4443      sign = sign();
4444      break;
4445    default:
4446      jj_la1[76] = jj_gen;
4447      ;
4448    }
4449    longToken = jj_consume_token(EXACT_NUMERIC);
4450                try
4451                {
4452                        long longvalue = Long.parseLong(longToken.image);
4453                        if (sign.equals("-"))
4454                        {
4455                                {if (true) return -longvalue;}
4456                        }
4457                        else
4458                        {
4459                                {if (true) return longvalue;}
4460                        }
4461                }
4462                catch (NumberFormatException JavaDoc nfe)
4463                {
4464                        {if (true) throw
4465                        StandardException.newException(
4466                                   SQLState.LANG_INVALID_INTEGER_LITERAL, longToken.image);}
4467                }
4468    throw new Error JavaDoc("Missing return statement in function");
4469  }
4470
4471/*
4472 * <A NAME="precision">precision</A>
4473 */

4474  final public int precision() throws ParseException, StandardException {
4475        int uintValue;
4476    uintValue = uint_value();
4477                {if (true) return uintValue;}
4478    throw new Error JavaDoc("Missing return statement in function");
4479  }
4480
4481/*
4482 * <A NAME="uint_value">uint_value</A>
4483 */

4484  final public int uint_value() throws ParseException, StandardException {
4485        Token uintToken;
4486    /*
4487            because the parser won't match to UINT, we use EXACT_NUMERIC.
4488         */

4489            uintToken = jj_consume_token(EXACT_NUMERIC);
4490                try {
4491                        {if (true) return Integer.parseInt(uintToken.image);}
4492                } catch (NumberFormatException JavaDoc nfe) {
4493                        {if (true) throw StandardException.newException(SQLState.LANG_INVALID_INTEGER_LITERAL, uintToken.image);}
4494                }
4495    throw new Error JavaDoc("Missing return statement in function");
4496  }
4497
4498/*
4499 * <A NAME="scale">scale</A>
4500 */

4501  final public int scale() throws ParseException, StandardException {
4502        int uintValue;
4503    uintValue = uint_value();
4504                {if (true) return uintValue;}
4505    throw new Error JavaDoc("Missing return statement in function");
4506  }
4507
4508/*
4509 * <A NAME="datetimeType">datetimeType</A>
4510 */

4511  final public DataTypeDescriptor datetimeType() throws ParseException, StandardException {
4512        Token tzTok = null;
4513        int prec = -1;
4514    switch (jj_nt.kind) {
4515    case DATE:
4516      jj_consume_token(DATE);
4517                {if (true) return DataTypeDescriptor.getBuiltInDataTypeDescriptor(Types.DATE);}
4518      break;
4519    case TIME:
4520      jj_consume_token(TIME);
4521                /*
4522            We do not try to set up a precision for time/timestamp
4523            values because this field gets mapped to the precision
4524            field in the JDBC driver that is for the number of
4525            decimal digits in the value. Precision for time is
4526            actually the scale of the seconds value.
4527
4528            If/when precision for times is supported, we may need
4529            to migrate the system catalog information to fill in
4530            the default values appropriately (the default for
4531            time is 0, fortunately; but for timestamp it is
4532            actually 9 due to java.sql.Timestamp's precision).
4533         */

4534                {if (true) return DataTypeDescriptor.getBuiltInDataTypeDescriptor(Types.TIME);}
4535      break;
4536    case TIMESTAMP:
4537      jj_consume_token(TIMESTAMP);
4538                {if (true) return DataTypeDescriptor.getBuiltInDataTypeDescriptor(Types.TIMESTAMP);}
4539      break;
4540    default:
4541      jj_la1[77] = jj_gen;
4542      jj_consume_token(-1);
4543      throw new ParseException();
4544    }
4545    throw new Error JavaDoc("Missing return statement in function");
4546  }
4547
4548/*
4549 * <A NAME="timePrecision">timePrecision</A>
4550 */

4551  final public void qualifiedNameList(Vector JavaDoc list, int id_length_limit) throws ParseException, StandardException {
4552    qualifiedNameElement(list, id_length_limit);
4553    label_8:
4554    while (true) {
4555      switch (jj_nt.kind) {
4556      case COMMA:
4557        ;
4558        break;
4559      default:
4560        jj_la1[78] = jj_gen;
4561        break label_8;
4562      }
4563      jj_consume_token(COMMA);
4564      qualifiedNameElement(list, id_length_limit);
4565    }
4566  }
4567
4568  final public void qualifiedNameElement(Vector JavaDoc list, int id_length_limit) throws ParseException, StandardException {
4569        TableName qualifiedName = null;
4570    qualifiedName = qualifiedName(id_length_limit);
4571                list.addElement(qualifiedName);
4572  }
4573
4574/*
4575 * <A NAME="qualifiedName">qualifiedName</A>
4576 */

4577  final public TableName qualifiedName(int nodeType, int id_length_limit) throws ParseException, StandardException {
4578        //String catalogName = null;
4579
String JavaDoc schemaName = null;
4580        String JavaDoc qualifiedId;
4581        String JavaDoc firstName = null;
4582        String JavaDoc secondName = null;
4583    firstName = identifier(Limits.MAX_IDENTIFIER_LENGTH, false);
4584    if (getToken(1).kind == PERIOD &&
4585                                                                    getToken(2).kind != ASTERISK) {
4586      jj_consume_token(PERIOD);
4587      secondName = identifier(Limits.MAX_IDENTIFIER_LENGTH, false);
4588    } else {
4589      ;
4590    }
4591                if (secondName == null)
4592                {
4593                        qualifiedId = firstName;
4594                }
4595                else
4596                {
4597                        schemaName = firstName;
4598                        qualifiedId = secondName;
4599                }
4600
4601                //limit the qualifiedId to the id length limit passed to this method
4602
checkIdentifierLengthLimit(qualifiedId, id_length_limit);
4603                if (schemaName != null)
4604                        checkIdentifierLengthLimit(schemaName, Limits.MAX_IDENTIFIER_LENGTH);
4605
4606                {if (true) return (TableName) nodeFactory.getNode(
4607                                                                nodeType,
4608                                                                schemaName,
4609                                                                qualifiedId,
4610                                                                new Integer JavaDoc(lastIdentifierToken.beginOffset),
4611                                                                new Integer JavaDoc(lastIdentifierToken.endOffset),
4612                                                                getContextManager());}
4613    throw new Error JavaDoc("Missing return statement in function");
4614  }
4615
4616/*
4617 * <A NAME="queryExpression">queryExpression</A>
4618 *
4619 * We have to be carefull to get the associativity correct. According to the SQL spec
4620 * <non-join query expression> ::=
4621 * <non-join query term>
4622 * | <query expression body> UNION [ ALL ] <query term>
4623 * | <query expression body> EXCEPT [ ALL ] <query term>
4624 * Meaning that
4625 * t1 UNION ALL t2 UNION t3
4626 * is equivalent to
4627 * (t1 UNION ALL t2) UNION t3
4628 * However recursive descent parsers want recursion to be on the right, so this kind of associativity is unnatural
4629 * for our parser. The queryExpression method must know whether it is being called as the right hand side of a
4630 * set operator to produce a query tree with the correct associativity.
4631 */

4632  final public ResultSetNode queryExpression(ResultSetNode leftSide, int operatorType) throws ParseException, StandardException {
4633        ResultSetNode term;
4634    term = nonJoinQueryTerm(leftSide, operatorType);
4635    switch (jj_nt.kind) {
4636    case EXCEPT:
4637    case UNION:
4638      term = unionOrExcept(term);
4639      break;
4640    default:
4641      jj_la1[79] = jj_gen;
4642      ;
4643    }
4644                {if (true) return term;}
4645    throw new Error JavaDoc("Missing return statement in function");
4646  }
4647
4648/*
4649 * <A NAME="unionOrExcept">unionOrExcept</A>
4650 */

4651  final public ResultSetNode unionOrExcept(ResultSetNode term) throws ParseException, StandardException {
4652        ResultSetNode expression;
4653        Token tok = null;
4654    switch (jj_nt.kind) {
4655    case UNION:
4656      jj_consume_token(UNION);
4657      switch (jj_nt.kind) {
4658      case ALL:
4659      case DISTINCT:
4660        switch (jj_nt.kind) {
4661        case ALL:
4662          tok = jj_consume_token(ALL);
4663          break;
4664        case DISTINCT:
4665          jj_consume_token(DISTINCT);
4666          break;
4667        default:
4668          jj_la1[80] = jj_gen;
4669          jj_consume_token(-1);
4670          throw new ParseException();
4671        }
4672        break;
4673      default:
4674        jj_la1[81] = jj_gen;
4675        ;
4676      }
4677      expression = queryExpression(term,
4678                                                                      (tok != null) ? UNION_ALL_OP : UNION_OP);
4679                {if (true) return expression;}
4680      break;
4681    case EXCEPT:
4682      jj_consume_token(EXCEPT);
4683      switch (jj_nt.kind) {
4684      case ALL:
4685      case DISTINCT:
4686        switch (jj_nt.kind) {
4687        case ALL:
4688          tok = jj_consume_token(ALL);
4689          break;
4690        case DISTINCT:
4691          jj_consume_token(DISTINCT);
4692          break;
4693        default:
4694          jj_la1[82] = jj_gen;
4695          jj_consume_token(-1);
4696          throw new ParseException();
4697        }
4698        break;
4699      default:
4700        jj_la1[83] = jj_gen;
4701        ;
4702      }
4703      expression = queryExpression(term,
4704                                                                      (tok != null) ? EXCEPT_ALL_OP : EXCEPT_OP);
4705                {if (true) return expression;}
4706      break;
4707    default:
4708      jj_la1[84] = jj_gen;
4709      jj_consume_token(-1);
4710      throw new ParseException();
4711    }
4712    throw new Error JavaDoc("Missing return statement in function");
4713  }
4714
4715/*
4716 * <A NAME="nonJoinQueryTerm">nonJoinQueryTerm</A>
4717 *
4718 * Be careful with the associativity of INTERSECT. According to the SQL spec
4719 * t1 INTERSECT t2 INTERSECT ALL t3
4720 * is equivalent to
4721 * (t1 INTERSECT t2) INTERSECT ALL t3
4722 * which is not the same as
4723 * t1 INTERSECT (t2 INTERSECT ALL t3)
4724 * See the comment on queryExpression.
4725 */

4726  final public ResultSetNode nonJoinQueryTerm(ResultSetNode leftSide, int operatorType) throws ParseException, StandardException {
4727        ResultSetNode term;
4728    term = nonJoinQueryPrimary();
4729    switch (jj_nt.kind) {
4730    case INTERSECT:
4731      term = intersect(term);
4732      break;
4733    default:
4734      jj_la1[85] = jj_gen;
4735      ;
4736    }
4737        switch( operatorType)
4738        {
4739        case NO_SET_OP:
4740            {if (true) return term;}
4741
4742        case UNION_OP:
4743            {if (true) return (ResultSetNode) nodeFactory.getNode(
4744                C_NodeTypes.UNION_NODE,
4745                leftSide,
4746                term,
4747                Boolean.FALSE,
4748                Boolean.FALSE,
4749                null,
4750                getContextManager());}
4751
4752        case UNION_ALL_OP:
4753            {if (true) return (ResultSetNode) nodeFactory.getNode(
4754                C_NodeTypes.UNION_NODE,
4755                leftSide,
4756                term,
4757                Boolean.TRUE,
4758                Boolean.FALSE,
4759                null,
4760                getContextManager());}
4761
4762        case EXCEPT_OP:
4763            {if (true) return (ResultSetNode) nodeFactory.getNode(
4764                C_NodeTypes.INTERSECT_OR_EXCEPT_NODE,
4765                ReuseFactory.getInteger( IntersectOrExceptNode.EXCEPT_OP),
4766                leftSide,
4767                term,
4768                Boolean.FALSE,
4769                null,
4770                getContextManager());}
4771
4772        case EXCEPT_ALL_OP:
4773            {if (true) return (ResultSetNode) nodeFactory.getNode(
4774                C_NodeTypes.INTERSECT_OR_EXCEPT_NODE,
4775                ReuseFactory.getInteger( IntersectOrExceptNode.EXCEPT_OP),
4776                leftSide,
4777                term,
4778                Boolean.TRUE,
4779                null,
4780                getContextManager());}
4781
4782        case INTERSECT_OP:
4783            {if (true) return (ResultSetNode) nodeFactory.getNode(
4784                C_NodeTypes.INTERSECT_OR_EXCEPT_NODE,
4785                ReuseFactory.getInteger( IntersectOrExceptNode.INTERSECT_OP),
4786                leftSide,
4787                term,
4788                Boolean.FALSE,
4789                null,
4790                getContextManager());}
4791
4792        case INTERSECT_ALL_OP:
4793            {if (true) return (ResultSetNode) nodeFactory.getNode(
4794                C_NodeTypes.INTERSECT_OR_EXCEPT_NODE,
4795                ReuseFactory.getInteger( IntersectOrExceptNode.INTERSECT_OP),
4796                leftSide,
4797                term,
4798                Boolean.TRUE,
4799                null,
4800                getContextManager());}
4801
4802
4803        default:
4804            if (SanityManager.DEBUG)
4805            {
4806                SanityManager.THROWASSERT( "Invalid set operator type: " + operatorType);
4807            }
4808            {if (true) return null;}
4809        }
4810    throw new Error JavaDoc("Missing return statement in function");
4811  }
4812
4813/*
4814 * <A NAME="intersect">intersect</A>
4815 */

4816  final public ResultSetNode intersect(ResultSetNode term) throws ParseException, StandardException {
4817        ResultSetNode expression;
4818        Token tok = null;
4819    jj_consume_token(INTERSECT);
4820    switch (jj_nt.kind) {
4821    case ALL:
4822    case DISTINCT:
4823      switch (jj_nt.kind) {
4824      case ALL:
4825        tok = jj_consume_token(ALL);
4826        break;
4827      case DISTINCT:
4828        jj_consume_token(DISTINCT);
4829        break;
4830      default:
4831        jj_la1[86] = jj_gen;
4832        jj_consume_token(-1);
4833        throw new ParseException();
4834      }
4835      break;
4836    default:
4837      jj_la1[87] = jj_gen;
4838      ;
4839    }
4840    expression = nonJoinQueryTerm(term, (tok != null) ? INTERSECT_ALL_OP : INTERSECT_OP);
4841                {if (true) return expression;}
4842    throw new Error JavaDoc("Missing return statement in function");
4843  }
4844
4845/*
4846 * <A NAME="nonJoinQueryPrimary">nonJoinQueryPrimary</A>
4847 */

4848  final public ResultSetNode nonJoinQueryPrimary() throws ParseException, StandardException {
4849        ResultSetNode primary;
4850    switch (jj_nt.kind) {
4851    case SELECT:
4852    case VALUES:
4853      primary = simpleTable();
4854                {if (true) return primary;}
4855      break;
4856    case LEFT_PAREN:
4857      jj_consume_token(LEFT_PAREN);
4858      primary = queryExpression(null, NO_SET_OP);
4859      jj_consume_token(RIGHT_PAREN);
4860                {if (true) return primary;}
4861      break;
4862    default:
4863      jj_la1[88] = jj_gen;
4864      jj_consume_token(-1);
4865      throw new ParseException();
4866    }
4867    throw new Error JavaDoc("Missing return statement in function");
4868  }
4869
4870/*
4871 * <A NAME="simpleTable">simpleTable</A>
4872 */

4873  final public ResultSetNode simpleTable() throws ParseException, StandardException {
4874        ResultSetNode resultSetNode;
4875    switch (jj_nt.kind) {
4876    case SELECT:
4877      resultSetNode = querySpecification();
4878                {if (true) return resultSetNode;}
4879      break;
4880    case VALUES:
4881      resultSetNode = tableValueConstructor();
4882                {if (true) return resultSetNode;}
4883      break;
4884    default:
4885      jj_la1[89] = jj_gen;
4886      jj_consume_token(-1);
4887      throw new ParseException();
4888    }
4889    throw new Error JavaDoc("Missing return statement in function");
4890  }
4891
4892/*
4893 * <A NAME="querySpecification">querySpecification</A>
4894 */

4895  final public ResultSetNode querySpecification() throws ParseException, StandardException {
4896        ResultColumnList selectList;
4897        SelectNode selectNode;
4898        boolean isDistinct = false;
4899    jj_consume_token(SELECT);
4900    if (jj_2_16(1)) {
4901      isDistinct = setQuantifier();
4902    } else {
4903      ;
4904    }
4905    selectList = selectList();
4906    selectNode = tableExpression(selectList);
4907                if (isDistinct) selectNode.makeDistinct();
4908                {if (true) return selectNode;}
4909    throw new Error JavaDoc("Missing return statement in function");
4910  }
4911
4912/*
4913 * <A NAME="setQuantifier">setQuantifier</A>
4914 */

4915  final public boolean setQuantifier() throws ParseException {
4916    if (getToken(1).kind == DISTINCT &&
4917                            !(
4918                                    getToken(2).kind == PERIOD ||
4919                                    getToken(2).kind == DOUBLE_COLON
4920                            )) {
4921      jj_consume_token(DISTINCT);
4922                {if (true) return true;}
4923    } else if (getToken(1).kind == ALL &&
4924                            !(
4925                                    getToken(2).kind == PERIOD ||
4926                                    getToken(2).kind == DOUBLE_COLON
4927                            )) {
4928      jj_consume_token(ALL);
4929                {if (true) return false;}
4930    } else {
4931      jj_consume_token(-1);
4932      throw new ParseException();
4933    }
4934    throw new Error JavaDoc("Missing return statement in function");
4935  }
4936
4937/*
4938 * <A NAME="selectList">selectList</A>
4939 */

4940  final public ResultColumnList selectList() throws ParseException, StandardException {
4941        ResultColumn allResultColumn;
4942        ResultColumnList resultColumns = (ResultColumnList) nodeFactory.getNode(
4943                                                                        C_NodeTypes.RESULT_COLUMN_LIST,
4944                                                                        getContextManager());
4945    switch (jj_nt.kind) {
4946    case ASTERISK:
4947      jj_consume_token(ASTERISK);
4948                allResultColumn = (ResultColumn) nodeFactory.getNode(
4949                                                                                C_NodeTypes.ALL_RESULT_COLUMN,
4950                                                                                null,
4951                                                                                getContextManager());
4952                /* Add the new AllResultColumn to the end of the list */
4953                resultColumns.addResultColumn(allResultColumn);
4954                {if (true) return resultColumns;}
4955      break;
4956    default:
4957      jj_la1[90] = jj_gen;
4958      if (jj_2_17(1)) {
4959        selectColumnList(resultColumns);
4960                {if (true) return resultColumns;}
4961      } else {
4962        jj_consume_token(-1);
4963        throw new ParseException();
4964      }
4965    }
4966    throw new Error JavaDoc("Missing return statement in function");
4967  }
4968
4969  final public void selectColumnList(ResultColumnList resultColumns) throws ParseException, StandardException {
4970    selectSublist(resultColumns);
4971    label_9:
4972    while (true) {
4973      switch (jj_nt.kind) {
4974      case COMMA:
4975        ;
4976        break;
4977      default:
4978        jj_la1[91] = jj_gen;
4979        break label_9;
4980      }
4981      jj_consume_token(COMMA);
4982      selectSublist(resultColumns);
4983    }
4984  }
4985
4986/*
4987 * <A NAME="selectSublist">selectSublist</A>
4988 */

4989  final public void selectSublist(ResultColumnList resultColumns) throws ParseException, StandardException {
4990        ResultColumn resultColumn;
4991        ResultColumn allResultColumn;
4992        TableName tableName;
4993    if (getToken(2).kind == PERIOD &&
4994                            (
4995                                    getToken(3).kind == ASTERISK ||
4996                                    (getToken(4).kind == PERIOD && getToken(5).kind == ASTERISK)
4997                            )) {
4998      tableName = qualifiedName(Limits.MAX_IDENTIFIER_LENGTH);
4999      jj_consume_token(PERIOD);
5000      jj_consume_token(ASTERISK);
5001                allResultColumn = (ResultColumn) nodeFactory.getNode(
5002                                                                                C_NodeTypes.ALL_RESULT_COLUMN,
5003                                                                                tableName,
5004                                                                                getContextManager());
5005                /* Add the new AllResultColumn to the end of the list */
5006                resultColumns.addResultColumn(allResultColumn);
5007    } else if (jj_2_18(1)) {
5008      resultColumn = derivedColumn(resultColumns);
5009                /* Add the new ResultColumn to the end of the list */
5010                resultColumns.addResultColumn(resultColumn);
5011    } else {
5012      jj_consume_token(-1);
5013      throw new ParseException();
5014    }
5015  }
5016
5017/*
5018 * <A NAME="derivedColumn">derivedColumn</A>
5019 */

5020  final public ResultColumn derivedColumn(ResultColumnList resultColumns) throws ParseException, StandardException {
5021        ValueNode columnExpression;
5022        String JavaDoc columnName = null;
5023    //true to additiveExpression ensures that for the derived columns, we will not allow boolean values inside (),
5024
//eg (2 > 1) should be disallowed in the select clause
5025
columnExpression = additiveExpression(null, 0, true);
5026    switch (jj_nt.kind) {
5027    case AS:
5028    case BINARY:
5029    case COALESCE:
5030    case COUNT:
5031    case D:
5032    case MODULE:
5033    case T:
5034    case TS:
5035    case VALUE:
5036    case VARBINARY:
5037    case ABS:
5038    case ABSVAL:
5039    case ACTION:
5040    case ALWAYS:
5041    case BLOB:
5042    case C:
5043    case CALLED:
5044    case CLOB:
5045    case COBOL:
5046    case COMMITTED:
5047    case CONCAT:
5048    case CONTAINS:
5049    case DATA:
5050    case DATE:
5051    case DAY:
5052    case DYNAMIC:
5053    case FORTRAN:
5054    case GENERATED:
5055    case IDENTITY_VAL_LOCAL:
5056    case INCREMENT:
5057    case INITIAL:
5058    case INTERVAL:
5059    case LANGUAGE:
5060    case LARGE:
5061    case LENGTH:
5062    case LEVEL:
5063    case LOCKS:
5064    case LOCKSIZE:
5065    case LOGGED:
5066    case MOD:
5067    case MODIFIES:
5068    case MODIFY:
5069    case MONTH:
5070    case _MORE:
5071    case MUMPS:
5072    case NAME:
5073    case NCLOB:
5074    case NULLABLE:
5075    case NUMBER:
5076    case OBJECT:
5077    case PASCAL:
5078    case PLI:
5079    case PRECISION:
5080    case RELEASE:
5081    case REPEATABLE:
5082    case RESTART:
5083    case RETURNS:
5084    case ROW:
5085    case SAVEPOINT:
5086    case SCALE:
5087    case SERIALIZABLE:
5088    case SQL_TSI_FRAC_SECOND:
5089    case SQL_TSI_SECOND:
5090    case SQL_TSI_MINUTE:
5091    case SQL_TSI_HOUR:
5092    case SQL_TSI_DAY:
5093    case SQL_TSI_WEEK:
5094    case SQL_TSI_MONTH:
5095    case SQL_TSI_QUARTER:
5096    case SQL_TSI_YEAR:
5097    case START:
5098    case STATEMENT:
5099    case SYNONYM:
5100    case THEN:
5101    case TIME:
5102    case TIMESTAMP:
5103    case TIMESTAMPADD:
5104    case TIMESTAMPDIFF:
5105    case TRUNCATE:
5106    case TYPE:
5107    case UNCOMMITTED:
5108    case USAGE:
5109    case WHEN:
5110    case CURDATE:
5111    case CURTIME:
5112    case DATABASE:
5113    case LONG:
5114    case AFTER:
5115    case BEFORE:
5116    case CLASS:
5117    case COMPRESS:
5118    case CONTENT:
5119    case CS:
5120    case DB2SQL:
5121    case DIRTY:
5122    case DOCUMENT:
5123    case EACH:
5124    case EMPTY:
5125    case EXCLUSIVE:
5126    case FN:
5127    case INDEX:
5128    case JAVA:
5129    case LCASE:
5130    case LOCATE:
5131    case LOCK:
5132    case MESSAGE_LOCALE:
5133    case METHOD:
5134    case MODE:
5135    case NEW:
5136    case NEW_TABLE:
5137    case OJ:
5138    case OFF:
5139    case OLD:
5140    case OLD_TABLE:
5141    case PARAMETER:
5142    case PASSING:
5143    case PROPERTIES:
5144    case READS:
5145    case REF:
5146    case REFERENCING:
5147    case RENAME:
5148    case RESET:
5149    case RESULT:
5150    case RETAIN:
5151    case RETURNING:
5152    case RR:
5153    case RS:
5154    case SEQUENCE:
5155    case SEQUENTIAL:
5156    case SETS:
5157    case SHARE:
5158    case SQLID:
5159    case SPECIFIC:
5160    case SQRT:
5161    case STABILITY:
5162    case STRIP:
5163    case STYLE:
5164    case TRIGGER:
5165    case UCASE:
5166    case UR:
5167    case WHITESPACE:
5168    case IDENTIFIER:
5169    case DELIMITED_IDENTIFIER:
5170      columnName = asClause();
5171      break;
5172    default:
5173      jj_la1[92] = jj_gen;
5174      ;
5175    }
5176                /*
5177        ** If there is no AS clause, and the expression is a simple
5178        ** column, use the name of the column as the result column
5179        ** name.
5180        */

5181                if ((columnName == null) && (columnExpression instanceof ColumnReference))
5182                {
5183                        columnName = ((ColumnReference) columnExpression).columnName;
5184                }
5185
5186                {if (true) return (ResultColumn) nodeFactory.getNode(
5187                                                C_NodeTypes.RESULT_COLUMN,
5188                                                columnName,
5189                                                columnExpression,
5190                                                getContextManager());}
5191    throw new Error JavaDoc("Missing return statement in function");
5192  }
5193
5194/*
5195 * <A NAME="asClause">asClause</A>
5196 */

5197  final public String JavaDoc asClause() throws ParseException, StandardException {
5198        String JavaDoc columnName;
5199    switch (jj_nt.kind) {
5200    case AS:
5201      jj_consume_token(AS);
5202      break;
5203    default:
5204      jj_la1[93] = jj_gen;
5205      ;
5206    }
5207    columnName = identifier(Limits.MAX_IDENTIFIER_LENGTH, true);
5208                {if (true) return columnName;}
5209    throw new Error JavaDoc("Missing return statement in function");
5210  }
5211
5212/*
5213 * <A NAME="valueExpression">valueExpression</A>
5214 *
5215 * @param inSelectClause will be true if this method got called while parsing the select or values clause
5216 * If in select or values clause, we do not want to allow boolean values.
5217 */

5218  final public ValueNode valueExpression(boolean inSelectClause) throws ParseException, StandardException {
5219        ValueNode leftOperand;
5220    leftOperand = orExpression(null, inSelectClause);
5221    label_10:
5222    while (true) {
5223      switch (jj_nt.kind) {
5224      case OR:
5225        ;
5226        break;
5227      default:
5228        jj_la1[94] = jj_gen;
5229        break label_10;
5230      }
5231      jj_consume_token(OR);
5232      leftOperand = orExpression(leftOperand, inSelectClause);
5233    }
5234                {if (true) return leftOperand;}
5235    throw new Error JavaDoc("Missing return statement in function");
5236  }
5237
5238/*
5239 * <A NAME="orExpression">orExpression</A>
5240 *
5241 * @param inSelectClause will be true if this method got called while parsing the select or values clause
5242 * If in select or values clause, we do not want to allow boolean values.
5243 */

5244  final public ValueNode orExpression(ValueNode farLeftOperand, boolean inSelectClause) throws ParseException, StandardException {
5245        ValueNode leftOperand;
5246    leftOperand = andExpression(null, inSelectClause);
5247    label_11:
5248    while (true) {
5249      switch (jj_nt.kind) {
5250      case AND:
5251        ;
5252        break;
5253      default:
5254        jj_la1[95] = jj_gen;
5255        break label_11;
5256      }
5257      jj_consume_token(AND);
5258      leftOperand = andExpression(leftOperand, inSelectClause);
5259    }
5260                if (farLeftOperand == null)
5261                {
5262                        {if (true) return leftOperand;}
5263                }
5264                else
5265                {
5266                        {if (true) return (ValueNode) nodeFactory.getNode(
5267                                                                                C_NodeTypes.OR_NODE,
5268                                                                                farLeftOperand,
5269                                                                                leftOperand,
5270                                                                                getContextManager());}
5271                }
5272    throw new Error JavaDoc("Missing return statement in function");
5273  }
5274
5275/*
5276 * <A NAME="andExpression">andExpression</A>
5277 *
5278 * @param inSelectClause will be true if this method got called while parsing the select or values clause
5279 * If in select or values clause, we do not want to allow boolean values.
5280 */

5281  final public ValueNode andExpression(ValueNode farLeftOperand, boolean inSelectClause) throws ParseException, StandardException {
5282        Token tok = null;
5283        ValueNode test;
5284    if (getToken(1).kind == NOT && !(getToken(2).kind == PERIOD ||
5285                            getToken(2).kind == DOUBLE_COLON)) {
5286      tok = jj_consume_token(NOT);
5287    } else {
5288      ;
5289    }
5290    test = isSearchCondition(inSelectClause);
5291                /* Put the NOT on top of test */
5292                if (tok != null)
5293                {
5294                        test = (ValueNode) nodeFactory.getNode(
5295                                                                        C_NodeTypes.NOT_NODE,
5296                                                                        test,
5297                                                                        getContextManager());
5298                }
5299
5300                if (farLeftOperand != null)
5301                {
5302                        test = (ValueNode) nodeFactory.getNode(
5303                                                                                C_NodeTypes.AND_NODE,
5304                                                                                farLeftOperand,
5305                                                                                test,
5306                                                                                getContextManager());
5307                }
5308                {if (true) return test;}
5309    throw new Error JavaDoc("Missing return statement in function");
5310  }
5311
5312/*
5313 * <A NAME="isSearchCondition">isSearchCondition</A>
5314 *
5315 * @param inSelectClause will be true if this method got called while parsing the select or values clause
5316 * If in select or values clause, we do not want to allow boolean values.
5317 */

5318  final public ValueNode isSearchCondition(boolean inSelectClause) throws ParseException, StandardException {
5319        ValueNode result;
5320        ValueNode booleanPrimary;
5321        Token isToken = null;
5322        Token notToken = null;
5323        Token truthValue = null;
5324    booleanPrimary = booleanPrimary(inSelectClause);
5325    switch (jj_nt.kind) {
5326    case IS:
5327      isToken = jj_consume_token(IS);
5328      switch (jj_nt.kind) {
5329      case NOT:
5330        notToken = jj_consume_token(NOT);
5331        break;
5332      default:
5333        jj_la1[96] = jj_gen;
5334        ;
5335      }
5336      jj_consume_token(NULL);
5337      break;
5338    default:
5339      jj_la1[97] = jj_gen;
5340      ;
5341    }
5342                if ( isToken != null )
5343                {
5344                                result = (ValueNode) nodeFactory.getNode(
5345                                                                                        C_NodeTypes.IS_NULL_NODE,
5346                                                                                        booleanPrimary,
5347                                                                                        getContextManager());
5348
5349                                /* Put the NOT on top of the tree */
5350                                if (notToken != null)
5351                                {
5352                                        result = (ValueNode) nodeFactory.getNode(
5353                                                                                        C_NodeTypes.NOT_NODE,
5354                                                                                        result,
5355                                                                                        getContextManager());
5356                                }
5357                }
5358                else { result = booleanPrimary; }
5359
5360                {if (true) return result;}
5361    throw new Error JavaDoc("Missing return statement in function");
5362  }
5363
5364/*
5365 * <A NAME="booleanPrimary">booleanPrimary</A>
5366 *
5367 * @param inSelectClause will be true if this method got called while parsing the select or values clause
5368 * If in select or values clause, we do not want to allow boolean values.
5369 */

5370  final public ValueNode booleanPrimary(boolean inSelectClause) throws ParseException, StandardException {
5371        ValueNode primary;
5372        ValueNode searchCondition;
5373    primary = predicate(inSelectClause);
5374                {if (true) return primary;}
5375    throw new Error JavaDoc("Missing return statement in function");
5376  }
5377
5378/*
5379 * <A NAME="predicate">predicate</A>
5380 *
5381 * @param inSelectClause will be true if this method got called while parsing the select or values clause
5382 * If in select or values clause, we do not want to allow boolean values.
5383 */

5384  final public ValueNode predicate(boolean inSelectClause) throws ParseException, StandardException {
5385        ValueNode value;
5386    if (jj_2_19(1)) {
5387      value = additiveExpression(null, 0, inSelectClause);
5388    } else {
5389      switch (jj_nt.kind) {
5390      case EXISTS:
5391        value = existsExpression();
5392        break;
5393      default:
5394        jj_la1[98] = jj_gen;
5395        jj_consume_token(-1);
5396        throw new ParseException();
5397      }
5398    }
5399    label_12:
5400    while (true) {
5401      if (remainingPredicateFollows()) {
5402        ;
5403      } else {
5404        break label_12;
5405      }
5406      value = remainingPredicate(value, inSelectClause);
5407    }
5408                {if (true) return value;}
5409    throw new Error JavaDoc("Missing return statement in function");
5410  }
5411
5412/*
5413 * <A NAME="remainingPredicates">remainingPredicates</A>
5414 *
5415 * @param inSelectClause will be true if this method got called while parsing the select or values clause
5416 * If in select or values clause, we do not want to allow boolean values.
5417 */

5418  final public ValueNode remainingPredicate(ValueNode value, boolean inSelectClause) throws ParseException, StandardException {
5419        Token tok = null;
5420    switch (jj_nt.kind) {
5421    case LESS_THAN_OPERATOR:
5422    case LESS_THAN_OR_EQUALS_OPERATOR:
5423    case EQUALS_OPERATOR:
5424    case NOT_EQUALS_OPERATOR:
5425    case NOT_EQUALS_OPERATOR2:
5426    case GREATER_THAN_OPERATOR:
5427    case GREATER_THAN_OR_EQUALS_OPERATOR:
5428      value = remainingNonNegatablePredicate(value, inSelectClause);
5429                {if (true) return value;}
5430      break;
5431    case BETWEEN:
5432    case IN:
5433    case LIKE:
5434    case NOT:
5435      switch (jj_nt.kind) {
5436      case NOT:
5437        tok = jj_consume_token(NOT);
5438        break;
5439      default:
5440        jj_la1[99] = jj_gen;
5441        ;
5442      }
5443      value = remainingNegatablePredicate(value, inSelectClause);
5444                /* Put the NOT on top of the tree */
5445                if (tok != null)
5446                {
5447                        value = (ValueNode) nodeFactory.getNode(
5448                                                                                C_NodeTypes.NOT_NODE,
5449                                                                                value,
5450                                                                                getContextManager());
5451                }
5452
5453                {if (true) return value;}
5454      break;
5455    default:
5456      jj_la1[100] = jj_gen;
5457      jj_consume_token(-1);
5458      throw new ParseException();
5459    }
5460    throw new Error JavaDoc("Missing return statement in function");
5461  }
5462
5463/*
5464 * <A NAME="remainingNonNegatablePredicate">remainingNonNegatablePredicate</A>
5465 *
5466 * @param inSelectClause will be true if this method got called while parsing the select or values clause
5467 * If in select or values clause, we do not want to allow boolean values.
5468 */

5469  final public ValueNode remainingNonNegatablePredicate(ValueNode leftOperand, boolean inSelectClause) throws ParseException, StandardException {
5470        int operator;
5471        String JavaDoc javaClassName;
5472        Token tok = null;
5473        ValueNode tree = null;
5474        ValueNode likePattern;
5475        ValueNode betweenLeft;
5476        ValueNode betweenRight;
5477    operator = compOp();
5478    if ((getToken(1).kind == ALL || getToken(1).kind == ANY ||
5479                            getToken(1).kind == SOME) && getToken(2).kind == LEFT_PAREN) {
5480      operator = quantifier(operator);
5481      jj_consume_token(LEFT_PAREN);
5482      leftOperand = tableSubquery(operator, leftOperand);
5483      jj_consume_token(RIGHT_PAREN);
5484    } else if (jj_2_20(1)) {
5485      leftOperand = additiveExpression(leftOperand, operator, inSelectClause);
5486    } else {
5487      jj_consume_token(-1);
5488      throw new ParseException();
5489    }
5490                {if (true) return leftOperand;}
5491    throw new Error JavaDoc("Missing return statement in function");
5492  }
5493
5494/*
5495 * <A NAME="remainingNegatablePredicate">remainingNegatablePredicate</A>
5496 *
5497 * @param inSelectClause will be true if this method got called while parsing the select or values clause
5498 * If in select or values clause, we do not want to allow boolean values.
5499 */

5500  final public ValueNode remainingNegatablePredicate(ValueNode leftOperand, boolean inSelectClause) throws ParseException, StandardException {
5501        ValueNode tree = null;
5502        ValueNode likePattern;
5503        ValueNode betweenLeft;
5504        ValueNode betweenRight;
5505        ValueNode escapeValue = null;
5506    switch (jj_nt.kind) {
5507    case IN:
5508      jj_consume_token(IN);
5509      tree = inPredicateValue(leftOperand);
5510                {if (true) return tree;}
5511      break;
5512    case LIKE:
5513      jj_consume_token(LIKE);
5514      likePattern = additiveExpression(null, 0, inSelectClause);
5515      switch (jj_nt.kind) {
5516      case ESCAPE:
5517      case LEFT_BRACE:
5518        switch (jj_nt.kind) {
5519        case ESCAPE:
5520          jj_consume_token(ESCAPE);
5521          escapeValue = additiveExpression(null, 0, inSelectClause);
5522          break;
5523        case LEFT_BRACE:
5524          jj_consume_token(LEFT_BRACE);
5525          jj_consume_token(ESCAPE);
5526          escapeValue = additiveExpression(null, 0, inSelectClause);
5527          jj_consume_token(RIGHT_BRACE);
5528          break;
5529        default:
5530          jj_la1[101] = jj_gen;
5531          jj_consume_token(-1);
5532          throw new ParseException();
5533        }
5534        break;
5535      default:
5536        jj_la1[102] = jj_gen;
5537        ;
5538      }
5539                tree = (ValueNode) nodeFactory.getNode(
5540                                                                C_NodeTypes.LIKE_OPERATOR_NODE,
5541                                                                leftOperand,
5542                                                                likePattern,
5543                                                                escapeValue,
5544                                                                getContextManager());
5545
5546                {if (true) return tree;}
5547      break;
5548    case BETWEEN:
5549      jj_consume_token(BETWEEN);
5550      betweenLeft = additiveExpression(null, 0, inSelectClause);
5551      jj_consume_token(AND);
5552      betweenRight = additiveExpression(null, 0, inSelectClause);
5553                ValueNodeList betweenList = (ValueNodeList) nodeFactory.getNode(
5554                                                                                                        C_NodeTypes.VALUE_NODE_LIST,
5555                                                                                                        getContextManager());
5556                betweenList.addElement(betweenLeft);
5557                betweenList.addElement(betweenRight);
5558                tree = (ValueNode) nodeFactory.getNode(
5559                                                                C_NodeTypes.BETWEEN_OPERATOR_NODE,
5560                                                                leftOperand,
5561                                                                betweenList,
5562                                                                getContextManager());
5563
5564                {if (true) return tree;}
5565      break;
5566    default:
5567      jj_la1[103] = jj_gen;
5568      jj_consume_token(-1);
5569      throw new ParseException();
5570    }
5571    throw new Error JavaDoc("Missing return statement in function");
5572  }
5573
5574/*
5575 * <A NAME="compOp">compOp</A>
5576 */

5577  final public int compOp() throws ParseException, StandardException {
5578    switch (jj_nt.kind) {
5579    case EQUALS_OPERATOR:
5580      jj_consume_token(EQUALS_OPERATOR);
5581                {if (true) return BinaryOperatorNode.EQ;}
5582      break;
5583    case NOT_EQUALS_OPERATOR:
5584      jj_consume_token(NOT_EQUALS_OPERATOR);
5585                {if (true) return BinaryOperatorNode.NE;}
5586      break;
5587    case NOT_EQUALS_OPERATOR2:
5588      jj_consume_token(NOT_EQUALS_OPERATOR2);
5589                {if (true) return BinaryOperatorNode.NE;}
5590      break;
5591    case LESS_THAN_OPERATOR:
5592      jj_consume_token(LESS_THAN_OPERATOR);
5593                {if (true) return BinaryOperatorNode.LT;}
5594      break;
5595    case GREATER_THAN_OPERATOR:
5596      jj_consume_token(GREATER_THAN_OPERATOR);
5597                {if (true) return BinaryOperatorNode.GT;}
5598      break;
5599    case LESS_THAN_OR_EQUALS_OPERATOR:
5600      jj_consume_token(LESS_THAN_OR_EQUALS_OPERATOR);
5601                {if (true) return BinaryOperatorNode.LE;}
5602      break;
5603    case GREATER_THAN_OR_EQUALS_OPERATOR:
5604      jj_consume_token(GREATER_THAN_OR_EQUALS_OPERATOR);
5605                {if (true) return BinaryOperatorNode.GE;}
5606      break;
5607    default:
5608      jj_la1[104] = jj_gen;
5609      jj_consume_token(-1);
5610      throw new ParseException();
5611    }
5612    throw new Error JavaDoc("Missing return statement in function");
5613  }
5614
5615/*
5616 * <A NAME="additiveExpression">additiveExpression</A>
5617 *
5618 * @param inSelectClause will be true if this method got called while parsing the select or values clause
5619 * If in select or values clause, we do not want to allow boolean values.
5620 */

5621  final public ValueNode additiveExpression(ValueNode farLeftOperand, int compOp, boolean inSelectClause) throws ParseException, StandardException {
5622        ValueNode leftOperand;
5623        int operator;
5624        int nodeType;
5625    leftOperand = multiplicativeExpression(null, 0, inSelectClause);
5626    label_13:
5627    while (true) {
5628      switch (jj_nt.kind) {
5629      case PLUS_SIGN:
5630      case MINUS_SIGN:
5631        ;
5632        break;
5633      default:
5634        jj_la1[105] = jj_gen;
5635        break label_13;
5636      }
5637      operator = additiveOperator();
5638      leftOperand = multiplicativeExpression(leftOperand, operator, inSelectClause);
5639    }
5640                if (farLeftOperand == null)
5641                        {if (true) return leftOperand;}
5642
5643                switch (compOp)
5644                {
5645                  case BinaryOperatorNode.EQ:
5646                        nodeType = C_NodeTypes.BINARY_EQUALS_OPERATOR_NODE;
5647                        break;
5648
5649                  case BinaryOperatorNode.NE:
5650                        nodeType = C_NodeTypes.BINARY_NOT_EQUALS_OPERATOR_NODE;
5651                        break;
5652
5653                  case BinaryOperatorNode.LT:
5654                        nodeType = C_NodeTypes.BINARY_LESS_THAN_OPERATOR_NODE;
5655                        break;
5656
5657                  case BinaryOperatorNode.GT:
5658                        nodeType = C_NodeTypes.BINARY_GREATER_THAN_OPERATOR_NODE;
5659                        break;
5660
5661                  case BinaryOperatorNode.LE:
5662                        nodeType = C_NodeTypes.BINARY_LESS_EQUALS_OPERATOR_NODE;
5663                        break;
5664
5665                  case BinaryOperatorNode.GE:
5666                        nodeType = C_NodeTypes.BINARY_GREATER_EQUALS_OPERATOR_NODE;
5667                        break;
5668
5669                  default:
5670                        if (SanityManager.DEBUG)
5671                        SanityManager.THROWASSERT("Unknown comparison operator " + compOp);
5672                        nodeType = 0;
5673                        break;
5674                }
5675
5676                {if (true) return (ValueNode) nodeFactory.getNode(
5677                                                        nodeType,
5678                                                        farLeftOperand,
5679                                                        leftOperand,
5680                                                        getContextManager());}
5681    throw new Error JavaDoc("Missing return statement in function");
5682  }
5683
5684/*
5685 * <A NAME="additiveOperator">additiveOperator</A>
5686 */

5687  final public int additiveOperator() throws ParseException, StandardException {
5688        Token tok;
5689    switch (jj_nt.kind) {
5690    case PLUS_SIGN:
5691      tok = jj_consume_token(PLUS_SIGN);
5692                {if (true) return BinaryOperatorNode.PLUS;}
5693      break;
5694    case MINUS_SIGN:
5695      tok = jj_consume_token(MINUS_SIGN);
5696                {if (true) return BinaryOperatorNode.MINUS;}
5697      break;
5698    default:
5699      jj_la1[106] = jj_gen;
5700      jj_consume_token(-1);
5701      throw new ParseException();
5702    }
5703    throw new Error JavaDoc("Missing return statement in function");
5704  }
5705
5706/*
5707 * <A NAME="multiplicativeExpression">multiplicativeExpression</A>
5708 *
5709 * @param inSelectClause will be true if this method got called while parsing the select or values clause
5710 * If in select or values clause, we do not want to allow boolean values.
5711 */

5712  final public ValueNode multiplicativeExpression(ValueNode farLeftOperand, int additiveOperator, boolean inSelectClause) throws ParseException, StandardException {
5713        ValueNode leftOperand;
5714        int multOp;
5715    leftOperand = unaryExpression(null, 0, inSelectClause);
5716    label_14:
5717    while (true) {
5718      switch (jj_nt.kind) {
5719      case ASTERISK:
5720      case SOLIDUS:
5721      case CONCATENATION_OPERATOR:
5722        ;
5723        break;
5724      default:
5725        jj_la1[107] = jj_gen;
5726        break label_14;
5727      }
5728      multOp = multiplicativeOperator();
5729      leftOperand = unaryExpression(leftOperand, multOp, inSelectClause);
5730    }
5731                if (farLeftOperand == null)
5732                        {if (true) return leftOperand;}
5733
5734                switch (additiveOperator)
5735                {
5736                  case BinaryOperatorNode.PLUS:
5737                        {if (true) return (ValueNode) nodeFactory.getNode(
5738                                                                        C_NodeTypes.BINARY_PLUS_OPERATOR_NODE,
5739                                                                        farLeftOperand,
5740                                                                        leftOperand,
5741                                                                        getContextManager()
5742                                                                        );}
5743
5744                  case BinaryOperatorNode.MINUS:
5745                        {if (true) return (ValueNode) nodeFactory.getNode(
5746                                                                        C_NodeTypes.BINARY_MINUS_OPERATOR_NODE,
5747                                                                        farLeftOperand,
5748                                                                        leftOperand,
5749                                                                        getContextManager()
5750                                                                        );}
5751
5752                  default:
5753                        if (SanityManager.DEBUG)
5754                        SanityManager.THROWASSERT(
5755                                        "Unexpected operator value of " + additiveOperator);
5756                        {if (true) return null;}
5757                }
5758    throw new Error JavaDoc("Missing return statement in function");
5759  }
5760
5761/*
5762 * <A NAME="multiplicativeOperator">multiplicativeOperator</A>
5763 */

5764  final public int multiplicativeOperator() throws ParseException, StandardException {
5765    switch (jj_nt.kind) {
5766    case ASTERISK:
5767      jj_consume_token(ASTERISK);
5768                {if (true) return BinaryOperatorNode.TIMES;}
5769      break;
5770    case SOLIDUS:
5771      jj_consume_token(SOLIDUS);
5772                {if (true) return BinaryOperatorNode.DIVIDE;}
5773      break;
5774    case CONCATENATION_OPERATOR:
5775      jj_consume_token(CONCATENATION_OPERATOR);
5776                {if (true) return BinaryOperatorNode.CONCATENATE;}
5777      break;
5778    default:
5779      jj_la1[108] = jj_gen;
5780      jj_consume_token(-1);
5781      throw new ParseException();
5782    }
5783    throw new Error JavaDoc("Missing return statement in function");
5784  }
5785
5786/*
5787 * <A NAME="unaryExpression">unaryExpression</A>
5788 *
5789 * @param inSelectClause will be true if this method got called while parsing the select or values clause
5790 * If in select or values clause, we do not want to allow boolean values.
5791 */

5792  final public ValueNode unaryExpression(ValueNode farLeftOperand, int multiplicativeOperator, boolean inSelectClause) throws ParseException, StandardException {
5793        ValueNode value;
5794        String JavaDoc sign = null;
5795        int tokKind1;
5796        int tokKind2;
5797    if (( (tokKind1 = getToken(1).kind) == PLUS_SIGN ||
5798                                               tokKind1 == MINUS_SIGN )
5799                                            &&
5800                                            ( (tokKind2 = getToken(2).kind) != EXACT_NUMERIC &&
5801                                               tokKind2 != APPROXIMATE_NUMERIC)) {
5802      sign = sign();
5803    } else {
5804      ;
5805    }
5806    value = primaryExpression(inSelectClause);
5807                if ("-".equals(sign))
5808                {
5809                        value = (ValueNode) nodeFactory.getNode(
5810                                                                                C_NodeTypes.UNARY_MINUS_OPERATOR_NODE,
5811                                                                                value,
5812                                                                                getContextManager());
5813                }
5814                else if ("+".equals(sign))
5815                {
5816                        value = (ValueNode) nodeFactory.getNode(
5817                                                                                C_NodeTypes.UNARY_PLUS_OPERATOR_NODE,
5818                                                                                value,
5819                                                                                getContextManager());
5820                }
5821                else if (SanityManager.DEBUG)
5822                {
5823                        if (sign != null)
5824                        {
5825                                SanityManager.THROWASSERT("Unknown unary operator '"
5826                                                                                        + sign
5827                                                                                        + "'");
5828                        }
5829                }
5830
5831                {if (true) return multOp(farLeftOperand, value, multiplicativeOperator);}
5832    throw new Error JavaDoc("Missing return statement in function");
5833  }
5834
5835/*
5836 * <A NAME="sign">sign</A>
5837 */

5838  final public String JavaDoc sign() throws ParseException {
5839        Token s;
5840    switch (jj_nt.kind) {
5841    case PLUS_SIGN:
5842      s = jj_consume_token(PLUS_SIGN);
5843                {if (true) return s.image;}
5844      break;
5845    case MINUS_SIGN:
5846      s = jj_consume_token(MINUS_SIGN);
5847                {if (true) return s.image;}
5848      break;
5849    default:
5850      jj_la1[109] = jj_gen;
5851      jj_consume_token(-1);
5852      throw new ParseException();
5853    }
5854    throw new Error JavaDoc("Missing return statement in function");
5855  }
5856
5857/*
5858 * <A NAME="primaryExpressionXX">primaryExpressionXX</A>
5859 *
5860 * @param inSelectClause will be true if this method got called while parsing the select or values clause
5861 * If in select or values clause, we do not want to allow boolean values.
5862 */

5863  final public ValueNode primaryExpressionXX(boolean inSelectClause) throws ParseException, StandardException {
5864        ValueNode value;
5865    value = primary(inSelectClause);
5866    label_15:
5867    while (true) {
5868      if (jj_2_21(1)) {
5869        ;
5870      } else {
5871        break label_15;
5872      }
5873      value = nonStaticMethodCallOrFieldAccess(value);
5874    }
5875                {if (true) return value;}
5876    throw new Error JavaDoc("Missing return statement in function");
5877  }
5878
5879  final public ValueNode nonStaticMethodCallOrFieldAccess(ValueNode receiver) throws ParseException, StandardException {
5880        ValueNode value;
5881    value = nonStaticMethodInvocation(receiver);
5882                {if (true) return value;}
5883    throw new Error JavaDoc("Missing return statement in function");
5884  }
5885
5886/*
5887 * <A NAME="nonStaticMethodInvocation">nonStaticMethodInvocation</A>
5888 */

5889  final public ValueNode nonStaticMethodInvocation(ValueNode receiver) throws ParseException, StandardException {
5890        Vector JavaDoc parameterList = new Vector JavaDoc();
5891        MethodCallNode methodNode;
5892        ParameterNode parameterNode;
5893    if (getToken(3).kind == LEFT_PAREN) {
5894      switch (jj_nt.kind) {
5895      case FIELD_REFERENCE:
5896        jj_consume_token(FIELD_REFERENCE);
5897        break;
5898      case PERIOD:
5899        jj_consume_token(PERIOD);
5900        break;
5901      default:
5902        jj_la1[110] = jj_gen;
5903        jj_consume_token(-1);
5904        throw new ParseException();
5905      }
5906      methodNode = methodName(receiver);
5907      methodCallParameterList(parameterList);
5908                /*
5909        ** ? parameters are not allowed for the receiver --
5910        ** unless the receiver is standing in for a named parameter,
5911        ** whose type is therefore known.
5912        */

5913                if (receiver instanceof ParameterNode)
5914                {
5915                        {if (true) throw StandardException.newException(SQLState.LANG_PARAMETER_RECEIVER,
5916                                                                                                methodNode.getMethodName());}
5917                }
5918
5919                methodNode.addParms(parameterList);
5920
5921                /*
5922        ** Assume this is being returned to the SQL domain. If it turns
5923        ** out that this is being returned to the Java domain, we will
5924        ** get rid of this node.
5925        */

5926                {if (true) return (ValueNode) nodeFactory.getNode(
5927                                                                C_NodeTypes.JAVA_TO_SQL_VALUE_NODE,
5928                                                                methodNode,
5929                                                                getContextManager());}
5930    } else {
5931      switch (jj_nt.kind) {
5932      case PERIOD:
5933        jj_consume_token(PERIOD);
5934        methodNode = methodName(receiver);
5935                /*
5936        ** ? parameters are not allowed for the receiver --
5937        ** unless the receiver is standing in for a named parameter,
5938        ** whose type is therefore known.
5939        */

5940                if (receiver instanceof ParameterNode)
5941                {
5942                        {if (true) throw StandardException.newException(SQLState.LANG_PARAMETER_RECEIVER,
5943                                                                                                methodNode.getMethodName());}
5944                }
5945
5946                methodNode.addParms(parameterList);
5947
5948                /*
5949        ** Assume this is being returned to the SQL domain. If it turns
5950        ** out that this is being returned to the Java domain, we will
5951        ** get rid of this node.
5952        */

5953                {if (true) return (ValueNode) nodeFactory.getNode(
5954                                                                C_NodeTypes.JAVA_TO_SQL_VALUE_NODE,
5955                                                                methodNode,
5956                                                                getContextManager());}
5957        break;
5958      default:
5959        jj_la1[111] = jj_gen;
5960        jj_consume_token(-1);
5961        throw new ParseException();
5962      }
5963    }
5964    throw new Error JavaDoc("Missing return statement in function");
5965  }
5966
5967/*
5968 * <A NAME="methodName">methodName</A>
5969 */

5970  final public MethodCallNode methodName(ValueNode receiver) throws ParseException, StandardException {
5971        String JavaDoc methodName;
5972    /*
5973        ** NOTE: allowing a delimited identifier as a method name is necessary,
5974        ** because Java is case-sensitive. But this also allows identifiers that
5975        ** do not match Java syntax. This will probably not cause a problem
5976        ** in later phases, like binding and code generation.
5977        */

5978            methodName = caseSensitiveIdentifierPlusReservedWords();
5979                {if (true) return (MethodCallNode) nodeFactory.getNode(
5980                                                                                C_NodeTypes.NON_STATIC_METHOD_CALL_NODE,
5981                                                                                methodName,
5982                                                                                receiver,
5983                                                                                getContextManager());}
5984    throw new Error JavaDoc("Missing return statement in function");
5985  }
5986
5987/*
5988 * <A NAME="staticMethodName">staticMethodName</A>
5989 */

5990  final public MethodCallNode staticMethodName(String JavaDoc javaClassName) throws ParseException, StandardException {
5991        String JavaDoc methodName;
5992    /*
5993        ** NOTE: allowing a delimited identifier as a method name is necessary,
5994        ** because Java is case-sensitive. But this also allows identifiers that
5995        ** do not match Java syntax. This will probably not cause a problem
5996        ** in later phases, like binding and code generation.
5997        */

5998            methodName = caseSensitiveIdentifierPlusReservedWords();
5999                {if (true) return (MethodCallNode) nodeFactory.getNode(
6000                                                                C_NodeTypes.STATIC_METHOD_CALL_NODE,
6001                                                                methodName,
6002                                                                javaClassName,
6003                                                                getContextManager());}
6004    throw new Error JavaDoc("Missing return statement in function");
6005  }
6006
6007/*
6008 * <A NAME="methodParameter">methodParameter</A>
6009 */

6010  final public void methodParameter(Vector JavaDoc parameterList) throws ParseException, StandardException {
6011        ValueNode parameter;
6012    if (jj_2_22(1)) {
6013      parameter = additiveExpression(null,0, false);
6014                parameterList.addElement(parameter);
6015    } else {
6016      switch (jj_nt.kind) {
6017      case NULL:
6018        parameter = nullSpecification();
6019                parameterList.addElement(parameter);
6020        break;
6021      default:
6022        jj_la1[112] = jj_gen;
6023        jj_consume_token(-1);
6024        throw new ParseException();
6025      }
6026    }
6027  }
6028
6029/*
6030 * <A NAME="primary">primary</A>
6031 *
6032 * @param inSelectClause will be true if this method got called while parsing the select or values clause
6033 * If in select or values clause, we do not want to allow boolean values.
6034 */

6035  final public ValueNode primary(boolean inSelectClause) throws ParseException, StandardException {
6036        String JavaDoc javaClassName;
6037        ValueNode value;
6038    if (javaClassFollows()) {
6039      value = staticClassReference();
6040                {if (true) return value;}
6041    } else if (jj_2_23(1)) {
6042      value = valueExpressionPrimary(inSelectClause);
6043                {if (true) return value;}
6044    } else {
6045      jj_consume_token(-1);
6046      throw new ParseException();
6047    }
6048    throw new Error JavaDoc("Missing return statement in function");
6049  }
6050
6051/*
6052 * <A NAME="staticClassReference">staticClassReference</A>
6053 */

6054  final public ValueNode staticClassReference() throws ParseException, StandardException {
6055        String JavaDoc javaClassName;
6056        ValueNode value;
6057    javaClassName = javaClass();
6058    jj_consume_token(DOUBLE_COLON);
6059    value = staticClassReferenceType(javaClassName);
6060                {if (true) return value;}
6061    throw new Error JavaDoc("Missing return statement in function");
6062  }
6063
6064/*
6065 * <A NAME="staticClassReferenceType">staticClassReferenceType</A>
6066 */

6067  final public ValueNode staticClassReferenceType(String JavaDoc javaClassName) throws ParseException, StandardException {
6068        ValueNode value;
6069    if ((getToken(2).kind == LEFT_PAREN)) {
6070      value = staticMethodInvocation(javaClassName);
6071                {if (true) return value;}
6072    } else {
6073      switch (jj_nt.kind) {
6074      case ADD:
6075      case ALL:
6076      case ALLOCATE:
6077      case ALTER:
6078      case AND:
6079      case ANY:
6080      case ARE:
6081      case AS:
6082      case ASC:
6083      case ASSERTION:
6084      case AT:
6085      case AUTHORIZATION:
6086      case AVG:
6087      case BEGIN:
6088      case BETWEEN:
6089      case BINARY:
6090      case BIT:
6091      case BOTH:
6092      case BY:
6093      case CASCADE:
6094      case CASCADED:
6095      case CASE:
6096      case CAST:
6097      case CHAR:
6098      case CHARACTER:
6099      case CHECK:
6100      case CLOSE:
6101      case COALESCE:
6102      case COLLATE:
6103      case COLLATION:
6104      case COLUMN:
6105      case COMMIT:
6106      case CONNECT:
6107      case CONNECTION:
6108      case CONSTRAINT:
6109      case CONSTRAINTS:
6110      case CONTINUE:
6111      case CONVERT:
6112      case CORRESPONDING:
6113      case COUNT:
6114      case CREATE:
6115      case CURRENT:
6116      case CURRENT_DATE:
6117      case CURRENT_TIME:
6118      case CURRENT_TIMESTAMP:
6119      case CURRENT_USER:
6120      case CURSOR:
6121      case D:
6122      case DEALLOCATE:
6123      case DEC:
6124      case DECIMAL:
6125      case DECLARE:
6126      case _DEFAULT:
6127      case DEFERRABLE:
6128      case DEFERRED:
6129      case DELETE:
6130      case DESC:
6131      case DESCRIBE:
6132      case DIAGNOSTICS:
6133      case DISCONNECT:
6134      case DISTINCT:
6135      case DOUBLE:
6136      case DROP:
6137      case ELSE:
6138      case END:
6139      case ENDEXEC:
6140      case ESCAPE:
6141      case EXCEPT:
6142      case EXCEPTION:
6143      case EXEC:
6144      case EXECUTE:
6145      case EXISTS:
6146      case EXTERNAL:
6147      case FALSE:
6148      case FETCH:
6149      case FIRST:
6150      case FLOAT:
6151      case FOR:
6152      case FOREIGN:
6153      case FOUND:
6154      case FROM:
6155      case FULL:
6156      case FUNCTION:
6157      case GET:
6158      case GLOBAL:
6159      case GO:
6160      case GOTO:
6161      case GRANT:
6162      case GROUP:
6163      case HAVING:
6164      case HOUR:
6165      case IDENTITY:
6166      case IMMEDIATE:
6167      case IN:
6168      case INDICATOR:
6169      case INITIALLY:
6170      case INNER:
6171      case INPUT:
6172      case INSENSITIVE:
6173      case INSERT:
6174      case INT:
6175      case INTEGER:
6176      case INTERSECT:
6177      case INTO:
6178      case IS:
6179      case ISOLATION:
6180      case JOIN:
6181      case KEY:
6182      case LAST:
6183      case LEFT:
6184      case LIKE:
6185      case LOWER:
6186      case MATCH:
6187      case MAX:
6188      case MIN:
6189      case MINUTE:
6190      case MODULE:
6191      case NATIONAL:
6192      case NATURAL:
6193      case NCHAR:
6194      case NEXT:
6195      case NO:
6196      case NOT:
6197      case NULL:
6198      case NULLIF:
6199      case NUMERIC:
6200      case OF:
6201      case ON:
6202      case ONLY:
6203      case OPEN:
6204      case OPTION:
6205      case OR:
6206      case ORDER:
6207      case OUTER:
6208      case OUTPUT:
6209      case OVERLAPS:
6210      case PAD:
6211      case PARTIAL:
6212      case PREPARE:
6213      case PRESERVE:
6214      case PRIMARY:
6215      case PRIOR:
6216      case PRIVILEGES:
6217      case PROCEDURE:
6218      case PUBLIC:
6219      case READ:
6220      case REAL:
6221      case REFERENCES:
6222      case RELATIVE:
6223      case RESTRICT:
6224      case REVOKE:
6225      case RIGHT:
6226      case ROLLBACK:
6227      case ROWS:
6228      case SCHEMA:
6229      case SCROLL:
6230      case SECOND:
6231      case SELECT:
6232      case SESSION_USER:
6233      case SET:
6234      case SMALLINT:
6235      case SOME:
6236      case SPACE:
6237      case SQL:
6238      case SQLCODE:
6239      case SQLERROR:
6240      case SQLSTATE:
6241      case SUBSTRING:
6242      case SUM:
6243      case SYSTEM_USER:
6244      case T:
6245      case TABLE:
6246      case TEMPORARY:
6247      case TIMEZONE_HOUR:
6248      case TIMEZONE_MINUTE:
6249      case TO:
6250      case TRANSACTION:
6251      case TRANSLATE:
6252      case TRANSLATION:
6253      case TRUE:
6254      case TS:
6255      case UNION:
6256      case UNIQUE:
6257      case UNKNOWN:
6258      case UPDATE:
6259      case UPPER:
6260      case USER:
6261      case USING:
6262      case VALUE:
6263      case VALUES:
6264      case VARBINARY:
6265      case VARCHAR:
6266      case VARYING:
6267      case VIEW:
6268      case WHENEVER:
6269      case WHERE:
6270      case WITH:
6271      case WORK:
6272      case WRITE:
6273      case YEAR:
6274      case ABS:
6275      case ABSVAL:
6276      case ACTION:
6277      case ALWAYS:
6278      case BLOB:
6279      case C:
6280      case CALLED:
6281      case CLOB:
6282      case COBOL:
6283      case COMMITTED:
6284      case CONCAT:
6285      case CONTAINS:
6286      case DATA:
6287      case DATE:
6288      case DAY:
6289      case DYNAMIC:
6290      case FORTRAN:
6291      case GENERATED:
6292      case IDENTITY_VAL_LOCAL:
6293      case INCREMENT:
6294      case INITIAL:
6295      case INOUT:
6296      case INTERVAL:
6297      case LANGUAGE:
6298      case LARGE:
6299      case LENGTH:
6300      case LEVEL:
6301      case LOCKS:
6302      case LOCKSIZE:
6303      case LOGGED:
6304      case MOD:
6305      case MODIFIES:
6306      case MODIFY:
6307      case MONTH:
6308      case _MORE:
6309      case MUMPS:
6310      case NAME:
6311      case NCLOB:
6312      case NULLABLE:
6313      case NUMBER:
6314      case OBJECT:
6315      case PASCAL:
6316      case PLI:
6317      case PRECISION:
6318      case RELEASE:
6319      case REPEATABLE:
6320      case RESTART:
6321      case RETURNS:
6322      case ROW:
6323      case SAVEPOINT:
6324      case SCALE:
6325      case SERIALIZABLE:
6326      case SQL_TSI_FRAC_SECOND:
6327      case SQL_TSI_SECOND:
6328      case SQL_TSI_MINUTE:
6329      case SQL_TSI_HOUR:
6330      case SQL_TSI_DAY:
6331      case SQL_TSI_WEEK:
6332      case SQL_TSI_MONTH:
6333      case SQL_TSI_QUARTER:
6334      case SQL_TSI_YEAR:
6335      case START:
6336      case STATEMENT:
6337      case SYNONYM:
6338      case THEN:
6339      case TIME:
6340      case TIMESTAMP:
6341      case TIMESTAMPADD:
6342      case TIMESTAMPDIFF:
6343      case TRUNCATE:
6344      case TYPE:
6345      case UNCOMMITTED:
6346      case USAGE:
6347      case WHEN:
6348      case BOOLEAN:
6349      case CALL:
6350      case CURDATE:
6351      case CURTIME:
6352      case DATABASE:
6353      case GET_CURRENT_CONNECTION:
6354      case EXPLAIN:
6355      case LONGINT:
6356      case LONG:
6357      case LTRIM:
6358      case RTRIM:
6359      case SUBSTR:
6360      case XML:
6361      case XMLEXISTS:
6362      case XMLPARSE:
6363      case XMLQUERY:
6364      case XMLSERIALIZE:
6365      case AFTER:
6366      case BEFORE:
6367      case CLASS:
6368      case COMPRESS:
6369      case CONTENT:
6370      case CS:
6371      case DB2SQL:
6372      case DIRTY:
6373      case DOCUMENT:
6374      case EACH:
6375      case EMPTY:
6376      case EXCLUSIVE:
6377      case FN:
6378      case INDEX:
6379      case JAVA:
6380      case LCASE:
6381      case LOCATE:
6382      case LOCK:
6383      case MESSAGE_LOCALE:
6384      case METHOD:
6385      case MODE:
6386      case NEW:
6387      case NEW_TABLE:
6388      case NVARCHAR:
6389      case OJ:
6390      case OFF:
6391      case OLD:
6392      case OLD_TABLE:
6393      case OUT:
6394      case PARAMETER:
6395      case PASSING:
6396      case PROPERTIES:
6397      case READS:
6398      case REF:
6399      case REFERENCING:
6400      case RENAME:
6401      case RESET:
6402      case RESULT:
6403      case RETAIN:
6404      case RETURNING:
6405      case RR:
6406      case RS:
6407      case SEQUENCE:
6408      case SEQUENTIAL:
6409      case SETS:
6410      case SHARE:
6411      case SQLID:
6412      case SPECIFIC:
6413      case SQRT:
6414      case STABILITY:
6415      case STRIP:
6416      case STYLE:
6417      case TRIGGER:
6418      case UCASE:
6419      case UR:
6420      case WHITESPACE:
6421      case IDENTIFIER:
6422      case DELIMITED_IDENTIFIER:
6423        value = staticClassFieldReference(javaClassName);
6424                {if (true) return value;}
6425        break;
6426      default:
6427        jj_la1[113] = jj_gen;
6428        jj_consume_token(-1);
6429        throw new ParseException();
6430      }
6431    }
6432    throw new Error JavaDoc("Missing return statement in function");
6433  }
6434
6435/*
6436 * <A NAME="staticClassFieldReference">staticClassFieldReference</A>
6437 */

6438  final public ValueNode staticClassFieldReference(String JavaDoc javaClassName) throws ParseException, StandardException {
6439        String JavaDoc fieldName = null;
6440    fieldName = caseSensitiveIdentifierPlusReservedWords();
6441                {if (true) return (ValueNode) nodeFactory.getNode(
6442                                        C_NodeTypes.JAVA_TO_SQL_VALUE_NODE,
6443                                        nodeFactory.getNode(
6444                                                                C_NodeTypes.STATIC_CLASS_FIELD_REFERENCE_NODE,
6445                                                                javaClassName,
6446                                                                fieldName,
6447                                                                nextToLastTokenDelimitedIdentifier,
6448                                                                getContextManager()),
6449                                        getContextManager());}
6450    throw new Error JavaDoc("Missing return statement in function");
6451  }
6452
6453/*
6454 * <A NAME="nonSecondDatetimeField">nonSecondDatetimeField</A>
6455 */

6456  final public int nonSecondDatetimeField() throws ParseException {
6457    switch (jj_nt.kind) {
6458    case YEAR:
6459      jj_consume_token(YEAR);
6460                {if (true) return DateTimeDataValue.YEAR_FIELD;}
6461      break;
6462    case MONTH:
6463      jj_consume_token(MONTH);
6464                {if (true) return DateTimeDataValue.MONTH_FIELD;}
6465      break;
6466    case DAY:
6467      jj_consume_token(DAY);
6468                {if (true) return DateTimeDataValue.DAY_FIELD;}
6469      break;
6470    case HOUR:
6471      jj_consume_token(HOUR);
6472                {if (true) return DateTimeDataValue.HOUR_FIELD;}
6473      break;
6474    case MINUTE:
6475      jj_consume_token(MINUTE);
6476                {if (true) return DateTimeDataValue.MINUTE_FIELD;}
6477      break;
6478    default:
6479      jj_la1[114] = jj_gen;
6480      jj_consume_token(-1);
6481      throw new ParseException();
6482    }
6483    throw new Error JavaDoc("Missing return statement in function");
6484  }
6485
6486  final public ValueNode escapedValueFunction() throws ParseException, StandardException {
6487        ValueNode value;
6488    ValueNode str1;
6489    ValueNode str2;
6490        ValueNode startPosition;
6491    ValueNode length = null;
6492    if (jj_2_24(1)) {
6493      value = miscBuiltinsCore(true /* is JDBC escape */);
6494                {if (true) return value;}
6495    } else {
6496      switch (jj_nt.kind) {
6497      case SUBSTRING:
6498        jj_consume_token(SUBSTRING);
6499        jj_consume_token(LEFT_PAREN);
6500        value = additiveExpression(null, 0, false);
6501        jj_consume_token(COMMA);
6502        startPosition = additiveExpression(null, 0, false);
6503        switch (jj_nt.kind) {
6504        case COMMA:
6505          jj_consume_token(COMMA);
6506          length = additiveExpression(null, 0, false);
6507          break;
6508        default:
6509          jj_la1[115] = jj_gen;
6510          ;
6511        }
6512        jj_consume_token(RIGHT_PAREN);
6513        {if (true) return getSubstringNode(value, startPosition, length, Boolean.FALSE);}
6514        break;
6515      case CURDATE:
6516        jj_consume_token(CURDATE);
6517        jj_consume_token(LEFT_PAREN);
6518        jj_consume_token(RIGHT_PAREN);
6519                {if (true) return (ValueNode) nodeFactory.getNode(
6520                                                                C_NodeTypes.CURRENT_DATETIME_OPERATOR_NODE,
6521                                                                ReuseFactory.getInteger(
6522                                                                        CurrentDatetimeOperatorNode.CURRENT_DATE),
6523                                                                getContextManager());}
6524        break;
6525      case CURTIME:
6526        jj_consume_token(CURTIME);
6527        jj_consume_token(LEFT_PAREN);
6528        jj_consume_token(RIGHT_PAREN);
6529                {if (true) return (ValueNode) nodeFactory.getNode(
6530                                                        C_NodeTypes.CURRENT_DATETIME_OPERATOR_NODE,
6531                                                        ReuseFactory.getInteger(
6532                                                                CurrentDatetimeOperatorNode.CURRENT_TIME),
6533                                                        getContextManager());}
6534        break;
6535      case CONCAT:
6536        jj_consume_token(CONCAT);
6537        jj_consume_token(LEFT_PAREN);
6538        str1 = additiveExpression(null,0, false);
6539        jj_consume_token(COMMA);
6540        str2 = additiveExpression(null,0, false);
6541        jj_consume_token(RIGHT_PAREN);
6542        {if (true) return (ValueNode) nodeFactory.getNode(
6543                            C_NodeTypes.CONCATENATION_OPERATOR_NODE,
6544                            str1,
6545                            str2,
6546                            getContextManager());}
6547        break;
6548      case CURRENT_USER:
6549      case SESSION_USER:
6550      case USER:
6551        /* Method versions of USER special registers
6552             * are ODBC remnants. Only supported
6553             * when escaped.
6554             */

6555                value = userNode();
6556        jj_consume_token(LEFT_PAREN);
6557        jj_consume_token(RIGHT_PAREN);
6558                {if (true) return value;}
6559        break;
6560      case TIMESTAMPADD:
6561      case TIMESTAMPDIFF:
6562        value = timestampArithmeticFuncion();
6563        {if (true) return value;}
6564        break;
6565      default:
6566        jj_la1[116] = jj_gen;
6567        if (getEscapedSYSFUN(getToken(1).image) != null) {
6568          value = escapedSYSFUNFunction();
6569        {if (true) return value;}
6570        } else {
6571          jj_consume_token(-1);
6572          throw new ParseException();
6573        }
6574      }
6575    }
6576    throw new Error JavaDoc("Missing return statement in function");
6577  }
6578
6579/*
6580 * <A NAME="numericValueFunction">numericValueFunction</A>
6581 */

6582  final public ValueNode escapedSYSFUNFunction() throws ParseException, StandardException {
6583    Vector JavaDoc parameterList = new Vector JavaDoc();
6584        Token tok;
6585    tok = jj_consume_token(IDENTIFIER);
6586    methodCallParameterList(parameterList);
6587            String JavaDoc sysFunName = getEscapedSYSFUN(tok.image);
6588
6589            TableName functionName = (TableName) nodeFactory.getNode(
6590                                                                C_NodeTypes.TABLE_NAME,
6591                                                                SchemaDescriptor.IBM_SYSTEM_FUN_SCHEMA_NAME,
6592                                                                sysFunName,
6593                                                                new Integer JavaDoc(0),
6594                                                                new Integer JavaDoc(0),
6595                                                                getContextManager());
6596
6597                MethodCallNode methodNode = (MethodCallNode) nodeFactory.getNode(
6598                                                                C_NodeTypes.STATIC_METHOD_CALL_NODE,
6599                                                                functionName,
6600                                                                null,
6601                                                                getContextManager());
6602
6603                methodNode.addParms(parameterList);
6604
6605                /*
6606        ** Assume this is being returned to the SQL domain. If it turns
6607        ** out that this is being returned to the Java domain, we will
6608        ** get rid of this node.
6609        */

6610                {if (true) return (ValueNode) nodeFactory.getNode(
6611                                                                C_NodeTypes.JAVA_TO_SQL_VALUE_NODE,
6612                                                                methodNode,
6613                                                                getContextManager());}
6614    throw new Error JavaDoc("Missing return statement in function");
6615  }
6616
6617/*
6618 * <A NAME="timestampArithmeticFuncion">timestampArithmeticFuncion</A>
6619 */

6620  final public ValueNode timestampArithmeticFuncion() throws ParseException, StandardException {
6621    ValueNode intervalType;
6622    ValueNode tstamp1;
6623    ValueNode tstamp2;
6624    ValueNode count;
6625    switch (jj_nt.kind) {
6626    case TIMESTAMPADD:
6627      jj_consume_token(TIMESTAMPADD);
6628      jj_consume_token(LEFT_PAREN);
6629      intervalType = jdbcIntervalType();
6630      jj_consume_token(COMMA);
6631      count = additiveExpression(null,0,false);
6632      jj_consume_token(COMMA);
6633      tstamp1 = additiveExpression(null,0,false);
6634      jj_consume_token(RIGHT_PAREN);
6635        {if (true) return (ValueNode) nodeFactory.getNode( C_NodeTypes.TIMESTAMP_ADD_FN_NODE,
6636                                                tstamp1,
6637                                                intervalType,
6638                                                count,
6639                                                ReuseFactory.getInteger( TernaryOperatorNode.TIMESTAMPADD),
6640                                                null,
6641                                                getContextManager());}
6642      break;
6643    case TIMESTAMPDIFF:
6644      jj_consume_token(TIMESTAMPDIFF);
6645      jj_consume_token(LEFT_PAREN);
6646      intervalType = jdbcIntervalType();
6647      jj_consume_token(COMMA);
6648      tstamp1 = additiveExpression(null,0,false);
6649      jj_consume_token(COMMA);
6650      tstamp2 = additiveExpression(null,0,false);
6651      jj_consume_token(RIGHT_PAREN);
6652        {if (true) return (ValueNode) nodeFactory.getNode( C_NodeTypes.TIMESTAMP_DIFF_FN_NODE,
6653                                                tstamp2,
6654                                                intervalType,
6655                                                tstamp1,
6656                                                ReuseFactory.getInteger( TernaryOperatorNode.TIMESTAMPDIFF),
6657                                                null,
6658                                                getContextManager());}
6659      break;
6660    default:
6661      jj_la1[117] = jj_gen;
6662      jj_consume_token(-1);
6663      throw new ParseException();
6664    }
6665    throw new Error JavaDoc("Missing return statement in function");
6666  }
6667
6668/*
6669 * <A NAME="jdbcIntervalType">jdbcIntervalType</A>
6670 */

6671  final public ValueNode jdbcIntervalType() throws ParseException, StandardException {
6672    switch (jj_nt.kind) {
6673    case SQL_TSI_FRAC_SECOND:
6674      jj_consume_token(SQL_TSI_FRAC_SECOND);
6675        {if (true) return getJdbcIntervalNode( DateTimeDataValue.FRAC_SECOND_INTERVAL);}
6676      break;
6677    case SQL_TSI_SECOND:
6678      jj_consume_token(SQL_TSI_SECOND);
6679        {if (true) return getJdbcIntervalNode( DateTimeDataValue.SECOND_INTERVAL);}
6680      break;
6681    case SQL_TSI_MINUTE:
6682      jj_consume_token(SQL_TSI_MINUTE);
6683        {if (true) return getJdbcIntervalNode( DateTimeDataValue.MINUTE_INTERVAL);}
6684      break;
6685    case SQL_TSI_HOUR:
6686      jj_consume_token(SQL_TSI_HOUR);
6687        {if (true) return getJdbcIntervalNode( DateTimeDataValue.HOUR_INTERVAL);}
6688      break;
6689    case SQL_TSI_DAY:
6690      jj_consume_token(SQL_TSI_DAY);
6691        {if (true) return getJdbcIntervalNode( DateTimeDataValue.DAY_INTERVAL);}
6692      break;
6693    case SQL_TSI_WEEK:
6694      jj_consume_token(SQL_TSI_WEEK);
6695        {if (true) return getJdbcIntervalNode( DateTimeDataValue.WEEK_INTERVAL);}
6696      break;
6697    case SQL_TSI_MONTH:
6698      jj_consume_token(SQL_TSI_MONTH);
6699        {if (true) return getJdbcIntervalNode( DateTimeDataValue.MONTH_INTERVAL);}
6700      break;
6701    case SQL_TSI_QUARTER:
6702      jj_consume_token(SQL_TSI_QUARTER);
6703        {if (true) return getJdbcIntervalNode( DateTimeDataValue.QUARTER_INTERVAL);}
6704      break;
6705    case SQL_TSI_YEAR:
6706      jj_consume_token(SQL_TSI_YEAR);
6707        {if (true) return getJdbcIntervalNode( DateTimeDataValue.YEAR_INTERVAL);}
6708      break;
6709    default:
6710      jj_la1[118] = jj_gen;
6711      jj_consume_token(-1);
6712      throw new ParseException();
6713    }
6714    throw new Error JavaDoc("Missing return statement in function");
6715  }
6716
6717/*
6718 * <A NAME="numericValueFunction">numericValueFunction</A>
6719 */

6720  final public ValueNode numericValueFunction() throws ParseException, StandardException {
6721        ValueNode value;
6722        int field;
6723    switch (jj_nt.kind) {
6724    case ABS:
6725      jj_consume_token(ABS);
6726      value = absFunction();
6727                {if (true) return value;}
6728      break;
6729    case ABSVAL:
6730      jj_consume_token(ABSVAL);
6731      value = absFunction();
6732                {if (true) return value;}
6733      break;
6734    case SQRT:
6735      jj_consume_token(SQRT);
6736      jj_consume_token(LEFT_PAREN);
6737      value = additiveExpression(null,0,false);
6738      jj_consume_token(RIGHT_PAREN);
6739        {if (true) return (ValueNode)nodeFactory.getNode(
6740                C_NodeTypes.SQRT_OPERATOR_NODE,
6741                value,
6742                getContextManager());}
6743      break;
6744    case MOD:
6745      jj_consume_token(MOD);
6746      value = modFunction();
6747                {if (true) return value;}
6748      break;
6749    case IDENTITY_VAL_LOCAL:
6750      jj_consume_token(IDENTITY_VAL_LOCAL);
6751      jj_consume_token(LEFT_PAREN);
6752      jj_consume_token(RIGHT_PAREN);
6753                {if (true) return (ValueNode) nodeFactory.getNode(
6754                                                C_NodeTypes.IDENTITY_VAL_NODE,
6755                                                getContextManager());}
6756      break;
6757    default:
6758      jj_la1[119] = jj_gen;
6759      jj_consume_token(-1);
6760      throw new ParseException();
6761    }
6762    throw new Error JavaDoc("Missing return statement in function");
6763  }
6764
6765/*
6766 * <A NAME="coalesceFunction">coalesceFunction</A>
6767 */

6768  final public ValueNode coalesceFunction(String JavaDoc coalesceOrValue) throws ParseException, StandardException {
6769    ValueNodeList expressionList = (ValueNodeList) nodeFactory.getNode(
6770        C_NodeTypes.VALUE_NODE_LIST,
6771        getContextManager());
6772    jj_consume_token(LEFT_PAREN);
6773    coalesceExpression(expressionList);
6774    label_16:
6775    while (true) {
6776      switch (jj_nt.kind) {
6777      case COMMA:
6778        ;
6779        break;
6780      default:
6781        jj_la1[120] = jj_gen;
6782        break label_16;
6783      }
6784      jj_consume_token(COMMA);
6785      coalesceExpression(expressionList);
6786    }
6787    jj_consume_token(RIGHT_PAREN);
6788        {if (true) return (ValueNode)nodeFactory.getNode(
6789                C_NodeTypes.COALESCE_FUNCTION_NODE,
6790                coalesceOrValue,
6791                expressionList,
6792                getContextManager());}
6793    throw new Error JavaDoc("Missing return statement in function");
6794  }
6795
6796/*
6797 * <A NAME="coalesceExpression">coalesceExpression</A>
6798 */

6799  final public void coalesceExpression(ValueNodeList expressionList) throws ParseException, StandardException {
6800        ValueNode expression;
6801    expression = additiveExpression(null,0,false);
6802                expressionList.addElement(expression);
6803  }
6804
6805/*
6806 * <A NAME="absFunction">absFunction</A>
6807 */

6808  final public ValueNode absFunction() throws ParseException, StandardException {
6809    ValueNode value;
6810    jj_consume_token(LEFT_PAREN);
6811    value = additiveExpression(null,0, false);
6812    jj_consume_token(RIGHT_PAREN);
6813        {if (true) return (ValueNode)nodeFactory.getNode(
6814                C_NodeTypes.ABSOLUTE_OPERATOR_NODE,
6815                value,
6816                getContextManager());}
6817    throw new Error JavaDoc("Missing return statement in function");
6818  }
6819
6820/*
6821 * <A NAME="modFunction">modFunction</A>
6822 */

6823  final public ValueNode modFunction() throws ParseException, StandardException {
6824    ValueNode int1;
6825        ValueNode int2;
6826    jj_consume_token(LEFT_PAREN);
6827    int1 = additiveExpression(null,0,false);
6828    jj_consume_token(COMMA);
6829    int2 = additiveExpression(null,0,false);
6830    jj_consume_token(RIGHT_PAREN);
6831        {if (true) return (ValueNode)nodeFactory.getNode(
6832                C_NodeTypes.MOD_OPERATOR_NODE,
6833                int1, int2,
6834                getContextManager());}
6835    throw new Error JavaDoc("Missing return statement in function");
6836  }
6837
6838/*
6839 * <A NAME="datetimeField">datetimeField</A>
6840 */

6841  final public int datetimeField() throws ParseException {
6842        int field;
6843    switch (jj_nt.kind) {
6844    case HOUR:
6845    case MINUTE:
6846    case YEAR:
6847    case DAY:
6848    case MONTH:
6849      field = nonSecondDatetimeField();
6850                {if (true) return field;}
6851      break;
6852    case SECOND:
6853      jj_consume_token(SECOND);
6854                {if (true) return DateTimeDataValue.SECOND_FIELD;}
6855      break;
6856    default:
6857      jj_la1[121] = jj_gen;
6858      jj_consume_token(-1);
6859      throw new ParseException();
6860    }
6861    throw new Error JavaDoc("Missing return statement in function");
6862  }
6863
6864  final public ValueNode characterValueFunction() throws ParseException, StandardException {
6865        ValueNode value = null;
6866        ValueNode str1;
6867        ValueNode str2;
6868        Token upperTok = null;
6869        Token lowerTok = null;
6870        ValueNode startPosition;
6871    ValueNode length = null;
6872    switch (jj_nt.kind) {
6873    case SUBSTR:
6874      jj_consume_token(SUBSTR);
6875      jj_consume_token(LEFT_PAREN);
6876      value = additiveExpression(null,0,false);
6877      jj_consume_token(COMMA);
6878      startPosition = additiveExpression(null,0,false);
6879      switch (jj_nt.kind) {
6880      case COMMA:
6881        jj_consume_token(COMMA);
6882        length = additiveExpression(null,0,false);
6883        break;
6884      default:
6885        jj_la1[122] = jj_gen;
6886        ;
6887      }
6888      jj_consume_token(RIGHT_PAREN);
6889        {if (true) return getSubstringNode( value, startPosition, length, Boolean.FALSE );}
6890      break;
6891    case LOWER:
6892    case UPPER:
6893      switch (jj_nt.kind) {
6894      case UPPER:
6895        upperTok = jj_consume_token(UPPER);
6896        break;
6897      case LOWER:
6898        lowerTok = jj_consume_token(LOWER);
6899        break;
6900      default:
6901        jj_la1[123] = jj_gen;
6902        jj_consume_token(-1);
6903        throw new ParseException();
6904      }
6905      jj_consume_token(LEFT_PAREN);
6906      value = additiveExpression(null,0,false);
6907      jj_consume_token(RIGHT_PAREN);
6908                {if (true) return (ValueNode) nodeFactory.getNode(
6909                                        C_NodeTypes.SIMPLE_STRING_OPERATOR_NODE,
6910                                        value,
6911                                        (upperTok != null) ? "upper" : "lower",
6912                                        getContextManager());}
6913      break;
6914    case LCASE:
6915    case UCASE:
6916      switch (jj_nt.kind) {
6917      case UCASE:
6918        upperTok = jj_consume_token(UCASE);
6919        break;
6920      case LCASE:
6921        lowerTok = jj_consume_token(LCASE);
6922        break;
6923      default:
6924        jj_la1[124] = jj_gen;
6925        jj_consume_token(-1);
6926        throw new ParseException();
6927      }
6928      jj_consume_token(LEFT_PAREN);
6929      value = additiveExpression(null,0,false);
6930      jj_consume_token(RIGHT_PAREN);
6931                {if (true) return (ValueNode) nodeFactory.getNode(
6932                                        C_NodeTypes.SIMPLE_STRING_OPERATOR_NODE,
6933                                        value,
6934                                        (upperTok != null) ? "upper" : "lower",
6935                                        getContextManager());}
6936      break;
6937    case LTRIM:
6938    case RTRIM:
6939      value = trimFunction();
6940                {if (true) return value;}
6941      break;
6942    case LOCATE:
6943      jj_consume_token(LOCATE);
6944      jj_consume_token(LEFT_PAREN);
6945      str1 = additiveExpression(null,0,false);
6946      jj_consume_token(COMMA);
6947      str2 = additiveExpression(null,0,false);
6948      switch (jj_nt.kind) {
6949      case COMMA:
6950        jj_consume_token(COMMA);
6951        value = additiveExpression(null,0,false);
6952        break;
6953      default:
6954        jj_la1[125] = jj_gen;
6955        ;
6956      }
6957      jj_consume_token(RIGHT_PAREN);
6958                // if start is missing, start is equal to 1
6959
{if (true) return (ValueNode) nodeFactory.getNode(
6960                            C_NodeTypes.LOCATE_FUNCTION_NODE,
6961                            str1,
6962                            str2,
6963                            (value == null) ? getNodeFactory().getNode(
6964                                        C_NodeTypes.INT_CONSTANT_NODE,
6965                                        ReuseFactory.getInteger(1),
6966                                        getContextManager() )
6967                                                                                        : value,
6968                            ReuseFactory.getInteger(TernaryOperatorNode.LOCATE),
6969                            null,
6970                            getContextManager());}
6971      break;
6972    default:
6973      jj_la1[126] = jj_gen;
6974      jj_consume_token(-1);
6975      throw new ParseException();
6976    }
6977    throw new Error JavaDoc("Missing return statement in function");
6978  }
6979
6980  final public ValueNode trimFunction() throws ParseException, StandardException {
6981        ValueNode source;
6982        Integer JavaDoc trimType;
6983    trimType = trimType();
6984    jj_consume_token(LEFT_PAREN);
6985    source = additiveExpression(null,0,false);
6986    jj_consume_token(RIGHT_PAREN);
6987                {if (true) return (ValueNode) nodeFactory.getNode(
6988                                                                        C_NodeTypes.TRIM_OPERATOR_NODE,
6989                                                                        source,
6990                                                                        source,
6991                                                                        null,
6992                                                                        ReuseFactory.getInteger(TernaryOperatorNode.TRIM),
6993                                                                        trimType,
6994                                                                        getContextManager());}
6995    throw new Error JavaDoc("Missing return statement in function");
6996  }
6997
6998  final public Integer JavaDoc trimType() throws ParseException {
6999    switch (jj_nt.kind) {
7000    case RTRIM:
7001      jj_consume_token(RTRIM);
7002                {if (true) return ReuseFactory.getInteger(StringDataValue.TRAILING);}
7003      break;
7004    case LTRIM:
7005      jj_consume_token(LTRIM);
7006                {if (true) return ReuseFactory.getInteger(StringDataValue.LEADING);}
7007      break;
7008    default:
7009      jj_la1[127] = jj_gen;
7010      jj_consume_token(-1);
7011      throw new ParseException();
7012    }
7013    throw new Error JavaDoc("Missing return statement in function");
7014  }
7015
7016/*
7017 * <A NAME="valueExpressionPrimary">valueExpressionPrimary</A>
7018 *
7019 * @param inSelectClause will be true if this method got called while parsing the select or values clause
7020 * If in select or values clause, we do not want to allow boolean values.
7021 */

7022  final public ValueNode valueExpressionPrimary(boolean inSelectClause) throws ParseException, StandardException {
7023        ValueNode value;
7024        int tokKind;
7025    if (escapedValueFunctionFollows()) {
7026      jj_consume_token(LEFT_BRACE);
7027      jj_consume_token(FN);
7028      value = escapedValueFunction();
7029      jj_consume_token(RIGHT_BRACE);
7030                {if (true) return value;}
7031    } else if (getToken(2).kind == SCHEMA || getToken(2).kind == SQLID) {
7032      jj_consume_token(CURRENT);
7033      switch (jj_nt.kind) {
7034      case SCHEMA:
7035        jj_consume_token(SCHEMA);
7036        break;
7037      case SQLID:
7038        jj_consume_token(SQLID);
7039        break;
7040      default:
7041        jj_la1[128] = jj_gen;
7042        jj_consume_token(-1);
7043        throw new ParseException();
7044      }
7045                {if (true) return (ValueNode) nodeFactory.getNode(
7046                                                C_NodeTypes.CURRENT_SCHEMA_NODE,
7047                                                getContextManager());}
7048    } else if (getToken(2).kind == ISOLATION) {
7049      jj_consume_token(CURRENT);
7050      jj_consume_token(ISOLATION);
7051                {if (true) return (ValueNode) nodeFactory.getNode(
7052                                                C_NodeTypes.CURRENT_ISOLATION_NODE,
7053                                                getContextManager());}
7054    } else {
7055      switch (jj_nt.kind) {
7056      case CASE:
7057      case CURRENT_USER:
7058      case FALSE:
7059      case NULLIF:
7060      case SESSION_USER:
7061      case TRUE:
7062      case USER:
7063      case LEFT_BRACE:
7064      case PLUS_SIGN:
7065      case MINUS_SIGN:
7066      case QUESTION_MARK:
7067      case EXACT_NUMERIC:
7068      case STRING:
7069      case HEX_STRING:
7070      case APPROXIMATE_NUMERIC:
7071        /* Omitted "case_expression" */
7072                value = valueSpecification();
7073                {if (true) return value;}
7074        break;
7075      default:
7076        jj_la1[129] = jj_gen;
7077        if (newInvocationFollows(1)) {
7078          value = newInvocation();
7079                {if (true) return value;}
7080        } else if (aggregateFollows()) {
7081          value = aggregateNode();
7082                {if (true) return value;}
7083        } else if (miscBuiltinFollows()) {
7084          value = miscBuiltins();
7085                {if (true) return value;}
7086        } else {
7087          switch (jj_nt.kind) {
7088          case BINARY:
7089          case COALESCE:
7090          case COUNT:
7091          case D:
7092          case MODULE:
7093          case T:
7094          case TS:
7095          case VALUE:
7096          case VARBINARY:
7097          case ABS:
7098          case ABSVAL:
7099          case ACTION:
7100          case ALWAYS:
7101          case BLOB:
7102          case C:
7103          case CALLED:
7104          case CLOB:
7105          case COBOL:
7106          case COMMITTED:
7107          case CONCAT:
7108          case CONTAINS:
7109          case DATA:
7110          case DATE:
7111          case DAY:
7112          case DYNAMIC:
7113          case FORTRAN:
7114          case GENERATED:
7115          case IDENTITY_VAL_LOCAL:
7116          case INCREMENT:
7117          case INITIAL:
7118          case INTERVAL:
7119          case LANGUAGE:
7120          case LARGE:
7121          case LENGTH:
7122          case LEVEL:
7123          case LOCKS:
7124          case LOCKSIZE:
7125          case LOGGED:
7126          case MOD:
7127          case MODIFIES:
7128          case MODIFY:
7129          case MONTH:
7130          case _MORE:
7131          case MUMPS:
7132          case NAME:
7133          case NCLOB:
7134          case NULLABLE:
7135          case NUMBER:
7136          case OBJECT:
7137          case PASCAL:
7138          case PLI:
7139          case PRECISION:
7140          case RELEASE:
7141          case REPEATABLE:
7142          case RESTART:
7143          case RETURNS:
7144          case ROW:
7145          case SAVEPOINT:
7146          case SCALE:
7147          case SERIALIZABLE:
7148          case SQL_TSI_FRAC_SECOND:
7149          case SQL_TSI_SECOND:
7150          case SQL_TSI_MINUTE:
7151          case SQL_TSI_HOUR:
7152          case SQL_TSI_DAY:
7153          case SQL_TSI_WEEK:
7154          case SQL_TSI_MONTH:
7155          case SQL_TSI_QUARTER:
7156          case SQL_TSI_YEAR:
7157          case START:
7158          case STATEMENT:
7159          case SYNONYM:
7160          case THEN:
7161          case TIME:
7162          case TIMESTAMP:
7163          case TIMESTAMPADD:
7164          case TIMESTAMPDIFF:
7165          case TRUNCATE:
7166          case TYPE:
7167          case UNCOMMITTED:
7168          case USAGE:
7169          case WHEN:
7170          case CURDATE:
7171          case CURTIME:
7172          case DATABASE:
7173          case LONG:
7174          case AFTER:
7175          case BEFORE:
7176          case CLASS:
7177          case COMPRESS:
7178          case CONTENT:
7179          case CS:
7180          case DB2SQL:
7181          case DIRTY:
7182          case DOCUMENT:
7183          case EACH:
7184          case EMPTY:
7185          case EXCLUSIVE:
7186          case FN:
7187          case INDEX:
7188          case JAVA:
7189          case LCASE:
7190          case LOCATE:
7191          case LOCK:
7192          case MESSAGE_LOCALE:
7193          case METHOD:
7194          case MODE:
7195          case NEW:
7196          case NEW_TABLE:
7197          case OJ:
7198          case OFF:
7199          case OLD:
7200          case OLD_TABLE:
7201          case PARAMETER:
7202          case PASSING:
7203          case PROPERTIES:
7204          case READS:
7205          case REF:
7206          case REFERENCING:
7207          case RENAME:
7208          case RESET:
7209          case RESULT:
7210          case RETAIN:
7211          case RETURNING:
7212          case RR:
7213          case RS:
7214          case SEQUENCE:
7215          case SEQUENTIAL:
7216          case SETS:
7217          case SHARE:
7218          case SQLID:
7219          case SPECIFIC:
7220          case SQRT:
7221          case STABILITY:
7222          case STRIP:
7223          case STYLE:
7224          case TRIGGER:
7225          case UCASE:
7226          case UR:
7227          case WHITESPACE:
7228          case IDENTIFIER:
7229          case DELIMITED_IDENTIFIER:
7230            value = columnReference();
7231                {if (true) return value;}
7232            break;
7233          case LEFT_PAREN:
7234            jj_consume_token(LEFT_PAREN);
7235            if (getToken(1).kind == SELECT || getToken(1).kind == VALUES) {
7236              value = subquery(SubqueryNode.EXPRESSION_SUBQUERY, null);
7237            } else if (inSelectClause) {
7238              value = additiveExpression(null,0, inSelectClause);
7239            } else if (jj_2_25(1)) {
7240              //following will happen if we are not coming here for select/values clause
7241
value = valueExpression(inSelectClause);
7242            } else {
7243              jj_consume_token(-1);
7244              throw new ParseException();
7245            }
7246            jj_consume_token(RIGHT_PAREN);
7247                {if (true) return value;}
7248            break;
7249          case CAST:
7250            value = castSpecification();
7251                {if (true) return value;}
7252            break;
7253          default:
7254            jj_la1[130] = jj_gen;
7255            jj_consume_token(-1);
7256            throw new ParseException();
7257          }
7258        }
7259      }
7260    }
7261    throw new Error JavaDoc("Missing return statement in function");
7262  }
7263
7264/*
7265 * <A NAME="miscBuiltins">miscBuiltins</A>
7266 */

7267  final public ValueNode miscBuiltins() throws ParseException, StandardException {
7268        ValueNode value;
7269    if (( (getToken(1).kind == GET_CURRENT_CONNECTION ||
7270                    getToken(1).kind == ABS ||
7271                    getToken(1).kind == ABSVAL ||
7272                    getToken(1).kind == SQRT ||
7273                    getToken(1).kind == MOD ||
7274                    getToken(1).kind == COALESCE ||
7275                    getToken(1).kind == VALUE ||
7276                    getToken(1).kind == IDENTITY_VAL_LOCAL ||
7277                    getToken(1).kind == SUBSTRING ||
7278                    getToken(1).kind == SUBSTR ||
7279                    getToken(1).kind == UPPER ||
7280                    getToken(1).kind == LOWER ||
7281                    getToken(1).kind == UCASE ||
7282                    getToken(1).kind == LCASE ||
7283                    getToken(1).kind == LTRIM ||
7284                    getToken(1).kind == RTRIM ||
7285                    getToken(1).kind == DATE ||
7286                    getToken(1).kind == TIME ||
7287                    getToken(1).kind == TIMESTAMP ||
7288                    getToken(1).kind == DOUBLE ||
7289                    getToken(1).kind == CHAR ||
7290                    getToken(1).kind == VARCHAR ||
7291                    getToken(1).kind == INTEGER ||
7292                    getToken(1).kind == INT ||
7293                    getToken(1).kind == SMALLINT ||
7294                    getToken(1).kind == LONGINT ||
7295                    getToken(1).kind == YEAR ||
7296                    getToken(1).kind == MONTH ||
7297                    getToken(1).kind == DAY ||
7298                    getToken(1).kind == HOUR ||
7299                    getToken(1).kind == MINUTE ||
7300                    getToken(1).kind == SECOND ||
7301                    getToken(1).kind == LENGTH ||
7302                    getToken(1).kind == LOCATE ||
7303                    getToken(1).kind == XMLPARSE ||
7304                    getToken(1).kind == XMLSERIALIZE ||
7305                    getToken(1).kind == XMLEXISTS ||
7306                    getToken(1).kind == XMLQUERY ) &&
7307                  getToken(2).kind == LEFT_PAREN
7308                  )) {
7309      /* miscBuiltins() are composed of the core
7310         * system, string and numeric functions,
7311         * date functions
7312         * and static method calls.
7313         */

7314              value = miscBuiltinsCore(false /* not JDBC escape */);
7315                {if (true) return value;}
7316    } else if (jj_2_26(1)) {
7317      value = datetimeValueFunction();
7318                {if (true) return value;}
7319    } else {
7320      switch (jj_nt.kind) {
7321      case BINARY:
7322      case COALESCE:
7323      case COUNT:
7324      case D:
7325      case MODULE:
7326      case T:
7327      case TS:
7328      case VALUE:
7329      case VARBINARY:
7330      case ABS:
7331      case ABSVAL:
7332      case ACTION:
7333      case ALWAYS:
7334      case BLOB:
7335      case C:
7336      case CALLED:
7337      case CLOB:
7338      case COBOL:
7339      case COMMITTED:
7340      case CONCAT:
7341      case CONTAINS:
7342      case DATA:
7343      case DATE:
7344      case DAY:
7345      case DYNAMIC:
7346      case FORTRAN:
7347      case GENERATED:
7348      case IDENTITY_VAL_LOCAL:
7349      case INCREMENT:
7350      case INITIAL:
7351      case INTERVAL:
7352      case LANGUAGE:
7353      case LARGE:
7354      case LENGTH:
7355      case LEVEL:
7356      case LOCKS:
7357      case LOCKSIZE:
7358      case LOGGED:
7359      case MOD:
7360      case MODIFIES:
7361      case MODIFY:
7362      case MONTH:
7363      case _MORE:
7364      case MUMPS:
7365      case NAME:
7366      case NCLOB:
7367      case NULLABLE:
7368      case NUMBER:
7369      case OBJECT:
7370      case PASCAL:
7371      case PLI:
7372      case PRECISION:
7373      case RELEASE:
7374      case REPEATABLE:
7375      case RESTART:
7376      case RETURNS:
7377      case ROW:
7378      case SAVEPOINT:
7379      case SCALE:
7380      case SERIALIZABLE:
7381      case SQL_TSI_FRAC_SECOND:
7382      case SQL_TSI_SECOND:
7383      case SQL_TSI_MINUTE:
7384      case SQL_TSI_HOUR:
7385      case SQL_TSI_DAY:
7386      case SQL_TSI_WEEK:
7387      case SQL_TSI_MONTH:
7388      case SQL_TSI_QUARTER:
7389      case SQL_TSI_YEAR:
7390      case START:
7391      case STATEMENT:
7392      case SYNONYM:
7393      case THEN:
7394      case TIME:
7395      case TIMESTAMP:
7396      case TIMESTAMPADD:
7397      case TIMESTAMPDIFF:
7398      case TRUNCATE:
7399      case TYPE:
7400      case UNCOMMITTED:
7401      case USAGE:
7402      case WHEN:
7403      case CURDATE:
7404      case CURTIME:
7405      case DATABASE:
7406      case LONG:
7407      case AFTER:
7408      case BEFORE:
7409      case CLASS:
7410      case COMPRESS:
7411      case CONTENT:
7412      case CS:
7413      case DB2SQL:
7414      case DIRTY:
7415      case DOCUMENT:
7416      case EACH:
7417      case EMPTY:
7418      case EXCLUSIVE:
7419      case FN:
7420      case INDEX:
7421      case JAVA:
7422      case LCASE:
7423      case LOCATE:
7424      case LOCK:
7425      case MESSAGE_LOCALE:
7426      case METHOD:
7427      case MODE:
7428      case NEW:
7429      case NEW_TABLE:
7430      case OJ:
7431      case OFF:
7432      case OLD:
7433      case OLD_TABLE:
7434      case PARAMETER:
7435      case PASSING:
7436      case PROPERTIES:
7437      case READS:
7438      case REF:
7439      case REFERENCING:
7440      case RENAME:
7441      case RESET:
7442      case RESULT:
7443      case RETAIN:
7444      case RETURNING:
7445      case RR:
7446      case RS:
7447      case SEQUENCE:
7448      case SEQUENTIAL:
7449      case SETS:
7450      case SHARE:
7451      case SQLID:
7452      case SPECIFIC:
7453      case SQRT:
7454      case STABILITY:
7455      case STRIP:
7456      case STYLE:
7457      case TRIGGER:
7458      case UCASE:
7459      case UR:
7460      case WHITESPACE:
7461      case IDENTIFIER:
7462      case DELIMITED_IDENTIFIER:
7463        /* This is where we build a node for static method aliases */
7464                value = routineInvocation();
7465                {if (true) return value;}
7466        break;
7467      default:
7468        jj_la1[131] = jj_gen;
7469        jj_consume_token(-1);
7470        throw new ParseException();
7471      }
7472    }
7473    throw new Error JavaDoc("Missing return statement in function");
7474  }
7475
7476  final public ValueNode miscBuiltinsCore(boolean isJDBCEscape) throws ParseException, StandardException {
7477        ValueNode value;
7478    switch (jj_nt.kind) {
7479    case GET_CURRENT_CONNECTION:
7480      jj_consume_token(GET_CURRENT_CONNECTION);
7481      jj_consume_token(LEFT_PAREN);
7482      jj_consume_token(RIGHT_PAREN);
7483                checkInternalFeature("GETCURRENTCONNECTION()");
7484                {if (true) return (ValueNode) nodeFactory.getNode(
7485                                                                C_NodeTypes.JAVA_TO_SQL_VALUE_NODE,
7486                                                                nodeFactory.getNode(
7487                                                                        C_NodeTypes.GET_CURRENT_CONNECTION_NODE,
7488                                                                        getContextManager()),
7489                                                                getContextManager());}
7490      break;
7491    case ABS:
7492    case ABSVAL:
7493    case IDENTITY_VAL_LOCAL:
7494    case MOD:
7495    case SQRT:
7496      value = numericValueFunction();
7497                {if (true) return value;}
7498      break;
7499    case LOWER:
7500    case UPPER:
7501    case LTRIM:
7502    case RTRIM:
7503    case SUBSTR:
7504    case LCASE:
7505    case LOCATE:
7506    case UCASE:
7507      value = characterValueFunction();
7508                {if (true) return value;}
7509      break;
7510    default:
7511      jj_la1[132] = jj_gen;
7512      if (jj_2_27(1)) {
7513        value = dataTypeScalarFunction();
7514                {if (true) return value;}
7515      } else {
7516        switch (jj_nt.kind) {
7517        case COALESCE:
7518          jj_consume_token(COALESCE);
7519          value = coalesceFunction("COALESCE");
7520                {if (true) return value;}
7521          break;
7522        case VALUE:
7523          jj_consume_token(VALUE);
7524          value = coalesceFunction("VALUE");
7525                {if (true) return value;}
7526          break;
7527        case LENGTH:
7528          jj_consume_token(LENGTH);
7529          jj_consume_token(LEFT_PAREN);
7530          value = additiveExpression(null,0, false);
7531          jj_consume_token(RIGHT_PAREN);
7532                ContextManager localCM = getContextManager();
7533                if( isJDBCEscape)
7534                        {if (true) return (ValueNode) nodeFactory.getNode(
7535                                                                C_NodeTypes.CHAR_LENGTH_OPERATOR_NODE,
7536                                                                (ValueNode) nodeFactory.getNode(
7537                                                                        C_NodeTypes.TRIM_OPERATOR_NODE,
7538                                                                        value,
7539                                                                                value,
7540                                                                                null,
7541                                                                        ReuseFactory.getInteger(TernaryOperatorNode.TRIM),
7542                                                                        ReuseFactory.getInteger(StringDataValue.TRAILING),
7543                                        localCM),
7544                                                                localCM);}
7545                {if (true) return (ValueNode) nodeFactory.getNode(
7546                                                        C_NodeTypes.DB2_LENGTH_OPERATOR_NODE,
7547                                                        value,
7548                                                        localCM);}
7549          break;
7550        case XMLEXISTS:
7551        case XMLPARSE:
7552        case XMLQUERY:
7553        case XMLSERIALIZE:
7554          value = xmlFunction();
7555                {if (true) return value;}
7556          break;
7557        default:
7558          jj_la1[133] = jj_gen;
7559          jj_consume_token(-1);
7560          throw new ParseException();
7561        }
7562      }
7563    }
7564    throw new Error JavaDoc("Missing return statement in function");
7565  }
7566
7567/*
7568 * <A NAME="dataTypeScalarFunction">dataTypeScalarFunction</A>
7569 */

7570  final public ValueNode dataTypeScalarFunction() throws ParseException, StandardException {
7571        DataTypeDescriptor dts;
7572        ValueNode value; //converted result
7573
ValueNode operand;
7574        int charType;
7575        int length = -1;
7576    switch (jj_nt.kind) {
7577    case HOUR:
7578    case MINUTE:
7579    case SECOND:
7580    case YEAR:
7581    case DATE:
7582    case DAY:
7583    case MONTH:
7584    case TIME:
7585    case TIMESTAMP:
7586      //Note: When you add a new data type function, in addition to adding it
7587
// here, you need to add it to miscBuiltins()
7588
value = dateTimeScalarFunction();
7589                {if (true) return value;}
7590      break;
7591    default:
7592      jj_la1[135] = jj_gen;
7593      if (jj_2_28(1)) {
7594        dts = numericFunctionType();
7595        jj_consume_token(LEFT_PAREN);
7596        operand = additiveExpression(null,0, false);
7597        jj_consume_token(RIGHT_PAREN);
7598                        value = (ValueNode) nodeFactory.getNode(
7599                                                                        C_NodeTypes.CAST_NODE,
7600                                                                        operand,
7601                                                                        dts,
7602                                                                        getContextManager());
7603                        ((CastNode) value).setForDataTypeFunction(true);
7604
7605                        {if (true) return value;}
7606      } else {
7607        switch (jj_nt.kind) {
7608        case CHAR:
7609        case VARCHAR:
7610          charType = charOrVarchar();
7611          jj_consume_token(LEFT_PAREN);
7612          operand = additiveExpression(null,0, false);
7613          switch (jj_nt.kind) {
7614          case COMMA:
7615            jj_consume_token(COMMA);
7616            length = length();
7617            break;
7618          default:
7619            jj_la1[134] = jj_gen;
7620            ;
7621          }
7622          jj_consume_token(RIGHT_PAREN);
7623                // Always check db2 limits for this function. It's new
7624
checkTypeLimits(charType,length);
7625                value = (ValueNode) nodeFactory.getNode(
7626                                                                                                C_NodeTypes.CAST_NODE,
7627                                                                                                operand,
7628                                                                                                new Integer JavaDoc(charType),
7629                                                                                                new Integer JavaDoc(length),
7630                                                                                                getContextManager());
7631
7632                ((CastNode) value).setForDataTypeFunction(true);
7633                {if (true) return value;}
7634          break;
7635        default:
7636          jj_la1[136] = jj_gen;
7637          jj_consume_token(-1);
7638          throw new ParseException();
7639        }
7640      }
7641    }
7642    throw new Error JavaDoc("Missing return statement in function");
7643  }
7644
7645/*
7646 * <A NAME="xmlFunction">xmlFunction</A>
7647 *
7648 * This method parses the built-in functions used with
7649 * the XML datatype.
7650 *
7651 */

7652  final public ValueNode xmlFunction() throws ParseException, StandardException {
7653        ValueNode value;
7654        checkVersion(DataDictionary.DD_VERSION_DERBY_10_1, "XML");
7655
7656        // We only allow XML operations if the classpath has all
7657
// of the required external classes (namley, JAXP and Xalan).
7658
org.apache.derby.iapi.types.XML.checkXMLRequirements();
7659    switch (jj_nt.kind) {
7660    case XMLPARSE:
7661      jj_consume_token(XMLPARSE);
7662      jj_consume_token(LEFT_PAREN);
7663      xmlDocOrContent();
7664      value = xmlParseValue();
7665      jj_consume_token(RIGHT_PAREN);
7666                {if (true) return value;}
7667      break;
7668    case XMLSERIALIZE:
7669      jj_consume_token(XMLSERIALIZE);
7670      jj_consume_token(LEFT_PAREN);
7671      value = xmlSerializeValue();
7672      jj_consume_token(RIGHT_PAREN);
7673                {if (true) return value;}
7674      break;
7675    case XMLEXISTS:
7676      jj_consume_token(XMLEXISTS);
7677      jj_consume_token(LEFT_PAREN);
7678      value = xmlQueryValue(true);
7679      jj_consume_token(RIGHT_PAREN);
7680                {if (true) return value;}
7681      break;
7682    case XMLQUERY:
7683      jj_consume_token(XMLQUERY);
7684      jj_consume_token(LEFT_PAREN);
7685      value = xmlQueryValue(false);
7686      jj_consume_token(RIGHT_PAREN);
7687                {if (true) return value;}
7688      break;
7689    default:
7690      jj_la1[137] = jj_gen;
7691      jj_consume_token(-1);
7692      throw new ParseException();
7693    }
7694    throw new Error JavaDoc("Missing return statement in function");
7695  }
7696
7697/*
7698 * <A NAME="xmlParseValue">xmlParseValue</A>
7699 *
7700 * Syntax is as follows:
7701 *
7702 * XMLPARSE( DOCUMENT <string-value-expression> PRESERVE WHITESPACE )
7703 *
7704 * The result of this operation will be an XML value, which can either
7705 * be used transiently or else can be stored persistently in a table that
7706 * has an XML column. For example:
7707 *
7708 * ij> CREATE TABLE x_table (id INT, xdoc XML);
7709 * 0 rows inserted/updated/deleted
7710 * ij> INSERT INTO x_table VALUES (1, XMLPARSE(DOCUMENT '<simp> doc </simp>'
7711 * PRESERVE WHITESPACE));
7712 * 1 row inserted/updated/deleted
7713 *
7714 * We only allow XML documents (as opposed to XML content) to be
7715 * parsed into XML values. Note that we require the "PRESERVE WHITESPACE"
7716 * keyword to be explicit; this is because the SQL/XML (2003) spec says that
7717 * if no whitespace option is given, the default is "STRIP WHITESPACE", which
7718 * we don't support (yet).
7719 *
7720 * By the time we get to this method, the "DOCUMENT" keyword has already
7721 * been parsed.
7722 *
7723 */

7724  final public ValueNode xmlParseValue() throws ParseException, StandardException {
7725        ValueNode value;
7726        boolean wsOption;
7727    value = additiveExpression(null,0,false);
7728    wsOption = xmlPreserveWhitespace();
7729                {if (true) return (ValueNode) nodeFactory.getNode(
7730                                        C_NodeTypes.XML_PARSE_OPERATOR_NODE,
7731                                        value,
7732                                        ReuseFactory.getInteger(UnaryOperatorNode.XMLPARSE_OP),
7733                                        new Object JavaDoc[] {(wsOption ? Boolean.TRUE : Boolean.FALSE)},
7734                                        getContextManager());}
7735    throw new Error JavaDoc("Missing return statement in function");
7736  }
7737
7738/*
7739 * <A NAME="xmlPreserveWhitespace">xmlPreserveWhitespace</A>
7740 *
7741 * For now, we only support the PRESERVE WHITESPACE option.
7742 *
7743 */

7744  final public boolean xmlPreserveWhitespace() throws ParseException, StandardException {
7745    if ((getToken(1).kind != STRIP) &&
7746                    (getToken(1).kind != PRESERVE)) {
7747                {if (true) throw StandardException.newException(
7748                        SQLState.LANG_XML_KEYWORD_MISSING, "PRESERVE WHITESPACE",
7749                        ReuseFactory.getInteger(getToken(1).beginLine),
7750                        ReuseFactory.getInteger(getToken(1).beginColumn));}
7751    } else {
7752      switch (jj_nt.kind) {
7753      case STRIP:
7754        jj_consume_token(STRIP);
7755        jj_consume_token(WHITESPACE);
7756          // don't preserve whitespace.
7757
{if (true) throw StandardException.newException(
7758                        SQLState.LANG_UNSUPPORTED_XML_FEATURE, "STRIP WHITESPACE");}
7759        break;
7760      case PRESERVE:
7761        jj_consume_token(PRESERVE);
7762        jj_consume_token(WHITESPACE);
7763          // must preserve whitespace.
7764
{if (true) return true;}
7765        break;
7766      default:
7767        jj_la1[138] = jj_gen;
7768        jj_consume_token(-1);
7769        throw new ParseException();
7770      }
7771    }
7772    throw new Error JavaDoc("Missing return statement in function");
7773  }
7774
7775/*
7776 * <A NAME="xmlSerializeValue">xmlSerializeValue</A>
7777 *
7778 * Syntax is as follows:
7779 *
7780 * XMLSERIALIZE( <xml-value-expression> AS <string-data-type> )
7781 *
7782 * The result of this operation will be a string value with the type specified
7783 * by the user. For example:
7784 *
7785 * ij> SELECT id, XMLSERIALIZE(xdoc AS varchar(30)) FROM x_table;
7786 * ID |2
7787 * ------------------------------------------
7788 * 1 |<simp> doc </simp>
7789 *
7790 */

7791  final public ValueNode xmlSerializeValue() throws ParseException, StandardException {
7792        ValueNode value;
7793        DataTypeDescriptor targetType;
7794    value = additiveExpression(null,0,false);
7795    targetType = xmlSerializeTargetType();
7796                {if (true) return (ValueNode) nodeFactory.getNode(
7797                                        C_NodeTypes.XML_SERIALIZE_OPERATOR_NODE,
7798                                        value,
7799                                        ReuseFactory.getInteger(UnaryOperatorNode.XMLSERIALIZE_OP),
7800                                        new Object JavaDoc[] {targetType},
7801                                        getContextManager());}
7802    throw new Error JavaDoc("Missing return statement in function");
7803  }
7804
7805/*
7806 * <A NAME="xmlSerializeTargetType">xmlSerializeTargetType</A>
7807 *
7808 * Parse the target type of an XMLSERIALIZE operation.
7809 *
7810 */

7811  final public DataTypeDescriptor xmlSerializeTargetType() throws ParseException, StandardException {
7812        DataTypeDescriptor targetType;
7813    if ((getToken(1).kind != AS)) {
7814                {if (true) throw StandardException.newException(
7815                        SQLState.LANG_XML_KEYWORD_MISSING, "AS",
7816                        ReuseFactory.getInteger(getToken(1).beginLine),
7817                        ReuseFactory.getInteger(getToken(1).beginColumn));}
7818    } else {
7819      switch (jj_nt.kind) {
7820      case AS:
7821        jj_consume_token(AS);
7822        targetType = dataTypeDDL();
7823                {if (true) return targetType;}
7824        break;
7825      default:
7826        jj_la1[139] = jj_gen;
7827        jj_consume_token(-1);
7828        throw new ParseException();
7829      }
7830    }
7831    throw new Error JavaDoc("Missing return statement in function");
7832  }
7833
7834/*
7835 * <A NAME="xmlQueryValue">xmlQueryValue</A>
7836 *
7837 * This method is used for parsing the XMLEXISTS and XMLQUERY operators
7838 * (which operator depends on the received boolean parameter).
7839 *
7840 * For XMLEXISTS, the syntax is as follows:
7841 *
7842 * XMLEXISTS( <xpath-expression> PASSING BY REF <xml-value-expression> )
7843 *
7844 * The result of this operation will be a boolean true/false/unknown value:
7845 * -- Unknown if either <xquery-expression> or <xml-value-expression> is null;
7846 * -- True if evaluation of the given query expression against the
7847 * given xml-value returns at least one node.
7848 * -- False otherwise.
7849 *
7850 * For example:
7851 *
7852 * ij> SELECT id FROM x_table WHERE XMLEXISTS('/simple' PASSING BY REF xdoc);
7853 * ID
7854 * -----------
7855 * 1
7856 *
7857 * ====
7858 *
7859 * For XMLQUERY, the syntax is as follows:
7860 *
7861 * XMLQUERY( <xquery-expression>
7862 * PASSING BY REF <xml-value-expression>
7863 * [ RETURNING SEQUENCE [ BY REF ] ]
7864 * EMPTY ON EMPTY
7865 * )
7866 *
7867 * The result of this operation will be an XMLDataValue.
7868 *
7869 * For example:
7870 *
7871 * ij> SELECT XMLSERIALIZE(
7872 * XMLQUERY('/simple' PASSING BY REF xdoc EMPTY ON EMPTY) AS CHAR(100));
7873 * ID
7874 * -----------
7875 * <simp> doc </simp>
7876 *
7877 */

7878  final public ValueNode xmlQueryValue(boolean existsOnly) throws ParseException, StandardException {
7879        // The query expression (currently must be an expression
7880
// supported by Xalan--i.e. XPath only).
7881
ValueNode xqueryExpr = null;
7882
7883        // Context item for the query; not required by SQL/XML spec,
7884
// but required by Derby for now.
7885
ValueNode xmlValue = null;
7886
7887        // User-specified default passing mechanism. Since Derby only
7888
// supports one type of passing mechanism--BY REF--this value
7889
// isn't currently used.
7890
short defaultPassingMech = -1;
7891    xqueryExpr = additiveExpression(null, 0, false);
7892    jj_consume_token(PASSING);
7893    defaultPassingMech = xmlPassingMechanism();
7894    xmlValue = xqVarList();
7895    if (!existsOnly) {
7896      if (jj_2_30(1)) {
7897        xqReturningClause();
7898        if (jj_2_29(1)) {
7899          xmlPassingMechanism();
7900        } else {
7901          ;
7902        }
7903      } else {
7904        ;
7905      }
7906      xqEmptyHandlingClause();
7907
7908    } else if (existsOnly) {
7909
7910    } else {
7911      jj_consume_token(-1);
7912      throw new ParseException();
7913    }
7914                ValueNode vNode = (ValueNode) nodeFactory.getNode(
7915                        (existsOnly
7916                                ? C_NodeTypes.XML_EXISTS_OPERATOR_NODE
7917                                : C_NodeTypes.XML_QUERY_OPERATOR_NODE),
7918                        xqueryExpr,
7919                        xmlValue,
7920                        (existsOnly
7921                                ? ReuseFactory.getInteger(BinaryOperatorNode.XMLEXISTS_OP)
7922                                : ReuseFactory.getInteger(BinaryOperatorNode.XMLQUERY_OP)),
7923                        getContextManager());
7924
7925                {if (true) return vNode;}
7926    throw new Error JavaDoc("Missing return statement in function");
7927  }
7928
7929/**
7930 * <A NAME="xqVarList">xqVarList</A>
7931 *
7932 * Parse a list of XML query variables, which can include at most one
7933 * XML value to be used as the "context item" for the query. If
7934 * such a context item was found, return that item; for all other
7935 * variable declarations we currently throw a "not supported" error
7936 * because Xalan doesn't allowing binding of variables.
7937 */

7938  final public ValueNode xqVarList() throws ParseException, StandardException {
7939        // Placeholder for the XML context item as we parse the
7940
// argument list.
7941
ValueNode [] xmlValue = new ValueNode [] { (ValueNode)null };
7942    xqVariable(xmlValue);
7943    label_17:
7944    while (true) {
7945      switch (jj_nt.kind) {
7946      case COMMA:
7947        ;
7948        break;
7949      default:
7950        jj_la1[140] = jj_gen;
7951        break label_17;
7952      }
7953      jj_consume_token(COMMA);
7954      xqVariable(xmlValue);
7955    }
7956                {if (true) return xmlValue[0];}
7957    throw new Error JavaDoc("Missing return statement in function");
7958  }
7959
7960/**
7961 * <A NAME="xqVariable">xqVariable</A>
7962 *
7963 * Parse an XML query variable. If the argument is an XML value
7964 * to be used as the "context item" for a query, then store the
7965 * value in the first slot of the received ValueNode array;
7966 * otherwise, throw a "not supported" errror (for now).
7967 */

7968  final public void xqVariable(ValueNode [] xmlVal) throws ParseException, StandardException {
7969        ValueNode curVal;
7970        String JavaDoc varName = null;
7971        short passingMech = -1;
7972    curVal = additiveExpression(null,0, false);
7973    if (getToken(1).kind == AS) {
7974      jj_consume_token(AS);
7975      varName = identifier(Limits.MAX_IDENTIFIER_LENGTH, true);
7976                        /* From XQuery 1.0: "The <identifier> I contained in XQV
7977             * shall be an XML 1.1 NCName." From XML 1.1:
7978             *
7979             * [4] NCName ::= (Letter | '_') (NCNameChar)*
7980             * [5] NCNameChar ::= Letter | Digit | '.' | '-' | '_' |
7981             * CombiningChar | Extender
7982             *
7983             * Since Derby's definition of an "identifier" is a subset
7984             * of NCName, we just use Derby's definition. This means
7985             * that some valid NCNames won't be recognized by Derby--
7986             * but since the ones we _do_ recognize are all still valid
7987             * NCNames, we're not breaking any rules.
7988             */

7989
7990                        /* All of that said, since we use Xalan as the underlying
7991             * query engine and Xalan doesn't support variable binding,
7992             * there's no point in letting the user specify variables
7993             * right now. So we disallow it. In the future we'll have
7994             * to add logic here to store the variables and pass them
7995             * to the correct operator for binding/execution.
7996             */

7997                        {if (true) throw StandardException.newException(
7998                                SQLState.LANG_UNSUPPORTED_XML_FEATURE, "PASSING ... AS");}
7999    } else {
8000      ;
8001    }
8002    if (jj_2_31(1)) {
8003      passingMech = xmlPassingMechanism();
8004    } else {
8005      ;
8006    }
8007                        if (varName == null)
8008                        {
8009                                /* We get here if we just parsed an XML context item.
8010                 * That said, if we already have one (xmlVal[0] is not
8011                 * null) then we can't allow second one, per SQL/XML[2006]
8012                 * (6.17: Syntax Rules:5.b.i): "XMQ shall contain exactly
8013                 * one <XML query context item> XQCI."
8014                 */

8015                                if (xmlVal[0] != null)
8016                                {
8017                                        {if (true) throw StandardException.newException(
8018                                                SQLState.LANG_MULTIPLE_XML_CONTEXT_ITEMS);}
8019                                }
8020
8021                                xmlVal[0] = curVal;
8022
8023                                /* Note: It's possible that a passing mechanism was
8024                 * specified for the context item; if so its value is
8025                 * stored in passingMech. However, we don't actually
8026                 * store that passing mechanism anywhere because we
8027                 * (currently) only support BY REF, so we know what
8028                 * it has to be. If we add support for other passing
8029                 * mechanisms (namely, BY VALUE) in the future, we'll
8030                 * have to store the passing mechanism provided by
8031                 * the user and process it at compilation/execution
8032                 * time.
8033                 */

8034                        }
8035
8036  }
8037
8038/*
8039 * <A NAME="xmlPassingMechanism">xmlPassingMechanism</A>
8040 *
8041 * For now, we only support the BY REF option because
8042 * that gives us better performance (allows us to avoid
8043 * performing potentially deep copies of XML nodes). This
8044 * means that if the same XML value is passed BY REF into
8045 * two different XML arguments for a single operator, then
8046 * every node in the first XML argument must have an
8047 * identical node in the second XML argument, and the
8048 * ids for both nodes must be the same. That said,
8049 * since we don't support variable binding yet, this
8050 * becomes a non-issue because we can't pass XML values.
8051 * In the future, though, we may choose to support the
8052 * passing/binding of variables (the only reason we
8053 * don't now is because Xalan doesn't support it) and
8054 * if we do, BY REF should provide better performance
8055 * due to lack of deep copying.
8056 */

8057  final public short xmlPassingMechanism() throws ParseException, StandardException {
8058    if (getToken(2).kind == REF) {
8059      jj_consume_token(BY);
8060      jj_consume_token(REF);
8061          // pass the XML value by reference
8062
{if (true) return org.apache.derby.iapi.types.XML.XQ_PASS_BY_REF;}
8063    } else {
8064      switch (jj_nt.kind) {
8065      case BY:
8066        jj_consume_token(BY);
8067        jj_consume_token(VALUE);
8068          // pass a 'copy' of the XML value.
8069
{if (true) throw StandardException.newException(
8070                        SQLState.LANG_UNSUPPORTED_XML_FEATURE, "BY VALUE");}
8071        break;
8072      default:
8073        jj_la1[141] = jj_gen;
8074        jj_consume_token(-1);
8075        throw new ParseException();
8076      }
8077    }
8078    throw new Error JavaDoc("Missing return statement in function");
8079  }
8080
8081/*
8082 * <A NAME="xqReturningClause">xqReturningClause</A>
8083 *
8084 * For now we only support "RETURNING SEQUENCE". The reason
8085 * is that this applies to the XMLQUERY operator and the
8086 * results of evaluating a query expression in Xalan against
8087 * an XML value can be an arbritary sequence of items--including
8088 * atomic values. For simplicity we just return the values
8089 * as they are, without doing any further work. SQL/XML[2006]
8090 * says that if we supported RETURNING CONTENT then we'd have
8091 * to construct an XQuery document from the results--but we don't
8092 * do that extra work for now, so we just say that we return
8093 * SEQUENCE.
8094 *
8095 * NOTE: This means that we may not be able to store the results
8096 * of an XMLQUERY operation into a Derby XML column. Right now
8097 * an XML column can only hold valid DOCUMENT nodes, which we
8098 * we define as an XML value whose serialized form can be parsed
8099 * by a JAXP DocumentBuilder (because that's what Derby's XMLPARSE
8100 * operator uses and the result is always a Document node).
8101 * Internally this means that we can only store a sequence if it
8102 * contains exactly one org.w3c.dom.Node that is an instance of
8103 * org.w3c.dom.Document. If the result of an XMLQUERY operation
8104 * does not fit this criteria then it will *not* be storable into
8105 * Derby XML columns.
8106 */

8107  final public short xqReturningClause() throws ParseException, StandardException {
8108    if (getToken(2).kind == SEQUENCE) {
8109      jj_consume_token(RETURNING);
8110      jj_consume_token(SEQUENCE);
8111          // XMLQUERY should return result as a sequence.
8112
// NOTE: since Derby XML columns only allow DOCUMENT(UNTYPED),
8113
// the result of an XMLQUERY operator that returns SEQUENCE
8114
// might not be storable into an XML column.
8115
{if (true) return org.apache.derby.iapi.types.XML.XQ_RETURN_SEQUENCE;}
8116    } else {
8117      switch (jj_nt.kind) {
8118      case RETURNING:
8119        jj_consume_token(RETURNING);
8120        jj_consume_token(CONTENT);
8121          // XMLQUERY should return 'content'.
8122
{if (true) throw StandardException.newException(
8123                        SQLState.LANG_UNSUPPORTED_XML_FEATURE, "RETURNING CONTENT");}
8124        break;
8125      default:
8126        jj_la1[142] = jj_gen;
8127        jj_consume_token(-1);
8128        throw new ParseException();
8129      }
8130    }
8131    throw new Error JavaDoc("Missing return statement in function");
8132  }
8133
8134/*
8135 * <A NAME="xqEmptyHandlingClause">xqEmptyHandlingClause</A>
8136 *
8137 * Defines what the behavior should be when an XMLQUERY operator
8138 * results in an empty sequence. For now we just return the
8139 * empty sequence.
8140 */

8141  final public short xqEmptyHandlingClause() throws ParseException, StandardException {
8142    if (getToken(1).kind == EMPTY) {
8143      jj_consume_token(EMPTY);
8144      jj_consume_token(ON);
8145      jj_consume_token(EMPTY);
8146          // XMLQUERY should return an empty sequence when result of
8147
// the query is an empty sequence (i.e. when there are no
8148
// results).
8149
{if (true) return org.apache.derby.iapi.types.XML.XQ_EMPTY_ON_EMPTY;}
8150    } else {
8151      switch (jj_nt.kind) {
8152      case NULL:
8153        jj_consume_token(NULL);
8154        jj_consume_token(ON);
8155        jj_consume_token(EMPTY);
8156          // XMLQUERY should return a null XML value when result of
8157
// the query is an empty sequence (i.e. when there are no
8158
// results).
8159
{if (true) throw StandardException.newException(
8160                        SQLState.LANG_UNSUPPORTED_XML_FEATURE, "NULL ON EMPTY");}
8161        break;
8162      default:
8163        jj_la1[143] = jj_gen;
8164        jj_consume_token(-1);
8165        throw new ParseException();
8166      }
8167    }
8168    throw new Error JavaDoc("Missing return statement in function");
8169  }
8170
8171/*
8172 * <A NAME="numericFunctionType">numericFunctionType</A>
8173 */

8174  final public DataTypeDescriptor numericFunctionType() throws ParseException, StandardException {
8175        DataTypeDescriptor dts;
8176    if (jj_2_32(1)) {
8177      dts = doubleType();
8178                {if (true) return dts;}
8179    } else {
8180      switch (jj_nt.kind) {
8181      case INT:
8182      case INTEGER:
8183      case SMALLINT:
8184      case LONGINT:
8185        dts = exactIntegerType();
8186                {if (true) return dts;}
8187        break;
8188      default:
8189        jj_la1[144] = jj_gen;
8190        jj_consume_token(-1);
8191        throw new ParseException();
8192      }
8193    }
8194    throw new Error JavaDoc("Missing return statement in function");
8195  }
8196
8197/*
8198 * <A NAME="dateTimeScalarFunction">dateTimeScalarFunction</A>
8199 */

8200  final public ValueNode dateTimeScalarFunction() throws ParseException, StandardException {
8201        ValueNode value;
8202        ValueNode timestampNode;
8203        int field;
8204    switch (jj_nt.kind) {
8205    case TIME:
8206      jj_consume_token(TIME);
8207      jj_consume_token(LEFT_PAREN);
8208      value = additiveExpression(null,0, false);
8209      jj_consume_token(RIGHT_PAREN);
8210                {if (true) return (ValueNode) nodeFactory.getNode(
8211                                                        C_NodeTypes.CAST_NODE,
8212                                                        value,
8213                                                        DataTypeDescriptor.getBuiltInDataTypeDescriptor( Types.TIME),
8214                                                        getContextManager());}
8215      break;
8216    case DATE:
8217      jj_consume_token(DATE);
8218      jj_consume_token(LEFT_PAREN);
8219      value = additiveExpression(null,0, false);
8220      jj_consume_token(RIGHT_PAREN);
8221                {if (true) return (ValueNode) nodeFactory.getNode(
8222                                                        C_NodeTypes.UNARY_DATE_TIMESTAMP_OPERATOR_NODE,
8223                                                        value,
8224                                                        DataTypeDescriptor.getBuiltInDataTypeDescriptor( Types.DATE),
8225                                                        getContextManager());}
8226      break;
8227    case TIMESTAMP:
8228      jj_consume_token(TIMESTAMP);
8229      jj_consume_token(LEFT_PAREN);
8230      value = additiveExpression(null,0, false);
8231      timestampNode = timestampFunctionCompletion(value);
8232                {if (true) return timestampNode;}
8233      break;
8234    case HOUR:
8235    case MINUTE:
8236    case SECOND:
8237    case YEAR:
8238    case DAY:
8239    case MONTH:
8240      field = datetimeField();
8241      jj_consume_token(LEFT_PAREN);
8242      value = additiveExpression(null,0, false);
8243      jj_consume_token(RIGHT_PAREN);
8244                {if (true) return (ValueNode) nodeFactory.getNode(
8245                                                                C_NodeTypes.EXTRACT_OPERATOR_NODE,
8246                                                                ReuseFactory.getInteger(field),
8247                                                                value,
8248                                                                getContextManager());}
8249      break;
8250    default:
8251      jj_la1[145] = jj_gen;
8252      jj_consume_token(-1);
8253      throw new ParseException();
8254    }
8255    throw new Error JavaDoc("Missing return statement in function");
8256  }
8257
8258/*
8259 * <A NAME="timestampFunctionCompletion">timestampFunctionCompletion</A>
8260 */

8261  final public ValueNode timestampFunctionCompletion(ValueNode firstArg) throws ParseException, StandardException {
8262        ValueNode timeValue;
8263    switch (jj_nt.kind) {
8264    case RIGHT_PAREN:
8265      jj_consume_token(RIGHT_PAREN);
8266                {if (true) return (ValueNode) nodeFactory.getNode(
8267                                                        C_NodeTypes.UNARY_DATE_TIMESTAMP_OPERATOR_NODE,
8268                                                        firstArg,
8269                                                        DataTypeDescriptor.getBuiltInDataTypeDescriptor( Types.TIMESTAMP),
8270                                                        getContextManager());}
8271      break;
8272    case COMMA:
8273      jj_consume_token(COMMA);
8274      timeValue = additiveExpression(null,0, false);
8275      jj_consume_token(RIGHT_PAREN);
8276                {if (true) return (ValueNode) nodeFactory.getNode(
8277                                                        C_NodeTypes.TIMESTAMP_OPERATOR_NODE,
8278                                                        firstArg,
8279                                                        timeValue,
8280                                                        getContextManager());}
8281      break;
8282    default:
8283      jj_la1[146] = jj_gen;
8284      jj_consume_token(-1);
8285      throw new ParseException();
8286    }
8287    throw new Error JavaDoc("Missing return statement in function");
8288  }
8289
8290/*
8291 * <A NAME="booleanLiteral">booleanLiteral</A>
8292 */

8293  final public Token booleanLiteral() throws ParseException {
8294        Token tok;
8295    switch (jj_nt.kind) {
8296    case TRUE:
8297      tok = jj_consume_token(TRUE);
8298                {if (true) return tok;}
8299      break;
8300    case FALSE:
8301      tok = jj_consume_token(FALSE);
8302                {if (true) return tok;}
8303      break;
8304    default:
8305      jj_la1[147] = jj_gen;
8306      jj_consume_token(-1);
8307      throw new ParseException();
8308    }
8309    throw new Error JavaDoc("Missing return statement in function");
8310  }
8311
8312/*
8313 * <A NAME="generalValueSpecification">generalValueSpecification</A>
8314 */

8315  final public ValueNode generalValueSpecification() throws ParseException, StandardException {
8316                ValueNode parm;
8317    switch (jj_nt.kind) {
8318    case QUESTION_MARK:
8319      parm = dynamicParameterSpecification();
8320                {if (true) return parm;}
8321      break;
8322    case CURRENT_USER:
8323    case SESSION_USER:
8324    case USER:
8325      parm = userNode();
8326                {if (true) return parm;}
8327      break;
8328    default:
8329      jj_la1[148] = jj_gen;
8330      jj_consume_token(-1);
8331      throw new ParseException();
8332    }
8333    throw new Error JavaDoc("Missing return statement in function");
8334  }
8335
8336  final public ValueNode userNode() throws ParseException, StandardException {
8337    switch (jj_nt.kind) {
8338    case USER:
8339      jj_consume_token(USER);
8340                {if (true) return (ValueNode) nodeFactory.getNode(
8341                                                                C_NodeTypes.USER_NODE,
8342                                                                getContextManager());}
8343      break;
8344    case CURRENT_USER:
8345      jj_consume_token(CURRENT_USER);
8346                {if (true) return (ValueNode) nodeFactory.getNode(
8347                                                C_NodeTypes.CURRENT_USER_NODE,
8348                                                getContextManager());}
8349      break;
8350    case SESSION_USER:
8351      jj_consume_token(SESSION_USER);
8352                {if (true) return (ValueNode) nodeFactory.getNode(
8353                                                C_NodeTypes.SESSION_USER_NODE,
8354                                                getContextManager());}
8355      break;
8356    default:
8357      jj_la1[149] = jj_gen;
8358      jj_consume_token(-1);
8359      throw new ParseException();
8360    }
8361    throw new Error JavaDoc("Missing return statement in function");
8362  }
8363
8364/*
8365 * <A NAME="newInvocation">newInvocation</A>
8366 */

8367  final public JavaToSQLValueNode newInvocation() throws ParseException, StandardException {
8368        QueryTreeNode newNode;
8369        Vector JavaDoc parameterList = new Vector JavaDoc();
8370        String JavaDoc javaClassName;
8371    jj_consume_token(NEW);
8372    javaClassName = javaClassName();
8373    methodCallParameterList(parameterList);
8374                if (!javaClassName.startsWith("org.apache.derby.diag.") && !javaClassName.startsWith("org.apache.derby.catalog.") && !javaClassName.startsWith("com.ibm.db2j."))
8375                {
8376                        checkInternalFeature(javaClassName);
8377                }
8378                newNode = nodeFactory.getNode(C_NodeTypes.NEW_INVOCATION_NODE,
8379                                                                           javaClassName,
8380                                                                           parameterList,
8381                                                                           lastTokenDelimitedIdentifier,
8382                                                                           getContextManager());
8383
8384                /*
8385        ** Assume this is being returned to the SQL domain. If it turns
8386        ** out that this is being returned to the Java domain, we will
8387        ** get rid of this node.
8388        */

8389                {if (true) return (JavaToSQLValueNode) nodeFactory.getNode(
8390                                                                C_NodeTypes.JAVA_TO_SQL_VALUE_NODE,
8391                                                                newNode,
8392                                                                getContextManager());}
8393    throw new Error JavaDoc("Missing return statement in function");
8394  }
8395
8396/*
8397 * <A NAME="staticMethodInvocation">staticMethodInvocation</A>
8398 */

8399  final public ValueNode staticMethodInvocation(String JavaDoc javaClassName) throws ParseException, StandardException {
8400        Vector JavaDoc parameterList = new Vector JavaDoc();
8401        MethodCallNode methodNode;
8402    methodNode = staticMethodName(javaClassName);
8403    methodCallParameterList(parameterList);
8404                methodNode.addParms(parameterList);
8405
8406                /*
8407        ** Assume this is being returned to the SQL domain. If it turns
8408        ** out that this is being returned to the Java domain, we will
8409        ** get rid of this node.
8410        */

8411                {if (true) return (ValueNode) nodeFactory.getNode(
8412                                                                C_NodeTypes.JAVA_TO_SQL_VALUE_NODE,
8413                                                                methodNode,
8414                                                                getContextManager());}
8415    throw new Error JavaDoc("Missing return statement in function");
8416  }
8417
8418/**
8419 * <A NAME="methodCallParameterList">methodCallParameterList</A>
8420*/

8421  final public void methodCallParameterList(Vector JavaDoc parameterList) throws ParseException, StandardException {
8422    jj_consume_token(LEFT_PAREN);
8423    if (jj_2_33(1)) {
8424      methodParameter(parameterList);
8425      label_18:
8426      while (true) {
8427        switch (jj_nt.kind) {
8428        case COMMA:
8429          ;
8430          break;
8431        default:
8432          jj_la1[150] = jj_gen;
8433          break label_18;
8434        }
8435        jj_consume_token(COMMA);
8436        methodParameter(parameterList);
8437      }
8438    } else {
8439      ;
8440    }
8441    jj_consume_token(RIGHT_PAREN);
8442  }
8443
8444/*
8445 * <A NAME="routineInvocation">routineInvocation</A>
8446 */

8447  final public ValueNode routineInvocation() throws ParseException, StandardException {
8448        Vector JavaDoc parameterList = new Vector JavaDoc();
8449        TableName routineName;
8450        MethodCallNode methodNode;
8451    routineName = qualifiedName(Limits.MAX_IDENTIFIER_LENGTH);
8452    methodCallParameterList(parameterList);
8453                methodNode = (MethodCallNode) nodeFactory.getNode(
8454                                                                C_NodeTypes.STATIC_METHOD_CALL_NODE,
8455                                                                routineName,
8456                                                                null,
8457                                                                getContextManager());
8458
8459                methodNode.addParms(parameterList);
8460
8461                /*
8462        ** Assume this is being returned to the SQL domain. If it turns
8463        ** out that this is being returned to the Java domain, we will
8464        ** get rid of this node.
8465        */

8466                {if (true) return (ValueNode) nodeFactory.getNode(
8467                                                                C_NodeTypes.JAVA_TO_SQL_VALUE_NODE,
8468                                                                methodNode,
8469                                                                getContextManager());}
8470    throw new Error JavaDoc("Missing return statement in function");
8471  }
8472
8473/*
8474 * <A NAME="javaClass">javaClass</A>
8475 */

8476  final public String JavaDoc javaClass() throws ParseException, StandardException {
8477        String JavaDoc javaClassName;
8478    javaClassName = javaClassName();
8479                {if (true) return javaClassName;}
8480    throw new Error JavaDoc("Missing return statement in function");
8481  }
8482
8483/*
8484 * <A NAME="columnMethodInvocation">columnMethodInvocation</A>
8485 */

8486  final public ValueNode columnMethodInvocation() throws ParseException, StandardException {
8487        ValueNode columnReference;
8488        ValueNode methodNode;
8489    columnReference = columnNameForInvocation();
8490    methodNode = nonStaticMethodInvocation(columnReference);
8491                {if (true) return methodNode;}
8492    throw new Error JavaDoc("Missing return statement in function");
8493  }
8494
8495/*
8496 * <A NAME="columnNameForInvocation">columnNameForInvocation</A>
8497 */

8498  final public ValueNode columnNameForInvocation() throws ParseException, StandardException {
8499        String JavaDoc firstName;
8500        String JavaDoc secondName = null;
8501        String JavaDoc thirdName = null;
8502        String JavaDoc columnName = null;
8503        String JavaDoc tableName = null;
8504        String JavaDoc schemaName = null;
8505        TableName tabName = null;
8506        ValueNode retval;
8507    firstName = identifier(Limits.MAX_IDENTIFIER_LENGTH, true);
8508    if (getToken(1).kind == PERIOD &&
8509                                            getToken(3).kind == PERIOD) {
8510      jj_consume_token(PERIOD);
8511      secondName = identifier(Limits.MAX_IDENTIFIER_LENGTH, true);
8512      if (getToken(1).kind == PERIOD &&
8513                                                      getToken(3).kind == PERIOD) {
8514        jj_consume_token(PERIOD);
8515        thirdName = identifier(Limits.MAX_IDENTIFIER_LENGTH, true);
8516      } else {
8517        ;
8518      }
8519    } else {
8520      ;
8521    }
8522                // Figure out what each identifier stands for
8523
if (thirdName == null)
8524                {
8525                        if (secondName == null)
8526                        {
8527                                // There's only one identifier, so it must be a column name
8528
columnName = firstName;
8529                        }
8530                        else
8531                        {
8532                                // There are two identifiers, so they are table and column names
8533
tableName = firstName;
8534                                columnName = secondName;
8535                        }
8536                }
8537                else
8538                {
8539                        // There are three identifiers,
8540
// so they are schema, table, and column names
8541
schemaName = firstName;
8542                        tableName = secondName;
8543                        columnName = thirdName;
8544                }
8545
8546                if (tableName != null)
8547                {
8548                        // There is a table name, so get a TableName node
8549
tabName =
8550                                (TableName) nodeFactory.getNode(
8551                                                        C_NodeTypes.TABLE_NAME,
8552                                                        schemaName,
8553                                                        tableName,
8554                                                        new Integer JavaDoc(nextToLastIdentifierToken.beginOffset),
8555                                                        new Integer JavaDoc(nextToLastIdentifierToken.endOffset),
8556                                                        getContextManager());
8557                }
8558
8559                // Get the column reference
8560
retval = (ValueNode) nodeFactory.getNode(
8561                                                                        C_NodeTypes.COLUMN_REFERENCE,
8562                                                                        columnName,
8563                                                                        tabName,
8564                                                                        new Integer JavaDoc(lastIdentifierToken.beginOffset),
8565                                                                        new Integer JavaDoc(lastIdentifierToken.endOffset),
8566                                                                        getContextManager());
8567
8568                {if (true) return retval;}
8569    throw new Error JavaDoc("Missing return statement in function");
8570  }
8571
8572/*
8573 * <A NAME="columnReference">columnReference</A>
8574 */

8575  final public ColumnReference columnReference() throws ParseException, StandardException {
8576        String JavaDoc firstName;
8577        String JavaDoc secondName = null;
8578        String JavaDoc thirdName = null;
8579        String JavaDoc columnName = null;
8580        String JavaDoc tableName = null;
8581        String JavaDoc schemaName = null;
8582        TableName tabName = null;
8583    firstName = identifier(Limits.MAX_IDENTIFIER_LENGTH, false);
8584    if (getToken(1).kind == PERIOD &&
8585                                            getToken(3).kind != LEFT_PAREN) {
8586      jj_consume_token(PERIOD);
8587      secondName = identifier(Limits.MAX_IDENTIFIER_LENGTH, false);
8588      if (getToken(1).kind == PERIOD &&
8589                                                      getToken(3).kind != LEFT_PAREN) {
8590        jj_consume_token(PERIOD);
8591        thirdName = identifier(Limits.MAX_IDENTIFIER_LENGTH, false);
8592      } else {
8593        ;
8594      }
8595    } else {
8596      ;
8597    }
8598                // Figure out what each name stands for
8599
if (thirdName == null)
8600                {
8601                        if (secondName == null)
8602                        {
8603                                // Only one name, must be column name
8604
columnName = firstName;
8605                        }
8606                        else
8607                        {
8608                                // Two names: table.column
8609
tableName = firstName;
8610                                columnName = secondName;
8611                        }
8612                }
8613                else
8614                {
8615                        // Three names: schema.table.column
8616
schemaName = firstName;
8617                        tableName = secondName;
8618                        columnName = thirdName;
8619                }
8620
8621                checkIdentifierLengthLimit(columnName, Limits.MAX_IDENTIFIER_LENGTH);
8622                if (schemaName != null)
8623                        checkIdentifierLengthLimit(schemaName, Limits.MAX_IDENTIFIER_LENGTH);
8624                if (tableName != null)
8625                        checkIdentifierLengthLimit(tableName, Limits.MAX_IDENTIFIER_LENGTH);
8626
8627                if (tableName != null)
8628                {
8629                        tabName = (TableName) nodeFactory.getNode(
8630                                                        C_NodeTypes.TABLE_NAME,
8631                                                        schemaName,
8632                                                        tableName,
8633                                                        new Integer JavaDoc(nextToLastIdentifierToken.beginOffset),
8634                                                        new Integer JavaDoc(nextToLastIdentifierToken.endOffset),
8635                                                        getContextManager());
8636                }
8637
8638                {if (true) return (ColumnReference) nodeFactory.getNode(
8639                                                                C_NodeTypes.COLUMN_REFERENCE,
8640                                                                columnName,
8641                                                                tabName,
8642                                                                new Integer JavaDoc(lastIdentifierToken.beginOffset),
8643                                                                new Integer JavaDoc(lastIdentifierToken.endOffset),
8644                                                                getContextManager());}
8645    throw new Error JavaDoc("Missing return statement in function");
8646  }
8647
8648/*
8649void
8650columnReference() throws StandardException :
8651{}
8652{
8653    /*
8654    **
8655    ** I re-wrote the above rule because it caused a grammar ambiguitity.
8656    ** The problem is that we are parsing a dot-separated list of identifiers,
8657    ** and the grammar doesn't know what the identifiers stand for, but the
8658    ** syntax assumed that it did. For example, in schema.table.column,
8659    ** the grammar doesn't know when it parses the first identifier whether
8660    ** it will be a catalog name, schema name, table name, or column name.
8661    **
8662    ** I think this problem could be solved by increasing the lookahead.
8663    ** I will try that solution next. I like that solution better because,
8664    ** if it works, it will be easier for the grammar to figure out what
8665    ** each identifier stands for.
8666    **
8667
8668    [ <MODULE> <PERIOD> <IDENTIFIER> |
8669      [ [ [ <IDENTIFIER> <PERIOD> ] <IDENTIFIER> <PERIOD> ] <IDENTIFIER> <PERIOD> ]
8670    ]
8671    <IDENTIFIER>
8672}
8673*/

8674  final public OrderByList orderByClause() throws ParseException, StandardException {
8675        OrderByList orderCols;
8676    jj_consume_token(ORDER);
8677    jj_consume_token(BY);
8678    orderCols = sortSpecificationList();
8679                {if (true) return orderCols;}
8680    throw new Error JavaDoc("Missing return statement in function");
8681  }
8682
8683  final public int atIsolationLevel() throws ParseException, StandardException {
8684        int isolationLevel;
8685    jj_consume_token(WITH);
8686    isolationLevel = isolationLevelDB2Abbrev();
8687                {if (true) return isolationLevel;}
8688    throw new Error JavaDoc("Missing return statement in function");
8689  }
8690
8691  final public OrderByList sortSpecificationList() throws ParseException, StandardException {
8692        OrderByList orderCols = (OrderByList) nodeFactory.getNode(
8693                                                                                        C_NodeTypes.ORDER_BY_LIST,
8694                                                                                        getContextManager());
8695    sortSpecification(orderCols);
8696    label_19:
8697    while (true) {
8698      switch (jj_nt.kind) {
8699      case COMMA:
8700        ;
8701        break;
8702      default:
8703        jj_la1[151] = jj_gen;
8704        break label_19;
8705      }
8706      jj_consume_token(COMMA);
8707      sortSpecification(orderCols);
8708    }
8709                {if (true) return orderCols;}
8710    throw new Error JavaDoc("Missing return statement in function");
8711  }
8712
8713  final public void sortSpecification(OrderByList orderCols) throws ParseException, StandardException {
8714        OrderByColumn orderCol;
8715    orderCol = sortKey();
8716    switch (jj_nt.kind) {
8717    case ASC:
8718    case DESC:
8719      orderingSpecification(orderCol);
8720      break;
8721    default:
8722      jj_la1[152] = jj_gen;
8723      ;
8724    }
8725                orderCols.addOrderByColumn(orderCol);
8726  }
8727
8728  final public OrderByColumn sortKey() throws ParseException, StandardException {
8729        ValueNode columnExpression;
8730    columnExpression = additiveExpression(null,0,true);
8731                {if (true) return (OrderByColumn) nodeFactory.getNode(
8732                                                                C_NodeTypes.ORDER_BY_COLUMN,
8733                                                                columnExpression,
8734                                                                getContextManager());}
8735    throw new Error JavaDoc("Missing return statement in function");
8736  }
8737
8738  final public void orderingSpecification(OrderByColumn orderCol) throws ParseException {
8739    switch (jj_nt.kind) {
8740    case ASC:
8741      jj_consume_token(ASC);
8742      break;
8743    case DESC:
8744      jj_consume_token(DESC);
8745                orderCol.setDescending();
8746      break;
8747    default:
8748      jj_la1[153] = jj_gen;
8749      jj_consume_token(-1);
8750      throw new ParseException();
8751    }
8752  }
8753
8754/*
8755 * <A NAME="forUpdateClause">forUpdateClause</A>
8756 */

8757  final public int forUpdateClause(Vector JavaDoc columnList) throws ParseException, StandardException {
8758        int retval;
8759    switch (jj_nt.kind) {
8760    case UPDATE:
8761      jj_consume_token(UPDATE);
8762      switch (jj_nt.kind) {
8763      case OF:
8764        jj_consume_token(OF);
8765        forUpdateColumnList(columnList);
8766        break;
8767      default:
8768        jj_la1[154] = jj_gen;
8769        ;
8770      }
8771                {if (true) return CursorNode.UPDATE;}
8772      break;
8773    case READ:
8774      jj_consume_token(READ);
8775      jj_consume_token(ONLY);
8776                {if (true) return CursorNode.READ_ONLY;}
8777      break;
8778    case FETCH:
8779      jj_consume_token(FETCH);
8780      jj_consume_token(ONLY);
8781                {if (true) return CursorNode.READ_ONLY;}
8782      break;
8783    default:
8784      jj_la1[155] = jj_gen;
8785      jj_consume_token(-1);
8786      throw new ParseException();
8787    }
8788    throw new Error JavaDoc("Missing return statement in function");
8789  }
8790
8791/*
8792 * <A NAME="forUpdateColumnList">forUpdateColumnList</A>
8793 */

8794  final public void forUpdateColumnList(Vector JavaDoc columnList) throws ParseException, StandardException {
8795    forUpdateColumn(columnList);
8796    label_20:
8797    while (true) {
8798      switch (jj_nt.kind) {
8799      case COMMA:
8800        ;
8801        break;
8802      default:
8803        jj_la1[156] = jj_gen;
8804        break label_20;
8805      }
8806      jj_consume_token(COMMA);
8807      forUpdateColumn(columnList);
8808    }
8809  }
8810
8811/*
8812 * <A NAME="forUpdateColumn">forUpdateColumn</A>
8813 */

8814  final public void forUpdateColumn(Vector JavaDoc columnList) throws ParseException, StandardException {
8815        String JavaDoc columnName;
8816    /* identifier() used to be columnName() */
8817            columnName = identifier(Limits.MAX_IDENTIFIER_LENGTH, true);
8818                columnList.addElement(columnName);
8819  }
8820
8821/*
8822 * <A NAME="setClauseList">setClauseList</A>
8823 */

8824  final public ResultColumnList setClauseList() throws ParseException, StandardException {
8825        ResultColumnList columnList = (ResultColumnList) nodeFactory.getNode(
8826                                                                                                C_NodeTypes.RESULT_COLUMN_LIST,
8827                                                                                                getContextManager());
8828    setClause(columnList);
8829    label_21:
8830    while (true) {
8831      switch (jj_nt.kind) {
8832      case COMMA:
8833        ;
8834        break;
8835      default:
8836        jj_la1[157] = jj_gen;
8837        break label_21;
8838      }
8839      jj_consume_token(COMMA);
8840      setClause(columnList);
8841    }
8842                {if (true) return columnList;}
8843    throw new Error JavaDoc("Missing return statement in function");
8844  }
8845
8846/*
8847 * <A NAME="setClause">setClause</A>
8848 */

8849  final public void setClause(ResultColumnList columnList) throws ParseException, StandardException {
8850        ResultColumn resultColumn;
8851        ColumnReference columnName;
8852        ValueNode valueNode;
8853    /* identifier() used to be objectColumn() */
8854            /*
8855            SQL92 only wants identifiers here (column names)
8856            but JBuilder expects table.column, so we allow the
8857            general form.
8858         */

8859            columnName = columnReference();
8860    jj_consume_token(EQUALS_OPERATOR);
8861    valueNode = updateSource(columnName.getColumnName());
8862                resultColumn = (ResultColumn) nodeFactory.getNode(
8863                                                                                C_NodeTypes.RESULT_COLUMN,
8864                                                                                columnName,
8865                                                                                valueNode,
8866                                                                                getContextManager());
8867                columnList.addResultColumn(resultColumn);
8868  }
8869
8870/*
8871 * <A NAME="updateSource">updateSource</A>
8872 */

8873  final public ValueNode updateSource(String JavaDoc columnName) throws ParseException, StandardException {
8874        ValueNode valueNode;
8875    if (jj_2_34(1)) {
8876      valueNode = additiveExpression(null,0, false);
8877                {if (true) return valueNode;}
8878    } else {
8879      switch (jj_nt.kind) {
8880      case NULL:
8881        valueNode = nullSpecification();
8882                {if (true) return valueNode;}
8883        break;
8884      case _DEFAULT:
8885        jj_consume_token(_DEFAULT);
8886                {if (true) return (ValueNode) nodeFactory.getNode(
8887                                                                C_NodeTypes.DEFAULT_NODE,
8888                                                                columnName,
8889                                                                getContextManager());}
8890        break;
8891      default:
8892        jj_la1[158] = jj_gen;
8893        jj_consume_token(-1);
8894        throw new ParseException();
8895      }
8896    }
8897    throw new Error JavaDoc("Missing return statement in function");
8898  }
8899
8900/*
8901 * <A NAME="nullSpecification">nullSpecification</A>
8902 */

8903  final public ValueNode nullSpecification() throws ParseException, StandardException {
8904    jj_consume_token(NULL);
8905                {if (true) return (ValueNode) nodeFactory.getNode(
8906                                                                        C_NodeTypes.UNTYPED_NULL_CONSTANT_NODE,
8907                                                                        getContextManager());}
8908    throw new Error JavaDoc("Missing return statement in function");
8909  }
8910
8911/*
8912 * <A NAME="insertColumnsAndSource">insertColumnsAndSource</A>
8913 */

8914  final public QueryTreeNode insertColumnsAndSource(QueryTreeNode targetTable) throws ParseException, StandardException {
8915        Properties targetProperties = null;
8916        ResultSetNode queryExpression;
8917        ResultColumnList columnList = null;
8918    if (getToken(1).kind == LEFT_PAREN && ! subqueryFollows()) {
8919      jj_consume_token(LEFT_PAREN);
8920      columnList = insertColumnList();
8921      jj_consume_token(RIGHT_PAREN);
8922    } else {
8923      ;
8924    }
8925    switch (jj_nt.kind) {
8926    case DERBYDASHPROPERTIES:
8927      targetProperties = propertyList(false);
8928      jj_consume_token(CHECK_PROPERTIES);
8929      break;
8930    default:
8931      jj_la1[159] = jj_gen;
8932      ;
8933    }
8934    queryExpression = queryExpression(null, NO_SET_OP);
8935                {if (true) return (QueryTreeNode) nodeFactory.getNode(
8936                                                        C_NodeTypes.INSERT_NODE,
8937                                                        targetTable,
8938                                                        columnList,
8939                                                        queryExpression,
8940                                                        targetProperties,
8941                                                        getContextManager());}
8942    throw new Error JavaDoc("Missing return statement in function");
8943  }
8944
8945/*
8946 * <A NAME="insertColumnList">insertColumnList</A>
8947 */

8948  final public ResultColumnList insertColumnList() throws ParseException, StandardException {
8949        ResultColumnList columnList = (ResultColumnList) nodeFactory.getNode(
8950                                                                                                C_NodeTypes.RESULT_COLUMN_LIST,
8951                                                                                                getContextManager());
8952    columnQualifiedNameList(columnList);
8953                {if (true) return columnList;}
8954    throw new Error JavaDoc("Missing return statement in function");
8955  }
8956
8957/*
8958 * <A NAME="columnQualifiedNameList">columnQualifiedNameList</A>
8959 */

8960  final public void columnQualifiedNameList(ResultColumnList columnList) throws ParseException, StandardException {
8961    columnQualifiedNameItem(columnList);
8962    label_22:
8963    while (true) {
8964      switch (jj_nt.kind) {
8965      case COMMA:
8966        ;
8967        break;
8968      default:
8969        jj_la1[160] = jj_gen;
8970        break label_22;
8971      }
8972      jj_consume_token(COMMA);
8973      columnQualifiedNameItem(columnList);
8974    }
8975  }
8976
8977/*
8978 * <A NAME="columnQualifiedNameItem">columnQualifiedNameItem</A>
8979 */

8980  final public void columnQualifiedNameItem(ResultColumnList columnList) throws ParseException, StandardException {
8981        ColumnReference columnRef;
8982        ResultColumn resultColumn;
8983    /*
8984            SQL92 only wants identifiers here (column names)
8985            but JBuilder expects table.column, so we allow the
8986            general form.
8987         */

8988            columnRef = columnReference();
8989                /*
8990        ** Store the column names for the result columns in the
8991        ** result column list. We don't know yet what valueNodes
8992        ** should be hooked up to each result column, so set that
8993        ** to null for now.
8994        */

8995                resultColumn = (ResultColumn) nodeFactory.getNode(
8996                                                                                C_NodeTypes.RESULT_COLUMN,
8997                                                                                columnRef,
8998                                                                                null,
8999                                                                                getContextManager());
9000                columnList.addResultColumn(resultColumn);
9001  }
9002
9003/*
9004 * <A NAME="rowValueConstructor">rowValueConstructor</A>
9005 */

9006  final public ResultSetNode rowValueConstructor(ResultSetNode leftRSN) throws ParseException, StandardException {
9007        ResultColumnList resultColumns = (ResultColumnList) nodeFactory.getNode(
9008                                                                                                C_NodeTypes.RESULT_COLUMN_LIST,
9009                                                                                                getContextManager());
9010        ResultSetNode newRSN;
9011    if (rowValueConstructorListFollows()) {
9012      jj_consume_token(LEFT_PAREN);
9013      rowValueConstructorList(resultColumns);
9014      jj_consume_token(RIGHT_PAREN);
9015                /* If leftRSN is null, simply return the newRSN, else generate and
9016         * return a UNION ALL above the 2 RSNs, after verifying that the size()
9017         * of both RSNs RCLs is the same.
9018         */

9019                newRSN = (ResultSetNode) nodeFactory.getNode(
9020                                                                C_NodeTypes.ROW_RESULT_SET_NODE,
9021                                                                resultColumns,
9022                                                                null,
9023                                                                getContextManager());
9024                if (leftRSN != null)
9025                {
9026                        if (leftRSN.getResultColumns().size() !=
9027                                newRSN.getResultColumns().size())
9028                        {
9029                                {if (true) throw StandardException.newException(SQLState.LANG_ROW_VALUE_CONSTRUCTOR_UNMATCHED_COLUMNS);}
9030                        }
9031
9032                        newRSN = (ResultSetNode) nodeFactory.getNode(
9033                                                                        C_NodeTypes.UNION_NODE,
9034                                                                        leftRSN,
9035                                                                        newRSN,
9036                                                                        Boolean.TRUE,
9037                                                                        Boolean.TRUE,
9038                                                                        null,
9039                                                                        getContextManager());
9040                }
9041                {if (true) return newRSN;}
9042    } else {
9043      rowValueConstructorElement(resultColumns);
9044                /* If leftRSN is null, simply return the newRSN, else generate and
9045         * return a UNION ALL above the 2 RSNs, after verifying that the size()
9046         * of both RSNs RCLs is the same.
9047         */

9048                newRSN = (ResultSetNode) nodeFactory.getNode(
9049                                                                C_NodeTypes.ROW_RESULT_SET_NODE,
9050                                                                resultColumns,
9051                                                                null,
9052                                                                getContextManager());
9053                if (leftRSN != null)
9054                {
9055                        if (leftRSN.getResultColumns().size() !=
9056                                newRSN.getResultColumns().size())
9057                        {
9058                                {if (true) throw StandardException.newException(SQLState.LANG_ROW_VALUE_CONSTRUCTOR_UNMATCHED_COLUMNS);}
9059                        }
9060
9061                        newRSN = (ResultSetNode) nodeFactory.getNode(
9062                                                                        C_NodeTypes.UNION_NODE,
9063                                                                        leftRSN,
9064                                                                        newRSN,
9065                                                                        Boolean.TRUE,
9066                                                                        Boolean.TRUE,
9067                                                                        null,
9068                                                                        getContextManager());
9069                }
9070                {if (true) return newRSN;}
9071    }
9072    throw new Error JavaDoc("Missing return statement in function");
9073  }
9074
9075/*
9076 * <A NAME="rowValueConstructorElement">rowValueConstructorElement</A>
9077 */

9078  final public void rowValueConstructorElement(ResultColumnList resultColumns) throws ParseException, StandardException {
9079        ValueNode value;
9080    if (jj_2_35(1)) {
9081      value = additiveExpression(null, 0, true);
9082                resultColumns.addResultColumn(
9083                        (ResultColumn) nodeFactory.getNode(
9084                                                        C_NodeTypes.RESULT_COLUMN,
9085                                                        null,
9086                                                        value,
9087                                                        getContextManager())
9088                                );
9089    } else {
9090      switch (jj_nt.kind) {
9091      case NULL:
9092        value = nullSpecification();
9093                resultColumns.addResultColumn(
9094                        (ResultColumn) nodeFactory.getNode(
9095                                                        C_NodeTypes.RESULT_COLUMN,
9096                                                        null,
9097                                                        value,
9098                                                        getContextManager())
9099                                );
9100        break;
9101      case _DEFAULT:
9102        jj_consume_token(_DEFAULT);
9103                resultColumns.addResultColumn(
9104                        (ResultColumn) nodeFactory.getNode(
9105                                                        C_NodeTypes.RESULT_COLUMN,
9106                                                        null,
9107                                                        (ValueNode) nodeFactory.getNode(
9108                                                                C_NodeTypes.DEFAULT_NODE,
9109                                                                null,
9110                                                                getContextManager()),
9111                                                        getContextManager())
9112                                );
9113        break;
9114      default:
9115        jj_la1[161] = jj_gen;
9116                {if (true) throw StandardException.newException(SQLState.LANG_EMPTY_VALUES_CLAUSE);}
9117      }
9118    }
9119  }
9120
9121/*
9122 * <A NAME="rowValueConstructorList">rowValueConstructorList</A>
9123 */

9124  final public void rowValueConstructorList(ResultColumnList resultColumns) throws ParseException, StandardException {
9125    rowValueConstructorElement(resultColumns);
9126    label_23:
9127    while (true) {
9128      switch (jj_nt.kind) {
9129      case COMMA:
9130        ;
9131        break;
9132      default:
9133        jj_la1[162] = jj_gen;
9134        break label_23;
9135      }
9136      jj_consume_token(COMMA);
9137      rowValueConstructorElement(resultColumns);
9138    }
9139  }
9140
9141/*
9142 * <A NAME="tableSubquery">tableSubquery</A>
9143 */

9144  final public SubqueryNode tableSubquery(int subqueryType, ValueNode leftOperand) throws ParseException, StandardException {
9145        SubqueryNode subqueryNode;
9146    subqueryNode = subquery(subqueryType, leftOperand);
9147                {if (true) return subqueryNode;}
9148    throw new Error JavaDoc("Missing return statement in function");
9149  }
9150
9151/*
9152 * <A NAME="subquery">subquery</A>
9153 */

9154  final public SubqueryNode subquery(int subqueryType, ValueNode leftOperand) throws ParseException, StandardException {
9155        ResultSetNode queryExpression;
9156        SubqueryNode subqueryNode;
9157    queryExpression = queryExpression(null, NO_SET_OP);
9158                subqueryNode = (SubqueryNode) nodeFactory.getNode(
9159                                                                                C_NodeTypes.SUBQUERY_NODE,
9160                                                                                queryExpression,
9161                                                                                ReuseFactory.getInteger(subqueryType),
9162                                                                                leftOperand,
9163                                                                                getContextManager());
9164                {if (true) return subqueryNode;}
9165    throw new Error JavaDoc("Missing return statement in function");
9166  }
9167
9168/*
9169 * <A NAME="inPredicateValue">inPredicateValue</A>
9170 */

9171  final public ValueNode inPredicateValue(ValueNode leftOperand) throws ParseException, StandardException {
9172        ValueNode retval;
9173        int tokKind;
9174    jj_consume_token(LEFT_PAREN);
9175    if (subqueryFollows()) {
9176      retval = tableSubquery(SubqueryNode.IN_SUBQUERY, leftOperand);
9177    } else if (jj_2_36(1)) {
9178      retval = inValueList(leftOperand);
9179    } else {
9180      jj_consume_token(-1);
9181      throw new ParseException();
9182    }
9183    jj_consume_token(RIGHT_PAREN);
9184                {if (true) return retval;}
9185    throw new Error JavaDoc("Missing return statement in function");
9186  }
9187
9188/*
9189 * <A NAME="inValueList">inValueList</A>
9190 */

9191  final public ValueNode inValueList(ValueNode leftOperand) throws ParseException, StandardException {
9192        ValueNodeList inList = (ValueNodeList) nodeFactory.getNode(
9193                                                                                        C_NodeTypes.VALUE_NODE_LIST,
9194                                                                                        getContextManager());
9195    inElement(inList);
9196    label_24:
9197    while (true) {
9198      switch (jj_nt.kind) {
9199      case COMMA:
9200        ;
9201        break;
9202      default:
9203        jj_la1[163] = jj_gen;
9204        break label_24;
9205      }
9206      jj_consume_token(COMMA);
9207      inElement(inList);
9208    }
9209                {if (true) return (ValueNode) nodeFactory.getNode(
9210                                                                C_NodeTypes.IN_LIST_OPERATOR_NODE,
9211                                                                leftOperand,
9212                                                                inList,
9213                                                                getContextManager());}
9214    throw new Error JavaDoc("Missing return statement in function");
9215  }
9216
9217/*
9218 * <A NAME="inElement">inElement</A>
9219 */

9220  final public void inElement(ValueNodeList inList) throws ParseException, StandardException {
9221        ValueNode valueNode;
9222    valueNode = additiveExpression(null, 0, false);
9223                inList.addElement(valueNode);
9224  }
9225
9226/*
9227 * <A NAME="quantifier">quantifier</A>
9228 */

9229  final public int quantifier(int opType) throws ParseException, StandardException {
9230        int retval = 0;
9231    switch (jj_nt.kind) {
9232    case ALL:
9233      jj_consume_token(ALL);
9234                switch (opType)
9235                {
9236                        case BinaryOperatorNode.EQ:
9237                                retval = SubqueryNode.EQ_ALL_SUBQUERY;
9238                                break;
9239
9240                        case BinaryOperatorNode.NE:
9241                                retval = SubqueryNode.NE_ALL_SUBQUERY;
9242                                break;
9243
9244                        case BinaryOperatorNode.LE:
9245                                retval = SubqueryNode.LE_ALL_SUBQUERY;
9246                                break;
9247
9248                        case BinaryOperatorNode.LT:
9249                                retval = SubqueryNode.LT_ALL_SUBQUERY;
9250                                break;
9251
9252                        case BinaryOperatorNode.GE:
9253                                retval = SubqueryNode.GE_ALL_SUBQUERY;
9254                                break;
9255
9256                        case BinaryOperatorNode.GT:
9257                                retval = SubqueryNode.GT_ALL_SUBQUERY;
9258                                break;
9259
9260                        default:
9261                                if (SanityManager.DEBUG)
9262                                SanityManager.THROWASSERT(
9263                                                "Invalid value for opType (" + opType +
9264                                                ") passed to quantifier()");
9265                }
9266                {if (true) return retval;}
9267      break;
9268    case ANY:
9269    case SOME:
9270      some();
9271                switch (opType)
9272                {
9273                        case BinaryOperatorNode.EQ:
9274                                retval = SubqueryNode.EQ_ANY_SUBQUERY;
9275                                break;
9276
9277                        case BinaryOperatorNode.NE:
9278                                retval = SubqueryNode.NE_ANY_SUBQUERY;
9279                                break;
9280
9281                        case BinaryOperatorNode.LE:
9282                                retval = SubqueryNode.LE_ANY_SUBQUERY;
9283                                break;
9284
9285                        case BinaryOperatorNode.LT:
9286                                retval = SubqueryNode.LT_ANY_SUBQUERY;
9287                                break;
9288
9289                        case BinaryOperatorNode.GE:
9290                                retval = SubqueryNode.GE_ANY_SUBQUERY;
9291                                break;
9292
9293                        case BinaryOperatorNode.GT:
9294                                retval = SubqueryNode.GT_ANY_SUBQUERY;
9295                                break;
9296
9297                        default:
9298                                if (SanityManager.DEBUG)
9299                                SanityManager.THROWASSERT(
9300                                                "Invalid value for opType (" + opType +
9301                                                ") passed to quantifier()");
9302                }
9303                {if (true) return retval;}
9304      break;
9305    default:
9306      jj_la1[164] = jj_gen;
9307      jj_consume_token(-1);
9308      throw new ParseException();
9309    }
9310    throw new Error JavaDoc("Missing return statement in function");
9311  }
9312
9313/*
9314 * <A NAME="some">some</A>
9315 */

9316  final public void some() throws ParseException, StandardException {
9317    switch (jj_nt.kind) {
9318    case SOME:
9319      jj_consume_token(SOME);
9320      break;
9321    case ANY:
9322      jj_consume_token(ANY);
9323      break;
9324    default:
9325      jj_la1[165] = jj_gen;
9326      jj_consume_token(-1);
9327      throw new ParseException();
9328    }
9329  }
9330
9331/*
9332 * <A NAME="existsExpression">existsExpression</A>
9333 */

9334  final public SubqueryNode existsExpression() throws ParseException, StandardException {
9335        SubqueryNode subqueryNode;
9336    jj_consume_token(EXISTS);
9337    jj_consume_token(LEFT_PAREN);
9338    subqueryNode = tableSubquery(SubqueryNode.EXISTS_SUBQUERY, null);
9339    jj_consume_token(RIGHT_PAREN);
9340                {if (true) return subqueryNode;}
9341    throw new Error JavaDoc("Missing return statement in function");
9342  }
9343
9344/*
9345 * <A NAME="tableExpression">tableExpression</A>
9346 */

9347  final public SelectNode tableExpression(ResultColumnList selectList) throws ParseException, StandardException {
9348        SelectNode selectNode;
9349        FromList fromList;
9350        ValueNode whereClause = null;
9351        GroupByList groupByList = null;
9352        ValueNode havingClause = null;
9353        Token whereToken;
9354    fromList = fromClause();
9355    switch (jj_nt.kind) {
9356    case WHERE:
9357      whereToken = jj_consume_token(WHERE);
9358      whereClause = whereClause(whereToken);
9359      break;
9360    default:
9361      jj_la1[166] = jj_gen;
9362      ;
9363    }
9364    switch (jj_nt.kind) {
9365    case GROUP:
9366      groupByList = groupByClause();
9367      break;
9368    default:
9369      jj_la1[167] = jj_gen;
9370      ;
9371    }
9372    switch (jj_nt.kind) {
9373    case HAVING:
9374      havingClause = havingClause();
9375      break;
9376    default:
9377      jj_la1[168] = jj_gen;
9378      ;
9379    }
9380                selectNode = (SelectNode) nodeFactory.getNode(
9381                                                        C_NodeTypes.SELECT_NODE,
9382                                                        selectList,
9383                                                        null, /* AGGREGATE list */
9384                                                        fromList,
9385                                                        whereClause,
9386                                                        groupByList,
9387                                                        getContextManager());
9388
9389                /* A SELECT with a GROUP BY or HAVING clause is the one instance where the
9390         * parser will generate a tree that does not exactly match the query.
9391         * The resulting tree is an outer SelectNode with the HAVING clause
9392         * as its WHERE clause and a FromList containing a single FromSubquery -
9393         * the user SELECT, minus the HAVING clause.
9394         * The outer SELECT gets a SELECT *.
9395         * The FromSubquery will have a null name, something that the user cannot do,
9396         * to enable the binding of any correlated columns in the HAVING clause.
9397         */

9398                if (groupByList != null || havingClause != null)
9399                {
9400                        vetSelectList280( selectList );
9401
9402                        FromSubquery fromSubquery;
9403                        ResultColumnList outerRCL =
9404                                                                                (ResultColumnList) nodeFactory.getNode(
9405                                                                                                C_NodeTypes.RESULT_COLUMN_LIST,
9406                                                                                                getContextManager());
9407
9408                        /* Wrap the user SELECT in a FromSubquery */
9409                        fromList = (FromList) nodeFactory.getNode(
9410                                                                        C_NodeTypes.FROM_LIST,
9411                                                                        getNodeFactory().doJoinOrderOptimization(),
9412                                                                        getContextManager());
9413                        fromSubquery = (FromSubquery) nodeFactory.getNode(
9414                                                                                                        C_NodeTypes.FROM_SUBQUERY,
9415                                                                                                        selectNode,
9416                                                                                                        null,
9417                                                                                                        null,
9418                                                                                                        null,
9419                                                                                                        getContextManager());
9420                        fromList.addElement(fromSubquery);
9421
9422                        /* Pull any aggregates out of the HAVING clause and append them to
9423             * SELECT list in the user's select, replacing the aggregates in
9424             * the HAVING clause with ColumnReferences to the aggregate.
9425             * Do NOT replace anything below a ResultSetNode. This means that
9426             * we'll replace
9427             * FROM x HAVING max(x.x) > 2
9428             * but not
9429             * FROM x HAVING x.x = (select max(y.y) from y)
9430             * Aggregates under a SELECT are all fixed up correctly
9431             * later, but here we need to get the aggregates that
9432             * aren't under result sets.
9433             *
9434             * Appended ResultColumns marked as generated so the wrapper
9435             * select won't see them when the * is expanded.
9436             *
9437             * RESOLVE - someday we should try to find matching aggregates
9438             * instead of just adding them.
9439             *
9440             * NOTE: This rewriting of the query tree makes the handling of an ORDER BY
9441             * clause difficult. See OrderByColumn.pullUpOrderByColumn. It makes specific
9442             * assumptions about the structure of the generated query tree. Do not make
9443             * any changes to this transformation without carefully considering the
9444             * OrderByColumn pullUpOrderByColumn and bindOrderByColumn methods.
9445             */

9446                        if (havingClause != null)
9447                        {
9448                                ReplaceAggregatesWithCRVisitor visitor =
9449                                        new ReplaceAggregatesWithCRVisitor(selectList, ResultSetNode.class);
9450                                havingClause = (ValueNode)havingClause.accept(visitor);
9451
9452                                // fix for HAVING without GROUP BY, makes sure we get one
9453
// aggregate operator by adding a count(*), this fixes beetle 5853, 5890
9454
if (groupByList == null) {
9455                                        ValueNode vn = (ValueNode) nodeFactory.getNode(
9456                                                                C_NodeTypes.AGGREGATE_NODE,
9457                                                                null,
9458                                                                org.apache.derby.impl.sql.compile.CountAggregateDefinition.class,
9459                                                                Boolean.FALSE, // distinct Boolean.TRUE?
9460
"COUNT(*)",
9461                                                                getContextManager());
9462                                        AggregateNode n = (AggregateNode) vn;
9463                                        n.replaceAggregatesWithColumnReferences(selectList, 0);
9464                                }
9465                        }
9466
9467                        outerRCL.addResultColumn((ResultColumn) nodeFactory.getNode(
9468                                                                                                C_NodeTypes.ALL_RESULT_COLUMN,
9469                                                                                                null,
9470                                                                                                getContextManager()));
9471                        // wrap another selectNode on the outside of the subquery
9472
selectNode = (SelectNode) nodeFactory.getNode(
9473                                                                                C_NodeTypes.SELECT_NODE,
9474                                                                                outerRCL, /* SELECT * from user SELECT */
9475                                                                                null, /* AGGREGATE list */
9476                                                                                fromList,
9477                                                                                havingClause,
9478                                                                                null, /* GROUP BY list */
9479                                                                                getContextManager());
9480
9481                        /* Mark the wrapping FromSubquery and SelectNode as appropriate */
9482                        if (groupByList != null)
9483                        {
9484                                fromSubquery.markAsForGroupByClause();
9485                                selectNode.markAsForGroupByClause();
9486                        }
9487                        if (havingClause != null)
9488                        {
9489                                fromSubquery.markAsForHavingClause();
9490                                selectNode.markAsForHavingClause();
9491                        }
9492                }
9493                {if (true) return selectNode;}
9494    throw new Error JavaDoc("Missing return statement in function");
9495  }
9496
9497/*
9498 * <A NAME="fromClause">fromClause</A>
9499 */

9500  final public FromList fromClause() throws ParseException, StandardException {
9501        FromList fromList = (FromList) nodeFactory.getNode(
9502                                                                        C_NodeTypes.FROM_LIST,
9503                                                                        getNodeFactory().doJoinOrderOptimization(),
9504                                                                        getContextManager());
9505        int tokKind;
9506        Token beginToken;
9507        Token endToken;
9508    jj_consume_token(FROM);
9509                beginToken = getToken(1);
9510    switch (jj_nt.kind) {
9511    case DERBYDASHPROPERTIES:
9512      fromListProperties(fromList);
9513      break;
9514    default:
9515      jj_la1[169] = jj_gen;
9516      ;
9517    }
9518    dummyTableReferenceRule(fromList);
9519    label_25:
9520    while (true) {
9521      switch (jj_nt.kind) {
9522      case COMMA:
9523        ;
9524        break;
9525      default:
9526        jj_la1[170] = jj_gen;
9527        break label_25;
9528      }
9529      jj_consume_token(COMMA);
9530      dummyTableReferenceRule(fromList);
9531    }
9532                                                                         endToken = getToken(0);
9533                fromList.setBeginOffset( beginToken.beginOffset);
9534                fromList.setEndOffset( endToken.endOffset);
9535                {if (true) return fromList;}
9536    throw new Error JavaDoc("Missing return statement in function");
9537  }
9538
9539/*
9540 * <A NAME="fromListProperties">fromListProperties</A>
9541 */

9542  final public void fromListProperties(FromList fromList) throws ParseException, StandardException {
9543        Properties properties;
9544    properties = propertyList(true);
9545    jj_consume_token(CHECK_PROPERTIES);
9546                fromList.setProperties(properties);
9547  }
9548
9549/* This rule created simply as a way to add the result of tableReference()
9550 * to the fromList.
9551 */

9552  final public void dummyTableReferenceRule(FromList fromList) throws ParseException, StandardException {
9553        FromTable tableReference;
9554    switch (jj_nt.kind) {
9555    case TABLE:
9556      jj_consume_token(TABLE);
9557      if (getToken(1).kind == LEFT_PAREN &&
9558                                      (
9559                                              getToken(2).kind == SELECT ||
9560                                              getToken(2).kind == VALUES
9561                                      )) {
9562
9563      } else {
9564        jj_consume_token(-1);
9565        throw new ParseException();
9566      }
9567      tableReference = tableReferenceTypes(false);
9568                fromList.addFromTable(tableReference);
9569      break;
9570    default:
9571      jj_la1[171] = jj_gen;
9572      if (jj_2_37(1)) {
9573        tableReference = tableReferenceTypes(false);
9574                fromList.addFromTable(tableReference);
9575      } else {
9576        jj_consume_token(-1);
9577        throw new ParseException();
9578      }
9579    }
9580  }
9581
9582  final public FromTable tableReferenceTypes(boolean nestedInParens) throws ParseException, StandardException {
9583        FromTable tableReference;
9584    if (jj_2_38(1)) {
9585      tableReference = tableReference(nestedInParens);
9586                {if (true) return tableReference ;}
9587    } else {
9588      switch (jj_nt.kind) {
9589      case LEFT_BRACE:
9590        jj_consume_token(LEFT_BRACE);
9591        jj_consume_token(OJ);
9592        tableReference = tableReference(nestedInParens);
9593        jj_consume_token(RIGHT_BRACE);
9594                {if (true) return tableReference;}
9595        break;
9596      default:
9597        jj_la1[172] = jj_gen;
9598        jj_consume_token(-1);
9599        throw new ParseException();
9600      }
9601    }
9602    throw new Error JavaDoc("Missing return statement in function");
9603  }
9604
9605  final public Object JavaDoc[] optionalTableClauses() throws ParseException, StandardException {
9606        Object JavaDoc[] otc = null;
9607        Properties tableProperties = null;
9608        ResultColumnList derivedRCL = null;
9609        String JavaDoc correlationName = null;
9610    switch (jj_nt.kind) {
9611    case DERBYDASHPROPERTIES:
9612      otc = optionalTableProperties();
9613                otc[OPTIONAL_TABLE_CLAUSES_DERIVED_RCL] = derivedRCL;
9614                otc[OPTIONAL_TABLE_CLAUSES_CORRELATION_NAME] = correlationName;
9615                {if (true) return otc;}
9616      break;
9617    default:
9618      jj_la1[177] = jj_gen;
9619      switch (jj_nt.kind) {
9620      case AS:
9621      case BINARY:
9622      case COALESCE:
9623      case COUNT:
9624      case D:
9625      case MODULE:
9626      case T:
9627      case TS:
9628      case VALUE:
9629      case VARBINARY:
9630      case ABS:
9631      case ABSVAL:
9632      case ACTION:
9633      case ALWAYS:
9634      case BLOB:
9635      case C:
9636      case CALLED:
9637      case CLOB:
9638      case COBOL:
9639      case COMMITTED:
9640      case CONCAT:
9641      case CONTAINS:
9642      case DATA:
9643      case DATE:
9644      case DAY:
9645      case DYNAMIC:
9646      case FORTRAN:
9647      case GENERATED:
9648      case IDENTITY_VAL_LOCAL:
9649      case INCREMENT:
9650      case INITIAL:
9651      case INTERVAL:
9652      case LANGUAGE:
9653      case LARGE:
9654      case LENGTH:
9655      case LEVEL:
9656      case LOCKS:
9657      case LOCKSIZE:
9658      case LOGGED:
9659      case MOD:
9660      case MODIFIES:
9661      case MODIFY:
9662      case MONTH:
9663      case _MORE:
9664      case MUMPS:
9665      case NAME:
9666      case NCLOB:
9667      case NULLABLE:
9668      case NUMBER:
9669      case OBJECT:
9670      case PASCAL:
9671      case PLI:
9672      case PRECISION:
9673      case RELEASE:
9674      case REPEATABLE:
9675      case RESTART:
9676      case RETURNS:
9677      case ROW:
9678      case SAVEPOINT:
9679      case SCALE:
9680      case SERIALIZABLE:
9681      case SQL_TSI_FRAC_SECOND:
9682      case SQL_TSI_SECOND:
9683      case SQL_TSI_MINUTE:
9684      case SQL_TSI_HOUR:
9685      case SQL_TSI_DAY:
9686      case SQL_TSI_WEEK:
9687      case SQL_TSI_MONTH:
9688      case SQL_TSI_QUARTER:
9689      case SQL_TSI_YEAR:
9690      case START:
9691      case STATEMENT:
9692      case SYNONYM:
9693      case THEN:
9694      case TIME:
9695      case TIMESTAMP:
9696      case TIMESTAMPADD:
9697      case TIMESTAMPDIFF:
9698      case TRUNCATE:
9699      case TYPE:
9700      case UNCOMMITTED:
9701      case USAGE:
9702      case WHEN:
9703      case CURDATE:
9704      case CURTIME:
9705      case DATABASE:
9706      case LONG:
9707      case AFTER:
9708      case BEFORE:
9709      case CLASS:
9710      case COMPRESS:
9711      case CONTENT:
9712      case CS:
9713      case DB2SQL:
9714      case DIRTY:
9715      case DOCUMENT:
9716      case EACH:
9717      case EMPTY:
9718      case EXCLUSIVE:
9719      case FN:
9720      case INDEX:
9721      case JAVA:
9722      case LCASE:
9723      case LOCATE:
9724      case LOCK:
9725      case MESSAGE_LOCALE:
9726      case METHOD:
9727      case MODE:
9728      case NEW:
9729      case NEW_TABLE:
9730      case OJ:
9731      case OFF:
9732      case OLD:
9733      case OLD_TABLE:
9734      case PARAMETER:
9735      case PASSING:
9736      case PROPERTIES:
9737      case READS:
9738      case REF:
9739      case REFERENCING:
9740      case RENAME:
9741      case RESET:
9742      case RESULT:
9743      case RETAIN:
9744      case RETURNING:
9745      case RR:
9746      case RS:
9747      case SEQUENCE:
9748      case SEQUENTIAL:
9749      case SETS:
9750      case SHARE:
9751      case SQLID:
9752      case SPECIFIC:
9753      case SQRT:
9754      case STABILITY:
9755      case STRIP:
9756      case STYLE:
9757      case TRIGGER:
9758      case UCASE:
9759      case UR:
9760      case WHITESPACE:
9761      case IDENTIFIER:
9762      case DELIMITED_IDENTIFIER:
9763        switch (jj_nt.kind) {
9764        case AS:
9765          jj_consume_token(AS);
9766          break;
9767        default:
9768          jj_la1[173] = jj_gen;
9769          ;
9770        }
9771        correlationName = identifier(Limits.MAX_IDENTIFIER_LENGTH, true);
9772        switch (jj_nt.kind) {
9773        case LEFT_PAREN:
9774          jj_consume_token(LEFT_PAREN);
9775          derivedRCL = derivedColumnList();
9776          jj_consume_token(RIGHT_PAREN);
9777          break;
9778        default:
9779          jj_la1[174] = jj_gen;
9780          ;
9781        }
9782        switch (jj_nt.kind) {
9783        case DERBYDASHPROPERTIES:
9784          tableProperties = propertyList(true);
9785          jj_consume_token(CHECK_PROPERTIES);
9786          break;
9787        default:
9788          jj_la1[175] = jj_gen;
9789          ;
9790        }
9791        break;
9792      default:
9793        jj_la1[176] = jj_gen;
9794        ;
9795      }
9796                otc = new Object JavaDoc[OPTIONAL_TABLE_CLAUSES_SIZE];
9797                otc[OPTIONAL_TABLE_CLAUSES_TABLE_PROPERTIES] = tableProperties;
9798                otc[OPTIONAL_TABLE_CLAUSES_DERIVED_RCL] = derivedRCL;
9799                otc[OPTIONAL_TABLE_CLAUSES_CORRELATION_NAME] = correlationName;
9800                {if (true) return otc;}
9801    }
9802    throw new Error JavaDoc("Missing return statement in function");
9803  }
9804
9805  final public Object JavaDoc[] optionalTableProperties() throws ParseException, StandardException {
9806        Object JavaDoc[] otc = null;
9807        Properties tableProperties = null;
9808    tableProperties = propertyList(true);
9809    jj_consume_token(CHECK_PROPERTIES);
9810                otc = new Object JavaDoc[OPTIONAL_TABLE_CLAUSES_SIZE];
9811                otc[OPTIONAL_TABLE_CLAUSES_TABLE_PROPERTIES] = tableProperties;
9812                {if (true) return otc;}
9813    throw new Error JavaDoc("Missing return statement in function");
9814  }
9815
9816/*
9817 * <A NAME="tableReference">tableReference</A>
9818 */

9819  final public FromTable tableReference(boolean nestedInParens) throws ParseException, StandardException {
9820        JavaToSQLValueNode javaToSQLNode = null;
9821        TableName tableName;
9822        String JavaDoc correlationName = null;
9823        ResultColumnList derivedRCL = null;
9824        FromTable fromTable;
9825        TableOperatorNode joinTable = null;
9826        FromTable tableReference;
9827        Object JavaDoc[] optionalTableClauses = new Object JavaDoc[OPTIONAL_TABLE_CLAUSES_SIZE];
9828        Properties tableProperties = null;
9829        ResultSetNode derivedTable;
9830    if (newInvocationFollows(1)) {
9831      javaToSQLNode = newInvocation();
9832      switch (jj_nt.kind) {
9833      case AS:
9834        jj_consume_token(AS);
9835        break;
9836      default:
9837        jj_la1[178] = jj_gen;
9838        ;
9839      }
9840      correlationName = identifier(Limits.MAX_IDENTIFIER_LENGTH, true);
9841      switch (jj_nt.kind) {
9842      case LEFT_PAREN:
9843        jj_consume_token(LEFT_PAREN);
9844        derivedRCL = derivedColumnList();
9845        jj_consume_token(RIGHT_PAREN);
9846        break;
9847      default:
9848        jj_la1[179] = jj_gen;
9849        ;
9850      }
9851      switch (jj_nt.kind) {
9852      case DERBYDASHPROPERTIES:
9853        optionalTableClauses = optionalTableProperties();
9854        break;
9855      default:
9856        jj_la1[180] = jj_gen;
9857        ;
9858      }
9859      label_26:
9860      while (true) {
9861        if (joinedTableExpressionFollows()) {
9862          ;
9863        } else {
9864          break label_26;
9865        }
9866        joinTable = joinedTableExpression((joinTable != null) ?
9867                                                                                        joinTable :
9868                                                                                        (FromTable) nodeFactory.getNode(
9869                                                                                                C_NodeTypes.FROM_VTI,
9870                                                                                                javaToSQLNode.getJavaValueNode(),
9871                                                                                                correlationName,
9872                                                                                                derivedRCL,
9873                                                                                                ((optionalTableClauses != null) ?
9874                                                                                                        (Properties) optionalTableClauses[OPTIONAL_TABLE_CLAUSES_TABLE_PROPERTIES] :
9875                                                                                                        (Properties) null),
9876                                                                                                getContextManager()),
9877                                                                                nestedInParens);
9878      }
9879                /* Build a derived table if not a join expression */
9880                if (joinTable == null)
9881                {
9882                        fromTable = (FromTable) nodeFactory.getNode(
9883                                                                C_NodeTypes.FROM_VTI,
9884                                                                javaToSQLNode.getJavaValueNode(),
9885                                                                correlationName,
9886                                                                derivedRCL,
9887                                                                ((optionalTableClauses != null) ?
9888                                                                        (Properties) optionalTableClauses[OPTIONAL_TABLE_CLAUSES_TABLE_PROPERTIES] :
9889                                                                        (Properties) null),
9890                                                                getContextManager());
9891                }
9892                else
9893                {
9894                        fromTable = joinTable;
9895                }
9896
9897                {if (true) return fromTable;}
9898    } else {
9899      switch (jj_nt.kind) {
9900      case BINARY:
9901      case COALESCE:
9902      case COUNT:
9903      case D:
9904      case MODULE:
9905      case T:
9906      case TS:
9907      case VALUE:
9908      case VARBINARY:
9909      case ABS:
9910      case ABSVAL:
9911      case ACTION:
9912      case ALWAYS:
9913      case BLOB:
9914      case C:
9915      case CALLED:
9916      case CLOB:
9917      case COBOL:
9918      case COMMITTED:
9919      case CONCAT:
9920      case CONTAINS:
9921      case DATA:
9922      case DATE:
9923      case DAY:
9924      case DYNAMIC:
9925      case FORTRAN:
9926      case GENERATED:
9927      case IDENTITY_VAL_LOCAL:
9928      case INCREMENT:
9929      case INITIAL:
9930      case INTERVAL:
9931      case LANGUAGE:
9932      case LARGE:
9933      case LENGTH:
9934      case LEVEL:
9935      case LOCKS:
9936      case LOCKSIZE:
9937      case LOGGED:
9938      case MOD:
9939      case MODIFIES:
9940      case MODIFY:
9941      case MONTH:
9942      case _MORE:
9943      case MUMPS:
9944      case NAME:
9945      case NCLOB:
9946      case NULLABLE:
9947      case NUMBER:
9948      case OBJECT:
9949      case PASCAL:
9950      case PLI:
9951      case PRECISION:
9952      case RELEASE:
9953      case REPEATABLE:
9954      case RESTART:
9955      case RETURNS:
9956      case ROW:
9957      case SAVEPOINT:
9958      case SCALE:
9959      case SERIALIZABLE:
9960      case SQL_TSI_FRAC_SECOND:
9961      case SQL_TSI_SECOND:
9962      case SQL_TSI_MINUTE:
9963      case SQL_TSI_HOUR:
9964      case SQL_TSI_DAY:
9965      case SQL_TSI_WEEK:
9966      case SQL_TSI_MONTH:
9967      case SQL_TSI_QUARTER:
9968      case SQL_TSI_YEAR:
9969      case START:
9970      case STATEMENT:
9971      case SYNONYM:
9972      case THEN:
9973      case TIME:
9974      case TIMESTAMP:
9975      case TIMESTAMPADD:
9976      case TIMESTAMPDIFF:
9977      case TRUNCATE:
9978      case TYPE:
9979      case UNCOMMITTED:
9980      case USAGE:
9981      case WHEN:
9982      case CURDATE:
9983      case CURTIME:
9984      case DATABASE:
9985      case LONG:
9986      case AFTER:
9987      case BEFORE:
9988      case CLASS:
9989      case COMPRESS:
9990      case CONTENT:
9991      case CS:
9992      case DB2SQL:
9993      case DIRTY:
9994      case DOCUMENT:
9995      case EACH:
9996      case EMPTY:
9997      case EXCLUSIVE:
9998      case FN:
9999      case INDEX:
0000      case JAVA:
0001      case LCASE:
0002      case LOCATE:
0003      case LOCK:
0004      case MESSAGE_LOCALE:
0005      case METHOD:
0006      case MODE:
0007      case NEW:
0008      case NEW_TABLE:
0009      case OJ:
0010      case OFF:
0011      case OLD:
0012      case OLD_TABLE:
0013      case PARAMETER:
0014      case PASSING:
0015      case PROPERTIES:
0016      case READS:
0017      case REF:
0018      case REFERENCING:
0019      case RENAME:
0020      case RESET:
0021      case RESULT:
0022      case RETAIN:
0023      case RETURNING:
0024      case RR:
0025      case RS:
0026      case SEQUENCE:
0027      case SEQUENTIAL:
0028      case SETS:
0029      case SHARE:
0030      case SQLID:
0031      case SPECIFIC:
0032      case SQRT:
0033      case STABILITY:
0034      case STRIP:
0035      case STYLE:
0036      case TRIGGER:
0037      case UCASE:
0038      case UR:
0039      case WHITESPACE:
0040      case IDENTIFIER:
0041      case DELIMITED_IDENTIFIER:
0042        /* identifier() used to be correlationName() */
0043                tableName = qualifiedName(Limits.MAX_IDENTIFIER_LENGTH);
0044        optionalTableClauses = optionalTableClauses();
0045        label_27:
0046        while (true) {
0047          if (joinedTableExpressionFollows()) {
0048            ;
0049          } else {
0050            break label_27;
0051          }
0052          joinTable = joinedTableExpression((joinTable != null) ?
0053                                                                                          joinTable :
0054                                                                                          (FromTable) nodeFactory.getNode(
0055                                                                                                          C_NodeTypes.FROM_BASE_TABLE,
0056                                                                                                          tableName,
0057                                                                                                          (String JavaDoc) optionalTableClauses[OPTIONAL_TABLE_CLAUSES_CORRELATION_NAME],
0058                                                                                                          (ResultColumnList) optionalTableClauses[OPTIONAL_TABLE_CLAUSES_DERIVED_RCL],
0059                                                                                                          (Properties) optionalTableClauses[OPTIONAL_TABLE_CLAUSES_TABLE_PROPERTIES],
0060                                                                                                          getContextManager()),
0061                                                                                  nestedInParens);
0062        }
0063                /* Build a from table if not a join expression */
0064                if (joinTable == null)
0065                {
0066                        fromTable = (FromTable) nodeFactory.getNode(
0067                                                                                        C_NodeTypes.FROM_BASE_TABLE,
0068                                                                                        tableName,
0069                                                                                                (String JavaDoc) optionalTableClauses[OPTIONAL_TABLE_CLAUSES_CORRELATION_NAME],
0070                                                                                                (ResultColumnList) optionalTableClauses[OPTIONAL_TABLE_CLAUSES_DERIVED_RCL],
0071                                                                                                (Properties) optionalTableClauses[OPTIONAL_TABLE_CLAUSES_TABLE_PROPERTIES],
0072                                                                                        getContextManager());
0073                }
0074                else
0075                {
0076                        fromTable = joinTable;
0077                }
0078                {if (true) return fromTable;}
0079        break;
0080      default:
0081        jj_la1[184] = jj_gen;
0082        if (getToken(1).kind == LEFT_PAREN &&
0083                                        (
0084                                                getToken(2).kind == SELECT ||
0085                                                getToken(2).kind == VALUES
0086                                        )) {
0087          derivedTable = derivedTable();
0088          switch (jj_nt.kind) {
0089          case AS:
0090            jj_consume_token(AS);
0091            break;
0092          default:
0093            jj_la1[181] = jj_gen;
0094            ;
0095          }
0096          correlationName = identifier(Limits.MAX_IDENTIFIER_LENGTH, true);
0097          switch (jj_nt.kind) {
0098          case LEFT_PAREN:
0099            jj_consume_token(LEFT_PAREN);
0100            derivedRCL = derivedColumnList();
0101            jj_consume_token(RIGHT_PAREN);
0102            break;
0103          default:
0104            jj_la1[182] = jj_gen;
0105            ;
0106          }
0107          switch (jj_nt.kind) {
0108          case DERBYDASHPROPERTIES:
0109            optionalTableClauses = optionalTableProperties();
0110            break;
0111          default:
0112            jj_la1[183] = jj_gen;
0113            ;
0114          }
0115          label_28:
0116          while (true) {
0117            if (joinedTableExpressionFollows()) {
0118              ;
0119            } else {
0120              break label_28;
0121            }
0122            joinTable = joinedTableExpression((joinTable != null) ?
0123                                                                                            joinTable :
0124                                                                                            (FromTable) nodeFactory.getNode(
0125                                                                                                                    C_NodeTypes.FROM_SUBQUERY,
0126                                                                                                                    derivedTable,
0127                                                                                                                    correlationName,
0128                                                                                                                    derivedRCL,
0129                                                                                                                    ((optionalTableClauses != null) ?
0130                                                                                                                            (Properties) optionalTableClauses[OPTIONAL_TABLE_CLAUSES_TABLE_PROPERTIES] :
0131                                                                                                                            (Properties) null),
0132                                                                                                                    getContextManager()),
0133                                                                                    nestedInParens);
0134          }
0135                /* Build a derived table if not a join expression */
0136                if (joinTable == null)
0137                {
0138                        fromTable = (FromTable) nodeFactory.getNode(
0139                                                                                        C_NodeTypes.FROM_SUBQUERY,
0140                                                                                        derivedTable,
0141                                                                                        correlationName,
0142                                                                                        derivedRCL,
0143                                                                                        ((optionalTableClauses != null) ?
0144                                                                                                (Properties) optionalTableClauses[OPTIONAL_TABLE_CLAUSES_TABLE_PROPERTIES] :
0145                                                                                                (Properties) null),
0146                                                                                        getContextManager());
0147                }
0148                else
0149                {
0150                        fromTable = joinTable;
0151                }
0152
0153                {if (true) return fromTable;}
0154        } else {
0155          switch (jj_nt.kind) {
0156          case LEFT_PAREN:
0157            jj_consume_token(LEFT_PAREN);
0158            tableReference = tableReferenceTypes(true);
0159            jj_consume_token(RIGHT_PAREN);
0160            label_29:
0161            while (true) {
0162              if (joinedTableExpressionFollows()) {
0163                ;
0164              } else {
0165                break label_29;
0166              }
0167              joinTable = joinedTableExpression((joinTable != null) ?
0168                                                                                              joinTable :
0169                                                                                              tableReference,
0170                                                                                      nestedInParens);
0171            }
0172                if (joinTable == null)
0173                {
0174                        fromTable = tableReference;
0175                }
0176                else
0177                {
0178                        fromTable = joinTable;
0179                }
0180
0181                {if (true) return fromTable;}
0182            break;
0183          default:
0184            jj_la1[185] = jj_gen;
0185            jj_consume_token(-1);
0186            throw new ParseException();
0187          }
0188        }
0189      }
0190    }
0191    throw new Error JavaDoc("Missing return statement in function");
0192  }
0193
0194/*
0195 * <A NAME="derivedColumnList">derivedColumnList</A>
0196 */

0197  final public ResultColumnList derivedColumnList() throws ParseException, StandardException {
0198        ResultColumnList resultColumns =
0199                                                                        (ResultColumnList) nodeFactory.getNode(
0200                                                                                        C_NodeTypes.RESULT_COLUMN_LIST,
0201                                                                                        getContextManager());
0202    columnNameList(resultColumns);
0203                {if (true) return resultColumns;}
0204    throw new Error JavaDoc("Missing return statement in function");
0205  }
0206
0207/*
0208 * <A NAME="columnNameList">columnNameList</A>
0209 */

0210  final public void columnNameList(ResultColumnList columnList) throws ParseException, StandardException {
0211    columnNameItem(columnList);
0212    label_30:
0213    while (true) {
0214      switch (jj_nt.kind) {
0215      case COMMA:
0216        ;
0217        break;
0218      default:
0219        jj_la1[186] = jj_gen;
0220        break label_30;
0221      }
0222      jj_consume_token(COMMA);
0223      columnNameItem(columnList);
0224    }
0225  }
0226
0227/*
0228 * <A NAME="columnNameItem">columnNameItem</A>
0229 */

0230  final public void columnNameItem(ResultColumnList columnList) throws ParseException, StandardException {
0231        String JavaDoc columnName;
0232        ResultColumn resultColumn;
0233    /* identifier() used to be columnName() */
0234            columnName = identifier(Limits.MAX_IDENTIFIER_LENGTH, true);
0235                /*
0236        ** Store the column names for the result columns in the
0237        ** result column list. We don't know yet what valueNodes
0238        ** should be hooked up to each result column, so set that
0239        ** to null for now.
0240        */

0241                resultColumn = (ResultColumn) nodeFactory.getNode(
0242                                                                        C_NodeTypes.RESULT_COLUMN,
0243                                                                        columnName,
0244                                                                        null,
0245                                                                        getContextManager());
0246                columnList.addResultColumn(resultColumn);
0247  }
0248
0249/*
0250 * <A NAME="indexColumnList">indexColumnList</A>
0251 */

0252  final public void indexColumnList(Vector JavaDoc columnList) throws ParseException, StandardException {
0253    indexColumnItem(columnList);
0254    label_31:
0255    while (true) {
0256      switch (jj_nt.kind) {
0257      case COMMA:
0258        ;
0259        break;
0260      default:
0261        jj_la1[187] = jj_gen;
0262        break label_31;
0263      }
0264      jj_consume_token(COMMA);
0265      indexColumnItem(columnList);
0266    }
0267  }
0268
0269/*
0270 * <A NAME="indexColumnItem">indexColumnItem</A>
0271 */

0272  final public void indexColumnItem(Vector JavaDoc columnList) throws ParseException, StandardException {
0273        String JavaDoc columnName;
0274    /* identifier never ends with a space; appending a space meaning desc */
0275            columnName = identifier(Limits.MAX_IDENTIFIER_LENGTH, true);
0276    switch (jj_nt.kind) {
0277    case ASC:
0278    case DESC:
0279      switch (jj_nt.kind) {
0280      case ASC:
0281        jj_consume_token(ASC);
0282        break;
0283      case DESC:
0284        jj_consume_token(DESC);
0285                                                                                     columnName = columnName + ' ';
0286        break;
0287      default:
0288        jj_la1[188] = jj_gen;
0289        jj_consume_token(-1);
0290        throw new ParseException();
0291      }
0292      break;
0293    default:
0294      jj_la1[189] = jj_gen;
0295      ;
0296    }
0297                /*
0298        ** Store the column names for the index columns in the
0299        ** index column list.
0300        */

0301                columnList.addElement(columnName);
0302  }
0303
0304/*
0305 * <A NAME="derivedTable">derivedTable</A>
0306 */

0307  final public ResultSetNode derivedTable() throws ParseException, StandardException {
0308        SubqueryNode tableSubquery;
0309    jj_consume_token(LEFT_PAREN);
0310    tableSubquery = tableSubquery(SubqueryNode.FROM_SUBQUERY, null);
0311    jj_consume_token(RIGHT_PAREN);
0312                {if (true) return tableSubquery.getResultSet();}
0313    throw new Error JavaDoc("Missing return statement in function");
0314  }
0315
0316  final public TableOperatorNode joinedTableExpression(ResultSetNode leftRSN, boolean nestedInParens) throws ParseException, StandardException {
0317        TableOperatorNode joinNode;
0318    joinNode = qualifiedJoin(leftRSN, nestedInParens);
0319                {if (true) return joinNode;}
0320    throw new Error JavaDoc("Missing return statement in function");
0321  }
0322
0323  final public TableOperatorNode qualifiedJoin(ResultSetNode leftRSN, boolean nestedInParens) throws ParseException, StandardException {
0324        int joinType = JoinNode.INNERJOIN;
0325        ResultSetNode rightRSN;
0326        TableOperatorNode ton = null;
0327        Object JavaDoc[] onOrUsingClause = null;
0328        ResultColumnList usingClause = null;
0329        ValueNode onClause;
0330    switch (jj_nt.kind) {
0331    case INNER:
0332    case LEFT:
0333    case RIGHT:
0334      joinType = joinType();
0335      break;
0336    default:
0337      jj_la1[190] = jj_gen;
0338      ;
0339    }
0340    jj_consume_token(JOIN);
0341    rightRSN = tableReferenceTypes(nestedInParens);
0342    onOrUsingClause = joinSpecification(leftRSN, rightRSN);
0343                /* If NATURAL OR UNION is specified, then no joinSpecification()
0344         * is required, otherwise it is required.
0345         */

0346
0347                /* RESOLVE - Since we don't support NATURAL or UNION joins yet,
0348         * onOrUsingClause must be non-null. (Change error message if and
0349         * when grammar changes.)
0350         */

0351
0352                /* Figure out whether an ON or USING clause was used */
0353                onClause = (ValueNode) onOrUsingClause[ON_CLAUSE];
0354                usingClause = (ResultColumnList) onOrUsingClause[USING_CLAUSE];
0355
0356                if (onClause == null && usingClause == null)
0357                {
0358                        {if (true) throw StandardException.newException(SQLState.LANG_MISSING_JOIN_SPECIFICATION,
0359                                                        JoinNode.joinTypeToString(joinType));}
0360                }
0361
0362                switch(joinType)
0363                {
0364                        case JoinNode.INNERJOIN:
0365                                ton = (TableOperatorNode) nodeFactory.getNode(
0366                                                                        C_NodeTypes.JOIN_NODE,
0367                                                                        leftRSN,
0368                                                                        rightRSN,
0369                                                                        onClause,
0370                                                                        usingClause,
0371                                                                        null,
0372                                                                        null,
0373                                                                        null,
0374                                                                        getContextManager());
0375                                break;
0376
0377                        case JoinNode.LEFTOUTERJOIN:
0378                                ton = (TableOperatorNode) nodeFactory.getNode(
0379                                                                                C_NodeTypes.HALF_OUTER_JOIN_NODE,
0380                                                                                leftRSN,
0381                                                                                rightRSN,
0382                                                                                onClause,
0383                                                                                usingClause,
0384                                                                                Boolean.FALSE,
0385                                                                                null,
0386                                                                                getContextManager());
0387                                break;
0388
0389                        case JoinNode.RIGHTOUTERJOIN:
0390                                ton = (TableOperatorNode) nodeFactory.getNode(
0391                                                                                C_NodeTypes.HALF_OUTER_JOIN_NODE,
0392                                                                                leftRSN,
0393                                                                                rightRSN,
0394                                                                                onClause,
0395                                                                                usingClause,
0396                                                                                Boolean.TRUE,
0397                                                                                null,
0398                                                                                getContextManager());
0399                                break;
0400
0401
0402                        default:
0403                                if (SanityManager.DEBUG)
0404                                {
0405                                        SanityManager.ASSERT(false, "Unexpected joinType");
0406                                }
0407                                {if (true) return null;}
0408                }
0409
0410                /* Mark whether or not we are nested within parens */
0411                ton.setNestedInParens(nestedInParens);
0412                {if (true) return ton;}
0413    throw new Error JavaDoc("Missing return statement in function");
0414  }
0415
0416  final public int joinType() throws ParseException, StandardException {
0417        int joinType;
0418    switch (jj_nt.kind) {
0419    case INNER:
0420      jj_consume_token(INNER);
0421                {if (true) return JoinNode.INNERJOIN;}
0422      break;
0423    case LEFT:
0424    case RIGHT:
0425      joinType = outerJoinType();
0426      switch (jj_nt.kind) {
0427      case OUTER:
0428        jj_consume_token(OUTER);
0429        break;
0430      default:
0431        jj_la1[191] = jj_gen;
0432        ;
0433      }
0434                {if (true) return joinType;}
0435      break;
0436    default:
0437      jj_la1[192] = jj_gen;
0438      jj_consume_token(-1);
0439      throw new ParseException();
0440    }
0441    throw new Error JavaDoc("Missing return statement in function");
0442  }
0443
0444  final public int outerJoinType() throws ParseException, StandardException {
0445    switch (jj_nt.kind) {
0446    case LEFT:
0447      jj_consume_token(LEFT);
0448                {if (true) return JoinNode.LEFTOUTERJOIN;}
0449      break;
0450    case RIGHT:
0451      jj_consume_token(RIGHT);
0452                {if (true) return JoinNode.RIGHTOUTERJOIN;}
0453      break;
0454    default:
0455      jj_la1[193] = jj_gen;
0456      jj_consume_token(-1);
0457      throw new ParseException();
0458    }
0459    throw new Error JavaDoc("Missing return statement in function");
0460  }
0461
0462  final public Object JavaDoc[] joinSpecification(ResultSetNode leftRSN, ResultSetNode rightRSN) throws ParseException, StandardException {
0463        Object JavaDoc[] onOrUsingClause = new Object JavaDoc[ON_OR_USING_CLAUSE_SIZE];
0464        ResultColumnList usingClause = null;
0465        ValueNode joinClause = null;
0466    joinClause = joinCondition();
0467                onOrUsingClause[ON_CLAUSE] = joinClause;
0468                onOrUsingClause[USING_CLAUSE] = usingClause;
0469                {if (true) return onOrUsingClause;}
0470    throw new Error JavaDoc("Missing return statement in function");
0471  }
0472
0473  final public ValueNode joinCondition() throws ParseException, StandardException {
0474        ValueNode joinClause;
0475    jj_consume_token(ON);
0476    joinClause = valueExpression(false);
0477                {if (true) return joinClause;}
0478    throw new Error JavaDoc("Missing return statement in function");
0479  }
0480
0481/*
0482 * <A NAME="tableValueConstructor">tableValueConstructor</A>
0483 */

0484  final public ResultSetNode tableValueConstructor() throws ParseException, StandardException {
0485        ResultSetNode resultSetNode;
0486    jj_consume_token(VALUES);
0487    resultSetNode = tableValueConstructorList();
0488                {if (true) return resultSetNode;}
0489    throw new Error JavaDoc("Missing return statement in function");
0490  }
0491
0492/*
0493 * <A NAME="tableValueConstructorList">tableValueConstructorList</A>
0494 */

0495  final public ResultSetNode tableValueConstructorList() throws ParseException, StandardException {
0496        ResultSetNode resultSetNode;
0497    resultSetNode = rowValueConstructor(null);
0498    label_32:
0499    while (true) {
0500      switch (jj_nt.kind) {
0501      case COMMA:
0502        ;
0503        break;
0504      default:
0505        jj_la1[194] = jj_gen;
0506        break label_32;
0507      }
0508      jj_consume_token(COMMA);
0509      resultSetNode = rowValueConstructor(resultSetNode);
0510    }
0511                if (resultSetNode instanceof UnionNode)
0512                {
0513                        ((UnionNode) resultSetNode).markTopTableConstructor();
0514                }
0515
0516                {if (true) return resultSetNode;}
0517    throw new Error JavaDoc("Missing return statement in function");
0518  }
0519
0520/*
0521 * <A NAME="explicitTable">explicitTable</A>
0522 */

0523
0524/*
0525 * <A NAME="datetimeValueFunction">datetimeValueFunction</A>
0526 */

0527  final public ValueNode datetimeValueFunction() throws ParseException, StandardException {
0528        int prec = -1;
0529    if ((getToken(1).kind == CURRENT && getToken(2).kind == DATE)) {
0530      jj_consume_token(CURRENT);
0531      jj_consume_token(DATE);
0532                {if (true) return (ValueNode) nodeFactory.getNode(
0533                                                                C_NodeTypes.CURRENT_DATETIME_OPERATOR_NODE,
0534                                                                ReuseFactory.getInteger(
0535                                                                        CurrentDatetimeOperatorNode.CURRENT_DATE),
0536                                                                getContextManager());}
0537    } else {
0538      switch (jj_nt.kind) {
0539      case CURRENT_DATE:
0540        jj_consume_token(CURRENT_DATE);
0541                {if (true) return (ValueNode) nodeFactory.getNode(
0542                                                                C_NodeTypes.CURRENT_DATETIME_OPERATOR_NODE,
0543                                                                ReuseFactory.getInteger(
0544                                                                        CurrentDatetimeOperatorNode.CURRENT_DATE),
0545                                                                getContextManager());}
0546        break;
0547      default:
0548        jj_la1[195] = jj_gen;
0549        if ((getToken(1).kind == CURRENT && getToken(2).kind == TIME)) {
0550          jj_consume_token(CURRENT);
0551          jj_consume_token(TIME);
0552                {if (true) return (ValueNode) nodeFactory.getNode(
0553                                                        C_NodeTypes.CURRENT_DATETIME_OPERATOR_NODE,
0554                                                        ReuseFactory.getInteger(
0555                                                                CurrentDatetimeOperatorNode.CURRENT_TIME),
0556                                                        getContextManager());}
0557        } else {
0558          switch (jj_nt.kind) {
0559          case CURRENT_TIME:
0560            jj_consume_token(CURRENT_TIME);
0561                {if (true) return (ValueNode) nodeFactory.getNode(
0562                                                        C_NodeTypes.CURRENT_DATETIME_OPERATOR_NODE,
0563                                                        ReuseFactory.getInteger(
0564                                                                CurrentDatetimeOperatorNode.CURRENT_TIME),
0565                                                        getContextManager());}
0566            break;
0567          default:
0568            jj_la1[196] = jj_gen;
0569            if ((getToken(1).kind == CURRENT && getToken(2).kind == TIMESTAMP)) {
0570              jj_consume_token(CURRENT);
0571              jj_consume_token(TIMESTAMP);
0572                {if (true) return (ValueNode) nodeFactory.getNode(
0573                                                        C_NodeTypes.CURRENT_DATETIME_OPERATOR_NODE,
0574                                                        ReuseFactory.getInteger(
0575                                                                CurrentDatetimeOperatorNode.CURRENT_TIMESTAMP),
0576                                                        getContextManager());}
0577            } else {
0578              switch (jj_nt.kind) {
0579              case CURRENT_TIMESTAMP:
0580                jj_consume_token(CURRENT_TIMESTAMP);
0581                {if (true) return (ValueNode) nodeFactory.getNode(
0582                                                        C_NodeTypes.CURRENT_DATETIME_OPERATOR_NODE,
0583                                                        ReuseFactory.getInteger(
0584                                                                CurrentDatetimeOperatorNode.CURRENT_TIMESTAMP),
0585                                                        getContextManager());}
0586                break;
0587              default:
0588                jj_la1[197] = jj_gen;
0589                jj_consume_token(-1);
0590                throw new ParseException();
0591              }
0592            }
0593          }
0594        }
0595      }
0596    }
0597    throw new Error JavaDoc("Missing return statement in function");
0598  }
0599
0600/*
0601** Note that set function and aggregate are used
0602** interchangeably in the parser. The tree has
0603** aggregate nodes.
0604*/

0605  final public ValueNode aggregateNode() throws ParseException, StandardException {
0606        ValueNode agg;
0607    switch (jj_nt.kind) {
0608    case COUNT:
0609      jj_consume_token(COUNT);
0610      jj_consume_token(LEFT_PAREN);
0611      switch (jj_nt.kind) {
0612      case ASTERISK:
0613        jj_consume_token(ASTERISK);
0614                        agg = (ValueNode) nodeFactory.getNode(
0615                                                                C_NodeTypes.AGGREGATE_NODE,
0616                                                                null,
0617                                                                CountAggregateDefinition.class,
0618                                                                Boolean.FALSE,
0619                                                                "COUNT(*)",
0620                                                                getContextManager());
0621        break;
0622      default:
0623        jj_la1[198] = jj_gen;
0624        if (jj_2_39(1)) {
0625          agg = aggregateExpression("COUNT", CountAggregateDefinition.class);
0626        } else {
0627          jj_consume_token(-1);
0628          throw new ParseException();
0629        }
0630      }
0631      jj_consume_token(RIGHT_PAREN);
0632                {if (true) return agg;}
0633      break;
0634    case AVG:
0635    case MAX:
0636    case MIN:
0637    case SUM:
0638      agg = generalAggregate();
0639                {if (true) return agg;}
0640      break;
0641    default:
0642      jj_la1[199] = jj_gen;
0643      jj_consume_token(-1);
0644      throw new ParseException();
0645    }
0646    throw new Error JavaDoc("Missing return statement in function");
0647  }
0648
0649  final public ValueNode aggregateExpression(String JavaDoc aggName, Class JavaDoc aggClass) throws ParseException, StandardException {
0650        boolean distinct = false;
0651        ValueNode value;
0652    if (jj_2_40(1)) {
0653      distinct = setQuantifier();
0654    } else {
0655      ;
0656    }
0657    value = additiveExpression(null, 0, false);
0658                {if (true) return (ValueNode) nodeFactory.getNode(
0659                                                                C_NodeTypes.AGGREGATE_NODE,
0660                                                                value,
0661                                                                aggClass,
0662                                                                distinct ? Boolean.TRUE : Boolean.FALSE,
0663                                                                aggName,
0664                                                                getContextManager());}
0665    throw new Error JavaDoc("Missing return statement in function");
0666  }
0667
0668  final public ValueNode generalAggregate() throws ParseException, StandardException {
0669        Token aggToken;
0670        String JavaDoc methodAliasString;
0671        ValueNode aggExpr;
0672        ValueNode value;
0673    aggToken = builtInAggregateType();
0674    jj_consume_token(LEFT_PAREN);
0675    aggExpr = aggregateExpression(aggName(aggToken), aggClass(aggToken));
0676    jj_consume_token(RIGHT_PAREN);
0677                {if (true) return aggExpr;}
0678    throw new Error JavaDoc("Missing return statement in function");
0679  }
0680
0681/*
0682** All built in aggregates are pretty similar to user
0683** defined aggregates, except we know what to map to
0684** without looking up the class name.
0685**
0686** NOTE: COUNT is omitted here because the COUNT aggregate is
0687** factored into a different rule, to distinguish between
0688** COUNT(*) and COUNT(<expression>).
0689*/

0690  final public Token builtInAggregateType() throws ParseException, StandardException {
0691        Token retval;
0692    switch (jj_nt.kind) {
0693    case MAX:
0694      retval = jj_consume_token(MAX);
0695      break;
0696    case AVG:
0697      retval = jj_consume_token(AVG);
0698      break;
0699    case MIN:
0700      retval = jj_consume_token(MIN);
0701      break;
0702    case SUM:
0703      retval = jj_consume_token(SUM);
0704      break;
0705    default:
0706      jj_la1[200] = jj_gen;
0707      jj_consume_token(-1);
0708      throw new ParseException();
0709    }
0710                {if (true) return retval;}
0711    throw new Error JavaDoc("Missing return statement in function");
0712  }
0713
0714  final public ValueNode castSpecification() throws ParseException, StandardException {
0715        DataTypeDescriptor dts;
0716        ValueNode treeTop;
0717        ValueNode value;
0718        int charType;
0719        int length = -1;
0720    jj_consume_token(CAST);
0721    jj_consume_token(LEFT_PAREN);
0722    value = castOperand();
0723    jj_consume_token(AS);
0724    dts = dataTypeCast();
0725    jj_consume_token(RIGHT_PAREN);
0726                treeTop = (ValueNode) nodeFactory.getNode(
0727                                                                        C_NodeTypes.CAST_NODE,
0728                                                                        value,
0729                                                                        dts,
0730                                                                        getContextManager());
0731
0732                /* We need to generate a SQL->Java conversion tree above us if
0733         * the dataTypeCast is a user type.
0734         */

0735                if (dts.getTypeId().userType())
0736                {
0737                        treeTop = (ValueNode) nodeFactory.getNode(
0738                                                        C_NodeTypes.JAVA_TO_SQL_VALUE_NODE,
0739                                                        nodeFactory.getNode(
0740                                                                                        C_NodeTypes.SQL_TO_JAVA_VALUE_NODE,
0741                                                                                        treeTop,
0742                                                                                        getContextManager()),
0743                                                        getContextManager());
0744                }
0745
0746                {if (true) return treeTop;}
0747    throw new Error JavaDoc("Missing return statement in function");
0748  }
0749
0750/*
0751 * <A NAME="charOrVarchar">charOrVarchar</A>
0752 */

0753  final public int charOrVarchar() throws ParseException {
0754    switch (jj_nt.kind) {
0755    case CHAR:
0756      jj_consume_token(CHAR);
0757                {if (true) return Types.CHAR;}
0758      break;
0759    case VARCHAR:
0760      jj_consume_token(VARCHAR);
0761                {if (true) return Types.VARCHAR;}
0762      break;
0763    default:
0764      jj_la1[201] = jj_gen;
0765      jj_consume_token(-1);
0766      throw new ParseException();
0767    }
0768    throw new Error JavaDoc("Missing return statement in function");
0769  }
0770
0771  final public ValueNode castOperand() throws ParseException, StandardException {
0772        ValueNode value;
0773    if (jj_2_41(1)) {
0774      value = additiveExpression(null, 0, false);
0775                {if (true) return value;}
0776    } else {
0777      switch (jj_nt.kind) {
0778      case NULL:
0779        jj_consume_token(NULL);
0780                {if (true) return (ValueNode) nodeFactory.getNode(
0781                                                                        C_NodeTypes.UNTYPED_NULL_CONSTANT_NODE,
0782                                                                        getContextManager());}
0783        break;
0784      default:
0785        jj_la1[202] = jj_gen;
0786        jj_consume_token(-1);
0787        throw new ParseException();
0788      }
0789    }
0790    throw new Error JavaDoc("Missing return statement in function");
0791  }
0792
0793/*
0794 * <A NAME="dynamicParameterSpecification">dynamicParameterSpecification</A>
0795 */

0796  final public ParameterNode dynamicParameterSpecification() throws ParseException, StandardException {
0797    jj_consume_token(QUESTION_MARK);
0798                {if (true) return makeParameterNode( );}
0799    throw new Error JavaDoc("Missing return statement in function");
0800  }
0801
0802/*
0803 * <A NAME="whereClause">whereClause</A>
0804 */

0805  final public ValueNode whereClause(Token beginToken) throws ParseException, StandardException {
0806        ValueNode value;
0807        Token endToken;
0808    /* valueExpression() was searchCondition() */
0809            value = valueExpression(false);
0810                endToken = getToken(0);
0811
0812                value.setBeginOffset( beginToken.endOffset + 1 );
0813                value.setEndOffset( endToken.endOffset );
0814
0815                {if (true) return value;}
0816    throw new Error JavaDoc("Missing return statement in function");
0817  }
0818
0819  final public GroupByList groupByClause() throws ParseException, StandardException {
0820        GroupByList groupingCols;
0821    jj_consume_token(GROUP);
0822    jj_consume_token(BY);
0823    groupingCols = groupingColumnReferenceList();
0824                {if (true) return groupingCols;}
0825    throw new Error JavaDoc("Missing return statement in function");
0826  }
0827
0828  final public GroupByList groupingColumnReferenceList() throws ParseException, StandardException {
0829        GroupByList groupingCols = (GroupByList) nodeFactory.getNode(
0830                                                                        C_NodeTypes.GROUP_BY_LIST,
0831                                                                        getContextManager());
0832    groupingColumnReference(groupingCols);
0833    label_33:
0834    while (true) {
0835      switch (jj_nt.kind) {
0836      case COMMA:
0837        ;
0838        break;
0839      default:
0840        jj_la1[203] = jj_gen;
0841        break label_33;
0842      }
0843      jj_consume_token(COMMA);
0844      groupingColumnReference(groupingCols);
0845    }
0846                {if (true) return groupingCols;}
0847    throw new Error JavaDoc("Missing return statement in function");
0848  }
0849
0850  final public void groupingColumnReference(GroupByList groupingCols) throws ParseException, StandardException {
0851        ValueNode columnExpression;
0852    columnExpression = additiveExpression(null, 0, false);
0853                if (columnExpression.isParameterNode())
0854                {
0855                        {if (true) throw StandardException.newException(SQLState.LANG_SYNTAX_ERROR, "?");}
0856                }
0857                if (columnExpression instanceof AggregateNode)
0858                {
0859                        AggregateNode agNode = (AggregateNode)columnExpression;
0860                        {if (true) throw StandardException.newException(
0861                                SQLState.LANG_AGGREGATE_IN_GROUPBY_LIST,
0862                                agNode.getAggregateName());}
0863                }
0864                groupingCols.addGroupByColumn(
0865                        (GroupByColumn) nodeFactory.getNode(
0866                                                        C_NodeTypes.GROUP_BY_COLUMN,
0867                                                        columnExpression,
0868                                                        getContextManager()));
0869  }
0870
0871  final public ValueNode havingClause() throws ParseException, StandardException {
0872        ValueNode value;
0873    jj_consume_token(HAVING);
0874    value = valueExpression(false);
0875                {if (true) return value;}
0876    throw new Error JavaDoc("Missing return statement in function");
0877  }
0878
0879  final public QueryTreeNode schemaDefinition() throws ParseException, StandardException {
0880        String JavaDoc schemaName = null;
0881        String JavaDoc authName = null;
0882    jj_consume_token(SCHEMA);
0883    switch (jj_nt.kind) {
0884    case BINARY:
0885    case COALESCE:
0886    case COUNT:
0887    case D:
0888    case MODULE:
0889    case T:
0890    case TS:
0891    case VALUE:
0892    case VARBINARY:
0893    case ABS:
0894    case ABSVAL:
0895    case ACTION:
0896    case ALWAYS:
0897    case BLOB:
0898    case C:
0899    case CALLED:
0900    case CLOB:
0901    case COBOL:
0902    case COMMITTED:
0903    case CONCAT:
0904    case CONTAINS:
0905    case DATA:
0906    case DATE:
0907    case DAY:
0908    case DYNAMIC:
0909    case FORTRAN:
0910    case GENERATED:
0911    case IDENTITY_VAL_LOCAL:
0912    case INCREMENT:
0913    case INITIAL:
0914    case INTERVAL:
0915    case LANGUAGE:
0916    case LARGE:
0917    case LENGTH:
0918    case LEVEL:
0919    case LOCKS:
0920    case LOCKSIZE:
0921    case LOGGED:
0922    case MOD:
0923    case MODIFIES:
0924    case MODIFY:
0925    case MONTH:
0926    case _MORE:
0927    case MUMPS:
0928    case NAME:
0929    case NCLOB:
0930    case NULLABLE:
0931    case NUMBER:
0932    case OBJECT:
0933    case PASCAL:
0934    case PLI:
0935    case PRECISION:
0936    case RELEASE:
0937    case REPEATABLE:
0938    case RESTART:
0939    case RETURNS:
0940    case ROW:
0941    case SAVEPOINT:
0942    case SCALE:
0943    case SERIALIZABLE:
0944    case SQL_TSI_FRAC_SECOND:
0945    case SQL_TSI_SECOND:
0946    case SQL_TSI_MINUTE:
0947    case SQL_TSI_HOUR:
0948    case SQL_TSI_DAY:
0949    case SQL_TSI_WEEK:
0950    case SQL_TSI_MONTH:
0951    case SQL_TSI_QUARTER:
0952    case SQL_TSI_YEAR:
0953    case START:
0954    case STATEMENT:
0955    case SYNONYM:
0956    case THEN:
0957    case TIME:
0958    case TIMESTAMP:
0959    case TIMESTAMPADD:
0960    case TIMESTAMPDIFF:
0961    case TRUNCATE:
0962    case TYPE:
0963    case UNCOMMITTED:
0964    case USAGE:
0965    case WHEN:
0966    case CURDATE:
0967    case CURTIME:
0968    case DATABASE:
0969    case LONG:
0970    case AFTER:
0971    case BEFORE:
0972    case CLASS:
0973    case COMPRESS:
0974    case CONTENT:
0975    case CS:
0976    case DB2SQL:
0977    case DIRTY:
0978    case DOCUMENT:
0979    case EACH:
0980    case EMPTY:
0981    case EXCLUSIVE:
0982    case FN:
0983    case INDEX:
0984    case JAVA:
0985    case LCASE:
0986    case LOCATE:
0987    case LOCK:
0988    case MESSAGE_LOCALE:
0989    case METHOD:
0990    case MODE:
0991    case NEW:
0992    case NEW_TABLE:
0993    case OJ:
0994    case OFF:
0995    case OLD:
0996    case OLD_TABLE:
0997    case PARAMETER:
0998    case PASSING:
0999    case PROPERTIES:
1000    case READS:
1001    case REF:
1002    case REFERENCING:
1003    case RENAME:
1004    case RESET:
1005    case RESULT:
1006    case RETAIN:
1007    case RETURNING:
1008    case RR:
1009    case RS:
1010    case SEQUENCE:
1011    case SEQUENTIAL:
1012    case SETS:
1013    case SHARE:
1014    case SQLID:
1015    case SPECIFIC:
1016    case SQRT:
1017    case STABILITY:
1018    case STRIP:
1019    case STYLE:
1020    case TRIGGER:
1021    case UCASE:
1022    case UR:
1023    case WHITESPACE:
1024    case IDENTIFIER:
1025    case DELIMITED_IDENTIFIER:
1026      schemaName = identifier(Limits.MAX_IDENTIFIER_LENGTH, true);
1027      switch (jj_nt.kind) {
1028      case AUTHORIZATION:
1029        jj_consume_token(AUTHORIZATION);
1030        authName = identifier(Limits.MAX_IDENTIFIER_LENGTH, true);
1031        break;
1032      default:
1033        jj_la1[204] = jj_gen;
1034        ;
1035      }
1036                        if (authName != null)
1037                                checkVersion( DataDictionary.DD_VERSION_DERBY_10_2, "AUTHORIZATION");
1038
1039                        if (schemaName.startsWith("SYS"))
1040                                {if (true) throw StandardException.newException(SQLState.INVALID_SCHEMA_SYS, schemaName);}
1041
1042                        {if (true) return (QueryTreeNode) nodeFactory.getNode(
1043                                        C_NodeTypes.CREATE_SCHEMA_NODE,
1044                                        schemaName,
1045                                        authName,
1046                                        getContextManager()
1047                                        );}
1048      break;
1049    case AUTHORIZATION:
1050      jj_consume_token(AUTHORIZATION);
1051      authName = identifier(Limits.MAX_IDENTIFIER_LENGTH, true);
1052                        checkVersion( DataDictionary.DD_VERSION_DERBY_10_2, "AUTHORIZATION");
1053                        if (authName.startsWith("SYS"))
1054                                {if (true) throw StandardException.newException(SQLState.INVALID_SCHEMA_SYS, authName);}
1055
1056                        {if (true) return (QueryTreeNode) nodeFactory.getNode(
1057                                        C_NodeTypes.CREATE_SCHEMA_NODE,
1058                                        authName,
1059                                        authName,
1060                                        getContextManager()
1061                                        );}
1062      break;
1063    default:
1064      jj_la1[205] = jj_gen;
1065      jj_consume_token(-1);
1066      throw new ParseException();
1067    }
1068    throw new Error JavaDoc("Missing return statement in function");
1069  }
1070
1071/*
1072 * <A NAME="tableDefinition">tableDefinition</A>
1073 */

1074  final public QueryTreeNode tableDefinition() throws ParseException, StandardException {
1075        char lockGranularity = TableDescriptor.DEFAULT_LOCK_GRANULARITY;
1076        Properties properties = null;
1077        TableName tableName;
1078        TableElementList tableElementList;
1079    jj_consume_token(TABLE);
1080    tableName = qualifiedName(Limits.MAX_IDENTIFIER_LENGTH);
1081    tableElementList = tableElementList();
1082    switch (jj_nt.kind) {
1083    case DERBYDASHPROPERTIES:
1084      properties = propertyList(false);
1085      jj_consume_token(CHECK_PROPERTIES);
1086      break;
1087    default:
1088      jj_la1[206] = jj_gen;
1089      ;
1090    }
1091                {if (true) return (QueryTreeNode) nodeFactory.getNode(
1092                                                                C_NodeTypes.CREATE_TABLE_NODE,
1093                                                                tableName,
1094                                                                tableElementList,
1095                                                                properties,
1096                                                                new Character JavaDoc(lockGranularity),
1097                                                                getContextManager());}
1098    throw new Error JavaDoc("Missing return statement in function");
1099  }
1100
1101/*
1102 * This method is called when a comment starting with --derby-properties is found.
1103 * Such a comment is a special directive to Derby and allows a sql to pass optimizer
1104 * overrides. Derby looks for propertyName=value [,propertyName=value]* after
1105 * --derby-properties and returns these properties in a Properties object as a return
1106 * value of this method.
1107 * The param propertiesUseAllowed true indicates that users are allowed to
1108 * specify optimizer overrides in the given context.
1109 * False means optimizer overrides in the given context are allowed internally
1110 * only eg impl/load/import.java specifies property insertMode=replace/bulkInsert
1111 * in the insert statement. This same property will not be acceptable from an
1112 * insert statement from a user sql.
1113 */

1114  final public Properties propertyList(boolean propertiesUseAllowed) throws ParseException, StandardException {
1115        Properties properties = new FormatableProperties();
1116        StringTokenizer JavaDoc commaSeparatedProperties;
1117        StringTokenizer JavaDoc equalOperatorSeparatedProperty;
1118    jj_consume_token(DERBYDASHPROPERTIES);
1119                //first use StringTokenizer to get tokens which are delimited by ,s
1120
commaSeparatedProperties = new StringTokenizer JavaDoc(getToken(1).image,",");
1121                while (commaSeparatedProperties.hasMoreTokens()) {
1122                        //Now verify that tokens delimited by ,s follow propertyName=value pattern
1123
String JavaDoc currentProperty = commaSeparatedProperties.nextToken();
1124                        equalOperatorSeparatedProperty = new StringTokenizer JavaDoc(currentProperty,"=", true);
1125                        if (equalOperatorSeparatedProperty.countTokens() != 3)
1126                                {if (true) throw StandardException.newException(SQLState.PROPERTY_SYNTAX_INVALID);}
1127                        else {
1128                                String JavaDoc key = equalOperatorSeparatedProperty.nextToken().trim();
1129                                if (!equalOperatorSeparatedProperty.nextToken().equals("="))
1130                                        {if (true) throw StandardException.newException(SQLState.PROPERTY_SYNTAX_INVALID);}
1131                                String JavaDoc value = equalOperatorSeparatedProperty.nextToken().trim();
1132                                verifyImageLength(value);
1133                                /* Trim off the leading and trailing ', and compress all '' to ' */
1134                                if (value.startsWith("'") && value.endsWith("'"))
1135                                        value = compressQuotes(value.substring(1, value.length() - 1), SINGLEQUOTES);
1136                                /* Trim off the leading and trailing ", and compress all "" to " */
1137                                else if (value.startsWith("\"") && value.endsWith("\""))
1138                                        value = compressQuotes(value.substring(1, value.length() - 1), DOUBLEQUOTES);
1139                                else
1140                                        value = value.toUpperCase();
1141                                // Do not allow user to specify multiple values for the same key
1142
if (properties.put(key, value) != null)
1143                                {
1144                                        {if (true) throw StandardException.newException(SQLState.LANG_DUPLICATE_PROPERTY, key);}
1145                                }
1146                }
1147        }
1148        //if this property override is supported in internal mode only, then do that verification here.
1149
if (!propertiesUseAllowed)
1150                checkInternalFeature("DERBY-PROPERTIES");
1151        {if (true) return properties;}
1152    throw new Error JavaDoc("Missing return statement in function");
1153  }
1154
1155/*
1156 * <A NAME="DB2lockGranularityClause">DB2lockGranularityClause</A>
1157 */

1158  final public char DB2lockGranularityClause() throws ParseException, StandardException {
1159        char lockGranularity;
1160    jj_consume_token(LOCKSIZE);
1161    lockGranularity = lockGranularity();
1162                {if (true) return lockGranularity;}
1163    throw new Error JavaDoc("Missing return statement in function");
1164  }
1165
1166/*
1167 * <A NAME="lockGranularity">lockGranularity</A>
1168 */

1169  final public char lockGranularity() throws ParseException, StandardException {
1170    switch (jj_nt.kind) {
1171    case TABLE:
1172      jj_consume_token(TABLE);
1173                {if (true) return TableDescriptor.TABLE_LOCK_GRANULARITY;}
1174      break;
1175    case ROW:
1176      jj_consume_token(ROW);
1177                {if (true) return TableDescriptor.ROW_LOCK_GRANULARITY;}
1178      break;
1179    default:
1180      jj_la1[207] = jj_gen;
1181      jj_consume_token(-1);
1182      throw new ParseException();
1183    }
1184    throw new Error JavaDoc("Missing return statement in function");
1185  }
1186
1187/*
1188 * <A NAME="indexDefinition">indexDefinition</A>
1189 */

1190  final public QueryTreeNode indexDefinition() throws ParseException, StandardException {
1191        Boolean JavaDoc unique = Boolean.FALSE;
1192        Properties properties = null;
1193        TableName indexName;
1194        TableName tableName;
1195        Vector JavaDoc indexColumnList = new Vector JavaDoc();
1196    switch (jj_nt.kind) {
1197    case UNIQUE:
1198      unique = unique();
1199      break;
1200    default:
1201      jj_la1[208] = jj_gen;
1202      ;
1203    }
1204    jj_consume_token(INDEX);
1205    indexName = qualifiedName(Limits.MAX_IDENTIFIER_LENGTH);
1206    jj_consume_token(ON);
1207    tableName = qualifiedName(Limits.MAX_IDENTIFIER_LENGTH);
1208    jj_consume_token(LEFT_PAREN);
1209    indexColumnList(indexColumnList);
1210    jj_consume_token(RIGHT_PAREN);
1211    switch (jj_nt.kind) {
1212    case DERBYDASHPROPERTIES:
1213      properties = propertyList(false);
1214      jj_consume_token(CHECK_PROPERTIES);
1215      break;
1216    default:
1217      jj_la1[209] = jj_gen;
1218      ;
1219    }
1220                /* User allowed to specify schema name on table and index.
1221         * If no schema name specified for index, then it "inherits"
1222         * its schema name from the table.
1223         * If index has a schema name and table does not, then
1224         * table "inherits" its schema name from the index.
1225         * If schema names are specified for both objects, then the
1226         * schema names must be the same.
1227         */

1228                if (indexName.getSchemaName() == null)
1229                {
1230                        indexName.setSchemaName(tableName.getSchemaName());
1231                }
1232                else if (tableName.getSchemaName() == null)
1233                {
1234                        tableName.setSchemaName(indexName.getSchemaName());
1235                }
1236                else
1237                {
1238                        /* schema name specified for both */
1239                        if (! (indexName.getSchemaName().equals(
1240                                                tableName.getSchemaName())))
1241                        {
1242                                {if (true) throw StandardException.newException(SQLState.LANG_INDEX_AND_TABLE_IN_DIFFERENT_SCHEMAS,
1243                                                        indexName,
1244                                                        tableName);}
1245                        }
1246                }
1247                {if (true) return (QueryTreeNode) nodeFactory.getNode(
1248                                                                C_NodeTypes.CREATE_INDEX_NODE,
1249                                                                unique,
1250                                                                DEFAULT_INDEX_TYPE,
1251                                                                indexName,
1252                                                                tableName,
1253                                                                indexColumnList,
1254                                                                properties,
1255                                                                getContextManager());}
1256    throw new Error JavaDoc("Missing return statement in function");
1257  }
1258
1259/*
1260 * <A NAME="unique">unique</A>
1261 */

1262  final public Boolean JavaDoc unique() throws ParseException, StandardException {
1263    jj_consume_token(UNIQUE);
1264                {if (true) return Boolean.TRUE;}
1265    throw new Error JavaDoc("Missing return statement in function");
1266  }
1267
1268/**
1269    CREATE PROCEDURE
1270
1271    procedureElements contains the description of the procedure.
1272    (CREATE FUNCTIONS shares this lyout), see functionDefinition
1273
1274    0 - Object[] 3 element array for parameters
1275    1 - TableName - specific name
1276    2 - Integer - dynamic result set count
1277    3 - String language (always java) - ignore
1278    4 - String external name (also passed directly to create alias node - ignore
1279    5 - Short parameter style (always java) - ignore
1280    6 - Short - SQL allowed.
1281    7 - Boolean - CALLED ON NULL INPUT (always TRUE for procedures)
1282    8 - TypeDescriptor - return type (always NULL for procedures)
1283*/

1284  final public QueryTreeNode procedureDefinition() throws ParseException, StandardException {
1285        TableName procedureName;
1286        Object JavaDoc[] procedureElements = new Object JavaDoc[9];
1287    jj_consume_token(PROCEDURE);
1288    procedureName = qualifiedName(Limits.MAX_IDENTIFIER_LENGTH);
1289    procedureElements[0] = procedureParameterList();
1290    label_34:
1291    while (true) {
1292      routineElement(true, procedureElements);
1293      switch (jj_nt.kind) {
1294      case EXTERNAL:
1295      case NO:
1296      case CALLED:
1297      case CONTAINS:
1298      case DYNAMIC:
1299      case LANGUAGE:
1300      case MODIFIES:
1301      case RETURNS:
1302      case PARAMETER:
1303      case READS:
1304      case RESULT:
1305      case SPECIFIC:
1306        ;
1307        break;
1308      default:
1309        jj_la1[210] = jj_gen;
1310        break label_34;
1311      }
1312    }
1313                    checkRequiredRoutineClause(JAVA_ROUTINE_CLAUSES, procedureElements);
1314
1315                        {if (true) return getCreateAliasNode(
1316                                                        procedureName,
1317                                                        (String JavaDoc) procedureElements[4],
1318                                                        procedureElements,
1319                                                        AliasInfo.ALIAS_TYPE_PROCEDURE_AS_CHAR,
1320                                                        Boolean.FALSE);}
1321    throw new Error JavaDoc("Missing return statement in function");
1322  }
1323
1324  final public void routineElement(boolean isProcedure, Object JavaDoc[] routineElements) throws ParseException, StandardException {
1325        int drs;
1326        int clausePosition = -1;
1327        Object JavaDoc clauseValue = null;
1328    switch (jj_nt.kind) {
1329    case SPECIFIC:
1330      jj_consume_token(SPECIFIC);
1331      clauseValue = qualifiedName(Limits.MAX_IDENTIFIER_LENGTH);
1332                          clausePosition = 1; {if (true) throw StandardException.newException(SQLState.NOT_IMPLEMENTED, "SPECIFIC identifier");}
1333      break;
1334    case DYNAMIC:
1335    case RESULT:
1336      switch (jj_nt.kind) {
1337      case DYNAMIC:
1338        jj_consume_token(DYNAMIC);
1339        break;
1340      default:
1341        jj_la1[211] = jj_gen;
1342        ;
1343      }
1344      jj_consume_token(RESULT);
1345      jj_consume_token(SETS);
1346      drs = uint_value();
1347                        if (!isProcedure)
1348                                {if (true) throw StandardException.newException(SQLState.LANG_SYNTAX_ERROR, "RESULT SETS");}
1349                        clauseValue = ReuseFactory.getInteger(drs); clausePosition = 2;
1350      break;
1351    case LANGUAGE:
1352      jj_consume_token(LANGUAGE);
1353      jj_consume_token(JAVA);
1354                                     clauseValue = "JAVA"; clausePosition = 3;
1355      break;
1356    case EXTERNAL:
1357      jj_consume_token(EXTERNAL);
1358      jj_consume_token(NAME);
1359      clauseValue = string();
1360                                                           clausePosition = 4;
1361      break;
1362    case PARAMETER:
1363      jj_consume_token(PARAMETER);
1364      jj_consume_token(STYLE);
1365      clauseValue = parameterStyle();
1366                                                                     clausePosition = 5;
1367      break;
1368    case NO:
1369      jj_consume_token(NO);
1370      jj_consume_token(SQL);
1371                                                          clauseValue = ReuseFactory.getShort(RoutineAliasInfo.NO_SQL); clausePosition = 6;
1372      break;
1373    case CONTAINS:
1374      jj_consume_token(CONTAINS);
1375      jj_consume_token(SQL);
1376                                                  clauseValue = ReuseFactory.getShort(RoutineAliasInfo.CONTAINS_SQL); clausePosition = 6;
1377      break;
1378    case READS:
1379      jj_consume_token(READS);
1380      jj_consume_token(SQL);
1381      jj_consume_token(DATA);
1382                                          clauseValue = ReuseFactory.getShort(RoutineAliasInfo.READS_SQL_DATA); clausePosition = 6;
1383      break;
1384    case MODIFIES:
1385      jj_consume_token(MODIFIES);
1386      jj_consume_token(SQL);
1387      jj_consume_token(DATA);
1388                        if (!isProcedure)
1389                                {if (true) throw StandardException.newException(SQLState.LANG_SYNTAX_ERROR, "MODIFIES SQL DATA");}
1390                        clauseValue = ReuseFactory.getShort(RoutineAliasInfo.MODIFIES_SQL_DATA); clausePosition = 6;
1391      break;
1392    case CALLED:
1393    case RETURNS:
1394      clauseValue = calledOnNullInput(isProcedure);
1395                                                           clausePosition = 7;
1396      break;
1397    default:
1398      jj_la1[212] = jj_gen;
1399      jj_consume_token(-1);
1400      throw new ParseException();
1401    }
1402                if (clausePosition != -1) {
1403                        // check for repeated clause
1404
if (routineElements[clausePosition] != null) {
1405
1406                                String JavaDoc which = ROUTINE_CLAUSE_NAMES[clausePosition];
1407                                {if (true) throw StandardException.newException(SQLState.LANG_DB2_MULTIPLE_ELEMENTS, which);}
1408                        }
1409
1410                        routineElements[clausePosition] = clauseValue;
1411                }
1412  }
1413
1414  final public Boolean JavaDoc calledOnNullInput(boolean isProcedure) throws ParseException, StandardException {
1415        Boolean JavaDoc calledOnNull;
1416    switch (jj_nt.kind) {
1417    case CALLED:
1418      jj_consume_token(CALLED);
1419                           calledOnNull = Boolean.TRUE;
1420      break;
1421    case RETURNS:
1422      jj_consume_token(RETURNS);
1423      jj_consume_token(NULL);
1424                   if (isProcedure)
1425                     {if (true) throw StandardException.newException(SQLState.LANG_SYNTAX_ERROR,
1426                             "RETURNS NULL ON NULL INPUT");}
1427
1428                   calledOnNull = Boolean.FALSE;
1429      break;
1430    default:
1431      jj_la1[213] = jj_gen;
1432      jj_consume_token(-1);
1433      throw new ParseException();
1434    }
1435    jj_consume_token(ON);
1436    jj_consume_token(NULL);
1437    jj_consume_token(INPUT);
1438                {if (true) return calledOnNull;}
1439    throw new Error JavaDoc("Missing return statement in function");
1440  }
1441
1442  final public Short JavaDoc parameterStyle() throws ParseException {
1443    jj_consume_token(JAVA);
1444                                 {if (true) return ReuseFactory.getShort(RoutineAliasInfo.PS_JAVA);}
1445    throw new Error JavaDoc("Missing return statement in function");
1446  }
1447
1448  final public Object JavaDoc[] procedureParameterList() throws ParseException, StandardException {
1449        Vector JavaDoc[] list = new Vector JavaDoc[3];
1450        list[0] = new Vector JavaDoc(); // name
1451
list[1] = new Vector JavaDoc(); // type
1452
list[2] = new Vector JavaDoc();
1453    jj_consume_token(LEFT_PAREN);
1454    switch (jj_nt.kind) {
1455    case BINARY:
1456    case COALESCE:
1457    case COUNT:
1458    case D:
1459    case IN:
1460    case MODULE:
1461    case T:
1462    case TS:
1463    case VALUE:
1464    case VARBINARY:
1465    case ABS:
1466    case ABSVAL:
1467    case ACTION:
1468    case ALWAYS:
1469    case BLOB:
1470    case C:
1471    case CALLED:
1472    case CLOB:
1473    case COBOL:
1474    case COMMITTED:
1475    case CONCAT:
1476    case CONTAINS:
1477    case DATA:
1478    case DATE:
1479    case DAY:
1480    case DYNAMIC:
1481    case FORTRAN:
1482    case GENERATED:
1483    case IDENTITY_VAL_LOCAL:
1484    case INCREMENT:
1485    case INITIAL:
1486    case INOUT:
1487    case INTERVAL:
1488    case LANGUAGE:
1489    case LARGE:
1490    case LENGTH:
1491    case LEVEL:
1492    case LOCKS:
1493    case LOCKSIZE:
1494    case LOGGED:
1495    case MOD:
1496    case MODIFIES:
1497    case MODIFY:
1498    case MONTH:
1499    case _MORE:
1500    case MUMPS:
1501    case NAME:
1502    case NCLOB:
1503    case NULLABLE:
1504    case NUMBER:
1505    case OBJECT:
1506    case PASCAL:
1507    case PLI:
1508    case PRECISION:
1509    case RELEASE:
1510    case REPEATABLE:
1511    case RESTART:
1512    case RETURNS:
1513    case ROW:
1514    case SAVEPOINT:
1515    case SCALE:
1516    case SERIALIZABLE:
1517    case SQL_TSI_FRAC_SECOND:
1518    case SQL_TSI_SECOND:
1519    case SQL_TSI_MINUTE:
1520    case SQL_TSI_HOUR:
1521    case SQL_TSI_DAY:
1522    case SQL_TSI_WEEK:
1523    case SQL_TSI_MONTH:
1524    case SQL_TSI_QUARTER:
1525    case SQL_TSI_YEAR:
1526    case START:
1527    case STATEMENT:
1528    case SYNONYM:
1529    case THEN:
1530    case TIME:
1531    case TIMESTAMP:
1532    case TIMESTAMPADD:
1533    case TIMESTAMPDIFF:
1534    case TRUNCATE:
1535    case TYPE:
1536    case UNCOMMITTED:
1537    case USAGE:
1538    case WHEN:
1539    case CURDATE:
1540    case CURTIME:
1541    case DATABASE:
1542    case LONG:
1543    case AFTER:
1544    case BEFORE:
1545    case CLASS:
1546    case COMPRESS:
1547    case CONTENT:
1548    case CS:
1549    case DB2SQL:
1550    case DIRTY:
1551    case DOCUMENT:
1552    case EACH:
1553    case EMPTY:
1554    case EXCLUSIVE:
1555    case FN:
1556    case INDEX:
1557    case JAVA:
1558    case LCASE:
1559    case LOCATE:
1560    case LOCK:
1561    case MESSAGE_LOCALE:
1562    case METHOD:
1563    case MODE:
1564    case NEW:
1565    case NEW_TABLE:
1566    case OJ:
1567    case OFF:
1568    case OLD:
1569    case OLD_TABLE:
1570    case OUT:
1571    case PARAMETER:
1572    case PASSING:
1573    case PROPERTIES:
1574    case READS:
1575    case REF:
1576    case REFERENCING:
1577    case RENAME:
1578    case RESET:
1579    case RESULT:
1580    case RETAIN:
1581    case RETURNING:
1582    case RR:
1583    case RS:
1584    case SEQUENCE:
1585    case SEQUENTIAL:
1586    case SETS:
1587    case SHARE:
1588    case SQLID:
1589    case SPECIFIC:
1590    case SQRT:
1591    case STABILITY:
1592    case STRIP:
1593    case STYLE:
1594    case TRIGGER:
1595    case UCASE:
1596    case UR:
1597    case WHITESPACE:
1598    case IDENTIFIER:
1599    case DELIMITED_IDENTIFIER:
1600      procedureParameterDefinition(list);
1601      label_35:
1602      while (true) {
1603        switch (jj_nt.kind) {
1604        case COMMA:
1605          ;
1606          break;
1607        default:
1608          jj_la1[214] = jj_gen;
1609          break label_35;
1610        }
1611        jj_consume_token(COMMA);
1612        procedureParameterDefinition(list);
1613      }
1614      break;
1615    default:
1616      jj_la1[215] = jj_gen;
1617      ;
1618    }
1619    jj_consume_token(RIGHT_PAREN);
1620                {if (true) return list;}
1621    throw new Error JavaDoc("Missing return statement in function");
1622  }
1623
1624/*
1625 * <A NAME="Definition">procedureParameterDefinition</A>
1626 */

1627  final public void procedureParameterDefinition(Vector JavaDoc[] list) throws ParseException, StandardException {
1628        DataTypeDescriptor typeDescriptor;
1629        String JavaDoc parameterName;
1630        Integer JavaDoc inout;
1631    inout = inoutParameter();
1632    parameterName = identifier(Limits.MAX_IDENTIFIER_LENGTH, true);
1633    typeDescriptor = dataTypeDDL();
1634                list[0].addElement(parameterName);
1635                list[1].addElement(typeDescriptor);
1636                list[2].addElement(inout);
1637  }
1638
1639  final public Integer JavaDoc inoutParameter() throws ParseException {
1640        int mode = JDBC30Translation.PARAMETER_MODE_IN;
1641    switch (jj_nt.kind) {
1642    case IN:
1643    case INOUT:
1644    case OUT:
1645      switch (jj_nt.kind) {
1646      case IN:
1647        jj_consume_token(IN);
1648
1649        break;
1650      case OUT:
1651        jj_consume_token(OUT);
1652                          mode = JDBC30Translation.PARAMETER_MODE_OUT;
1653        break;
1654      case INOUT:
1655        jj_consume_token(INOUT);
1656                            mode = JDBC30Translation.PARAMETER_MODE_IN_OUT;
1657        break;
1658      default:
1659        jj_la1[216] = jj_gen;
1660        jj_consume_token(-1);
1661        throw new ParseException();
1662      }
1663      break;
1664    default:
1665      jj_la1[217] = jj_gen;
1666      ;
1667    }
1668          {if (true) return ReuseFactory.getInteger(mode);}
1669    throw new Error JavaDoc("Missing return statement in function");
1670  }
1671
1672/**
1673    CREATE FUNCTION
1674
1675    functionElements contains the description of the function.
1676
1677    0 - Object[] 3 element array for parameters
1678    1 - TableName - specific name
1679    2 - Integer - dynamic result set count - always 0
1680    3 - String language (always java) - required to be set
1681    4 - String external name (also passed directly to create alias node - ignore
1682    5 - Short parameter style (always java) - required to be set
1683    6 - Short - SQL allowed.
1684    7 - Boolean - CALLED ON NULL INPUT
1685    8 - TypeDescriptor - return type
1686*/

1687  final public QueryTreeNode functionDefinition() throws ParseException, StandardException {
1688        TableName functionName;
1689        Object JavaDoc[] functionElements = new Object JavaDoc[9];
1690    jj_consume_token(FUNCTION);
1691    functionName = qualifiedName(Limits.MAX_IDENTIFIER_LENGTH);
1692    functionElements[0] = functionParameterList();
1693    jj_consume_token(RETURNS);
1694    functionElements[8] = dataTypeCommon();
1695    label_36:
1696    while (true) {
1697      routineElement(false, functionElements);
1698      switch (jj_nt.kind) {
1699      case EXTERNAL:
1700      case NO:
1701      case CALLED:
1702      case CONTAINS:
1703      case DYNAMIC:
1704      case LANGUAGE:
1705      case MODIFIES:
1706      case RETURNS:
1707      case PARAMETER:
1708      case READS:
1709      case RESULT:
1710      case SPECIFIC:
1711        ;
1712        break;
1713      default:
1714        jj_la1[218] = jj_gen;
1715        break label_36;
1716      }
1717    }
1718                    checkRequiredRoutineClause(JAVA_ROUTINE_CLAUSES, functionElements);
1719
1720                        {if (true) return getCreateAliasNode(
1721                                                        functionName,
1722                                                        (String JavaDoc) functionElements[4],
1723                                                        functionElements,
1724                                                        AliasInfo.ALIAS_TYPE_FUNCTION_AS_CHAR,
1725                                                        Boolean.FALSE);}
1726    throw new Error JavaDoc("Missing return statement in function");
1727  }
1728
1729  final public Object JavaDoc[] functionParameterList() throws ParseException, StandardException {
1730        Vector JavaDoc[] list = new Vector JavaDoc[3];
1731        list[0] = new Vector JavaDoc(); // name
1732
list[1] = new Vector JavaDoc(); // type
1733
list[2] = new Vector JavaDoc();
1734    jj_consume_token(LEFT_PAREN);
1735    switch (jj_nt.kind) {
1736    case BINARY:
1737    case COALESCE:
1738    case COUNT:
1739    case D:
1740    case MODULE:
1741    case T:
1742    case TS:
1743    case VALUE:
1744    case VARBINARY:
1745    case ABS:
1746    case ABSVAL:
1747    case ACTION:
1748    case ALWAYS:
1749    case BLOB:
1750    case C:
1751    case CALLED:
1752    case CLOB:
1753    case COBOL:
1754    case COMMITTED:
1755    case CONCAT:
1756    case CONTAINS:
1757    case DATA:
1758    case DATE:
1759    case DAY:
1760    case DYNAMIC:
1761    case FORTRAN:
1762    case GENERATED:
1763    case IDENTITY_VAL_LOCAL:
1764    case INCREMENT:
1765    case INITIAL:
1766    case INTERVAL:
1767    case LANGUAGE:
1768    case LARGE:
1769    case LENGTH:
1770    case LEVEL:
1771    case LOCKS:
1772    case LOCKSIZE:
1773    case LOGGED:
1774    case MOD:
1775    case MODIFIES:
1776    case MODIFY:
1777    case MONTH:
1778    case _MORE:
1779    case MUMPS:
1780    case NAME:
1781    case NCLOB:
1782    case NULLABLE:
1783    case NUMBER:
1784    case OBJECT:
1785    case PASCAL:
1786    case PLI:
1787    case PRECISION:
1788    case RELEASE:
1789    case REPEATABLE:
1790    case RESTART:
1791    case RETURNS:
1792    case ROW:
1793    case SAVEPOINT:
1794    case SCALE:
1795    case SERIALIZABLE:
1796    case SQL_TSI_FRAC_SECOND:
1797    case SQL_TSI_SECOND:
1798    case SQL_TSI_MINUTE:
1799    case SQL_TSI_HOUR:
1800    case SQL_TSI_DAY:
1801    case SQL_TSI_WEEK:
1802    case SQL_TSI_MONTH:
1803    case SQL_TSI_QUARTER:
1804    case SQL_TSI_YEAR:
1805    case START:
1806    case STATEMENT:
1807    case SYNONYM:
1808    case THEN:
1809    case TIME:
1810    case TIMESTAMP:
1811    case TIMESTAMPADD:
1812    case TIMESTAMPDIFF:
1813    case TRUNCATE:
1814    case TYPE:
1815    case UNCOMMITTED:
1816    case USAGE:
1817    case WHEN:
1818    case CURDATE:
1819    case CURTIME:
1820    case DATABASE:
1821    case LONG:
1822    case AFTER:
1823    case BEFORE:
1824    case CLASS:
1825    case COMPRESS:
1826    case CONTENT:
1827    case CS:
1828    case DB2SQL:
1829    case DIRTY:
1830    case DOCUMENT:
1831    case EACH:
1832    case EMPTY:
1833    case EXCLUSIVE:
1834    case FN:
1835    case INDEX:
1836    case JAVA:
1837    case LCASE:
1838    case LOCATE:
1839    case LOCK:
1840    case MESSAGE_LOCALE:
1841    case METHOD:
1842    case MODE:
1843    case NEW:
1844    case NEW_TABLE:
1845    case OJ:
1846    case OFF:
1847    case OLD:
1848    case OLD_TABLE:
1849    case PARAMETER:
1850    case PASSING:
1851    case PROPERTIES:
1852    case READS:
1853    case REF:
1854    case REFERENCING:
1855    case RENAME:
1856    case RESET:
1857    case RESULT:
1858    case RETAIN:
1859    case RETURNING:
1860    case RR:
1861    case RS:
1862    case SEQUENCE:
1863    case SEQUENTIAL:
1864    case SETS:
1865    case SHARE:
1866    case SQLID:
1867    case SPECIFIC:
1868    case SQRT:
1869    case STABILITY:
1870    case STRIP:
1871    case STYLE:
1872    case TRIGGER:
1873    case UCASE:
1874    case UR:
1875    case WHITESPACE:
1876    case IDENTIFIER:
1877    case DELIMITED_IDENTIFIER:
1878      functionParameterDefinition(list);
1879      label_37:
1880      while (true) {
1881        switch (jj_nt.kind) {
1882        case COMMA:
1883          ;
1884          break;
1885        default:
1886          jj_la1[219] = jj_gen;
1887          break label_37;
1888        }
1889        jj_consume_token(COMMA);
1890        functionParameterDefinition(list);
1891      }
1892      break;
1893    default:
1894      jj_la1[220] = jj_gen;
1895      ;
1896    }
1897    jj_consume_token(RIGHT_PAREN);
1898                {if (true) return list;}
1899    throw new Error JavaDoc("Missing return statement in function");
1900  }
1901
1902/*
1903 * <A NAME="Definition">functionParameterDefinition</A>
1904 */

1905  final public void functionParameterDefinition(Vector JavaDoc[] list) throws ParseException, StandardException {
1906        DataTypeDescriptor typeDescriptor;
1907        String JavaDoc parameterName;
1908        Integer JavaDoc inout;
1909    parameterName = identifier(Limits.MAX_IDENTIFIER_LENGTH, true);
1910    typeDescriptor = dataTypeDDL();
1911                list[0].addElement(parameterName);
1912                list[1].addElement(typeDescriptor);
1913                list[2].addElement(ReuseFactory.getInteger(JDBC30Translation.PARAMETER_MODE_IN));
1914  }
1915
1916  final public QueryTreeNode viewDefinition(Token beginToken) throws ParseException, StandardException {
1917        int checkOptionType;
1918        ResultColumnList resultColumns = null;
1919        ResultSetNode queryExpression;
1920        TableName tableName;
1921        Token checkTok = null;
1922        Token endToken;
1923    jj_consume_token(VIEW);
1924    tableName = qualifiedName(Limits.MAX_IDENTIFIER_LENGTH);
1925    switch (jj_nt.kind) {
1926    case LEFT_PAREN:
1927      jj_consume_token(LEFT_PAREN);
1928      resultColumns = viewColumnList();
1929      jj_consume_token(RIGHT_PAREN);
1930      break;
1931    default:
1932      jj_la1[221] = jj_gen;
1933      ;
1934    }
1935    jj_consume_token(AS);
1936    queryExpression = queryExpression(null, NO_SET_OP);
1937                checkOptionType = ViewDescriptor.NO_CHECK_OPTION;
1938                endToken = getToken(0);
1939                /* Parameters not allowed in create view */
1940                HasNodeVisitor visitor = new HasNodeVisitor(ParameterNode.class);
1941                queryExpression.accept(visitor);
1942                if (visitor.hasNode())
1943                {
1944                        {if (true) throw StandardException.newException(SQLState.LANG_NO_PARAMS_IN_VIEWS);}
1945                }
1946
1947                {if (true) return (QueryTreeNode) nodeFactory.getNode(
1948                                                                C_NodeTypes.CREATE_VIEW_NODE,
1949                                                                tableName,
1950                                                                resultColumns,
1951                                                                queryExpression,
1952                                                                ReuseFactory.getInteger(checkOptionType),
1953                                                                StringUtil.slice(statementSQLText,
1954                                                                                                beginToken.beginOffset,
1955                                                                                                endToken.endOffset,false),
1956                                                                getContextManager());}
1957    throw new Error JavaDoc("Missing return statement in function");
1958  }
1959
1960  final public ResultColumnList viewColumnList() throws ParseException, StandardException {
1961        ResultColumnList resultColumns = (ResultColumnList) nodeFactory.getNode(
1962                                                                                        C_NodeTypes.RESULT_COLUMN_LIST,
1963                                                                                        getContextManager());
1964    columnNameList(resultColumns);
1965                {if (true) return resultColumns;}
1966    throw new Error JavaDoc("Missing return statement in function");
1967  }
1968
1969  final public QueryTreeNode triggerDefinition() throws ParseException, StandardException {
1970        Boolean JavaDoc isBefore;
1971        Boolean JavaDoc isRow;
1972        TableName tableName;
1973        TableName triggerName;
1974        Token[] tokenHolder = new Token[1];
1975        Token beginToken;
1976        Token checkTok = null;
1977        Token endToken;
1978        int actionBegin;
1979        int actionEnd;
1980        int triggerEvent;
1981        QueryTreeNode actionNode;
1982        ResultColumnList triggerColumns = (ResultColumnList) nodeFactory.getNode(
1983                                                                                        C_NodeTypes.RESULT_COLUMN_LIST,
1984                                                                                        getContextManager());
1985        Vector JavaDoc refClause = null;
1986    jj_consume_token(TRIGGER);
1987    triggerName = qualifiedName(Limits.MAX_IDENTIFIER_LENGTH);
1988    isBefore = beforeOrAfter();
1989    triggerEvent = triggerEvent(triggerColumns);
1990    jj_consume_token(ON);
1991    tableName = qualifiedName(Limits.MAX_IDENTIFIER_LENGTH);
1992    switch (jj_nt.kind) {
1993    case REFERENCING:
1994      refClause = triggerReferencingClause();
1995      break;
1996    default:
1997      jj_la1[222] = jj_gen;
1998      ;
1999    }
2000    jj_consume_token(FOR);
2001    jj_consume_token(EACH);
2002    isRow = rowOrStatement();
2003    jj_consume_token(MODE);
2004    jj_consume_token(DB2SQL);
2005    //we are not top level statement
2006
actionNode = proceduralStatement(tokenHolder);
2007                actionEnd = getToken(0).endOffset;
2008                actionBegin = tokenHolder[0].beginOffset;
2009
2010                // No DML in action node for BEFORE triggers.
2011
if (isBefore.booleanValue() && (actionNode instanceof DMLModStatementNode)) {
2012                                {if (true) throw StandardException.newException(
2013                                        SQLState.LANG_UNSUPPORTED_TRIGGER_STMT,
2014                                        ((StatementNode) actionNode).statementToString(), "BEFORE");}
2015                                        }
2016
2017
2018                // no params in trigger action
2019
HasNodeVisitor visitor = new HasNodeVisitor(ParameterNode.class);
2020                actionNode.accept(visitor);
2021                if (visitor.hasNode())
2022                {
2023                        {if (true) throw StandardException.newException(SQLState.LANG_NO_PARAMS_IN_TRIGGER_ACTION);}
2024                }
2025
2026                {if (true) return (QueryTreeNode) nodeFactory.getNode(
2027                                                                C_NodeTypes.CREATE_TRIGGER_NODE,
2028                                                                triggerName,
2029                                                                tableName,
2030                                                                ReuseFactory.getInteger(triggerEvent),
2031                                                                triggerColumns,
2032                                                                isBefore,
2033                                                                isRow,
2034                                                                Boolean.TRUE, // enabled
2035
refClause, // referencing clause
2036
null,// when clause node
2037
null, // when clause text
2038
ReuseFactory.getInteger(0),
2039                                                                                        // when clause begin offset
2040
actionNode,
2041                                                                StringUtil.slice(statementSQLText,
2042                                                                        actionBegin,
2043                                                                        actionEnd,false),
2044                                                                ReuseFactory.getInteger(actionBegin),
2045                                                                getContextManager());}
2046    throw new Error JavaDoc("Missing return statement in function");
2047  }
2048
2049  final public QueryTreeNode synonymDefinition() throws ParseException, StandardException {
2050        TableName synonymName;
2051        TableName targetName;
2052    jj_consume_token(SYNONYM);
2053    synonymName = qualifiedName(Limits.MAX_IDENTIFIER_LENGTH);
2054    jj_consume_token(FOR);
2055    targetName = qualifiedName(Limits.MAX_IDENTIFIER_LENGTH);
2056                checkVersion(DataDictionary.DD_VERSION_DERBY_10_1,
2057                             "CREATE SYNONYM");
2058
2059                {if (true) return (StatementNode) getNodeFactory().getCreateAliasNode
2060                        (
2061                                synonymName,
2062                                targetName,
2063                                null,
2064                                AliasInfo.ALIAS_TYPE_SYNONYM_AS_CHAR,
2065                                Boolean.FALSE,
2066                                getContextManager()
2067                        );}
2068    throw new Error JavaDoc("Missing return statement in function");
2069  }
2070
2071  final public Boolean JavaDoc beforeOrAfter() throws ParseException {
2072    switch (jj_nt.kind) {
2073    case NO:
2074      jj_consume_token(NO);
2075      jj_consume_token(CASCADE);
2076      jj_consume_token(BEFORE);
2077                {if (true) return Boolean.TRUE;}
2078      break;
2079    case AFTER:
2080      jj_consume_token(AFTER);
2081                {if (true) return Boolean.FALSE;}
2082      break;
2083    default:
2084      jj_la1[223] = jj_gen;
2085      jj_consume_token(-1);
2086      throw new ParseException();
2087    }
2088    throw new Error JavaDoc("Missing return statement in function");
2089  }
2090
2091  final public int triggerEvent(ResultColumnList rcl) throws ParseException, StandardException {
2092    switch (jj_nt.kind) {
2093    case INSERT:
2094      jj_consume_token(INSERT);
2095                {if (true) return TriggerDescriptor.TRIGGER_EVENT_INSERT;}
2096      break;
2097    case DELETE:
2098      jj_consume_token(DELETE);
2099                {if (true) return TriggerDescriptor.TRIGGER_EVENT_DELETE;}
2100      break;
2101    case UPDATE:
2102      jj_consume_token(UPDATE);
2103      switch (jj_nt.kind) {
2104      case OF:
2105        jj_consume_token(OF);
2106        columnNameList(rcl);
2107        break;
2108      default:
2109        jj_la1[224] = jj_gen;
2110        ;
2111      }
2112                {if (true) return TriggerDescriptor.TRIGGER_EVENT_UPDATE;}
2113      break;
2114    default:
2115      jj_la1[225] = jj_gen;
2116      jj_consume_token(-1);
2117      throw new ParseException();
2118    }
2119    throw new Error JavaDoc("Missing return statement in function");
2120  }
2121
2122  final public Boolean JavaDoc rowOrStatement() throws ParseException {
2123    switch (jj_nt.kind) {
2124    case ROW:
2125      token = jj_consume_token(ROW);
2126                {if (true) return Boolean.TRUE;}
2127      break;
2128    case STATEMENT:
2129      token = jj_consume_token(STATEMENT);
2130                {if (true) return Boolean.FALSE;}
2131      break;
2132    default:
2133      jj_la1[226] = jj_gen;
2134      jj_consume_token(-1);
2135      throw new ParseException();
2136    }
2137    throw new Error JavaDoc("Missing return statement in function");
2138  }
2139
2140  final public Vector JavaDoc triggerReferencingClause() throws ParseException, StandardException {
2141        Vector JavaDoc vector = new Vector JavaDoc();
2142    jj_consume_token(REFERENCING);
2143    triggerReferencingExpression(vector);
2144    label_38:
2145    while (true) {
2146      switch (jj_nt.kind) {
2147      case NEW:
2148      case NEW_TABLE:
2149      case OLD:
2150      case OLD_TABLE:
2151        ;
2152        break;
2153      default:
2154        jj_la1[227] = jj_gen;
2155        break label_38;
2156      }
2157      triggerReferencingExpression(vector);
2158    }
2159                {if (true) return vector;}
2160    throw new Error JavaDoc("Missing return statement in function");
2161  }
2162
2163  final public void triggerReferencingExpression(Vector JavaDoc vector) throws ParseException, StandardException {
2164        String JavaDoc identifier;
2165        boolean isNew = true;
2166        boolean isRow = true;
2167    switch (jj_nt.kind) {
2168    case NEW:
2169      jj_consume_token(NEW);
2170      break;
2171    case OLD:
2172      jj_consume_token(OLD);
2173                 isNew = false;
2174      break;
2175    case NEW_TABLE:
2176      jj_consume_token(NEW_TABLE);
2177                        isRow = false;
2178      break;
2179    case OLD_TABLE:
2180      jj_consume_token(OLD_TABLE);
2181                        isNew = false; isRow = false;
2182      break;
2183    default:
2184      jj_la1[228] = jj_gen;
2185      jj_consume_token(-1);
2186      throw new ParseException();
2187    }
2188    jj_consume_token(AS);
2189    identifier = identifier(Limits.MAX_IDENTIFIER_LENGTH, true);
2190                vector.addElement(new TriggerReferencingStruct(isRow, isNew, identifier));
2191  }
2192
2193/*
2194 * <A NAME="defaultClause">defaultClause</A>
2195 */

2196  final public ValueNode defaultClause(long[] autoIncrementInfo, String JavaDoc columnName) throws ParseException, StandardException {
2197        ValueNode value;
2198        Token beginToken;
2199        Token endToken;
2200    switch (jj_nt.kind) {
2201    case _DEFAULT:
2202    case WITH:
2203      switch (jj_nt.kind) {
2204      case WITH:
2205        jj_consume_token(WITH);
2206        break;
2207      default:
2208        jj_la1[229] = jj_gen;
2209        ;
2210      }
2211      beginToken = jj_consume_token(_DEFAULT);
2212      value = defaultOption(beginToken, autoIncrementInfo, columnName);
2213                {if (true) return value;}
2214      break;
2215    case GENERATED:
2216      value = generatedColumnOption(autoIncrementInfo);
2217                {if (true) return value;}
2218      break;
2219    default:
2220      jj_la1[230] = jj_gen;
2221      jj_consume_token(-1);
2222      throw new ParseException();
2223    }
2224    throw new Error JavaDoc("Missing return statement in function");
2225  }
2226
2227/*
2228 * <A NAME="defaultNullOnlyClause">defaultNullOnlyClause</A>
2229 */

2230  final public ValueNode defaultNullOnlyClause() throws ParseException, StandardException {
2231    jj_consume_token(_DEFAULT);
2232    jj_consume_token(NULL);
2233                {if (true) return (ValueNode) nodeFactory.getNode(
2234                                                                        C_NodeTypes.UNTYPED_NULL_CONSTANT_NODE,
2235                                                                        getContextManager());}
2236    throw new Error JavaDoc("Missing return statement in function");
2237  }
2238
2239/*
2240 * <A NAME="generatedColumnOption">generatedColumnOption</A>
2241 */

2242
2243//ToCleanUp
2244
//A specific class not such long[] should exists for autoIncrementInfo ...
2245
final public ValueNode generatedColumnOption(long[] autoIncrementInfo) throws ParseException, StandardException {
2246        ValueNode value = null;
2247        autoIncrementInfo[QueryTreeNode.AUTOINCREMENT_START_INDEX] = 1;
2248        autoIncrementInfo[QueryTreeNode.AUTOINCREMENT_INC_INDEX] = 1;
2249        autoIncrementInfo[QueryTreeNode.AUTOINCREMENT_IS_AUTOINCREMENT_INDEX] = 1;
2250        autoIncrementInfo[QueryTreeNode.AUTOINCREMENT_CREATE_MODIFY] = ColumnDefinitionNode.CREATE_AUTOINCREMENT;
2251    jj_consume_token(GENERATED);
2252    switch (jj_nt.kind) {
2253    case ALWAYS:
2254      jj_consume_token(ALWAYS);
2255                value = null;
2256      break;
2257    case BY:
2258      jj_consume_token(BY);
2259      jj_consume_token(_DEFAULT);
2260                checkVersion(DataDictionary.DD_VERSION_DERBY_10_1,
2261                             "GENERATED BY DEFAULT");
2262
2263                value = (ValueNode) nodeFactory.getNode(C_NodeTypes.DEFAULT_NODE,
2264                                                        getContextManager()) ;
2265      break;
2266    default:
2267      jj_la1[231] = jj_gen;
2268      jj_consume_token(-1);
2269      throw new ParseException();
2270    }
2271    jj_consume_token(AS);
2272    jj_consume_token(IDENTITY);
2273    switch (jj_nt.kind) {
2274    case LEFT_PAREN:
2275      jj_consume_token(LEFT_PAREN);
2276      autoIncrementBeginEnd(autoIncrementInfo);
2277      jj_consume_token(RIGHT_PAREN);
2278      break;
2279    default:
2280      jj_la1[232] = jj_gen;
2281      ;
2282    }
2283                {if (true) return value;}
2284    throw new Error JavaDoc("Missing return statement in function");
2285  }
2286
2287/*
2288 * <A NAME="autoIncrementBeginEnd">autoIncrementBeginEnd</A>
2289 */

2290  final public void autoIncrementBeginEnd(long[] autoIncrementInfo) throws ParseException, StandardException {
2291        long autoIncrementInitial = 1;
2292        long autoIncrementIncrement = 1;
2293    switch (jj_nt.kind) {
2294    case INCREMENT:
2295      jj_consume_token(INCREMENT);
2296      jj_consume_token(BY);
2297      autoIncrementIncrement = exactNumber();
2298                autoIncrementInfo[QueryTreeNode.AUTOINCREMENT_INC_INDEX] = autoIncrementIncrement;
2299                autoIncrementInfo[QueryTreeNode.AUTOINCREMENT_CREATE_MODIFY] = ColumnDefinitionNode.CREATE_AUTOINCREMENT;
2300                {if (true) return;}
2301      break;
2302    case START:
2303      jj_consume_token(START);
2304      jj_consume_token(WITH);
2305      autoIncrementInitial = exactNumber();
2306      switch (jj_nt.kind) {
2307      case COMMA:
2308        jj_consume_token(COMMA);
2309        jj_consume_token(INCREMENT);
2310        jj_consume_token(BY);
2311        autoIncrementIncrement = exactNumber();
2312        break;
2313      default:
2314        jj_la1[233] = jj_gen;
2315        ;
2316      }
2317                autoIncrementInfo[QueryTreeNode.AUTOINCREMENT_START_INDEX] = autoIncrementInitial;
2318                autoIncrementInfo[QueryTreeNode.AUTOINCREMENT_INC_INDEX] = autoIncrementIncrement;
2319                autoIncrementInfo[QueryTreeNode.AUTOINCREMENT_CREATE_MODIFY] = ColumnDefinitionNode.CREATE_AUTOINCREMENT;
2320                {if (true) return;}
2321      break;
2322    default:
2323      jj_la1[234] = jj_gen;
2324      jj_consume_token(-1);
2325      throw new ParseException();
2326    }
2327  }
2328
2329/*
2330 * <A NAME="defaultOption">defaultOption</A>
2331 */

2332  final public ValueNode defaultOption(Token beginToken, long[] autoIncrementInfo,
2333        String JavaDoc columnName) throws ParseException, StandardException {
2334        Token endToken;
2335        Token errorTok = null;
2336        Token initialTok = null;
2337        ValueNode value;
2338    if (getToken(1).kind == NULL && !(getToken(2).kind == PERIOD ||
2339                            getToken(2).kind == DOUBLE_COLON)) {
2340      jj_consume_token(NULL);
2341                {if (true) return (ValueNode) nodeFactory.getNode(
2342                                                                        C_NodeTypes.UNTYPED_NULL_CONSTANT_NODE,
2343                                                                        getContextManager());}
2344    } else if (jj_2_42(1)) {
2345      value = DB2DefaultOption(columnName);
2346                endToken = getToken(0);
2347                value.setBeginOffset( beginToken.beginOffset );
2348                value.setEndOffset( endToken.endOffset );
2349                value = (ValueNode) nodeFactory.getNode(
2350                                                                C_NodeTypes.DEFAULT_NODE,
2351                                                                value,
2352                                                                StringUtil.slice(statementSQLText,
2353                                                                        beginToken.beginOffset + 7,
2354                                                                        endToken.endOffset,true),
2355                                                                getContextManager()
2356                                                        );
2357                {if (true) return value;}
2358    } else {
2359      jj_consume_token(-1);
2360      throw new ParseException();
2361    }
2362    throw new Error JavaDoc("Missing return statement in function");
2363  }
2364
2365/*
2366 * <A NAME="DB2DefaultOption">DB2DefaultOption</A>
2367 */

2368  final public ValueNode DB2DefaultOption(String JavaDoc columnName) throws ParseException, StandardException {
2369        ValueNode value;
2370    if (getToken(2).kind == SCHEMA || getToken(2).kind == SQLID) {
2371      jj_consume_token(CURRENT);
2372      switch (jj_nt.kind) {
2373      case SCHEMA:
2374        jj_consume_token(SCHEMA);
2375        break;
2376      case SQLID:
2377        jj_consume_token(SQLID);
2378        break;
2379      default:
2380        jj_la1[235] = jj_gen;
2381        jj_consume_token(-1);
2382        throw new ParseException();
2383      }
2384                {if (true) return (ValueNode) nodeFactory.getNode(
2385                                                C_NodeTypes.CURRENT_SCHEMA_NODE,
2386                                                getContextManager());}
2387    } else {
2388      switch (jj_nt.kind) {
2389      case USER:
2390        jj_consume_token(USER);
2391                {if (true) return (ValueNode) nodeFactory.getNode(
2392                                                                C_NodeTypes.USER_NODE,
2393                                                                getContextManager());}
2394        break;
2395      default:
2396        jj_la1[236] = jj_gen;
2397        if (getToken(1).kind == DATE ||
2398                        getToken(1).kind == TIME ||
2399                        getToken(1).kind == TIMESTAMP) {
2400          value = miscBuiltins();
2401          // these functions are allowed as valid <cast-function> defaults.
2402
// Once "BLOB" is allowed as a cast-function (5281), a case should be
2403
// added for that, as well.
2404
{if (true) return value;}
2405        } else if (getToken(2).kind == LEFT_PAREN ||
2406                               (getToken(4).kind == LEFT_PAREN &&
2407                                getToken(2).kind != COMMA)) {
2408          // Check against comma: see Derby-331
2409
// Before adding this, the following was erroneously
2410
// flagged as invalid:
2411
// create table foo(.., b int default 0, unique (a))
2412
value = miscBuiltins();
2413                // If we have a function (as indicated by an open paren,
2414
// which can be either the 2nd token (w/ normal function name)
2415
// or the 4th token (w/ qualified function name)), then
2416
// it's not valid. Catch it here and throw an "invalid
2417
// default" error (42894) instead of letting it go as
2418
// a syntax error (this matches DB2 UDB behavior).
2419
{if (true) throw StandardException.newException(
2420                        SQLState.LANG_DB2_INVALID_DEFAULT_VALUE,
2421                        columnName);}
2422        } else if (jj_2_43(1)) {
2423          value = datetimeValueFunction();
2424                {if (true) return value;}
2425        } else {
2426          switch (jj_nt.kind) {
2427          case FALSE:
2428          case TRUE:
2429          case LEFT_BRACE:
2430          case PLUS_SIGN:
2431          case MINUS_SIGN:
2432          case EXACT_NUMERIC:
2433          case STRING:
2434          case HEX_STRING:
2435          case APPROXIMATE_NUMERIC:
2436            // Only (valid) thing left is literals (i.e. actual constants).
2437
value = literal();
2438                {if (true) return value;}
2439            break;
2440          default:
2441            jj_la1[237] = jj_gen;
2442            jj_consume_token(-1);
2443            throw new ParseException();
2444          }
2445        }
2446      }
2447    }
2448    throw new Error JavaDoc("Missing return statement in function");
2449  }
2450
2451/*
2452 * <A NAME="literal">literal</A>
2453 */

2454  final public ValueNode literal() throws ParseException, StandardException {
2455        String JavaDoc sign = "";
2456        Token tok;
2457        String JavaDoc datetimeString;
2458        String JavaDoc bitString;
2459        ValueNode constantNode;
2460    switch (jj_nt.kind) {
2461    case PLUS_SIGN:
2462    case MINUS_SIGN:
2463    case EXACT_NUMERIC:
2464    case APPROXIMATE_NUMERIC:
2465      switch (jj_nt.kind) {
2466      case PLUS_SIGN:
2467      case MINUS_SIGN:
2468        sign = sign();
2469        break;
2470      default:
2471        jj_la1[238] = jj_gen;
2472        ;
2473      }
2474      constantNode = numericLiteral(sign);
2475                {if (true) return constantNode;}
2476      break;
2477    case STRING:
2478      constantNode = stringLiteral();
2479                {if (true) return constantNode;}
2480      break;
2481    case HEX_STRING:
2482      constantNode = hexLiteral();
2483                {if (true) return constantNode;}
2484      break;
2485    case LEFT_BRACE:
2486      constantNode = dateTimeLiteral();
2487                {if (true) return constantNode;}
2488      break;
2489    case FALSE:
2490    case TRUE:
2491      tok = booleanLiteral();
2492                checkInternalFeature(tok.image);
2493                {if (true) return (ValueNode) nodeFactory.getNode(
2494                                                                        C_NodeTypes.BOOLEAN_CONSTANT_NODE,
2495                                                                        StringUtil.SQLEqualsIgnoreCase(tok.image, "true") ?
2496                                                                                Boolean.TRUE : Boolean.FALSE,
2497                                                                        getContextManager());}
2498      break;
2499    default:
2500      jj_la1[239] = jj_gen;
2501      jj_consume_token(-1);
2502      throw new ParseException();
2503    }
2504    throw new Error JavaDoc("Missing return statement in function");
2505  }
2506
2507/*
2508 * <A NAME="numericLiteral">numericLiteral</A>
2509 */

2510  final public ValueNode numericLiteral(String JavaDoc sign) throws ParseException, StandardException {
2511        Token tok;
2512    switch (jj_nt.kind) {
2513    case EXACT_NUMERIC:
2514      tok = jj_consume_token(EXACT_NUMERIC);
2515                /*
2516        ** The various java parse utilities can't handle leading +,
2517        ** so only concatenate leading -.
2518        */

2519
2520                String JavaDoc num = tok.image;
2521
2522                if (sign.equals("-"))
2523                        num = sign.concat(num);
2524
2525                {if (true) return getNumericNode(num);}
2526      break;
2527    case APPROXIMATE_NUMERIC:
2528      tok = jj_consume_token(APPROXIMATE_NUMERIC);
2529                StringBuffer JavaDoc doubleImage;
2530                String JavaDoc doubleString;
2531                int ePosn, dotPosn; // Position of letter e and '.' in value
2532
Double JavaDoc doubleValue;
2533
2534                doubleImage = new StringBuffer JavaDoc(sign);
2535                doubleImage.append(tok.image);
2536                doubleString = doubleImage.toString();
2537
2538                ePosn = doubleString.indexOf('E');
2539                if (ePosn == -1)
2540                        ePosn = doubleString.indexOf('e');
2541                if (SanityManager.DEBUG)
2542                        SanityManager.ASSERT(ePosn != -1, "no E or e in approximate numeric");
2543
2544                // there is a limit on the length of a floatingpoint literal in DB2
2545
if (doubleString.length() > Limits.DB2_MAX_FLOATINGPOINT_LITERAL_LENGTH)
2546                        {if (true) throw StandardException.newException(SQLState.LANG_DB2_TOO_LONG_FLOATING_POINT_LITERAL, doubleString, TypeId.DOUBLE_NAME);}
2547                // if there is no '.' before the e, put one in
2548
dotPosn = doubleString.substring(0,ePosn).indexOf('.');
2549                if (dotPosn == -1) {
2550                        doubleImage.insert(ePosn,'.');
2551                        doubleString = doubleImage.toString();
2552                        ePosn++;
2553                }
2554
2555                try
2556                {
2557                        doubleValue = Double.valueOf(doubleString);
2558
2559                }
2560                catch (NumberFormatException JavaDoc nfe)
2561                {
2562                        {if (true) throw StandardException.newException(SQLState.LANG_FORMAT_EXCEPTION, TypeId.DOUBLE_NAME);}
2563                }
2564
2565                double dv = doubleValue.doubleValue();
2566
2567                // When the value is 0 it's possible rounded, try to detect it by checking if the mantissa is 0.0
2568
// "proof of correctness": any nonzero value (mantissa) with less than 30 characters will not be
2569
// rounded to 0.0 by a float/real. This correctly detects the case when
2570
// the radix/exponent being "too small" (1e-900) giving a value rounded to zero.
2571
if ( (dv == 0.0d) && (Double.parseDouble(doubleString.substring(0, ePosn-1)) != 0.0d) )
2572                {
2573                        {if (true) throw StandardException.newException(SQLState.LANG_OUTSIDE_RANGE_FOR_DATATYPE, TypeId.DOUBLE_NAME);}
2574                }
2575
2576                if (Double.isNaN(dv) || Double.isInfinite(dv))
2577                        {if (true) throw StandardException.newException(SQLState.LANG_OUTSIDE_RANGE_FOR_DATATYPE, TypeId.DOUBLE_NAME);}
2578
2579                {if (true) return (ValueNode) nodeFactory.getNode(
2580                                                                        C_NodeTypes.DOUBLE_CONSTANT_NODE,
2581                                                                        doubleValue,
2582                                                                        getContextManager());}
2583      break;
2584    default:
2585      jj_la1[240] = jj_gen;
2586      jj_consume_token(-1);
2587      throw new ParseException();
2588    }
2589    throw new Error JavaDoc("Missing return statement in function");
2590  }
2591
2592/*
2593 * <A NAME="dateTimeLiteral">dateTimeLiteral</A>
2594 */

2595  final public ValueNode dateTimeLiteral() throws ParseException, StandardException {
2596        ValueNode constantNode;
2597    jj_consume_token(LEFT_BRACE);
2598    constantNode = escapedDateTimeLiteral();
2599    jj_consume_token(RIGHT_BRACE);
2600                {if (true) return constantNode;}
2601    throw new Error JavaDoc("Missing return statement in function");
2602  }
2603
2604/*
2605 * <A NAME="escapedDateTimeLiteral">escapedDateTimeLiteral</A>
2606 */

2607  final public ValueNode escapedDateTimeLiteral() throws ParseException, StandardException {
2608        ValueNode constantNode;
2609    switch (jj_nt.kind) {
2610    case D:
2611      jj_consume_token(D);
2612      constantNode = bareDateLiteral();
2613                {if (true) return constantNode;}
2614      break;
2615    case T:
2616      jj_consume_token(T);
2617      constantNode = bareTimeLiteral();
2618                {if (true) return constantNode;}
2619      break;
2620    case TS:
2621      jj_consume_token(TS);
2622      constantNode = bareTimestampLiteral();
2623                {if (true) return constantNode;}
2624      break;
2625    default:
2626      jj_la1[241] = jj_gen;
2627      jj_consume_token(-1);
2628      throw new ParseException();
2629    }
2630    throw new Error JavaDoc("Missing return statement in function");
2631  }
2632
2633/*
2634 * <A NAME="bareDateLiteral">bareDateLiteral</A>
2635 */

2636  final public ValueNode bareDateLiteral() throws ParseException, StandardException {
2637        String JavaDoc dateString;
2638    dateString = string();
2639                {if (true) return (ValueNode) nodeFactory.getNode(
2640                                                C_NodeTypes.USERTYPE_CONSTANT_NODE,
2641                                                getLanguageConnectionContext().getDataValueFactory().getDateValue(dateString, true),
2642                                                getContextManager());}
2643    throw new Error JavaDoc("Missing return statement in function");
2644  }
2645
2646/*
2647 * <A NAME="bareTimeLiteral">bareTimeLiteral</A>
2648 */

2649  final public ValueNode bareTimeLiteral() throws ParseException, StandardException {
2650        String JavaDoc timeString;
2651    timeString = string();
2652                {if (true) return (ValueNode) nodeFactory.getNode(
2653                                                C_NodeTypes.USERTYPE_CONSTANT_NODE,
2654                                                getLanguageConnectionContext().getDataValueFactory().getTimeValue(timeString, true),
2655                                                getContextManager());}
2656    throw new Error JavaDoc("Missing return statement in function");
2657  }
2658
2659/*
2660 * <A NAME="bareTimestampLiteral">bareTimestampLiteral</A>
2661 */

2662  final public ValueNode bareTimestampLiteral() throws ParseException, StandardException {
2663        String JavaDoc timestampString;
2664    timestampString = string();
2665                {if (true) return (ValueNode) nodeFactory.getNode(
2666                                                C_NodeTypes.USERTYPE_CONSTANT_NODE,
2667                                                getLanguageConnectionContext().getDataValueFactory().getTimestampValue(timestampString, true),
2668                                                getContextManager());}
2669    throw new Error JavaDoc("Missing return statement in function");
2670  }
2671
2672/*
2673 * <A NAME="string">string</A>
2674 */

2675  final public String JavaDoc string() throws ParseException, StandardException {
2676        Token tok;
2677    tok = jj_consume_token(STRING);
2678                verifyImageLength(tok.image);
2679                /* Trim off the leading and trailing ', and compress all '' to ' */
2680                {if (true) return compressQuotes(tok.image.substring(1, tok.image.length() - 1),
2681                                                          SINGLEQUOTES);}
2682    throw new Error JavaDoc("Missing return statement in function");
2683  }
2684
2685/*
2686 * <A NAME="stringLiteral">stringLiteral</A>
2687 */

2688  final public CharConstantNode stringLiteral() throws ParseException, StandardException {
2689        Token tok;
2690        String JavaDoc string;
2691    tok = jj_consume_token(STRING);
2692                //there is a maximum limit on the length of the string
2693
if (tok.image.length()-2 > Limits.DB2_MAX_CHARACTER_LITERAL_LENGTH)//-2 is for the beginning and ending quote
2694
{if (true) throw StandardException.newException(SQLState.LANG_DB2_STRING_CONSTANT_TOO_LONG, StringUtil.formatForPrint(tok.image));}
2695                string = compressQuotes(tok.image.substring(1, tok.image.length() - 1), SINGLEQUOTES);
2696                /* Trim quotes from string. */
2697                {if (true) return (CharConstantNode) nodeFactory.getNode(
2698                                                                C_NodeTypes.CHAR_CONSTANT_NODE,
2699                                                                string,
2700                                                                getContextManager());}
2701    throw new Error JavaDoc("Missing return statement in function");
2702  }
2703
2704/*
2705 * <A NAME="hexLiteral">hexLiteral</A>
2706 */

2707  final public ValueNode hexLiteral() throws ParseException, StandardException {
2708        Token tok;
2709    tok = jj_consume_token(HEX_STRING);
2710                String JavaDoc hexLiteral = tok.image;
2711
2712                //there is a maximum limit on the length of the hex constant
2713
if (hexLiteral.length()-3 > Limits.DB2_MAX_HEX_LITERAL_LENGTH)//-3 is for X' at the beginning and ' at the end
2714
{if (true) throw StandardException.newException(SQLState.LANG_DB2_STRING_CONSTANT_TOO_LONG, StringUtil.formatForPrint(hexLiteral));}
2715                if ((hexLiteral.length()-3)%2 == 1)
2716                        {if (true) throw StandardException.newException(SQLState.LANG_DB2_INVALID_HEXADECIMAL_CONSTANT, StringUtil.formatForPrint(hexLiteral));}
2717
2718                int bitLength = ((hexLiteral.length() - 3) / 2);
2719                {if (true) return (ValueNode)
2720                                nodeFactory.getNode(C_NodeTypes.VARBIT_CONSTANT_NODE,
2721                                                                        hexLiteral.substring(2, hexLiteral.length() - 1), ReuseFactory.getInteger(bitLength),
2722                                                                        getContextManager());}
2723    throw new Error JavaDoc("Missing return statement in function");
2724  }
2725
2726  final public TableName constraintNameDefinition() throws ParseException, StandardException {
2727        TableName constraintName;
2728    jj_consume_token(CONSTRAINT);
2729    constraintName = qualifiedName(Limits.MAX_IDENTIFIER_LENGTH);
2730                {if (true) return constraintName;}
2731    throw new Error JavaDoc("Missing return statement in function");
2732  }
2733
2734/*
2735 * DB2 requires column check constraints to refer to only that column. Cloudscape currently
2736 * doesn't care if check constraints are column level or table level. For DB2 compatibility
2737 * check that column check constraints only refer to that column.
2738 */

2739  final public ConstraintDefinitionNode checkConstraintDefinition(TableName constraintName, String JavaDoc columnName) throws ParseException, StandardException {
2740        Token beginToken;
2741        Token endToken;
2742        ValueNode value;
2743        ResultColumnList rclList = null;
2744    jj_consume_token(CHECK);
2745    beginToken = jj_consume_token(LEFT_PAREN);
2746    value = valueExpression(false);
2747    endToken = jj_consume_token(RIGHT_PAREN);
2748                if (columnName != null)
2749                {
2750                        /* Column check constraint */
2751                        rclList = (ResultColumnList) nodeFactory.getNode(
2752                                                                        C_NodeTypes.RESULT_COLUMN_LIST,
2753                                                                        getContextManager());
2754                        rclList.addElement((ResultColumn) nodeFactory.getNode(
2755                                                                        C_NodeTypes.RESULT_COLUMN,
2756                                                                        columnName,
2757                                                                        null,
2758                                                                        getContextManager()));
2759                }
2760
2761                value.setBeginOffset( beginToken.beginOffset );
2762                value.setEndOffset( endToken.endOffset );
2763                {if (true) return (ConstraintDefinitionNode) nodeFactory.getNode(
2764                                        C_NodeTypes.CONSTRAINT_DEFINITION_NODE,
2765                                        constraintName,
2766                                        ReuseFactory.getInteger(DataDictionary.CHECK_CONSTRAINT),
2767                                        rclList,
2768                                        null,
2769                                        value,
2770                                        StringUtil.slice(statementSQLText,
2771                                                beginToken.beginOffset,
2772                                                endToken.endOffset,true),
2773                                        getContextManager()
2774                                        );}
2775    throw new Error JavaDoc("Missing return statement in function");
2776  }
2777
2778/*
2779 * <A NAME="spsRenameStatement">spsRenameStatement</A>
2780 */

2781  final public QueryTreeNode spsRenameStatement() throws ParseException, StandardException {
2782        QueryTreeNode qtn;
2783    jj_consume_token(RENAME);
2784    switch (jj_nt.kind) {
2785    case TABLE:
2786      qtn = renameTableStatement();
2787      break;
2788    case INDEX:
2789      qtn = renameIndexStatement();
2790      break;
2791    default:
2792      jj_la1[242] = jj_gen;
2793      jj_consume_token(-1);
2794      throw new ParseException();
2795    }
2796                {if (true) return qtn;}
2797    throw new Error JavaDoc("Missing return statement in function");
2798  }
2799
2800/*
2801 * <A NAME="renameTableStatement">renameTableStatement</A>
2802 */

2803  final public QueryTreeNode renameTableStatement() throws ParseException, StandardException {
2804        QueryTreeNode qtn;
2805        TableName tableName;
2806        String JavaDoc newTableName;
2807    jj_consume_token(TABLE);
2808    tableName = qualifiedName(Limits.MAX_IDENTIFIER_LENGTH);
2809    jj_consume_token(TO);
2810    newTableName = identifier(Limits.MAX_IDENTIFIER_LENGTH, true);
2811                {if (true) return (QueryTreeNode) nodeFactory.getNode(
2812                                                                C_NodeTypes.RENAME_NODE,
2813                                                                tableName,
2814                                                                null,
2815                                                                newTableName,
2816                                                                Boolean.FALSE,
2817                                                                ReuseFactory.getInteger(StatementType.RENAME_TABLE),
2818                                                                getContextManager());}
2819    throw new Error JavaDoc("Missing return statement in function");
2820  }
2821
2822/*
2823 * <A NAME="renameIndexStatement">renameIndexStatement</A>
2824 */

2825  final public QueryTreeNode renameIndexStatement() throws ParseException, StandardException {
2826        String JavaDoc oldIndexName;
2827        String JavaDoc newIndexName;
2828    jj_consume_token(INDEX);
2829    oldIndexName = identifier(Limits.MAX_IDENTIFIER_LENGTH, true);
2830    jj_consume_token(TO);
2831    newIndexName = identifier(Limits.MAX_IDENTIFIER_LENGTH, true);
2832                QueryTreeNode qtn = nodeFactory.getNode(
2833                                                                C_NodeTypes.RENAME_NODE,
2834                                                                null,
2835                                                                oldIndexName,
2836                                                                newIndexName,
2837                                                                Boolean.FALSE,
2838ReuseFactory.getInteger(StatementType.RENAME_INDEX),
2839                                                                getContextManager());
2840
2841                {if (true) return qtn;}
2842    throw new Error JavaDoc("Missing return statement in function");
2843  }
2844
2845  final public QueryTreeNode lockStatement() throws ParseException, StandardException {
2846        Boolean JavaDoc exclusiveMode;
2847        TableName tableName;
2848    jj_consume_token(LOCK);
2849    jj_consume_token(TABLE);
2850    tableName = qualifiedName(Limits.MAX_IDENTIFIER_LENGTH);
2851    jj_consume_token(IN);
2852    exclusiveMode = lockMode();
2853    jj_consume_token(MODE);
2854                {if (true) return nodeFactory.getNode(
2855                                                                C_NodeTypes.LOCK_TABLE_NODE,
2856                                                                tableName,
2857                                                                exclusiveMode,
2858                                                                getContextManager());}
2859    throw new Error JavaDoc("Missing return statement in function");
2860  }
2861
2862  final public Boolean JavaDoc lockMode() throws ParseException {
2863    switch (jj_nt.kind) {
2864    case EXCLUSIVE:
2865      jj_consume_token(EXCLUSIVE);
2866                {if (true) return Boolean.TRUE;}
2867      break;
2868    case SHARE:
2869      jj_consume_token(SHARE);
2870                {if (true) return Boolean.FALSE;}
2871      break;
2872    default:
2873      jj_la1[243] = jj_gen;
2874      jj_consume_token(-1);
2875      throw new ParseException();
2876    }
2877    throw new Error JavaDoc("Missing return statement in function");
2878  }
2879
2880  final public QueryTreeNode execStatement() throws ParseException, StandardException {
2881        TableName stmtName;
2882    jj_consume_token(EXECUTE);
2883    jj_consume_token(STATEMENT);
2884    stmtName = qualifiedName(Limits.MAX_IDENTIFIER_LENGTH);
2885                {if (true) return (QueryTreeNode) nodeFactory.getNode(
2886                                                                C_NodeTypes.EXEC_SPS_NODE,
2887                                                                stmtName,
2888                                                                getContextManager());}
2889    throw new Error JavaDoc("Missing return statement in function");
2890  }
2891
2892  final public TransactionStatementNode setIsolationStatement() throws ParseException, StandardException {
2893        TransactionStatementNode tranNode;
2894    setIsolationHeader();
2895    switch (jj_nt.kind) {
2896    case TO:
2897    case EQUALS_OPERATOR:
2898      switch (jj_nt.kind) {
2899      case EQUALS_OPERATOR:
2900        jj_consume_token(EQUALS_OPERATOR);
2901        break;
2902      case TO:
2903        jj_consume_token(TO);
2904        break;
2905      default:
2906        jj_la1[244] = jj_gen;
2907        jj_consume_token(-1);
2908        throw new ParseException();
2909      }
2910      break;
2911    default:
2912      jj_la1[245] = jj_gen;
2913      ;
2914    }
2915    tranNode = transactionMode();
2916                {if (true) return tranNode;}
2917    throw new Error JavaDoc("Missing return statement in function");
2918  }
2919
2920  final public void setIsolationHeader() throws ParseException, StandardException {
2921    switch (jj_nt.kind) {
2922    case ISOLATION:
2923      jj_consume_token(ISOLATION);
2924      break;
2925    default:
2926      jj_la1[246] = jj_gen;
2927      if (getToken(1).kind == CURRENT && getToken(2).kind == ISOLATION) {
2928        jj_consume_token(CURRENT);
2929        jj_consume_token(ISOLATION);
2930      } else {
2931        jj_consume_token(-1);
2932        throw new ParseException();
2933      }
2934    }
2935  }
2936
2937  final public TransactionStatementNode transactionMode() throws ParseException, StandardException {
2938        int isolationLevel;
2939    isolationLevel = isolationLevelDB2OrReset();
2940                {if (true) return (TransactionStatementNode) nodeFactory.getNode(
2941                                                                C_NodeTypes.SET_TRANSACTION_ISOLATION_NODE,
2942                                                                ReuseFactory.getInteger(isolationLevel),
2943                                                                getContextManager());}
2944    throw new Error JavaDoc("Missing return statement in function");
2945  }
2946
2947  final public int isolationLevelDB2OrReset() throws ParseException {
2948        int isolationLevel;
2949    switch (jj_nt.kind) {
2950    case RESET:
2951      jj_consume_token(RESET);
2952                          {if (true) return ExecutionContext.UNSPECIFIED_ISOLATION_LEVEL;}
2953      break;
2954    default:
2955      jj_la1[247] = jj_gen;
2956      if (jj_2_44(1)) {
2957        isolationLevel = isolationLevelDB2();
2958                                                         {if (true) return isolationLevel;}
2959      } else {
2960        jj_consume_token(-1);
2961        throw new ParseException();
2962      }
2963    }
2964    throw new Error JavaDoc("Missing return statement in function");
2965  }
2966
2967  final public int isolationLevelDB2() throws ParseException {
2968        int isolationLevel;
2969    switch (jj_nt.kind) {
2970    case CS:
2971    case RR:
2972    case RS:
2973    case UR:
2974      isolationLevel = isolationLevelDB2Abbrev();
2975                                                             {if (true) return isolationLevel;}
2976      break;
2977    case REPEATABLE:
2978    case SERIALIZABLE:
2979      switch (jj_nt.kind) {
2980      case REPEATABLE:
2981        jj_consume_token(REPEATABLE);
2982        jj_consume_token(READ);
2983        break;
2984      case SERIALIZABLE:
2985        jj_consume_token(SERIALIZABLE);
2986        break;
2987      default:
2988        jj_la1[248] = jj_gen;
2989        jj_consume_token(-1);
2990        throw new ParseException();
2991      }
2992                          {if (true) return ExecutionContext.SERIALIZABLE_ISOLATION_LEVEL;}
2993      break;
2994    case CURSOR:
2995      jj_consume_token(CURSOR);
2996      jj_consume_token(STABILITY);
2997                          {if (true) return ExecutionContext.READ_COMMITTED_ISOLATION_LEVEL;}
2998      break;
2999    case DIRTY:
3000      jj_consume_token(DIRTY);
3001      jj_consume_token(READ);
3002                          {if (true) return ExecutionContext.READ_UNCOMMITTED_ISOLATION_LEVEL;}
3003      break;
3004    default:
3005      jj_la1[249] = jj_gen;
3006      if (getToken(1).kind == READ && getToken(2).kind == COMMITTED) {
3007        jj_consume_token(READ);
3008        jj_consume_token(COMMITTED);
3009                          {if (true) return ExecutionContext.READ_COMMITTED_ISOLATION_LEVEL;}
3010      } else if (getToken(1).kind == READ && getToken(2).kind == UNCOMMITTED) {
3011        jj_consume_token(READ);
3012        jj_consume_token(UNCOMMITTED);
3013                          {if (true) return ExecutionContext.READ_UNCOMMITTED_ISOLATION_LEVEL;}
3014      } else {
3015        jj_consume_token(-1);
3016        throw new ParseException();
3017      }
3018    }
3019    throw new Error JavaDoc("Missing return statement in function");
3020  }
3021
3022  final public int isolationLevelDB2Abbrev() throws ParseException {
3023    switch (jj_nt.kind) {
3024    case RR:
3025      jj_consume_token(RR);
3026                          {if (true) return ExecutionContext.SERIALIZABLE_ISOLATION_LEVEL;}
3027      break;
3028    case RS:
3029      jj_consume_token(RS);
3030                         {if (true) return ExecutionContext.REPEATABLE_READ_ISOLATION_LEVEL;}
3031      break;
3032    case CS:
3033      jj_consume_token(CS);
3034                          {if (true) return ExecutionContext.READ_COMMITTED_ISOLATION_LEVEL;}
3035      break;
3036    case UR:
3037      jj_consume_token(UR);
3038                          {if (true) return ExecutionContext.READ_UNCOMMITTED_ISOLATION_LEVEL;}
3039      break;
3040    default:
3041      jj_la1[250] = jj_gen;
3042      jj_consume_token(-1);
3043      throw new ParseException();
3044    }
3045    throw new Error JavaDoc("Missing return statement in function");
3046  }
3047
3048  final public int isolationLevel() throws ParseException {
3049        int isolationLevel;
3050    jj_consume_token(ISOLATION);
3051    jj_consume_token(LEVEL);
3052    isolationLevel = levelOfIsolation();
3053                {if (true) return isolationLevel;}
3054    throw new Error JavaDoc("Missing return statement in function");
3055  }
3056
3057  final public int levelOfIsolation() throws ParseException {
3058    switch (jj_nt.kind) {
3059    case READ:
3060      jj_consume_token(READ);
3061                {if (true) return levelOfIsolationRead();}
3062      break;
3063    case REPEATABLE:
3064      jj_consume_token(REPEATABLE);
3065      jj_consume_token(READ);
3066                {if (true) return ExecutionContext.REPEATABLE_READ_ISOLATION_LEVEL;}
3067      break;
3068    case SERIALIZABLE:
3069      jj_consume_token(SERIALIZABLE);
3070                {if (true) return ExecutionContext.SERIALIZABLE_ISOLATION_LEVEL;}
3071      break;
3072    default:
3073      jj_la1[251] = jj_gen;
3074      jj_consume_token(-1);
3075      throw new ParseException();
3076    }
3077    throw new Error JavaDoc("Missing return statement in function");
3078  }
3079
3080  final public int levelOfIsolationRead() throws ParseException {
3081    switch (jj_nt.kind) {
3082    case UNCOMMITTED:
3083      jj_consume_token(UNCOMMITTED);
3084                {if (true) return ExecutionContext.READ_UNCOMMITTED_ISOLATION_LEVEL;}
3085      break;
3086    case COMMITTED:
3087      jj_consume_token(COMMITTED);
3088                {if (true) return ExecutionContext.READ_COMMITTED_ISOLATION_LEVEL;}
3089      break;
3090    default:
3091      jj_la1[252] = jj_gen;
3092      jj_consume_token(-1);
3093      throw new ParseException();
3094    }
3095    throw new Error JavaDoc("Missing return statement in function");
3096  }
3097
3098/*
3099 * <A NAME="simpleValueSpecification">simpleValueSpecification</A>
3100 */

3101  final public ValueNode simpleValueSpecification() throws ParseException, StandardException {
3102        ValueNode value;
3103    value = literal();
3104                {if (true) return value;}
3105    throw new Error JavaDoc("Missing return statement in function");
3106  }
3107
3108  final public QueryTreeNode setSchemaStatement() throws ParseException, StandardException {
3109        QueryTreeNode setSchema = null;
3110    setSchemaHeader();
3111    switch (jj_nt.kind) {
3112    case EQUALS_OPERATOR:
3113      jj_consume_token(EQUALS_OPERATOR);
3114      break;
3115    default:
3116      jj_la1[253] = jj_gen;
3117      ;
3118    }
3119    setSchema = setSchemaValues();
3120                if (parameterList != null && parameterList.size() > 0)
3121                {
3122                        setUpAndLinkParameters();
3123                        // set the type of parameter node, it should be a varchar max Limits.MAX_IDENTIFIER_LENGTH - non nullable
3124
ParameterNode p = (ParameterNode)parameterList.elementAt(0);
3125                        p.setType(new DataTypeDescriptor(TypeId.getBuiltInTypeId(Types.VARCHAR), false, Limits.MAX_IDENTIFIER_LENGTH));
3126                }
3127                {if (true) return setSchema;}
3128    throw new Error JavaDoc("Missing return statement in function");
3129  }
3130
3131  final public void setSchemaHeader() throws ParseException, StandardException {
3132    switch (jj_nt.kind) {
3133    case SCHEMA:
3134      jj_consume_token(SCHEMA);
3135      break;
3136    default:
3137      jj_la1[255] = jj_gen;
3138      if (getToken(1).kind == CURRENT && ( getToken(2).kind == SCHEMA || getToken(2).kind == SQLID )) {
3139        jj_consume_token(CURRENT);
3140        switch (jj_nt.kind) {
3141        case SCHEMA:
3142          jj_consume_token(SCHEMA);
3143          break;
3144        case SQLID:
3145          jj_consume_token(SQLID);
3146          break;
3147        default:
3148          jj_la1[254] = jj_gen;
3149          jj_consume_token(-1);
3150          throw new ParseException();
3151        }
3152      } else {
3153        jj_consume_token(-1);
3154        throw new ParseException();
3155      }
3156    }
3157  }
3158
3159  final public QueryTreeNode setSchemaValues() throws ParseException, StandardException {
3160        String JavaDoc schemaName;
3161    switch (jj_nt.kind) {
3162    case BINARY:
3163    case COALESCE:
3164    case COUNT:
3165    case D:
3166    case MODULE:
3167    case T:
3168    case TS:
3169    case VALUE:
3170    case VARBINARY:
3171    case ABS:
3172    case ABSVAL:
3173    case ACTION:
3174    case ALWAYS:
3175    case BLOB:
3176    case C:
3177    case CALLED:
3178    case CLOB:
3179    case COBOL:
3180    case COMMITTED:
3181    case CONCAT:
3182    case CONTAINS:
3183    case DATA:
3184    case DATE:
3185    case DAY:
3186    case DYNAMIC:
3187    case FORTRAN:
3188    case GENERATED:
3189    case IDENTITY_VAL_LOCAL:
3190    case INCREMENT:
3191    case INITIAL:
3192    case INTERVAL:
3193    case LANGUAGE:
3194    case LARGE:
3195    case LENGTH:
3196    case LEVEL:
3197    case LOCKS:
3198    case LOCKSIZE:
3199    case LOGGED:
3200    case MOD:
3201    case MODIFIES:
3202    case MODIFY:
3203    case MONTH:
3204    case _MORE:
3205    case MUMPS:
3206    case NAME:
3207    case NCLOB:
3208    case NULLABLE:
3209    case NUMBER:
3210    case OBJECT:
3211    case PASCAL:
3212    case PLI:
3213    case PRECISION:
3214    case RELEASE:
3215    case REPEATABLE:
3216    case RESTART:
3217    case RETURNS:
3218    case ROW:
3219    case SAVEPOINT:
3220    case SCALE:
3221    case SERIALIZABLE:
3222    case SQL_TSI_FRAC_SECOND:
3223    case SQL_TSI_SECOND:
3224    case SQL_TSI_MINUTE:
3225    case SQL_TSI_HOUR:
3226    case SQL_TSI_DAY:
3227    case SQL_TSI_WEEK:
3228    case SQL_TSI_MONTH:
3229    case SQL_TSI_QUARTER:
3230    case SQL_TSI_YEAR:
3231    case START:
3232    case STATEMENT:
3233    case SYNONYM:
3234    case THEN:
3235    case TIME:
3236    case TIMESTAMP:
3237    case TIMESTAMPADD:
3238    case TIMESTAMPDIFF:
3239    case TRUNCATE:
3240    case TYPE:
3241    case UNCOMMITTED:
3242    case USAGE:
3243    case WHEN:
3244    case CURDATE:
3245    case CURTIME:
3246    case DATABASE:
3247    case LONG:
3248    case AFTER:
3249    case BEFORE:
3250    case CLASS:
3251    case COMPRESS:
3252    case CONTENT:
3253    case CS:
3254    case DB2SQL:
3255    case DIRTY:
3256    case DOCUMENT:
3257    case EACH:
3258    case EMPTY:
3259    case EXCLUSIVE:
3260    case FN:
3261    case INDEX:
3262    case JAVA:
3263    case LCASE:
3264    case LOCATE:
3265    case LOCK:
3266    case MESSAGE_LOCALE:
3267    case METHOD:
3268    case MODE:
3269    case NEW:
3270    case NEW_TABLE:
3271    case OJ:
3272    case OFF:
3273    case OLD:
3274    case OLD_TABLE:
3275    case PARAMETER:
3276    case PASSING:
3277    case PROPERTIES:
3278    case READS:
3279    case REF:
3280    case REFERENCING:
3281    case RENAME:
3282    case RESET:
3283    case RESULT:
3284    case RETAIN:
3285    case RETURNING:
3286    case RR:
3287    case RS:
3288    case SEQUENCE:
3289    case SEQUENTIAL:
3290    case SETS:
3291    case SHARE:
3292    case SQLID:
3293    case SPECIFIC:
3294    case SQRT:
3295    case STABILITY:
3296    case STRIP:
3297    case STYLE:
3298    case TRIGGER:
3299    case UCASE:
3300    case UR:
3301    case WHITESPACE:
3302    case IDENTIFIER:
3303    case DELIMITED_IDENTIFIER:
3304      schemaName = identifier(Limits.MAX_IDENTIFIER_LENGTH, true);
3305                {if (true) return (QueryTreeNode) nodeFactory.getNode(
3306                                                                C_NodeTypes.SET_SCHEMA_NODE,
3307                                                                schemaName,
3308                                                                null,
3309                                                                getContextManager());}
3310      break;
3311    case USER:
3312      jj_consume_token(USER);
3313                {if (true) return (QueryTreeNode) nodeFactory.getNode(
3314                                                                C_NodeTypes.SET_SCHEMA_NODE,
3315                                                                null,
3316                                                                ReuseFactory.getInteger(StatementType.SET_SCHEMA_USER),
3317                                                                getContextManager());}
3318      break;
3319    case QUESTION_MARK:
3320      dynamicParameterSpecification();
3321                {if (true) return (QueryTreeNode) nodeFactory.getNode(
3322                                                                C_NodeTypes.SET_SCHEMA_NODE,
3323                                                                null,
3324                                                                ReuseFactory.getInteger(StatementType.SET_SCHEMA_DYNAMIC),
3325                                                                getContextManager());}
3326      break;
3327    case STRING:
3328      schemaName = string();
3329                /* Max length for schema name is Limits.MAX_IDENTIFIER_LENGTH */
3330                checkIdentifierLengthLimit(schemaName, Limits.MAX_IDENTIFIER_LENGTH);
3331                {if (true) return (QueryTreeNode) nodeFactory.getNode(
3332                                                                C_NodeTypes.SET_SCHEMA_NODE,
3333                                                                schemaName,
3334                                                                null,
3335                                                                getContextManager());}
3336      break;
3337    default:
3338      jj_la1[256] = jj_gen;
3339      jj_consume_token(-1);
3340      throw new ParseException();
3341    }
3342    throw new Error JavaDoc("Missing return statement in function");
3343  }
3344
3345// Set the locale for messages coming from the database system. This
3346
// is for support only, so we can get messages in our preferred language
3347
// (usually English). I didn't want to create all the execution wiring
3348
// to do this, so this command executes in the parser
3349
final public QueryTreeNode setMessageLocaleStatement() throws ParseException, StandardException {
3350        String JavaDoc messageLocale;
3351    jj_consume_token(MESSAGE_LOCALE);
3352    messageLocale = string();
3353                getContextManager().setMessageLocale(messageLocale);
3354
3355                {if (true) return nodeFactory.getNode(
3356                                                                                        C_NodeTypes.NOP_STATEMENT_NODE,
3357                                                                                        getContextManager());}
3358    throw new Error JavaDoc("Missing return statement in function");
3359  }
3360
3361/*
3362 * <A NAME="valueSpecification">valueSpecification</A>
3363 */

3364  final public ValueNode valueSpecification() throws ParseException, StandardException {
3365        ValueNode value;
3366        ValueNode leftExpression;
3367        ValueNode rightExpression;
3368    switch (jj_nt.kind) {
3369    case FALSE:
3370    case TRUE:
3371    case LEFT_BRACE:
3372    case PLUS_SIGN:
3373    case MINUS_SIGN:
3374    case EXACT_NUMERIC:
3375    case STRING:
3376    case HEX_STRING:
3377    case APPROXIMATE_NUMERIC:
3378      value = literal();
3379                {if (true) return value;}
3380      break;
3381    case CURRENT_USER:
3382    case SESSION_USER:
3383    case USER:
3384    case QUESTION_MARK:
3385      value = generalValueSpecification();
3386                {if (true) return value;}
3387      break;
3388    case NULLIF:
3389      jj_consume_token(NULLIF);
3390      jj_consume_token(LEFT_PAREN);
3391      leftExpression = additiveExpression(null, 0, false);
3392      jj_consume_token(COMMA);
3393      rightExpression = additiveExpression(null, 0, false);
3394      jj_consume_token(RIGHT_PAREN);
3395                // "NULLIF(L, R)" is the same as "L=R ? untyped NULL : L"
3396
// An impl assumption here is that Cloudscape can promote CHAR to any comparable datatypes such as numeric
3397
ContextManager cm = getContextManager();
3398                ValueNodeList thenElseList = (ValueNodeList) nodeFactory.getNode(C_NodeTypes.VALUE_NODE_LIST, cm);
3399
3400                //Use untyped null for then clause at this point. At the bind time, we will cast it to the datatype of L
3401
thenElseList.addElement((ValueNode) nodeFactory.getNode(
3402                                                                        C_NodeTypes.UNTYPED_NULL_CONSTANT_NODE,
3403                                                                        cm));
3404                thenElseList.addElement(leftExpression);
3405
3406                {if (true) return (ValueNode) nodeFactory.getNode(
3407                                                                                        C_NodeTypes.CONDITIONAL_NODE,
3408                                                                                        (ValueNode) nodeFactory.getNode(
3409                                                                                                                C_NodeTypes.BINARY_EQUALS_OPERATOR_NODE,
3410                                                                                                                leftExpression,
3411                                                                                                                rightExpression,
3412                                                                                                                cm),
3413                                                                                        thenElseList,
3414                                                                                        Boolean.TRUE,//this node is for nullif
3415
cm);}
3416      break;
3417    case CASE:
3418      jj_consume_token(CASE);
3419      value = whenThenExpression();
3420                {if (true) return value;}
3421      break;
3422    default:
3423      jj_la1[257] = jj_gen;
3424      jj_consume_token(-1);
3425      throw new ParseException();
3426    }
3427    throw new Error JavaDoc("Missing return statement in function");
3428  }
3429
3430/*
3431 * <A NAME="caseExpression">caseExpression</A>
3432 */

3433  final public ValueNode caseExpression() throws ParseException, StandardException {
3434        ValueNode expr;
3435    switch (jj_nt.kind) {
3436    case END:
3437      jj_consume_token(END);
3438                {if (true) return ((ValueNode) nodeFactory.getNode(
3439                                                                                C_NodeTypes.CAST_NODE,
3440                                                                                (ValueNode) nodeFactory.getNode(C_NodeTypes.UNTYPED_NULL_CONSTANT_NODE,
3441                                                                                                                                                getContextManager()),
3442                                                                                DataTypeDescriptor.getBuiltInDataTypeDescriptor(Types.CHAR, 1),
3443                                                                                getContextManager()));}
3444      break;
3445    case ELSE:
3446      jj_consume_token(ELSE);
3447      expr = thenElseExpression();
3448      jj_consume_token(END);
3449                {if (true) return expr;}
3450      break;
3451    case WHEN:
3452      expr = whenThenExpression();
3453                {if (true) return expr;}
3454      break;
3455    default:
3456      jj_la1[258] = jj_gen;
3457      jj_consume_token(-1);
3458      throw new ParseException();
3459    }
3460    throw new Error JavaDoc("Missing return statement in function");
3461  }
3462
3463/*
3464 * <A NAME="whenThenExpression">whenThenExpression</A>
3465 */

3466  final public ValueNode whenThenExpression() throws ParseException, StandardException {
3467        ValueNode expr;
3468        ValueNode thenExpr;
3469        ValueNode elseExpr;
3470    jj_consume_token(WHEN);
3471    expr = orExpression(null, false);
3472    label_39:
3473    while (true) {
3474      switch (jj_nt.kind) {
3475      case OR:
3476        ;
3477        break;
3478      default:
3479        jj_la1[259] = jj_gen;
3480        break label_39;
3481      }
3482      jj_consume_token(OR);
3483      expr = orExpression(expr, false);
3484    }
3485    jj_consume_token(THEN);
3486    thenExpr = thenElseExpression();
3487    elseExpr = caseExpression();
3488                ContextManager cm = getContextManager();
3489                ValueNodeList thenElseList = (ValueNodeList) nodeFactory.getNode(C_NodeTypes.VALUE_NODE_LIST, cm);
3490                thenElseList.addElement(thenExpr); // then
3491
thenElseList.addElement(elseExpr); // else
3492

3493                {if (true) return((ValueNode) nodeFactory.getNode(C_NodeTypes.CONDITIONAL_NODE,
3494                                                                                                expr,
3495                                                                                                thenElseList,
3496                                                                                                Boolean.FALSE,
3497                                                                                                cm));}
3498    throw new Error JavaDoc("Missing return statement in function");
3499  }
3500
3501/*
3502 * <A NAME="thenElseExpression">thenElseExpression</A>
3503 */

3504  final public ValueNode thenElseExpression() throws ParseException, StandardException {
3505        ValueNode expr;
3506    if (getToken(1).kind == NULL) {
3507      jj_consume_token(NULL);
3508                {if (true) return((ValueNode) nodeFactory.getNode(
3509                                                                                C_NodeTypes.CAST_NODE,
3510                                                                                (ValueNode) nodeFactory.getNode(C_NodeTypes.UNTYPED_NULL_CONSTANT_NODE,
3511                                                                                                                                                getContextManager()),
3512                                                                                DataTypeDescriptor.getBuiltInDataTypeDescriptor(Types.CHAR, 1),
3513                                                                                getContextManager()));}
3514    } else if (jj_2_45(1)) {
3515      expr = additiveExpression(null, 0, false);
3516                {if (true) return expr;}
3517    } else {
3518      jj_consume_token(-1);
3519      throw new ParseException();
3520    }
3521    throw new Error JavaDoc("Missing return statement in function");
3522  }
3523
3524  final public TableElementNode tableConstraintDefinition() throws ParseException, StandardException {
3525        Properties properties = null;
3526        ConstraintDefinitionNode tcdn;
3527        TableName constraintName = null;
3528        //initialize following two booleans before handling table level constraints
3529
explicitNotNull = false;
3530        explicitNull = false;
3531    switch (jj_nt.kind) {
3532    case CONSTRAINT:
3533      constraintName = constraintNameDefinition();
3534      break;
3535    default:
3536      jj_la1[260] = jj_gen;
3537      ;
3538    }
3539    tcdn = tableConstraint(constraintName);
3540    switch (jj_nt.kind) {
3541    case DERBYDASHPROPERTIES:
3542      properties = propertyList(false);
3543      jj_consume_token(CHECK_PROPERTIES);
3544      break;
3545    default:
3546      jj_la1[261] = jj_gen;
3547      ;
3548    }
3549                if (properties != null)
3550                {
3551                        tcdn.setProperties(properties);
3552                }
3553                {if (true) return tcdn;}
3554    throw new Error JavaDoc("Missing return statement in function");
3555  }
3556
3557  final public ConstraintDefinitionNode tableConstraint(TableName constraintName) throws ParseException, StandardException {
3558        ConstraintDefinitionNode tcdn;
3559    switch (jj_nt.kind) {
3560    case PRIMARY:
3561    case UNIQUE:
3562      tcdn = uniqueConstraintDefinition(constraintName);
3563                {if (true) return tcdn;}
3564      break;
3565    case FOREIGN:
3566      tcdn = referentialConstraintDefinition(constraintName);
3567                {if (true) return tcdn;}
3568      break;
3569    case CHECK:
3570      tcdn = checkConstraintDefinition(constraintName, null);
3571                {if (true) return tcdn;}
3572      break;
3573    default:
3574      jj_la1[262] = jj_gen;
3575      jj_consume_token(-1);
3576      throw new ParseException();
3577    }
3578    throw new Error JavaDoc("Missing return statement in function");
3579  }
3580
3581  final public ConstraintDefinitionNode uniqueConstraintDefinition(TableName constraintName) throws ParseException, StandardException {
3582        int constraintType;
3583        ResultColumnList uniqueColumnList;
3584    //for table level constraint, second parameter will be null
3585
constraintType = uniqueSpecification((DataTypeDescriptor) null, null);
3586    jj_consume_token(LEFT_PAREN);
3587    uniqueColumnList = uniqueColumnList();
3588    jj_consume_token(RIGHT_PAREN);
3589                //go through the unique columns list and if any of the columns in the
3590
//list is explicitly defined null, throw an exception for this. Columns
3591
//for which no nullability is defined are by default nullable. But in
3592
//case of create table, there nullability changes automatically to
3593
//non-nullable if primary key is defined on it. But if user explicitly
3594
//defines the nullability, then defining a primary key on it in create
3595
//table will result in an exception.
3596
if (constraintType == DataDictionary.PRIMARYKEY_CONSTRAINT)
3597                {
3598                        for (int index = 0; index < uniqueColumnList.size(); index++)
3599                        {
3600                                String JavaDoc primaryKeyColumnName = ((ResultColumn) uniqueColumnList.elementAt(index)).getName();
3601                                if (explicitlyNullableColumnsList.contains(primaryKeyColumnName))
3602                                {
3603                                        String JavaDoc errorState = SQLState.LANG_DB2_ADD_UNIQUE_OR_PRIMARY_KEY_ON_NULL_COLS;
3604                                        {if (true) throw StandardException.newException(errorState, primaryKeyColumnName);}
3605                                }
3606                        }
3607                }
3608                {if (true) return (ConstraintDefinitionNode) nodeFactory.getNode(
3609                                                C_NodeTypes.CONSTRAINT_DEFINITION_NODE,
3610                                                constraintName,
3611                                                ReuseFactory.getInteger(constraintType),
3612                                                uniqueColumnList,
3613                                                null,
3614                                                null,
3615                                                null,
3616                                                getContextManager()
3617                                                );}
3618    throw new Error JavaDoc("Missing return statement in function");
3619  }
3620
3621//the second parameter to the following method will always be null for a table level
3622
//constraint but not for a column level constraint
3623
final public int uniqueSpecification(DataTypeDescriptor dataTypeDescriptor,
3624String JavaDoc columnName) throws ParseException, StandardException {
3625    switch (jj_nt.kind) {
3626    case UNIQUE:
3627      jj_consume_token(UNIQUE);
3628                {if (true) return DataDictionary.UNIQUE_CONSTRAINT;}
3629      break;
3630    case PRIMARY:
3631      jj_consume_token(PRIMARY);
3632      jj_consume_token(KEY);
3633                //explicitNull can be true only if it's column level constraint and
3634
//that column has null constraint defined on it. In that case, defining
3635
//a column-level constraint of primary key on it will result in an error.
3636
if (explicitNull)
3637                {
3638                        String JavaDoc errorState = SQLState.LANG_DB2_ADD_UNIQUE_OR_PRIMARY_KEY_ON_NULL_COLS;
3639                        {if (true) throw StandardException.newException(errorState, columnName);}
3640                }
3641                {if (true) return DataDictionary.PRIMARYKEY_CONSTRAINT;}
3642      break;
3643    default:
3644      jj_la1[263] = jj_gen;
3645      jj_consume_token(-1);
3646      throw new ParseException();
3647    }
3648    throw new Error JavaDoc("Missing return statement in function");
3649  }
3650
3651  final public ResultColumnList uniqueColumnList() throws ParseException, StandardException {
3652        ResultColumnList resultColumns = (ResultColumnList) nodeFactory.getNode(
3653                                                                                        C_NodeTypes.RESULT_COLUMN_LIST,
3654                                                                                        getContextManager());
3655    columnNameList(resultColumns);
3656                {if (true) return resultColumns;}
3657    throw new Error JavaDoc("Missing return statement in function");
3658  }
3659
3660  final public ConstraintDefinitionNode referentialConstraintDefinition(TableName constraintName) throws ParseException, StandardException {
3661        ResultColumnList fkRcl = (ResultColumnList) nodeFactory.getNode(
3662                                                                                C_NodeTypes.RESULT_COLUMN_LIST,
3663                                                                                getContextManager());
3664        ResultColumnList refRcl = (ResultColumnList) nodeFactory.getNode(
3665                                                                                C_NodeTypes.RESULT_COLUMN_LIST,
3666                                                                                getContextManager());
3667        TableName referencedTable;
3668        int[] refActions = {StatementType.RA_NOACTION,
3669                            StatementType.RA_NOACTION};
3670    jj_consume_token(FOREIGN);
3671    jj_consume_token(KEY);
3672    jj_consume_token(LEFT_PAREN);
3673    columnNameList(fkRcl);
3674    jj_consume_token(RIGHT_PAREN);
3675    referencedTable = referencesSpecification(refRcl, refActions);
3676                {if (true) return (ConstraintDefinitionNode) nodeFactory.getNode(
3677                                                C_NodeTypes.FK_CONSTRAINT_DEFINITION_NODE,
3678                                                constraintName,
3679                                                referencedTable,
3680                                                fkRcl,
3681                                                refRcl,
3682                                                refActions,
3683                                                getContextManager());}
3684    throw new Error JavaDoc("Missing return statement in function");
3685  }
3686
3687  final public TableName referencesSpecification(ResultColumnList rcl, int[] refActions) throws ParseException, StandardException {
3688        TableName tableName = null;
3689    jj_consume_token(REFERENCES);
3690    tableName = referencedTableAndColumns(rcl);
3691    switch (jj_nt.kind) {
3692    case ON:
3693      jj_consume_token(ON);
3694      referentialTriggeredAction(refActions);
3695      break;
3696    default:
3697      jj_la1[264] = jj_gen;
3698      ;
3699    }
3700                {if (true) return tableName;}
3701    throw new Error JavaDoc("Missing return statement in function");
3702  }
3703
3704  final public TableName referencedTableAndColumns(ResultColumnList rcl) throws ParseException, StandardException {
3705        TableName tableName = null;
3706    tableName = qualifiedName(Limits.MAX_IDENTIFIER_LENGTH);
3707    switch (jj_nt.kind) {
3708    case LEFT_PAREN:
3709      jj_consume_token(LEFT_PAREN);
3710      columnNameList(rcl);
3711      jj_consume_token(RIGHT_PAREN);
3712      break;
3713    default:
3714      jj_la1[265] = jj_gen;
3715      ;
3716    }
3717                {if (true) return tableName;}
3718    throw new Error JavaDoc("Missing return statement in function");
3719  }
3720
3721  final public void referentialTriggeredAction(int [] refActions) throws ParseException, StandardException {
3722    switch (jj_nt.kind) {
3723    case UPDATE:
3724      refActions[1] = updateRule();
3725      switch (jj_nt.kind) {
3726      case ON:
3727        jj_consume_token(ON);
3728        refActions[0] = deleteRule();
3729        break;
3730      default:
3731        jj_la1[266] = jj_gen;
3732        ;
3733      }
3734      break;
3735    case DELETE:
3736      refActions[0] = deleteRule();
3737      switch (jj_nt.kind) {
3738      case ON:
3739        jj_consume_token(ON);
3740        refActions[1] = updateRule();
3741        break;
3742      default:
3743        jj_la1[267] = jj_gen;
3744        ;
3745      }
3746      break;
3747    default:
3748      jj_la1[268] = jj_gen;
3749      jj_consume_token(-1);
3750      throw new ParseException();
3751    }
3752  }
3753
3754  final public int updateRule() throws ParseException {
3755        int action;
3756    jj_consume_token(UPDATE);
3757    action = updateReferentialAction();
3758                {if (true) return action;}
3759    throw new Error JavaDoc("Missing return statement in function");
3760  }
3761
3762  final public int deleteRule() throws ParseException {
3763        int action;
3764    jj_consume_token(DELETE);
3765    action = deleteReferentialAction();
3766                {if (true) return action;}
3767    throw new Error JavaDoc("Missing return statement in function");
3768  }
3769
3770  final public int updateReferentialAction() throws ParseException {
3771    switch (jj_nt.kind) {
3772    case RESTRICT:
3773      jj_consume_token(RESTRICT);
3774                      {if (true) return StatementType.RA_RESTRICT;}
3775      break;
3776    case NO:
3777      jj_consume_token(NO);
3778      jj_consume_token(ACTION);
3779                         {if (true) return StatementType.RA_NOACTION;}
3780      break;
3781    default:
3782      jj_la1[269] = jj_gen;
3783      jj_consume_token(-1);
3784      throw new ParseException();
3785    }
3786    throw new Error JavaDoc("Missing return statement in function");
3787  }
3788
3789  final public int deleteReferentialAction() throws ParseException {
3790    switch (jj_nt.kind) {
3791    case CASCADE:
3792      jj_consume_token(CASCADE);
3793                   {if (true) return StatementType.RA_CASCADE;}
3794      break;
3795    case RESTRICT:
3796      jj_consume_token(RESTRICT);
3797                      {if (true) return StatementType.RA_RESTRICT;}
3798      break;
3799    case NO:
3800      jj_consume_token(NO);
3801      jj_consume_token(ACTION);
3802                         {if (true) return StatementType.RA_NOACTION;}
3803      break;
3804    case SET:
3805      jj_consume_token(SET);
3806      switch (jj_nt.kind) {
3807      case NULL:
3808        jj_consume_token(NULL);
3809                      {if (true) return StatementType.RA_SETNULL;}
3810        break;
3811      case _DEFAULT:
3812        jj_consume_token(_DEFAULT);
3813                            {if (true) return StatementType.RA_SETDEFAULT;}
3814        break;
3815      default:
3816        jj_la1[270] = jj_gen;
3817        jj_consume_token(-1);
3818        throw new ParseException();
3819      }
3820      break;
3821    default:
3822      jj_la1[271] = jj_gen;
3823      jj_consume_token(-1);
3824      throw new ParseException();
3825    }
3826    throw new Error JavaDoc("Missing return statement in function");
3827  }
3828
3829/*
3830 * <A NAME="columnConstraintDefinition">columnConstraintDefinition</A>
3831 */

3832  final public void columnConstraintDefinition(DataTypeDescriptor dataTypeDescriptor,
3833                                                   TableElementList tableElementList,
3834                                                   String JavaDoc columnName) throws ParseException, StandardException {
3835        int constraintType;
3836        TableElementNode tcdn;
3837        TableName constraintName = null;
3838    switch (jj_nt.kind) {
3839    case CONSTRAINT:
3840      constraintName = constraintNameDefinition();
3841      break;
3842    default:
3843      jj_la1[272] = jj_gen;
3844      ;
3845    }
3846    tcdn = columnConstraint(constraintName, dataTypeDescriptor, columnName);
3847                /* NOT NULL constraints are handled by marking the dataTypeDescriptor
3848         * as being non-nullable.
3849         */

3850                if (tcdn == null)
3851                {
3852                        {if (true) return;}
3853                }
3854
3855                /* All other constraints, whether column or table will be added as
3856         * table constraints. We do this to facilitate the handling of
3857         * multiple column constraints on the same column.
3858         */

3859                tableElementList.addTableElement(tcdn);
3860  }
3861
3862/*
3863 * <A NAME="columnConstraint">columnConstraint</A>
3864 */

3865  final public ConstraintDefinitionNode columnConstraint(TableName constraintName,
3866                                 DataTypeDescriptor dataTypeDescriptor,
3867                                 String JavaDoc columnName) throws ParseException, StandardException {
3868        int constraintType;
3869        Properties properties = null;
3870        ConstraintDefinitionNode tcdn;
3871        ResultColumnList refRcl = (ResultColumnList) nodeFactory.getNode(
3872                                                                                C_NodeTypes.RESULT_COLUMN_LIST,
3873                                                                                getContextManager());
3874        TableName referencedTable;
3875        int[] refActions = {StatementType.RA_NOACTION,
3876                            StatementType.RA_NOACTION} ;
3877    switch (jj_nt.kind) {
3878    case NOT:
3879      jj_consume_token(NOT);
3880      jj_consume_token(NULL);
3881                //if column is explicitly defined not nullable, set following flag
3882
explicitNotNull = true;
3883                //if both null and not null constraints are defined for a column,
3884
//throw an exception
3885
if (explicitNull)
3886                   {if (true) throw StandardException.newException(SQLState.LANG_ADDING_COLUMN_WITH_NULL_AND_NOT_NULL_CONSTRAINT, columnName);}
3887                dataTypeDescriptor.setNullability(false);
3888                {if (true) return null;}
3889      break;
3890    case PRIMARY:
3891    case UNIQUE:
3892      //pass the columnname as the second parameter. It will be used to throw an
3893
//exception if null constraint is defined for this column-level primary
3894
//key constraint
3895
constraintType = uniqueSpecification(dataTypeDescriptor,columnName);
3896      switch (jj_nt.kind) {
3897      case DERBYDASHPROPERTIES:
3898        properties = propertyList(false);
3899        jj_consume_token(CHECK_PROPERTIES);
3900        break;
3901      default:
3902        jj_la1[273] = jj_gen;
3903        ;
3904      }
3905                ResultColumnList uniqueColumnList =
3906                                                                                (ResultColumnList) nodeFactory.getNode(
3907                                                                                                C_NodeTypes.RESULT_COLUMN_LIST,
3908                                                                                                getContextManager());
3909                uniqueColumnList.addElement(
3910                        (ResultColumn) nodeFactory.getNode(
3911                                                        C_NodeTypes.RESULT_COLUMN,
3912                                                        columnName,
3913                                                        null,
3914                                                        getContextManager()));
3915
3916                {if (true) return (ConstraintDefinitionNode) nodeFactory.getNode(
3917                                                C_NodeTypes.CONSTRAINT_DEFINITION_NODE,
3918                                                constraintName,
3919                                                ReuseFactory.getInteger(constraintType),
3920                                                uniqueColumnList,
3921                                                properties,
3922                                                null,
3923                                                null,
3924                                                getContextManager()
3925                                                );}
3926      break;
3927    case REFERENCES:
3928      referencedTable = referencesSpecification(refRcl, refActions);
3929      switch (jj_nt.kind) {
3930      case DERBYDASHPROPERTIES:
3931        properties = propertyList(false);
3932        jj_consume_token(CHECK_PROPERTIES);
3933        break;
3934      default:
3935        jj_la1[274] = jj_gen;
3936        ;
3937      }
3938                ResultColumnList fkRcl = (ResultColumnList) nodeFactory.getNode(
3939                                                                                        C_NodeTypes.RESULT_COLUMN_LIST,
3940                                                                                        getContextManager());
3941                fkRcl.addElement(
3942                                        (ResultColumn) nodeFactory.getNode(
3943                                                                        C_NodeTypes.RESULT_COLUMN,
3944                                                                        columnName,
3945                                                                        null,
3946                                                                        getContextManager())
3947                                );
3948                tcdn = (ConstraintDefinitionNode) nodeFactory.getNode(
3949                                                C_NodeTypes.FK_CONSTRAINT_DEFINITION_NODE,
3950                                                constraintName,
3951                                                referencedTable,
3952                                                fkRcl,
3953                                                refRcl,
3954                                                refActions,
3955                                                getContextManager());
3956                if (properties != null)
3957                {
3958                        tcdn.setProperties(properties);
3959                }
3960                {if (true) return tcdn;}
3961      break;
3962    case CHECK:
3963      tcdn = checkConstraintDefinition(constraintName, columnName);
3964                {if (true) return tcdn;}
3965      break;
3966    default:
3967      jj_la1[275] = jj_gen;
3968      jj_consume_token(-1);
3969      throw new ParseException();
3970    }
3971    throw new Error JavaDoc("Missing return statement in function");
3972  }
3973
3974  final public QueryTreeNode dropSchemaStatement() throws ParseException, StandardException {
3975        String JavaDoc schemaName;
3976    jj_consume_token(SCHEMA);
3977    schemaName = identifier(Limits.MAX_IDENTIFIER_LENGTH, true);
3978    jj_consume_token(RESTRICT);
3979                QueryTreeNode stmt = nodeFactory.getNode(
3980                                                        C_NodeTypes.DROP_SCHEMA_NODE,
3981                                                        schemaName,
3982                                                        new Integer JavaDoc(StatementType.DROP_RESTRICT),
3983                                                        getContextManager());
3984
3985                {if (true) return stmt;}
3986    throw new Error JavaDoc("Missing return statement in function");
3987  }
3988
3989  final public QueryTreeNode alterTableStatement() throws ParseException, StandardException {
3990        QueryTreeNode node;
3991        TableName tableName;
3992    jj_consume_token(TABLE);
3993    tableName = qualifiedName(Limits.MAX_IDENTIFIER_LENGTH);
3994    node = alterTableBody(tableName);
3995                {if (true) return node;}
3996    throw new Error JavaDoc("Missing return statement in function");
3997  }
3998
3999  final public QueryTreeNode alterTableBody(TableName tableName) throws ParseException, StandardException {
4000        QueryTreeNode qtn;
4001        char lockGranularity = '\0';
4002        String JavaDoc newTableName;
4003        TableElementList tableElementList =
4004                                                                        (TableElementList) nodeFactory.getNode(
4005                                                                                                C_NodeTypes.TABLE_ELEMENT_LIST,
4006                                                                                                getContextManager());
4007        Token tok = null;
4008        int[] changeType = new int[1];
4009        int[] behavior = new int[1];
4010        boolean[] sequential = new boolean[1];
4011    switch (jj_nt.kind) {
4012    case COMPRESS:
4013      jj_consume_token(COMPRESS);
4014      switch (jj_nt.kind) {
4015      case SEQUENTIAL:
4016        tok = jj_consume_token(SEQUENTIAL);
4017        break;
4018      default:
4019        jj_la1[276] = jj_gen;
4020        ;
4021      }
4022                checkInternalFeature("COMPRESS");
4023                {if (true) return (QueryTreeNode) nodeFactory.getNode(
4024                                                        C_NodeTypes.ALTER_TABLE_NODE,
4025                                                        tableName,
4026                                                        new Boolean JavaDoc(tok != null),
4027                                                        getContextManager());}
4028      break;
4029    default:
4030      jj_la1[277] = jj_gen;
4031      if (jj_2_46(1)) {
4032        lockGranularity = alterTableAction(tableElementList, changeType, behavior, sequential);
4033                {if (true) return (QueryTreeNode) nodeFactory.getNode(
4034                                                        C_NodeTypes.ALTER_TABLE_NODE,
4035                                                        tableName,
4036                                                        tableElementList,
4037                                                        new Character JavaDoc(lockGranularity),
4038                                                        changeType,
4039                                                        behavior,
4040                                                        sequential,
4041                                                        getContextManager());}
4042      } else {
4043        jj_consume_token(-1);
4044        throw new ParseException();
4045      }
4046    }
4047    throw new Error JavaDoc("Missing return statement in function");
4048  }
4049
4050/*
4051 * <A NAME="alterTableRenameTableStatement">alterTableRenameTableStatement</A>
4052 */

4053/*
4054QueryTreeNode
4055alterTableRenameTableStatement(TableName tableName) throws StandardException :
4056{
4057    String newTableName;
4058}
4059{
4060    <TO> newTableName = identifier(Limits.MAX_IDENTIFIER_LENGTH, true)
4061    {
4062        return (QueryTreeNode) nodeFactory.getNode(
4063                            C_NodeTypes.RENAME_NODE,
4064                            tableName,
4065                            null,
4066                            newTableName,
4067                            Boolean.TRUE,
4068ReuseFactory.getInteger(StatementType.RENAME_TABLE),
4069                            getContextManager());
4070    }
4071}
4072*/

4073
4074/*
4075 * <A NAME="alterTableRenameColumnStatement">alterTableRenameColumnStatement</A>
4076 */

4077/*
4078QueryTreeNode
4079alterTableRenameColumnStatement(TableName tableName) throws StandardException :
4080{
4081    String oldColumnName;
4082    String newColumnName;
4083}
4084{
4085    oldColumnName = identifier(Limits.MAX_IDENTIFIER_LENGTH, true) <TO> newColumnName = identifier(Limits.MAX_IDENTIFIER_LENGTH, true)
4086    {
4087        return (QueryTreeNode) nodeFactory.getNode(
4088                            C_NodeTypes.RENAME_NODE,
4089                            tableName,
4090                            oldColumnName,
4091                            newColumnName,
4092                            Boolean.TRUE,
4093ReuseFactory.getInteger(StatementType.RENAME_COLUMN),
4094                            getContextManager());
4095    }
4096}
4097*/

4098  final public char alterTableAction(TableElementList tableElementList, int[] changeType, int[] behavior, boolean[] sequential) throws ParseException, StandardException {
4099        char lockGranularity = '\0';
4100        TableElementNode tableElement;
4101        DataTypeDescriptor typeDescriptor;
4102        Token tok = null;
4103        String JavaDoc columnName;
4104        long[] autoIncrementInfo = new long[4];
4105    switch (jj_nt.kind) {
4106    case ADD:
4107      jj_consume_token(ADD);
4108      switch (jj_nt.kind) {
4109      case BINARY:
4110      case COALESCE:
4111      case COLUMN:
4112      case COUNT:
4113      case D:
4114      case MODULE:
4115      case T:
4116      case TS:
4117      case VALUE:
4118      case VARBINARY:
4119      case ABS:
4120      case ABSVAL:
4121      case ACTION:
4122      case ALWAYS:
4123      case BLOB:
4124      case C:
4125      case CALLED:
4126      case CLOB:
4127      case COBOL:
4128      case COMMITTED:
4129      case CONCAT:
4130      case CONTAINS:
4131      case DATA:
4132      case DATE:
4133      case DAY:
4134      case DYNAMIC:
4135      case FORTRAN:
4136      case GENERATED:
4137      case IDENTITY_VAL_LOCAL:
4138      case INCREMENT:
4139      case INITIAL:
4140      case INTERVAL:
4141      case LANGUAGE:
4142      case LARGE:
4143      case LENGTH:
4144      case LEVEL:
4145      case LOCKS:
4146      case LOCKSIZE:
4147      case LOGGED:
4148      case MOD:
4149      case MODIFIES:
4150      case MODIFY:
4151      case MONTH:
4152      case _MORE:
4153      case MUMPS:
4154      case NAME:
4155      case NCLOB:
4156      case NULLABLE:
4157      case NUMBER:
4158      case OBJECT:
4159      case PASCAL:
4160      case PLI:
4161      case PRECISION:
4162      case RELEASE:
4163      case REPEATABLE:
4164      case RESTART:
4165      case RETURNS:
4166      case ROW:
4167      case SAVEPOINT:
4168      case SCALE:
4169      case SERIALIZABLE:
4170      case SQL_TSI_FRAC_SECOND:
4171      case SQL_TSI_SECOND:
4172      case SQL_TSI_MINUTE:
4173      case SQL_TSI_HOUR:
4174      case SQL_TSI_DAY:
4175      case SQL_TSI_WEEK:
4176      case SQL_TSI_MONTH:
4177      case SQL_TSI_QUARTER:
4178      case SQL_TSI_YEAR:
4179      case START:
4180      case STATEMENT:
4181      case SYNONYM:
4182      case THEN:
4183      case TIME:
4184      case TIMESTAMP:
4185      case TIMESTAMPADD:
4186      case TIMESTAMPDIFF:
4187      case TRUNCATE:
4188      case TYPE:
4189      case UNCOMMITTED:
4190      case USAGE:
4191      case WHEN:
4192      case CURDATE:
4193      case CURTIME:
4194      case DATABASE:
4195      case LONG:
4196      case AFTER:
4197      case BEFORE:
4198      case CLASS:
4199      case COMPRESS:
4200      case CONTENT:
4201      case CS:
4202      case DB2SQL:
4203      case DIRTY:
4204      case DOCUMENT:
4205      case EACH:
4206      case EMPTY:
4207      case EXCLUSIVE:
4208      case FN:
4209      case INDEX:
4210      case JAVA:
4211      case LCASE:
4212      case LOCATE:
4213      case LOCK:
4214      case MESSAGE_LOCALE:
4215      case METHOD:
4216      case MODE:
4217      case NEW:
4218      case NEW_TABLE:
4219      case OJ:
4220      case OFF:
4221      case OLD:
4222      case OLD_TABLE:
4223      case PARAMETER:
4224      case PASSING:
4225      case PROPERTIES:
4226      case READS:
4227      case REF:
4228      case REFERENCING:
4229      case RENAME:
4230      case RESET:
4231      case RESULT:
4232      case RETAIN:
4233      case RETURNING:
4234      case RR:
4235      case RS:
4236      case SEQUENCE:
4237      case SEQUENTIAL:
4238      case SETS:
4239      case SHARE:
4240      case SQLID:
4241      case SPECIFIC:
4242      case SQRT:
4243      case STABILITY:
4244      case STRIP:
4245      case STYLE:
4246      case TRIGGER:
4247      case UCASE:
4248      case UR:
4249      case WHITESPACE:
4250      case IDENTIFIER:
4251      case DELIMITED_IDENTIFIER:
4252        tableElement = addColumnDefinition(tableElementList);
4253        break;
4254      case CHECK:
4255      case CONSTRAINT:
4256      case FOREIGN:
4257      case PRIMARY:
4258      case UNIQUE:
4259        tableElement = tableConstraintDefinition();
4260        break;
4261      default:
4262        jj_la1[278] = jj_gen;
4263        jj_consume_token(-1);
4264        throw new ParseException();
4265      }
4266                if (tableElement instanceof ColumnDefinitionNode)
4267                {
4268                        //bug 5724 - auto increment columns not allowed in ALTER TABLE statement
4269
ColumnDefinitionNode cdn = (ColumnDefinitionNode) tableElement;
4270                        if ( cdn.isAutoincrementColumn())
4271                                {if (true) throw StandardException.newException(SQLState.LANG_ALTER_TABLE_AUTOINCREMENT_COLUMN_NOT_ALLOWED);}
4272                }
4273                changeType[0] = DDLStatementNode.ADD_TYPE;
4274                tableElementList.addTableElement(tableElement);
4275                {if (true) return lockGranularity;}
4276      break;
4277    case ALTER:
4278      jj_consume_token(ALTER);
4279      switch (jj_nt.kind) {
4280      case COLUMN:
4281        jj_consume_token(COLUMN);
4282        break;
4283      default:
4284        jj_la1[279] = jj_gen;
4285        ;
4286      }
4287      columnName = identifier(Limits.MAX_IDENTIFIER_LENGTH, true);
4288      tableElement = columnAlterClause(columnName);
4289                changeType[0] = DDLStatementNode.MODIFY_TYPE;
4290                tableElementList.addTableElement(tableElement);
4291                {if (true) return lockGranularity;}
4292      break;
4293    default:
4294      jj_la1[280] = jj_gen;
4295      if (getToken(1).kind == DROP
4296                      && (getToken(2).kind == CONSTRAINT
4297                              || getToken(2).kind == PRIMARY
4298                              || getToken(2).kind == FOREIGN
4299                              || getToken(2).kind == UNIQUE
4300                              || getToken(2).kind == CHECK)) {
4301        tableElement = dropTableConstraintDefinition();
4302                changeType[0] = DDLStatementNode.DROP_TYPE;
4303                tableElementList.addTableElement(tableElement);
4304                {if (true) return lockGranularity;}
4305      } else {
4306        switch (jj_nt.kind) {
4307        case LOCKSIZE:
4308          lockGranularity = DB2lockGranularityClause();
4309                changeType[0] = DDLStatementNode.LOCKING_TYPE;
4310                {if (true) return lockGranularity;}
4311          break;
4312        default:
4313          jj_la1[281] = jj_gen;
4314          jj_consume_token(-1);
4315          throw new ParseException();
4316        }
4317      }
4318    }
4319    throw new Error JavaDoc("Missing return statement in function");
4320  }
4321
4322  final public TableElementNode addColumnDefinition(TableElementList tableElementList) throws ParseException, StandardException {
4323        TableElementNode tableElement;
4324    switch (jj_nt.kind) {
4325    case COLUMN:
4326      jj_consume_token(COLUMN);
4327      break;
4328    default:
4329      jj_la1[282] = jj_gen;
4330      ;
4331    }
4332    tableElement = columnDefinition(tableElementList);
4333                {if (true) return tableElement;}
4334    throw new Error JavaDoc("Missing return statement in function");
4335  }
4336
4337/*
4338 * Various variants of the ALTER TABLE ALTER COLUMN statement.
4339 *
4340 * By the type we get here, we've parsed
4341 * ALTER TABLE tablename ALTER [COLUMN] columnname
4342 * and here we parse the remainder of the ALTER COLUMN clause, one of:
4343 * SET DATA TYPE data_type
4344 * SET INCREMENT BY increment_value
4345 * RESTART WITH increment_restart_value
4346 * [WITH] DEFAULT default_value
4347 * [NOT] NULL
4348 */

4349  final public TableElementNode columnAlterClause(String JavaDoc columnName) throws ParseException, StandardException {
4350        ValueNode defaultNode;
4351        long[] autoIncrementInfo = new long[4];
4352        long autoIncrementIncrement = 1;
4353        long autoIncrementRestartWith = 1;
4354        DataTypeDescriptor typeDescriptor = null;
4355    if (getToken(2).kind == DATA) {
4356      jj_consume_token(SET);
4357      jj_consume_token(DATA);
4358      jj_consume_token(TYPE);
4359      typeDescriptor = dataTypeDDL();
4360                {if (true) return (TableElementNode) nodeFactory.getNode(
4361                                                C_NodeTypes.MODIFY_COLUMN_TYPE_NODE,
4362                                                columnName, null,
4363                                                typeDescriptor, null,
4364                                                getContextManager());}
4365    } else if (getToken(2).kind == INCREMENT) {
4366      jj_consume_token(SET);
4367      jj_consume_token(INCREMENT);
4368      jj_consume_token(BY);
4369      autoIncrementIncrement = exactNumber();
4370                autoIncrementInfo[QueryTreeNode.AUTOINCREMENT_INC_INDEX] = autoIncrementIncrement;
4371                autoIncrementInfo[QueryTreeNode.AUTOINCREMENT_CREATE_MODIFY] = ColumnDefinitionNode.MODIFY_AUTOINCREMENT_INC_VALUE;
4372                {if (true) return (TableElementNode) nodeFactory.getNode(
4373                                                C_NodeTypes.MODIFY_COLUMN_DEFAULT_NODE,
4374                                                columnName,
4375                                                null, null, autoIncrementInfo,
4376                                                getContextManager());}
4377    } else {
4378      switch (jj_nt.kind) {
4379      case RESTART:
4380        jj_consume_token(RESTART);
4381        jj_consume_token(WITH);
4382        autoIncrementRestartWith = exactNumber();
4383                autoIncrementInfo[QueryTreeNode.AUTOINCREMENT_START_INDEX] = autoIncrementRestartWith;
4384                autoIncrementInfo[QueryTreeNode.AUTOINCREMENT_CREATE_MODIFY] = ColumnDefinitionNode.MODIFY_AUTOINCREMENT_RESTART_VALUE;
4385                {if (true) return (TableElementNode) nodeFactory.getNode(
4386                                                C_NodeTypes.MODIFY_COLUMN_DEFAULT_NODE,
4387                                                columnName,
4388                                                null, null, autoIncrementInfo,
4389                                                getContextManager());}
4390        break;
4391      default:
4392        jj_la1[283] = jj_gen;
4393        if (getToken(1).kind == WITH || getToken(1).kind == _DEFAULT) {
4394          defaultNode = defaultClause(autoIncrementInfo, columnName);
4395                if (autoIncrementInfo[QueryTreeNode.AUTOINCREMENT_IS_AUTOINCREMENT_INDEX]
4396                                 == 0)
4397                {
4398                        autoIncrementInfo = null;
4399                }
4400
4401                {if (true) return (TableElementNode) nodeFactory.getNode(
4402                                                                C_NodeTypes.MODIFY_COLUMN_DEFAULT_NODE,
4403                                                                columnName,
4404                                                                defaultNode, null, autoIncrementInfo,
4405                                                                getContextManager());}
4406        } else if (getToken(1).kind == NULL) {
4407          jj_consume_token(NULL);
4408                // for a MODIFY column NULL clause form a modify_column node
4409
// with all null values. In a column definition a [NOT] NULL
4410
// column constraint is specified by setting the right value
4411
// in the nullability field of the data type but we don't have
4412
// a datatype here.
4413
{if (true) return (TableElementNode) nodeFactory.getNode(
4414                                                                C_NodeTypes.MODIFY_COLUMN_CONSTRAINT_NODE,
4415                                                                columnName, null, null, null,
4416                                                                getContextManager());}
4417        } else if (getToken(1).kind == NOT) {
4418          jj_consume_token(NOT);
4419          jj_consume_token(NULL);
4420                // for a MODIFY column NOT NULL clause form a modify_column node
4421
// with all null values. In a column definition a [NOT] NULL
4422
// column constraint is specified by setting the right value
4423
// in the nullability field of the data type but we don't have
4424
// a datatype here.
4425
{if (true) return (TableElementNode) nodeFactory.getNode(
4426                                                                C_NodeTypes.MODIFY_COLUMN_CONSTRAINT_NOT_NULL_NODE,
4427                                                                columnName, null, null, null,
4428                                                                getContextManager());}
4429        } else {
4430          jj_consume_token(-1);
4431          throw new ParseException();
4432        }
4433      }
4434    }
4435    throw new Error JavaDoc("Missing return statement in function");
4436  }
4437
4438  final public TableElementNode dropTableConstraintDefinition() throws ParseException, StandardException {
4439        TableName constraintName;
4440    if (getToken(2).kind == CONSTRAINT) {
4441      jj_consume_token(DROP);
4442      jj_consume_token(CONSTRAINT);
4443      constraintName = qualifiedName(Limits.MAX_IDENTIFIER_LENGTH);
4444                {if (true) return (TableElementNode) nodeFactory.getNode(
4445                                                C_NodeTypes.CONSTRAINT_DEFINITION_NODE,
4446                                                constraintName,
4447                                                ReuseFactory.getInteger(DataDictionary.DROP_CONSTRAINT),
4448                                                null,
4449                                                null,
4450                                                null,
4451                                                null,
4452                                                ReuseFactory.getInteger(StatementType.DROP_DEFAULT),
4453                                                getContextManager()
4454                                                );}
4455    } else if (getToken(2).kind == PRIMARY) {
4456      jj_consume_token(DROP);
4457      jj_consume_token(PRIMARY);
4458      jj_consume_token(KEY);
4459                {if (true) return (TableElementNode) nodeFactory.getNode(
4460                                                C_NodeTypes.CONSTRAINT_DEFINITION_NODE,
4461                                                null,
4462                                                ReuseFactory.getInteger(DataDictionary.DROP_CONSTRAINT),
4463                                                null,
4464                                                null,
4465                                                null,
4466                                                null,
4467                                                ReuseFactory.getInteger(StatementType.DROP_DEFAULT),
4468                                                getContextManager()
4469                                                );}
4470    } else if (getToken(2).kind == FOREIGN) {
4471      jj_consume_token(DROP);
4472      jj_consume_token(FOREIGN);
4473      jj_consume_token(KEY);
4474      constraintName = qualifiedName(Limits.MAX_IDENTIFIER_LENGTH);
4475                {if (true) return (TableElementNode) nodeFactory.getNode(
4476                                                C_NodeTypes.CONSTRAINT_DEFINITION_NODE,
4477                                                constraintName,
4478                                                ReuseFactory.getInteger(DataDictionary.DROP_CONSTRAINT),
4479                                                null,
4480                                                null,
4481                                                null,
4482                                                null,
4483                                                ReuseFactory.getInteger(StatementType.DROP_DEFAULT),
4484                                                ReuseFactory.getInteger(DataDictionary.FOREIGNKEY_CONSTRAINT),
4485                                                getContextManager()
4486                                                );}
4487    } else if (getToken(2).kind == UNIQUE) {
4488      jj_consume_token(DROP);
4489      jj_consume_token(UNIQUE);
4490      constraintName = qualifiedName(Limits.MAX_IDENTIFIER_LENGTH);
4491                {if (true) return (TableElementNode) nodeFactory.getNode(
4492                                                C_NodeTypes.CONSTRAINT_DEFINITION_NODE,
4493                                                constraintName,
4494                                                ReuseFactory.getInteger(DataDictionary.DROP_CONSTRAINT),
4495                                                null,
4496                                                null,
4497                                                null,
4498                                                null,
4499                                                ReuseFactory.getInteger(StatementType.DROP_DEFAULT),
4500                                                ReuseFactory.getInteger(DataDictionary.UNIQUE_CONSTRAINT),
4501                                                getContextManager()
4502                                                );}
4503    } else {
4504      switch (jj_nt.kind) {
4505      case DROP:
4506        jj_consume_token(DROP);
4507        jj_consume_token(CHECK);
4508        constraintName = qualifiedName(Limits.MAX_IDENTIFIER_LENGTH);
4509                {if (true) return (TableElementNode) nodeFactory.getNode(
4510                                                C_NodeTypes.CONSTRAINT_DEFINITION_NODE,
4511                                                constraintName,
4512                                                ReuseFactory.getInteger(DataDictionary.DROP_CONSTRAINT),
4513                                                null,
4514                                                null,
4515                                                null,
4516                                                null,
4517                                                ReuseFactory.getInteger(StatementType.DROP_DEFAULT),
4518                                                ReuseFactory.getInteger(DataDictionary.CHECK_CONSTRAINT),
4519                                                getContextManager()
4520                                                );}
4521        break;
4522      default:
4523        jj_la1[284] = jj_gen;
4524        jj_consume_token(-1);
4525        throw new ParseException();
4526      }
4527    }
4528    throw new Error JavaDoc("Missing return statement in function");
4529  }
4530
4531/*
4532 * <A NAME="dropTableStatement">dropTableStatement</A>
4533 */

4534  final public QueryTreeNode dropTableStatement() throws ParseException, StandardException {
4535        TableName tableName;
4536    jj_consume_token(TABLE);
4537    tableName = qualifiedName(Limits.MAX_IDENTIFIER_LENGTH);
4538                // DB2 does not support a drop behaviour
4539
{if (true) return (QueryTreeNode) nodeFactory.getNode(
4540                                                                                        C_NodeTypes.DROP_TABLE_NODE,
4541                                                                                        tableName,
4542                                                                                        new Integer JavaDoc(StatementType.DROP_DEFAULT),
4543                                                                                        getContextManager());}
4544    throw new Error JavaDoc("Missing return statement in function");
4545  }
4546
4547/*
4548 * <A NAME="dropIndexStatement">dropIndexStatement</A>
4549 */

4550  final public QueryTreeNode dropIndexStatement() throws ParseException, StandardException {
4551        TableName indexName;
4552    jj_consume_token(INDEX);
4553    indexName = qualifiedName(Limits.MAX_IDENTIFIER_LENGTH);
4554                {if (true) return (QueryTreeNode) nodeFactory.getNode(
4555                                                                C_NodeTypes.DROP_INDEX_NODE,
4556                                                                indexName,
4557                                                                getContextManager());}
4558    throw new Error JavaDoc("Missing return statement in function");
4559  }
4560
4561/*
4562 * <A NAME="dropAliasStatement">dropAliasStatement</A>
4563 */

4564  final public QueryTreeNode dropAliasStatement() throws ParseException, StandardException {
4565        Object JavaDoc aliasName;
4566    switch (jj_nt.kind) {
4567    case PROCEDURE:
4568      jj_consume_token(PROCEDURE);
4569      aliasName = qualifiedName(Limits.MAX_IDENTIFIER_LENGTH);
4570                {if (true) return dropAliasNode(aliasName, AliasInfo.ALIAS_TYPE_PROCEDURE_AS_CHAR);}
4571      break;
4572    case FUNCTION:
4573      jj_consume_token(FUNCTION);
4574      aliasName = qualifiedName(Limits.MAX_IDENTIFIER_LENGTH);
4575                {if (true) return dropAliasNode(aliasName, AliasInfo.ALIAS_TYPE_FUNCTION_AS_CHAR);}
4576      break;
4577    case SYNONYM:
4578      jj_consume_token(SYNONYM);
4579      aliasName = qualifiedName(Limits.MAX_IDENTIFIER_LENGTH);
4580                checkVersion(DataDictionary.DD_VERSION_DERBY_10_1, "DROP SYNONYM");
4581
4582                {if (true) return dropAliasNode(aliasName, AliasInfo.ALIAS_TYPE_SYNONYM_AS_CHAR);}
4583      break;
4584    default:
4585      jj_la1[285] = jj_gen;
4586      jj_consume_token(-1);
4587      throw new ParseException();
4588    }
4589    throw new Error JavaDoc("Missing return statement in function");
4590  }
4591
4592  final public QueryTreeNode dropViewStatement() throws ParseException, StandardException {
4593        TableName viewName;
4594    jj_consume_token(VIEW);
4595    viewName = qualifiedName(Limits.MAX_IDENTIFIER_LENGTH);
4596                {if (true) return (QueryTreeNode) nodeFactory.getNode(
4597                                                                C_NodeTypes.DROP_VIEW_NODE,
4598                                                                viewName,
4599                                                                getContextManager());}
4600    throw new Error JavaDoc("Missing return statement in function");
4601  }
4602
4603  final public QueryTreeNode dropTriggerStatement() throws ParseException, StandardException {
4604        TableName triggerName;
4605    jj_consume_token(TRIGGER);
4606    triggerName = qualifiedName(Limits.MAX_IDENTIFIER_LENGTH);
4607                {if (true) return (QueryTreeNode) nodeFactory.getNode(
4608                                                                C_NodeTypes.DROP_TRIGGER_NODE,
4609                                                                triggerName,
4610                                                                getContextManager());}
4611    throw new Error JavaDoc("Missing return statement in function");
4612  }
4613
4614  final public QueryTreeNode truncateTableStatement() throws ParseException, StandardException {
4615        TableName tableName;
4616    jj_consume_token(TRUNCATE);
4617    jj_consume_token(TABLE);
4618    tableName = qualifiedName(Limits.MAX_IDENTIFIER_LENGTH);
4619                {if (true) return (QueryTreeNode) nodeFactory.getNode(
4620                                                        C_NodeTypes.ALTER_TABLE_NODE,
4621                                                        tableName,
4622                                                        getContextManager());}
4623    throw new Error JavaDoc("Missing return statement in function");
4624  }
4625
4626/*
4627 * <A NAME="grantStatement">grantStatement</A>
4628 */

4629  final public QueryTreeNode grantStatement() throws ParseException, StandardException {
4630    QueryTreeNode node;
4631    jj_consume_token(GRANT);
4632                checkVersion( DataDictionary.DD_VERSION_DERBY_10_2, "GRANT");
4633                checkSqlStandardAccess( "GRANT");
4634    switch (jj_nt.kind) {
4635    case ALL:
4636    case DELETE:
4637    case INSERT:
4638    case REFERENCES:
4639    case SELECT:
4640    case UPDATE:
4641    case TRIGGER:
4642      node = tableGrantStatement();
4643      break;
4644    case EXECUTE:
4645      node = routineGrantStatement();
4646      break;
4647    default:
4648      jj_la1[286] = jj_gen;
4649      jj_consume_token(-1);
4650      throw new ParseException();
4651    }
4652                {if (true) return node;}
4653    throw new Error JavaDoc("Missing return statement in function");
4654  }
4655
4656/*
4657 * <A NAME="tableGrantStatement">tableGrantStatement</A>
4658 */

4659  final public QueryTreeNode tableGrantStatement() throws ParseException, StandardException {
4660    PrivilegeNode privileges = null;
4661    List grantees;
4662    privileges = tablePrivileges();
4663    jj_consume_token(TO);
4664    grantees = granteeList();
4665        {if (true) return nodeFactory.getNode( C_NodeTypes.GRANT_NODE,
4666                                    privileges, grantees,
4667                                    getContextManager());}
4668    throw new Error JavaDoc("Missing return statement in function");
4669  }
4670
4671 // end of tableGrantStatement
4672

4673/*
4674 * <A NAME="tablePrivileges">tablePrivileges</A>
4675 */

4676  final public PrivilegeNode tablePrivileges() throws ParseException, StandardException {
4677    TablePrivilegesNode tablePrivilegesNode = null;
4678    TableName objectName = null;
4679    tablePrivilegesNode = tableActions();
4680    jj_consume_token(ON);
4681    switch (jj_nt.kind) {
4682    case TABLE:
4683      jj_consume_token(TABLE);
4684      break;
4685    default:
4686      jj_la1[287] = jj_gen;
4687      ;
4688    }
4689    objectName = qualifiedName(Limits.MAX_IDENTIFIER_LENGTH);
4690        {if (true) return (PrivilegeNode) nodeFactory.getNode( C_NodeTypes.PRIVILEGE_NODE,
4691                                                    ReuseFactory.getInteger( PrivilegeNode.TABLE_PRIVILEGES),
4692                                                    objectName, tablePrivilegesNode,
4693                                                    getContextManager());}
4694    throw new Error JavaDoc("Missing return statement in function");
4695  }
4696
4697  // end of tablePrivilege
4698

4699/*
4700 * <A NAME="tableActions">tableActions</A>
4701 */

4702  final public TablePrivilegesNode tableActions() throws ParseException, StandardException {
4703    TablePrivilegesNode tableActionsNode = (TablePrivilegesNode)
4704      nodeFactory.getNode( C_NodeTypes.TABLE_PRIVILEGES_NODE, getContextManager());
4705    switch (jj_nt.kind) {
4706    case ALL:
4707      jj_consume_token(ALL);
4708      jj_consume_token(PRIVILEGES);
4709        tableActionsNode.addAll();
4710        {if (true) return tableActionsNode;}
4711      break;
4712    case DELETE:
4713    case INSERT:
4714    case REFERENCES:
4715    case SELECT:
4716    case UPDATE:
4717    case TRIGGER:
4718      tableAction(tableActionsNode);
4719      label_40:
4720      while (true) {
4721        switch (jj_nt.kind) {
4722        case COMMA:
4723          ;
4724          break;
4725        default:
4726          jj_la1[288] = jj_gen;
4727          break label_40;
4728        }
4729        jj_consume_token(COMMA);
4730        tableAction(tableActionsNode);
4731      }
4732        {if (true) return tableActionsNode;}
4733      break;
4734    default:
4735      jj_la1[289] = jj_gen;
4736      jj_consume_token(-1);
4737      throw new ParseException();
4738    }
4739    throw new Error JavaDoc("Missing return statement in function");
4740  }
4741
4742  // end of tableActions
4743

4744/*
4745 * <A NAME="routineGrantStatement">routineGrantStatement</A>
4746 */

4747  final public QueryTreeNode routineGrantStatement() throws ParseException, StandardException {
4748    List grantees;
4749    RoutineDesignator routine = null;
4750    jj_consume_token(EXECUTE);
4751    jj_consume_token(ON);
4752    routine = routineDesignator();
4753    jj_consume_token(TO);
4754    grantees = granteeList();
4755        PrivilegeNode routinePrivilege = (PrivilegeNode)
4756          nodeFactory.getNode( C_NodeTypes.PRIVILEGE_NODE,
4757                               ReuseFactory.getInteger( PrivilegeNode.ROUTINE_PRIVILEGES),
4758                               routine, null,
4759                               getContextManager());
4760        {if (true) return nodeFactory.getNode( C_NodeTypes.GRANT_NODE,
4761                                    routinePrivilege, grantees,
4762                                    getContextManager());}
4763    throw new Error JavaDoc("Missing return statement in function");
4764  }
4765
4766 // end of routineGrantStatement
4767

4768/*
4769 * <A NAME="routineAlias">routineAlias</A>
4770 */

4771  final public RoutineDesignator routineDesignator() throws ParseException, StandardException {
4772    Token procOrFunction;
4773    RoutineDesignator routine = null;
4774    TableName name = null;
4775    List paramTypeList = null;
4776    switch (jj_nt.kind) {
4777    case FUNCTION:
4778      procOrFunction = jj_consume_token(FUNCTION);
4779      break;
4780    case PROCEDURE:
4781      procOrFunction = jj_consume_token(PROCEDURE);
4782      break;
4783    default:
4784      jj_la1[290] = jj_gen;
4785      jj_consume_token(-1);
4786      throw new ParseException();
4787    }
4788    name = qualifiedName(Limits.MAX_IDENTIFIER_LENGTH);
4789    switch (jj_nt.kind) {
4790    case LEFT_PAREN:
4791      jj_consume_token(LEFT_PAREN);
4792      paramTypeList = parameterTypeList();
4793      jj_consume_token(RIGHT_PAREN);
4794      break;
4795    default:
4796      jj_la1[291] = jj_gen;
4797      ;
4798    }
4799        {if (true) return new RoutineDesignator( false,
4800                                      name,
4801                                      (procOrFunction.kind == FUNCTION),
4802                                      paramTypeList);}
4803    throw new Error JavaDoc("Missing return statement in function");
4804  }
4805
4806  // end of routineDesignator
4807

4808
4809/*
4810 * <A NAME="parameterTypeList">parameterTypeList</A>
4811 */

4812  final public List parameterTypeList() throws ParseException, StandardException {
4813    ArrayList JavaDoc list = new ArrayList JavaDoc();
4814    DataTypeDescriptor dtd;
4815    if (jj_2_47(1)) {
4816      dtd = dataTypeCommon();
4817            list.add( dtd);
4818      label_41:
4819      while (true) {
4820        switch (jj_nt.kind) {
4821        case COMMA:
4822          ;
4823          break;
4824        default:
4825          jj_la1[292] = jj_gen;
4826          break label_41;
4827        }
4828        jj_consume_token(COMMA);
4829        dtd = dataTypeCommon();
4830            list.add( dtd);
4831      }
4832    } else {
4833      ;
4834    }
4835        {if (true) return list;}
4836    throw new Error JavaDoc("Missing return statement in function");
4837  }
4838
4839  // end of parameterTypeList
4840

4841
4842/*
4843 * <A NAME="tableAction">tableAction</A>
4844 */

4845  final public void tableAction(TablePrivilegesNode tablePrivilegesNode) throws ParseException, StandardException {
4846    ResultColumnList columnList = null;
4847    switch (jj_nt.kind) {
4848    case SELECT:
4849      jj_consume_token(SELECT);
4850      switch (jj_nt.kind) {
4851      case LEFT_PAREN:
4852        columnList = privilegeColumnList();
4853        break;
4854      default:
4855        jj_la1[293] = jj_gen;
4856        ;
4857      }
4858        tablePrivilegesNode.addAction( TablePrivilegeInfo.SELECT_ACTION, columnList);
4859      break;
4860    case DELETE:
4861      jj_consume_token(DELETE);
4862        tablePrivilegesNode.addAction( TablePrivilegeInfo.DELETE_ACTION, (ResultColumnList) null);
4863      break;
4864    case INSERT:
4865      jj_consume_token(INSERT);
4866        tablePrivilegesNode.addAction( TablePrivilegeInfo.INSERT_ACTION, (ResultColumnList) null);
4867      break;
4868    case UPDATE:
4869      jj_consume_token(UPDATE);
4870      switch (jj_nt.kind) {
4871      case LEFT_PAREN:
4872        columnList = privilegeColumnList();
4873        break;
4874      default:
4875        jj_la1[294] = jj_gen;
4876        ;
4877      }
4878        tablePrivilegesNode.addAction( TablePrivilegeInfo.UPDATE_ACTION, columnList);
4879      break;
4880    case REFERENCES:
4881      jj_consume_token(REFERENCES);
4882      switch (jj_nt.kind) {
4883      case LEFT_PAREN:
4884        columnList = privilegeColumnList();
4885        break;
4886      default:
4887        jj_la1[295] = jj_gen;
4888        ;
4889      }
4890        tablePrivilegesNode.addAction( TablePrivilegeInfo.REFERENCES_ACTION, columnList);
4891      break;
4892    case TRIGGER:
4893      jj_consume_token(TRIGGER);
4894        tablePrivilegesNode.addAction( TablePrivilegeInfo.TRIGGER_ACTION, (ResultColumnList) null);
4895      break;
4896    default:
4897      jj_la1[296] = jj_gen;
4898      jj_consume_token(-1);
4899      throw new ParseException();
4900    }
4901  }
4902
4903  // end of tableAction
4904

4905/*
4906 * <A NAME="privilegeColumnList">privilegeColumnList</A>
4907 */

4908  final public ResultColumnList privilegeColumnList() throws ParseException, StandardException {
4909    ResultColumnList cl = (ResultColumnList) nodeFactory.getNode( C_NodeTypes.RESULT_COLUMN_LIST,
4910                                                                  getContextManager());
4911    jj_consume_token(LEFT_PAREN);
4912    columnNameList(cl);
4913    jj_consume_token(RIGHT_PAREN);
4914        {if (true) return cl;}
4915    throw new Error JavaDoc("Missing return statement in function");
4916  }
4917
4918  // end of privilegeColumnList
4919

4920/*
4921 * <A NAME="granteeList">granteeList</A>
4922 */

4923  final public List granteeList() throws ParseException, StandardException {
4924    ArrayList JavaDoc list = new ArrayList JavaDoc();
4925    grantee(list);
4926    label_42:
4927    while (true) {
4928      switch (jj_nt.kind) {
4929      case COMMA:
4930        ;
4931        break;
4932      default:
4933        jj_la1[297] = jj_gen;
4934        break label_42;
4935      }
4936      jj_consume_token(COMMA);
4937      grantee(list);
4938    }
4939        {if (true) return list;}
4940    throw new Error JavaDoc("Missing return statement in function");
4941  }
4942
4943  final public void grantee(List list) throws ParseException, StandardException {
4944    String JavaDoc str;
4945    switch (jj_nt.kind) {
4946    case BINARY:
4947    case COALESCE:
4948    case COUNT:
4949    case D:
4950    case MODULE:
4951    case T:
4952    case TS:
4953    case VALUE:
4954    case VARBINARY:
4955    case ABS:
4956    case ABSVAL:
4957    case ACTION:
4958    case ALWAYS:
4959    case BLOB:
4960    case C:
4961    case CALLED:
4962    case CLOB:
4963    case COBOL:
4964    case COMMITTED:
4965    case CONCAT:
4966    case CONTAINS:
4967    case DATA:
4968    case DATE:
4969    case DAY:
4970    case DYNAMIC:
4971    case FORTRAN:
4972    case GENERATED:
4973    case IDENTITY_VAL_LOCAL:
4974    case INCREMENT:
4975    case INITIAL:
4976    case INTERVAL:
4977    case LANGUAGE:
4978    case LARGE:
4979    case LENGTH:
4980    case LEVEL:
4981    case LOCKS:
4982    case LOCKSIZE:
4983    case LOGGED:
4984    case MOD:
4985    case MODIFIES:
4986    case MODIFY:
4987    case MONTH:
4988    case _MORE:
4989    case MUMPS:
4990    case NAME:
4991    case NCLOB:
4992    case NULLABLE:
4993    case NUMBER:
4994    case OBJECT:
4995    case PASCAL:
4996    case PLI:
4997    case PRECISION:
4998    case RELEASE:
4999    case REPEATABLE:
5000    case RESTART:
5001    case RETURNS:
5002    case ROW:
5003    case SAVEPOINT:
5004    case SCALE:
5005    case SERIALIZABLE:
5006    case SQL_TSI_FRAC_SECOND:
5007    case SQL_TSI_SECOND:
5008    case SQL_TSI_MINUTE:
5009    case SQL_TSI_HOUR:
5010    case SQL_TSI_DAY:
5011    case SQL_TSI_WEEK:
5012    case SQL_TSI_MONTH:
5013    case SQL_TSI_QUARTER:
5014    case SQL_TSI_YEAR:
5015    case START:
5016    case STATEMENT:
5017    case SYNONYM:
5018    case THEN:
5019    case TIME:
5020    case TIMESTAMP:
5021    case TIMESTAMPADD:
5022    case TIMESTAMPDIFF:
5023    case TRUNCATE:
5024    case TYPE:
5025    case UNCOMMITTED:
5026    case USAGE:
5027    case WHEN:
5028    case CURDATE:
5029    case CURTIME:
5030    case DATABASE:
5031    case LONG:
5032    case AFTER:
5033    case BEFORE:
5034    case CLASS:
5035    case COMPRESS:
5036    case CONTENT:
5037    case CS:
5038    case DB2SQL:
5039    case DIRTY:
5040    case DOCUMENT:
5041    case EACH:
5042    case EMPTY:
5043    case EXCLUSIVE:
5044    case FN:
5045    case INDEX:
5046    case JAVA:
5047    case LCASE:
5048    case LOCATE:
5049    case LOCK:
5050    case MESSAGE_LOCALE:
5051    case METHOD:
5052    case MODE:
5053    case NEW:
5054    case NEW_TABLE:
5055    case OJ:
5056    case OFF:
5057    case OLD:
5058    case OLD_TABLE:
5059    case PARAMETER:
5060    case PASSING:
5061    case PROPERTIES:
5062    case READS:
5063    case REF:
5064    case REFERENCING:
5065    case RENAME:
5066    case RESET:
5067    case RESULT:
5068    case RETAIN:
5069    case RETURNING:
5070    case RR:
5071    case RS:
5072    case SEQUENCE:
5073    case SEQUENTIAL:
5074    case SETS:
5075    case SHARE:
5076    case SQLID:
5077    case SPECIFIC:
5078    case SQRT:
5079    case STABILITY:
5080    case STRIP:
5081    case STYLE:
5082    case TRIGGER:
5083    case UCASE:
5084    case UR:
5085    case WHITESPACE:
5086    case IDENTIFIER:
5087    case DELIMITED_IDENTIFIER:
5088      str = identifier(Limits.MAX_IDENTIFIER_LENGTH, true);
5089        checkAuthorizationLength(str);
5090        list.add(str);
5091      break;
5092    case PUBLIC:
5093      jj_consume_token(PUBLIC);
5094        list.add( Authorizer.PUBLIC_AUTHORIZATION_ID);
5095      break;
5096    default:
5097      jj_la1[298] = jj_gen;
5098      jj_consume_token(-1);
5099      throw new ParseException();
5100    }
5101  }
5102
5103/*
5104 * <A NAME="revokeStatement">revokeStatement</A>
5105 */

5106  final public QueryTreeNode revokeStatement() throws ParseException, StandardException {
5107    QueryTreeNode node;
5108    jj_consume_token(REVOKE);
5109          checkVersion( DataDictionary.DD_VERSION_DERBY_10_2, "REVOKE");
5110          checkSqlStandardAccess( "REVOKE");
5111    switch (jj_nt.kind) {
5112    case ALL:
5113    case DELETE:
5114    case INSERT:
5115    case REFERENCES:
5116    case SELECT:
5117    case UPDATE:
5118    case TRIGGER:
5119      node = tableRevokeStatement();
5120      break;
5121    case EXECUTE:
5122      node = routineRevokeStatement();
5123      break;
5124    default:
5125      jj_la1[299] = jj_gen;
5126      jj_consume_token(-1);
5127      throw new ParseException();
5128    }
5129        {if (true) return node;}
5130    throw new Error JavaDoc("Missing return statement in function");
5131  }
5132
5133/*
5134 * <A NAME="tableRevokeStatement">tableRevokeStatement</A>
5135 */

5136  final public QueryTreeNode tableRevokeStatement() throws ParseException, StandardException {
5137    PrivilegeNode privileges = null;
5138    List grantees;
5139    privileges = tablePrivileges();
5140    jj_consume_token(FROM);
5141    grantees = granteeList();
5142        {if (true) return nodeFactory.getNode( C_NodeTypes.REVOKE_NODE,
5143                                    privileges, grantees,
5144                                    getContextManager());}
5145    throw new Error JavaDoc("Missing return statement in function");
5146  }
5147
5148 // end of tableRevokeStatement
5149

5150/*
5151 * <A NAME="routineRevokeStatement">routineRevokeStatement</A>
5152 */

5153  final public QueryTreeNode routineRevokeStatement() throws ParseException, StandardException {
5154    List grantees;
5155    RoutineDesignator routine = null;
5156    jj_consume_token(EXECUTE);
5157    jj_consume_token(ON);
5158    routine = routineDesignator();
5159    jj_consume_token(FROM);
5160    grantees = granteeList();
5161    jj_consume_token(RESTRICT);
5162        PrivilegeNode routinePrivilege = (PrivilegeNode)
5163          nodeFactory.getNode( C_NodeTypes.PRIVILEGE_NODE,
5164                               ReuseFactory.getInteger( PrivilegeNode.ROUTINE_PRIVILEGES),
5165                               routine, null,
5166                               getContextManager());
5167        {if (true) return nodeFactory.getNode( C_NodeTypes.REVOKE_NODE,
5168                                    routinePrivilege, grantees,
5169                                    getContextManager());}
5170    throw new Error JavaDoc("Missing return statement in function");
5171  }
5172
5173 // end of routineRevokeStatement
5174

5175/*
5176 * <A NAME="identifier">identifier</A>
5177 */

5178  final public String JavaDoc internalIdentifier(int id_length_limit, boolean useANSICasing, boolean checkLength) throws ParseException, StandardException {
5179        String JavaDoc str;
5180        Token tok;
5181    switch (jj_nt.kind) {
5182    case IDENTIFIER:
5183      tok = jj_consume_token(IDENTIFIER);
5184        if( useANSICasing)
5185            str = StringUtil.SQLToUpperCase(tok.image);
5186        else
5187            str = getLanguageConnectionContext().convertIdentifierCase( tok.image);
5188                if (checkLength) {//if checkLength false, then calling method would do the length limit checks
5189
//limit the identifier to the id length limit passed to this method
5190
checkIdentifierLengthLimit(str, id_length_limit);
5191                }
5192                // Remember whether last token was a delimited identifier
5193
nextToLastTokenDelimitedIdentifier = lastTokenDelimitedIdentifier;
5194                lastTokenDelimitedIdentifier = Boolean.FALSE;
5195                nextToLastIdentifierToken = lastIdentifierToken;
5196                lastIdentifierToken = tok;
5197                {if (true) return str;}
5198      break;
5199    case DELIMITED_IDENTIFIER:
5200      str = delimitedIdentifier();
5201                if (checkLength) {//if checkLength false, then calling method would do the length limit checks
5202
//limit the identifier to the id length limit passed to this method
5203
checkIdentifierLengthLimit(str, id_length_limit);
5204                }
5205                {if (true) return str;}
5206      break;
5207    case BINARY:
5208    case COALESCE:
5209    case COUNT:
5210    case D:
5211    case MODULE:
5212    case T:
5213    case TS:
5214    case VALUE:
5215    case VARBINARY:
5216    case ABS:
5217    case ABSVAL:
5218    case ACTION:
5219    case ALWAYS:
5220    case BLOB:
5221    case C:
5222    case CALLED:
5223    case CLOB:
5224    case COBOL:
5225    case COMMITTED:
5226    case CONCAT:
5227    case CONTAINS:
5228    case DATA:
5229    case DATE:
5230    case DAY:
5231    case DYNAMIC:
5232    case FORTRAN:
5233    case GENERATED:
5234    case IDENTITY_VAL_LOCAL:
5235    case INCREMENT:
5236    case INITIAL:
5237    case INTERVAL:
5238    case LANGUAGE:
5239    case LARGE:
5240    case LENGTH:
5241    case LEVEL:
5242    case LOCKS:
5243    case LOCKSIZE:
5244    case LOGGED:
5245    case MOD:
5246    case MODIFIES:
5247    case MODIFY:
5248    case MONTH:
5249    case _MORE:
5250    case MUMPS:
5251    case NAME:
5252    case NCLOB:
5253    case NULLABLE:
5254    case NUMBER:
5255    case OBJECT:
5256    case PASCAL:
5257    case PLI:
5258    case PRECISION:
5259    case RELEASE:
5260    case REPEATABLE:
5261    case RESTART:
5262    case RETURNS:
5263    case ROW:
5264    case SAVEPOINT:
5265    case SCALE:
5266    case SERIALIZABLE:
5267    case SQL_TSI_FRAC_SECOND:
5268    case SQL_TSI_SECOND:
5269    case SQL_TSI_MINUTE:
5270    case SQL_TSI_HOUR:
5271    case SQL_TSI_DAY:
5272    case SQL_TSI_WEEK:
5273    case SQL_TSI_MONTH:
5274    case SQL_TSI_QUARTER:
5275    case SQL_TSI_YEAR:
5276    case START:
5277    case STATEMENT:
5278    case SYNONYM:
5279    case THEN:
5280    case TIME:
5281    case TIMESTAMP:
5282    case TIMESTAMPADD:
5283    case TIMESTAMPDIFF:
5284    case TRUNCATE:
5285    case TYPE:
5286    case UNCOMMITTED:
5287    case USAGE:
5288    case WHEN:
5289    case CURDATE:
5290    case CURTIME:
5291    case DATABASE:
5292    case LONG:
5293    case AFTER:
5294    case BEFORE:
5295    case CLASS:
5296    case COMPRESS:
5297    case CONTENT:
5298    case CS:
5299    case DB2SQL:
5300    case DIRTY:
5301    case DOCUMENT:
5302    case EACH:
5303    case EMPTY:
5304    case EXCLUSIVE:
5305    case FN:
5306    case INDEX:
5307    case JAVA:
5308    case LCASE:
5309    case LOCATE:
5310    case LOCK:
5311    case MESSAGE_LOCALE:
5312    case METHOD:
5313    case MODE:
5314    case NEW:
5315    case NEW_TABLE:
5316    case OJ:
5317    case OFF:
5318    case OLD:
5319    case OLD_TABLE:
5320    case PARAMETER:
5321    case PASSING:
5322    case PROPERTIES:
5323    case READS:
5324    case REF:
5325    case REFERENCING:
5326    case RENAME:
5327    case RESET:
5328    case RESULT:
5329    case RETAIN:
5330    case RETURNING:
5331    case RR:
5332    case RS:
5333    case SEQUENCE:
5334    case SEQUENTIAL:
5335    case SETS:
5336    case SHARE:
5337    case SQLID:
5338    case SPECIFIC:
5339    case SQRT:
5340    case STABILITY:
5341    case STRIP:
5342    case STYLE:
5343    case TRIGGER:
5344    case UCASE:
5345    case UR:
5346    case WHITESPACE:
5347      str = nonReservedKeyword();
5348                {if (true) return getLanguageConnectionContext().convertIdentifierCase( str);}
5349      break;
5350    default:
5351      jj_la1[300] = jj_gen;
5352      jj_consume_token(-1);
5353      throw new ParseException();
5354    }
5355    throw new Error JavaDoc("Missing return statement in function");
5356  }
5357
5358  final public String JavaDoc identifier(int id_length_limit, boolean checkLength) throws ParseException, StandardException {
5359        String JavaDoc id;
5360    id = internalIdentifier(id_length_limit, false, checkLength);
5361        {if (true) return id;}
5362    throw new Error JavaDoc("Missing return statement in function");
5363  }
5364
5365/*
5366 * <A NAME="delimitedIdentifier">delimitedIdentifier</A>
5367 */

5368  final public String JavaDoc delimitedIdentifier() throws ParseException {
5369        String JavaDoc str;
5370        Token tok;
5371    tok = jj_consume_token(DELIMITED_IDENTIFIER);
5372                str = tok.image.substring(1, tok.image.length() -1);
5373                str = normalizeDelimitedID( str );
5374                // Remember whether last token was a delimited identifier
5375
nextToLastTokenDelimitedIdentifier = lastTokenDelimitedIdentifier;
5376                lastTokenDelimitedIdentifier = Boolean.TRUE;
5377                nextToLastIdentifierToken = lastIdentifierToken;
5378                lastIdentifierToken = tok;
5379
5380                {if (true) return str;}
5381    throw new Error JavaDoc("Missing return statement in function");
5382  }
5383
5384/*
5385 * <A NAME="reservedKeyword">reservedKeyword</A>
5386 */

5387  final public String JavaDoc reservedKeyword() throws ParseException {
5388        Token tok;
5389    switch (jj_nt.kind) {
5390    case ADD:
5391      /* SQL92 reserved Keywords */
5392              tok = jj_consume_token(ADD);
5393      break;
5394    case ALL:
5395      tok = jj_consume_token(ALL);
5396      break;
5397    case ALLOCATE:
5398      tok = jj_consume_token(ALLOCATE);
5399      break;
5400    case ALTER:
5401      tok = jj_consume_token(ALTER);
5402      break;
5403    case AND:
5404      tok = jj_consume_token(AND);
5405      break;
5406    case ANY:
5407      tok = jj_consume_token(ANY);
5408      break;
5409    case ARE:
5410      tok = jj_consume_token(ARE);
5411      break;
5412    case AS:
5413      tok = jj_consume_token(AS);
5414      break;
5415    case ASC:
5416      tok = jj_consume_token(ASC);
5417      break;
5418    case ASSERTION:
5419      tok = jj_consume_token(ASSERTION);
5420      break;
5421    case AT:
5422      tok = jj_consume_token(AT);
5423      break;
5424    case AUTHORIZATION:
5425      tok = jj_consume_token(AUTHORIZATION);
5426      break;
5427    case AVG:
5428      tok = jj_consume_token(AVG);
5429      break;
5430    case BEGIN:
5431      tok = jj_consume_token(BEGIN);
5432      break;
5433    case BETWEEN:
5434      tok = jj_consume_token(BETWEEN);
5435      break;
5436    case BIT:
5437      tok = jj_consume_token(BIT);
5438      break;
5439    case BOTH:
5440      tok = jj_consume_token(BOTH);
5441      break;
5442    case BY:
5443      tok = jj_consume_token(BY);
5444      break;
5445    case CASCADE:
5446      tok = jj_consume_token(CASCADE);
5447      break;
5448    case CASCADED:
5449      tok = jj_consume_token(CASCADED);
5450      break;
5451    case CASE:
5452      tok = jj_consume_token(CASE);
5453      break;
5454    case CAST:
5455      tok = jj_consume_token(CAST);
5456      break;
5457    case CHAR:
5458      tok = jj_consume_token(CHAR);
5459      break;
5460    case CHARACTER:
5461      tok = jj_consume_token(CHARACTER);
5462      break;
5463    case CHECK:
5464      tok = jj_consume_token(CHECK);
5465      break;
5466    case CLOSE:
5467      tok = jj_consume_token(CLOSE);
5468      break;
5469    case COLLATE:
5470      tok = jj_consume_token(COLLATE);
5471      break;
5472    case COLLATION:
5473      tok = jj_consume_token(COLLATION);
5474      break;
5475    case COLUMN:
5476      tok = jj_consume_token(COLUMN);
5477      break;
5478    case COMMIT:
5479      tok = jj_consume_token(COMMIT);
5480      break;
5481    case CONNECT:
5482      tok = jj_consume_token(CONNECT);
5483      break;
5484    case CONNECTION:
5485      tok = jj_consume_token(CONNECTION);
5486      break;
5487    case CONSTRAINT:
5488      tok = jj_consume_token(CONSTRAINT);
5489      break;
5490    case CONSTRAINTS:
5491      tok = jj_consume_token(CONSTRAINTS);
5492      break;
5493    case CONTINUE:
5494      tok = jj_consume_token(CONTINUE);
5495      break;
5496    case CONVERT:
5497      tok = jj_consume_token(CONVERT);
5498      break;
5499    case CORRESPONDING:
5500      tok = jj_consume_token(CORRESPONDING);
5501      break;
5502    case CREATE:
5503      tok = jj_consume_token(CREATE);
5504      break;
5505    case CURRENT:
5506      tok = jj_consume_token(CURRENT);
5507      break;
5508    case CURRENT_DATE:
5509      tok = jj_consume_token(CURRENT_DATE);
5510      break;
5511    case CURRENT_TIME:
5512      tok = jj_consume_token(CURRENT_TIME);
5513      break;
5514    case CURRENT_TIMESTAMP:
5515      tok = jj_consume_token(CURRENT_TIMESTAMP);
5516      break;
5517    case CURRENT_USER:
5518      tok = jj_consume_token(CURRENT_USER);
5519      break;
5520    case CURSOR:
5521      tok = jj_consume_token(CURSOR);
5522      break;
5523    case DEALLOCATE:
5524      tok = jj_consume_token(DEALLOCATE);
5525      break;
5526    case DEC:
5527      tok = jj_consume_token(DEC);
5528      break;
5529    case DECIMAL:
5530      tok = jj_consume_token(DECIMAL);
5531      break;
5532    case DECLARE:
5533      tok = jj_consume_token(DECLARE);
5534      break;
5535    case _DEFAULT:
5536      tok = jj_consume_token(_DEFAULT);
5537      break;
5538    case DEFERRABLE:
5539      tok = jj_consume_token(DEFERRABLE);
5540      break;
5541    case DEFERRED:
5542      tok = jj_consume_token(DEFERRED);
5543      break;
5544    case DELETE:
5545      tok = jj_consume_token(DELETE);
5546      break;
5547    case DESC:
5548      tok = jj_consume_token(DESC);
5549      break;
5550    case DESCRIBE:
5551      tok = jj_consume_token(DESCRIBE);
5552      break;
5553    case DIAGNOSTICS:
5554      tok = jj_consume_token(DIAGNOSTICS);
5555      break;
5556    case DISCONNECT:
5557      tok = jj_consume_token(DISCONNECT);
5558      break;
5559    case DISTINCT:
5560      tok = jj_consume_token(DISTINCT);
5561      break;
5562    case DOUBLE:
5563      tok = jj_consume_token(DOUBLE);
5564      break;
5565    case DROP:
5566      tok = jj_consume_token(DROP);
5567      break;
5568    case ELSE:
5569      tok = jj_consume_token(ELSE);
5570      break;
5571    case END:
5572      tok = jj_consume_token(END);
5573      break;
5574    case ENDEXEC:
5575      tok = jj_consume_token(ENDEXEC);
5576      break;
5577    case ESCAPE:
5578      tok = jj_consume_token(ESCAPE);
5579      break;
5580    case EXCEPT:
5581      tok = jj_consume_token(EXCEPT);
5582      break;
5583    case EXCEPTION:
5584      tok = jj_consume_token(EXCEPTION);
5585      break;
5586    case EXEC:
5587      tok = jj_consume_token(EXEC);
5588      break;
5589    case EXECUTE:
5590      tok = jj_consume_token(EXECUTE);
5591      break;
5592    case EXISTS:
5593      tok = jj_consume_token(EXISTS);
5594      break;
5595    case EXTERNAL:
5596      tok = jj_consume_token(EXTERNAL);
5597      break;
5598    case FALSE:
5599      tok = jj_consume_token(FALSE);
5600      break;
5601    case FETCH:
5602      tok = jj_consume_token(FETCH);
5603      break;
5604    case FIRST:
5605      tok = jj_consume_token(FIRST);
5606      break;
5607    case FLOAT:
5608      tok = jj_consume_token(FLOAT);
5609      break;
5610    case FOR:
5611      tok = jj_consume_token(FOR);
5612      break;
5613    case FOREIGN:
5614      tok = jj_consume_token(FOREIGN);
5615      break;
5616    case FOUND:
5617      tok = jj_consume_token(FOUND);
5618      break;
5619    case FROM:
5620      tok = jj_consume_token(FROM);
5621      break;
5622    case FULL:
5623      tok = jj_consume_token(FULL);
5624      break;
5625    case FUNCTION:
5626      tok = jj_consume_token(FUNCTION);
5627      break;
5628    case GET:
5629      tok = jj_consume_token(GET);
5630      break;
5631    case GET_CURRENT_CONNECTION:
5632      tok = jj_consume_token(GET_CURRENT_CONNECTION);
5633      break;
5634    case GLOBAL:
5635      tok = jj_consume_token(GLOBAL);
5636      break;
5637    case GO:
5638      tok = jj_consume_token(GO);
5639      break;
5640    case GOTO:
5641      tok = jj_consume_token(GOTO);
5642      break;
5643    case GRANT:
5644      tok = jj_consume_token(GRANT);
5645      break;
5646    case GROUP:
5647      tok = jj_consume_token(GROUP);
5648      break;
5649    case HAVING:
5650      tok = jj_consume_token(HAVING);
5651      break;
5652    case HOUR:
5653      tok = jj_consume_token(HOUR);
5654      break;
5655    case IDENTITY:
5656      tok = jj_consume_token(IDENTITY);
5657      break;
5658    case IMMEDIATE:
5659      tok = jj_consume_token(IMMEDIATE);
5660      break;
5661    case IN:
5662      tok = jj_consume_token(IN);
5663      break;
5664    case INDICATOR:
5665      tok = jj_consume_token(INDICATOR);
5666      break;
5667    case INITIALLY:
5668      tok = jj_consume_token(INITIALLY);
5669      break;
5670    case INNER:
5671      tok = jj_consume_token(INNER);
5672      break;
5673    case INOUT:
5674      tok = jj_consume_token(INOUT);
5675      break;
5676    case INPUT:
5677      tok = jj_consume_token(INPUT);
5678      break;
5679    case INSENSITIVE:
5680      tok = jj_consume_token(INSENSITIVE);
5681      break;
5682    case INSERT:
5683      tok = jj_consume_token(INSERT);
5684      break;
5685    case INT:
5686      tok = jj_consume_token(INT);
5687      break;
5688    case INTEGER:
5689      tok = jj_consume_token(INTEGER);
5690      break;
5691    case INTERSECT:
5692      tok = jj_consume_token(INTERSECT);
5693      break;
5694    case INTO:
5695      tok = jj_consume_token(INTO);
5696      break;
5697    case IS:
5698      tok = jj_consume_token(IS);
5699      break;
5700    case ISOLATION:
5701      tok = jj_consume_token(ISOLATION);
5702      break;
5703    case JOIN:
5704      tok = jj_consume_token(JOIN);
5705      break;
5706    case KEY:
5707      tok = jj_consume_token(KEY);
5708      break;
5709    case LAST:
5710      tok = jj_consume_token(LAST);
5711      break;
5712    case LEFT:
5713      tok = jj_consume_token(LEFT);
5714      break;
5715    case LIKE:
5716      tok = jj_consume_token(LIKE);
5717      break;
5718    case LOWER:
5719      tok = jj_consume_token(LOWER);
5720      break;
5721    case MATCH:
5722      tok = jj_consume_token(MATCH);
5723      break;
5724    case MAX:
5725      tok = jj_consume_token(MAX);
5726      break;
5727    case MIN:
5728      tok = jj_consume_token(MIN);
5729      break;
5730    case MINUTE:
5731      tok = jj_consume_token(MINUTE);
5732      break;
5733    case NATIONAL:
5734      tok = jj_consume_token(NATIONAL);
5735      break;
5736    case NATURAL:
5737      tok = jj_consume_token(NATURAL);
5738      break;
5739    case NCHAR:
5740      tok = jj_consume_token(NCHAR);
5741      break;
5742    case NVARCHAR:
5743      tok = jj_consume_token(NVARCHAR);
5744      break;
5745    case NEXT:
5746      tok = jj_consume_token(NEXT);
5747      break;
5748    case NO:
5749      tok = jj_consume_token(NO);
5750      break;
5751    case NOT:
5752      tok = jj_consume_token(NOT);
5753      break;
5754    case NULL:
5755      tok = jj_consume_token(NULL);
5756      break;
5757    case NULLIF:
5758      tok = jj_consume_token(NULLIF);
5759      break;
5760    case NUMERIC:
5761      tok = jj_consume_token(NUMERIC);
5762      break;
5763    case OF:
5764      tok = jj_consume_token(OF);
5765      break;
5766    case ON:
5767      tok = jj_consume_token(ON);
5768      break;
5769    case ONLY:
5770      tok = jj_consume_token(ONLY);
5771      break;
5772    case OPEN:
5773      tok = jj_consume_token(OPEN);
5774      break;
5775    case OPTION:
5776      tok = jj_consume_token(OPTION);
5777      break;
5778    case OR:
5779      tok = jj_consume_token(OR);
5780      break;
5781    case ORDER:
5782      tok = jj_consume_token(ORDER);
5783      break;
5784    case OUT:
5785      tok = jj_consume_token(OUT);
5786      break;
5787    case OUTER:
5788      tok = jj_consume_token(OUTER);
5789      break;
5790    case OUTPUT:
5791      tok = jj_consume_token(OUTPUT);
5792      break;
5793    case OVERLAPS:
5794      tok = jj_consume_token(OVERLAPS);
5795      break;
5796    case PAD:
5797      tok = jj_consume_token(PAD);
5798      break;
5799    case PARTIAL:
5800      tok = jj_consume_token(PARTIAL);
5801      break;
5802    case PREPARE:
5803      tok = jj_consume_token(PREPARE);
5804      break;
5805    case PRESERVE:
5806      tok = jj_consume_token(PRESERVE);
5807      break;
5808    case PRIMARY:
5809      tok = jj_consume_token(PRIMARY);
5810      break;
5811    case PRIOR:
5812      tok = jj_consume_token(PRIOR);
5813      break;
5814    case PRIVILEGES:
5815      tok = jj_consume_token(PRIVILEGES);
5816      break;
5817    case PROCEDURE:
5818      tok = jj_consume_token(PROCEDURE);
5819      break;
5820    case PUBLIC:
5821      tok = jj_consume_token(PUBLIC);
5822      break;
5823    case READ:
5824      tok = jj_consume_token(READ);
5825      break;
5826    case REAL:
5827      tok = jj_consume_token(REAL);
5828      break;
5829    case REFERENCES:
5830      tok = jj_consume_token(REFERENCES);
5831      break;
5832    case RELATIVE:
5833      tok = jj_consume_token(RELATIVE);
5834      break;
5835    case RESTRICT:
5836      tok = jj_consume_token(RESTRICT);
5837      break;
5838    case REVOKE:
5839      tok = jj_consume_token(REVOKE);
5840      break;
5841    case RIGHT:
5842      tok = jj_consume_token(RIGHT);
5843      break;
5844    case ROLLBACK:
5845      tok = jj_consume_token(ROLLBACK);
5846      break;
5847    case ROWS:
5848      tok = jj_consume_token(ROWS);
5849      break;
5850    case SCHEMA:
5851      tok = jj_consume_token(SCHEMA);
5852      break;
5853    case SCROLL:
5854      tok = jj_consume_token(SCROLL);
5855      break;
5856    case SECOND:
5857      tok = jj_consume_token(SECOND);
5858      break;
5859    case SELECT:
5860      tok = jj_consume_token(SELECT);
5861      break;
5862    case SESSION_USER:
5863      tok = jj_consume_token(SESSION_USER);
5864      break;
5865    case SET:
5866      tok = jj_consume_token(SET);
5867      break;
5868    case SMALLINT:
5869      tok = jj_consume_token(SMALLINT);
5870      break;
5871    case SOME:
5872      tok = jj_consume_token(SOME);
5873      break;
5874    case SPACE:
5875      tok = jj_consume_token(SPACE);
5876      break;
5877    case SQL:
5878      tok = jj_consume_token(SQL);
5879      break;
5880    case SQLCODE:
5881      tok = jj_consume_token(SQLCODE);
5882      break;
5883    case SQLERROR:
5884      tok = jj_consume_token(SQLERROR);
5885      break;
5886    case SQLSTATE:
5887      tok = jj_consume_token(SQLSTATE);
5888      break;
5889    case SUBSTRING:
5890      tok = jj_consume_token(SUBSTRING);
5891      break;
5892    case SUM:
5893      tok = jj_consume_token(SUM);
5894      break;
5895    case SYSTEM_USER:
5896      tok = jj_consume_token(SYSTEM_USER);
5897      break;
5898    case TABLE:
5899      tok = jj_consume_token(TABLE);
5900      break;
5901    case TEMPORARY:
5902      tok = jj_consume_token(TEMPORARY);
5903      break;
5904    case TIMEZONE_HOUR:
5905      tok = jj_consume_token(TIMEZONE_HOUR);
5906      break;
5907    case TIMEZONE_MINUTE:
5908      tok = jj_consume_token(TIMEZONE_MINUTE);
5909      break;
5910    case TO:
5911      tok = jj_consume_token(TO);
5912      break;
5913    case TRANSACTION:
5914      tok = jj_consume_token(TRANSACTION);
5915      break;
5916    case TRANSLATE:
5917      tok = jj_consume_token(TRANSLATE);
5918      break;
5919    case TRANSLATION:
5920      tok = jj_consume_token(TRANSLATION);
5921      break;
5922    case TRUE:
5923      tok = jj_consume_token(TRUE);
5924      break;
5925    case UNION:
5926      tok = jj_consume_token(UNION);
5927      break;
5928    case UNIQUE:
5929      tok = jj_consume_token(UNIQUE);
5930      break;
5931    case UNKNOWN:
5932      tok = jj_consume_token(UNKNOWN);
5933      break;
5934    case UPDATE:
5935      tok = jj_consume_token(UPDATE);
5936      break;
5937    case UPPER:
5938      tok = jj_consume_token(UPPER);
5939      break;
5940    case USER:
5941      tok = jj_consume_token(USER);
5942      break;
5943    case USING:
5944      tok = jj_consume_token(USING);
5945      break;
5946    case VALUES:
5947      tok = jj_consume_token(VALUES);
5948      break;
5949    case VARCHAR:
5950      tok = jj_consume_token(VARCHAR);
5951      break;
5952    case VARYING:
5953      tok = jj_consume_token(VARYING);
5954      break;
5955    case VIEW:
5956      tok = jj_consume_token(VIEW);
5957      break;
5958    case WHENEVER:
5959      tok = jj_consume_token(WHENEVER);
5960      break;
5961    case WHERE:
5962      tok = jj_consume_token(WHERE);
5963      break;
5964    case WITH:
5965      tok = jj_consume_token(WITH);
5966      break;
5967    case WORK:
5968      tok = jj_consume_token(WORK);
5969      break;
5970    case WRITE:
5971      tok = jj_consume_token(WRITE);
5972      break;
5973    case YEAR:
5974      tok = jj_consume_token(YEAR);
5975      break;
5976    case BOOLEAN:
5977      tok = jj_consume_token(BOOLEAN);
5978      break;
5979    case CALL:
5980      tok = jj_consume_token(CALL);
5981      break;
5982    case EXPLAIN:
5983      tok = jj_consume_token(EXPLAIN);
5984      break;
5985    case LONGINT:
5986      tok = jj_consume_token(LONGINT);
5987      break;
5988    case LTRIM:
5989      tok = jj_consume_token(LTRIM);
5990      break;
5991    case RTRIM:
5992      tok = jj_consume_token(RTRIM);
5993      break;
5994    case SUBSTR:
5995      tok = jj_consume_token(SUBSTR);
5996      break;
5997    case XML:
5998      tok = jj_consume_token(XML);
5999      break;
6000    case XMLPARSE:
6001      tok = jj_consume_token(XMLPARSE);
6002      break;
6003    case XMLSERIALIZE:
6004      tok = jj_consume_token(XMLSERIALIZE);
6005      break;
6006    case XMLEXISTS:
6007      tok = jj_consume_token(XMLEXISTS);
6008      break;
6009    case XMLQUERY:
6010      tok = jj_consume_token(XMLQUERY);
6011      break;
6012    default:
6013      jj_la1[301] = jj_gen;
6014      jj_consume_token(-1);
6015      throw new ParseException();
6016    }
6017                // Remember whether last token was a delimited identifier
6018
nextToLastTokenDelimitedIdentifier = lastTokenDelimitedIdentifier;
6019                lastTokenDelimitedIdentifier = Boolean.FALSE;
6020                {if (true) return tok.image;}
6021    throw new Error JavaDoc("Missing return statement in function");
6022  }
6023
6024/*
6025 * <A NAME="nonReservedKeyword">nonReservedKeyword</A>
6026 */

6027  final public String JavaDoc nonReservedKeyword() throws ParseException {
6028        Token tok;
6029    switch (jj_nt.kind) {
6030    case ABS:
6031      tok = jj_consume_token(ABS);
6032      break;
6033    case ABSVAL:
6034      tok = jj_consume_token(ABSVAL);
6035      break;
6036    case ACTION:
6037      tok = jj_consume_token(ACTION);
6038      break;
6039    case AFTER:
6040      tok = jj_consume_token(AFTER);
6041      break;
6042    case ALWAYS:
6043      tok = jj_consume_token(ALWAYS);
6044      break;
6045    case BEFORE:
6046      tok = jj_consume_token(BEFORE);
6047      break;
6048    case BINARY:
6049      tok = jj_consume_token(BINARY);
6050      break;
6051    case BLOB:
6052      tok = jj_consume_token(BLOB);
6053      break;
6054    case C:
6055      tok = jj_consume_token(C);
6056      break;
6057    case CALLED:
6058      tok = jj_consume_token(CALLED);
6059      break;
6060    case CLASS:
6061      tok = jj_consume_token(CLASS);
6062      break;
6063    case CLOB:
6064      tok = jj_consume_token(CLOB);
6065      break;
6066    case COALESCE:
6067      tok = jj_consume_token(COALESCE);
6068      break;
6069    case COBOL:
6070      tok = jj_consume_token(COBOL);
6071      break;
6072    case COMMITTED:
6073      tok = jj_consume_token(COMMITTED);
6074      break;
6075    case COMPRESS:
6076      tok = jj_consume_token(COMPRESS);
6077      break;
6078    case CONCAT:
6079      tok = jj_consume_token(CONCAT);
6080      break;
6081    case CONTAINS:
6082      tok = jj_consume_token(CONTAINS);
6083      break;
6084    case CONTENT:
6085      tok = jj_consume_token(CONTENT);
6086      break;
6087    case COUNT:
6088      tok = jj_consume_token(COUNT);
6089      break;
6090    case CS:
6091      tok = jj_consume_token(CS);
6092      break;
6093    case CURDATE:
6094      tok = jj_consume_token(CURDATE);
6095      break;
6096    case CURTIME:
6097      tok = jj_consume_token(CURTIME);
6098      break;
6099    case D:
6100      tok = jj_consume_token(D);
6101      break;
6102    case DATA:
6103      tok = jj_consume_token(DATA);
6104      break;
6105    case DATE:
6106      tok = jj_consume_token(DATE);
6107      break;
6108    case DAY:
6109      tok = jj_consume_token(DAY);
6110      break;
6111    case DIRTY:
6112      tok = jj_consume_token(DIRTY);
6113      break;
6114    case DYNAMIC:
6115      tok = jj_consume_token(DYNAMIC);
6116      break;
6117    case DATABASE:
6118      tok = jj_consume_token(DATABASE);
6119      break;
6120    case DB2SQL:
6121      tok = jj_consume_token(DB2SQL);
6122      break;
6123    case DOCUMENT:
6124      tok = jj_consume_token(DOCUMENT);
6125      break;
6126    case EACH:
6127      tok = jj_consume_token(EACH);
6128      break;
6129    case EMPTY:
6130      tok = jj_consume_token(EMPTY);
6131      break;
6132    case EXCLUSIVE:
6133      tok = jj_consume_token(EXCLUSIVE);
6134      break;
6135    case FN:
6136      tok = jj_consume_token(FN);
6137      break;
6138    case FORTRAN:
6139      tok = jj_consume_token(FORTRAN);
6140      break;
6141    case GENERATED:
6142      tok = jj_consume_token(GENERATED);
6143      break;
6144    case IDENTITY_VAL_LOCAL:
6145      tok = jj_consume_token(IDENTITY_VAL_LOCAL);
6146      break;
6147    case INCREMENT:
6148      tok = jj_consume_token(INCREMENT);
6149      break;
6150    case INDEX:
6151      tok = jj_consume_token(INDEX);
6152      break;
6153    case INITIAL:
6154      tok = jj_consume_token(INITIAL);
6155      break;
6156    case INTERVAL:
6157      tok = jj_consume_token(INTERVAL);
6158      break;
6159    case JAVA:
6160      tok = jj_consume_token(JAVA);
6161      break;
6162    case LANGUAGE:
6163      tok = jj_consume_token(LANGUAGE);
6164      break;
6165    case LARGE:
6166      tok = jj_consume_token(LARGE);
6167      break;
6168    case LCASE:
6169      tok = jj_consume_token(LCASE);
6170      break;
6171    case LENGTH:
6172      tok = jj_consume_token(LENGTH);
6173      break;
6174    case LEVEL:
6175      tok = jj_consume_token(LEVEL);
6176      break;
6177    case LOCATE:
6178      tok = jj_consume_token(LOCATE);
6179      break;
6180    case LOCK:
6181      tok = jj_consume_token(LOCK);
6182      break;
6183    case LOCKS:
6184      tok = jj_consume_token(LOCKS);
6185      break;
6186    case LOCKSIZE:
6187      tok = jj_consume_token(LOCKSIZE);
6188      break;
6189    case LOGGED:
6190      tok = jj_consume_token(LOGGED);
6191      break;
6192    case LONG:
6193      tok = jj_consume_token(LONG);
6194      break;
6195    case MESSAGE_LOCALE:
6196      tok = jj_consume_token(MESSAGE_LOCALE);
6197      break;
6198    case METHOD:
6199      tok = jj_consume_token(METHOD);
6200      break;
6201    case MOD:
6202      tok = jj_consume_token(MOD);
6203      break;
6204    case MODE:
6205      tok = jj_consume_token(MODE);
6206      break;
6207    case MODIFIES:
6208      tok = jj_consume_token(MODIFIES);
6209      break;
6210    case MODIFY:
6211      tok = jj_consume_token(MODIFY);
6212      break;
6213    case MODULE:
6214      tok = jj_consume_token(MODULE);
6215      break;
6216    case MONTH:
6217      tok = jj_consume_token(MONTH);
6218      break;
6219    case _MORE:
6220      tok = jj_consume_token(_MORE);
6221      break;
6222    case MUMPS:
6223      tok = jj_consume_token(MUMPS);
6224      break;
6225    case NAME:
6226      tok = jj_consume_token(NAME);
6227      break;
6228    case NCLOB:
6229      tok = jj_consume_token(NCLOB);
6230      break;
6231    case NEW:
6232      tok = jj_consume_token(NEW);
6233      break;
6234    case NEW_TABLE:
6235      tok = jj_consume_token(NEW_TABLE);
6236      break;
6237    case NULLABLE:
6238      tok = jj_consume_token(NULLABLE);
6239      break;
6240    case NUMBER:
6241      tok = jj_consume_token(NUMBER);
6242      break;
6243    case OBJECT:
6244      tok = jj_consume_token(OBJECT);
6245      break;
6246    case OFF:
6247      tok = jj_consume_token(OFF);
6248      break;
6249    case OLD:
6250      tok = jj_consume_token(OLD);
6251      break;
6252    case OLD_TABLE:
6253      tok = jj_consume_token(OLD_TABLE);
6254      break;
6255    case OJ:
6256      tok = jj_consume_token(OJ);
6257      break;
6258    case PASCAL:
6259      tok = jj_consume_token(PASCAL);
6260      break;
6261    case PASSING:
6262      tok = jj_consume_token(PASSING);
6263      break;
6264    case PLI:
6265      tok = jj_consume_token(PLI);
6266      break;
6267    case PRECISION:
6268      tok = jj_consume_token(PRECISION);
6269      break;
6270    case PROPERTIES:
6271      tok = jj_consume_token(PROPERTIES);
6272      break;
6273    case READS:
6274      tok = jj_consume_token(READS);
6275      break;
6276    case REF:
6277      tok = jj_consume_token(REF);
6278      break;
6279    case RELEASE:
6280      tok = jj_consume_token(RELEASE);
6281      break;
6282    case RENAME:
6283      tok = jj_consume_token(RENAME);
6284      break;
6285    case REPEATABLE:
6286      tok = jj_consume_token(REPEATABLE);
6287      break;
6288    case REFERENCING:
6289      tok = jj_consume_token(REFERENCING);
6290      break;
6291    case RESET:
6292      tok = jj_consume_token(RESET);
6293      break;
6294    case RESTART:
6295      tok = jj_consume_token(RESTART);
6296      break;
6297    case RESULT:
6298      tok = jj_consume_token(RESULT);
6299      break;
6300    case RETAIN:
6301      tok = jj_consume_token(RETAIN);
6302      break;
6303    case RETURNING:
6304      tok = jj_consume_token(RETURNING);
6305      break;
6306    case RETURNS:
6307      tok = jj_consume_token(RETURNS);
6308      break;
6309    case ROW:
6310      tok = jj_consume_token(ROW);
6311      break;
6312    case RR:
6313      tok = jj_consume_token(RR);
6314      break;
6315    case RS:
6316      tok = jj_consume_token(RS);
6317      break;
6318    case SCALE:
6319      tok = jj_consume_token(SCALE);
6320      break;
6321    case SAVEPOINT:
6322      tok = jj_consume_token(SAVEPOINT);
6323      break;
6324    case SEQUENCE:
6325      tok = jj_consume_token(SEQUENCE);
6326      break;
6327    case SEQUENTIAL:
6328      tok = jj_consume_token(SEQUENTIAL);
6329      break;
6330    case SERIALIZABLE:
6331      tok = jj_consume_token(SERIALIZABLE);
6332      break;
6333    case SETS:
6334      tok = jj_consume_token(SETS);
6335      break;
6336    case SHARE:
6337      tok = jj_consume_token(SHARE);
6338      break;
6339    case SPECIFIC:
6340      tok = jj_consume_token(SPECIFIC);
6341      break;
6342    case SQLID:
6343      tok = jj_consume_token(SQLID);
6344      break;
6345    case SQL_TSI_FRAC_SECOND:
6346      tok = jj_consume_token(SQL_TSI_FRAC_SECOND);
6347      break;
6348    case SQL_TSI_SECOND:
6349      tok = jj_consume_token(SQL_TSI_SECOND);
6350      break;
6351    case SQL_TSI_MINUTE:
6352      tok = jj_consume_token(SQL_TSI_MINUTE);
6353      break;
6354    case SQL_TSI_HOUR:
6355      tok = jj_consume_token(SQL_TSI_HOUR);
6356      break;
6357    case SQL_TSI_DAY:
6358      tok = jj_consume_token(SQL_TSI_DAY);
6359      break;
6360    case SQL_TSI_WEEK:
6361      tok = jj_consume_token(SQL_TSI_WEEK);
6362      break;
6363    case SQL_TSI_MONTH:
6364      tok = jj_consume_token(SQL_TSI_MONTH);
6365      break;
6366    case SQL_TSI_QUARTER:
6367      tok = jj_consume_token(SQL_TSI_QUARTER);
6368      break;
6369    case SQL_TSI_YEAR:
6370      tok = jj_consume_token(SQL_TSI_YEAR);
6371      break;
6372    case SQRT:
6373      tok = jj_consume_token(SQRT);
6374      break;
6375    case STABILITY:
6376      tok = jj_consume_token(STABILITY);
6377      break;
6378    case START:
6379      tok = jj_consume_token(START);
6380      break;
6381    case STATEMENT:
6382      tok = jj_consume_token(STATEMENT);
6383      break;
6384    case STRIP:
6385      tok = jj_consume_token(STRIP);
6386      break;
6387    case SYNONYM:
6388      tok = jj_consume_token(SYNONYM);
6389      break;
6390    case STYLE:
6391      tok = jj_consume_token(STYLE);
6392      break;
6393    case T:
6394      tok = jj_consume_token(T);
6395      break;
6396    case THEN:
6397      tok = jj_consume_token(THEN);
6398      break;
6399    case TIME:
6400      tok = jj_consume_token(TIME);
6401      break;
6402    case TIMESTAMP:
6403      tok = jj_consume_token(TIMESTAMP);
6404      break;
6405    case TIMESTAMPADD:
6406      tok = jj_consume_token(TIMESTAMPADD);
6407      break;
6408    case TIMESTAMPDIFF:
6409      tok = jj_consume_token(TIMESTAMPDIFF);
6410      break;
6411    case TRIGGER:
6412      tok = jj_consume_token(TRIGGER);
6413      break;
6414    case TRUNCATE:
6415      tok = jj_consume_token(TRUNCATE);
6416      break;
6417    case TS:
6418      tok = jj_consume_token(TS);
6419      break;
6420    case TYPE:
6421      tok = jj_consume_token(TYPE);
6422      break;
6423    case UCASE:
6424      tok = jj_consume_token(UCASE);
6425      break;
6426    case UNCOMMITTED:
6427      tok = jj_consume_token(UNCOMMITTED);
6428      break;
6429    case UR:
6430      tok = jj_consume_token(UR);
6431      break;
6432    case USAGE:
6433      tok = jj_consume_token(USAGE);
6434      break;
6435    case VALUE:
6436      tok = jj_consume_token(VALUE);
6437      break;
6438    case VARBINARY:
6439      tok = jj_consume_token(VARBINARY);
6440      break;
6441    case PARAMETER:
6442      tok = jj_consume_token(PARAMETER);
6443      break;
6444    case WHEN:
6445      tok = jj_consume_token(WHEN);
6446      break;
6447    case WHITESPACE:
6448      tok = jj_consume_token(WHITESPACE);
6449      break;
6450    default:
6451      jj_la1[302] = jj_gen;
6452      jj_consume_token(-1);
6453      throw new ParseException();
6454    }
6455                // Remember whether last token was a delimited identifier
6456
nextToLastTokenDelimitedIdentifier = lastTokenDelimitedIdentifier;
6457                lastTokenDelimitedIdentifier = Boolean.FALSE;
6458                nextToLastIdentifierToken = lastIdentifierToken;
6459                lastIdentifierToken = tok;
6460                {if (true) return tok.image;}
6461    throw new Error JavaDoc("Missing return statement in function");
6462  }
6463
6464/*
6465 * <A NAME="caseSensitiveIdentifierPlusReservedWords">caseSensitiveIdentifierPlusReservedWords</A>
6466 */

6467  final public String JavaDoc caseSensitiveIdentifierPlusReservedWords() throws ParseException {
6468        String JavaDoc str;
6469    switch (jj_nt.kind) {
6470    case BINARY:
6471    case COALESCE:
6472    case COUNT:
6473    case D:
6474    case MODULE:
6475    case T:
6476    case TS:
6477    case VALUE:
6478    case VARBINARY:
6479    case ABS:
6480    case ABSVAL:
6481    case ACTION:
6482    case ALWAYS:
6483    case BLOB:
6484    case C:
6485    case CALLED:
6486    case CLOB:
6487    case COBOL:
6488    case COMMITTED:
6489    case CONCAT:
6490    case CONTAINS:
6491    case DATA:
6492    case DATE:
6493    case DAY:
6494    case DYNAMIC:
6495    case FORTRAN:
6496    case GENERATED:
6497    case IDENTITY_VAL_LOCAL:
6498    case INCREMENT:
6499    case INITIAL:
6500    case INTERVAL:
6501    case LANGUAGE:
6502    case LARGE:
6503    case LENGTH:
6504    case LEVEL:
6505    case LOCKS:
6506    case LOCKSIZE:
6507    case LOGGED:
6508    case MOD:
6509    case MODIFIES:
6510    case MODIFY:
6511    case MONTH:
6512    case _MORE:
6513    case MUMPS:
6514    case NAME:
6515    case NCLOB:
6516    case NULLABLE:
6517    case NUMBER:
6518    case OBJECT:
6519    case PASCAL:
6520    case PLI:
6521    case PRECISION:
6522    case RELEASE:
6523    case REPEATABLE:
6524    case RESTART:
6525    case RETURNS:
6526    case ROW:
6527    case SAVEPOINT:
6528    case SCALE:
6529    case SERIALIZABLE:
6530    case SQL_TSI_FRAC_SECOND:
6531    case SQL_TSI_SECOND:
6532    case SQL_TSI_MINUTE:
6533    case SQL_TSI_HOUR:
6534    case SQL_TSI_DAY:
6535    case SQL_TSI_WEEK:
6536    case SQL_TSI_MONTH:
6537    case SQL_TSI_QUARTER:
6538    case SQL_TSI_YEAR:
6539    case START:
6540    case STATEMENT:
6541    case SYNONYM:
6542    case THEN:
6543    case TIME:
6544    case TIMESTAMP:
6545    case TIMESTAMPADD:
6546    case TIMESTAMPDIFF:
6547    case TRUNCATE:
6548    case TYPE:
6549    case UNCOMMITTED:
6550    case USAGE:
6551    case WHEN:
6552    case CURDATE:
6553    case CURTIME:
6554    case DATABASE:
6555    case LONG:
6556    case AFTER:
6557    case BEFORE:
6558    case CLASS:
6559    case COMPRESS:
6560    case CONTENT:
6561    case CS:
6562    case DB2SQL:
6563    case DIRTY:
6564    case DOCUMENT:
6565    case EACH:
6566    case EMPTY:
6567    case EXCLUSIVE:
6568    case FN:
6569    case INDEX:
6570    case JAVA:
6571    case LCASE:
6572    case LOCATE:
6573    case LOCK:
6574    case MESSAGE_LOCALE:
6575    case METHOD:
6576    case MODE:
6577    case NEW:
6578    case NEW_TABLE:
6579    case OJ:
6580    case OFF:
6581    case OLD:
6582    case OLD_TABLE:
6583    case PARAMETER:
6584    case PASSING:
6585    case PROPERTIES:
6586    case READS:
6587    case REF:
6588    case REFERENCING:
6589    case RENAME:
6590    case RESET:
6591    case RESULT:
6592    case RETAIN:
6593    case RETURNING:
6594    case RR:
6595    case RS:
6596    case SEQUENCE:
6597    case SEQUENTIAL:
6598    case SETS:
6599    case SHARE:
6600    case SQLID:
6601    case SPECIFIC:
6602    case SQRT:
6603    case STABILITY:
6604    case STRIP:
6605    case STYLE:
6606    case TRIGGER:
6607    case UCASE:
6608    case UR:
6609    case WHITESPACE:
6610    case IDENTIFIER:
6611    case DELIMITED_IDENTIFIER:
6612      str = caseSensitiveIdentifier();
6613                {if (true) return str;}
6614      break;
6615    case ADD:
6616    case ALL:
6617    case ALLOCATE:
6618    case ALTER:
6619    case AND:
6620    case ANY:
6621    case ARE:
6622    case AS:
6623    case ASC:
6624    case ASSERTION:
6625    case AT:
6626    case AUTHORIZATION:
6627    case AVG:
6628    case BEGIN:
6629    case BETWEEN:
6630    case BIT:
6631    case BOTH:
6632    case BY:
6633    case CASCADE:
6634    case CASCADED:
6635    case CASE:
6636    case CAST:
6637    case CHAR:
6638    case CHARACTER:
6639    case CHECK:
6640    case CLOSE:
6641    case COLLATE:
6642    case COLLATION:
6643    case COLUMN:
6644    case COMMIT:
6645    case CONNECT:
6646    case CONNECTION:
6647    case CONSTRAINT:
6648    case CONSTRAINTS:
6649    case CONTINUE:
6650    case CONVERT:
6651    case CORRESPONDING:
6652    case CREATE:
6653    case CURRENT:
6654    case CURRENT_DATE:
6655    case CURRENT_TIME:
6656    case CURRENT_TIMESTAMP:
6657    case CURRENT_USER:
6658    case CURSOR:
6659    case DEALLOCATE:
6660    case DEC:
6661    case DECIMAL:
6662    case DECLARE:
6663    case _DEFAULT:
6664    case DEFERRABLE:
6665    case DEFERRED:
6666    case DELETE:
6667    case DESC:
6668    case DESCRIBE:
6669    case DIAGNOSTICS:
6670    case DISCONNECT:
6671    case DISTINCT:
6672    case DOUBLE:
6673    case DROP:
6674    case ELSE:
6675    case END:
6676    case ENDEXEC:
6677    case ESCAPE:
6678    case EXCEPT:
6679    case EXCEPTION:
6680    case EXEC:
6681    case EXECUTE:
6682    case EXISTS:
6683    case EXTERNAL:
6684    case FALSE:
6685    case FETCH:
6686    case FIRST:
6687    case FLOAT:
6688    case FOR:
6689    case FOREIGN:
6690    case FOUND:
6691    case FROM:
6692    case FULL:
6693    case FUNCTION:
6694    case GET:
6695    case GLOBAL:
6696    case GO:
6697    case GOTO:
6698    case GRANT:
6699    case GROUP:
6700    case HAVING:
6701    case HOUR:
6702    case IDENTITY:
6703    case IMMEDIATE:
6704    case IN:
6705    case INDICATOR:
6706    case INITIALLY:
6707    case INNER:
6708    case INPUT:
6709    case INSENSITIVE:
6710    case INSERT:
6711    case INT:
6712    case INTEGER:
6713    case INTERSECT:
6714    case INTO:
6715    case IS:
6716    case ISOLATION:
6717    case JOIN:
6718    case KEY:
6719    case LAST:
6720    case LEFT:
6721    case LIKE:
6722    case LOWER:
6723    case MATCH:
6724    case MAX:
6725    case MIN:
6726    case MINUTE:
6727    case NATIONAL:
6728    case NATURAL:
6729    case NCHAR:
6730    case NEXT:
6731    case NO:
6732    case NOT:
6733    case NULL:
6734    case NULLIF:
6735    case NUMERIC:
6736    case OF:
6737    case ON:
6738    case ONLY:
6739    case OPEN:
6740    case OPTION:
6741    case OR:
6742    case ORDER:
6743    case OUTER:
6744    case OUTPUT:
6745    case OVERLAPS:
6746    case PAD:
6747    case PARTIAL:
6748    case PREPARE:
6749    case PRESERVE:
6750    case PRIMARY:
6751    case PRIOR:
6752    case PRIVILEGES:
6753    case PROCEDURE:
6754    case PUBLIC:
6755    case READ:
6756    case REAL:
6757    case REFERENCES:
6758    case RELATIVE:
6759    case RESTRICT:
6760    case REVOKE:
6761    case RIGHT:
6762    case ROLLBACK:
6763    case ROWS:
6764    case SCHEMA:
6765    case SCROLL:
6766    case SECOND:
6767    case SELECT:
6768    case SESSION_USER:
6769    case SET:
6770    case SMALLINT:
6771    case SOME:
6772    case SPACE:
6773    case SQL:
6774    case SQLCODE:
6775    case SQLERROR:
6776    case SQLSTATE:
6777    case SUBSTRING:
6778    case SUM:
6779    case SYSTEM_USER:
6780    case TABLE:
6781    case TEMPORARY:
6782    case TIMEZONE_HOUR:
6783    case TIMEZONE_MINUTE:
6784    case TO:
6785    case TRANSACTION:
6786    case TRANSLATE:
6787    case TRANSLATION:
6788    case TRUE:
6789    case UNION:
6790    case UNIQUE:
6791    case UNKNOWN:
6792    case UPDATE:
6793    case UPPER:
6794    case USER:
6795    case USING:
6796    case VALUES:
6797    case VARCHAR:
6798    case VARYING:
6799    case VIEW:
6800    case WHENEVER:
6801    case WHERE:
6802    case WITH:
6803    case WORK:
6804    case WRITE:
6805    case YEAR:
6806    case INOUT:
6807    case BOOLEAN:
6808    case CALL:
6809    case GET_CURRENT_CONNECTION:
6810    case EXPLAIN:
6811    case LONGINT:
6812    case LTRIM:
6813    case RTRIM:
6814    case SUBSTR:
6815    case XML:
6816    case XMLEXISTS:
6817    case XMLPARSE:
6818    case XMLQUERY:
6819    case XMLSERIALIZE:
6820    case NVARCHAR:
6821    case OUT:
6822      str = reservedKeyword();
6823                {if (true) return str;}
6824      break;
6825    default:
6826      jj_la1[303] = jj_gen;
6827      jj_consume_token(-1);
6828      throw new ParseException();
6829    }
6830    throw new Error JavaDoc("Missing return statement in function");
6831  }
6832
6833/*
6834 * <A NAME="caseInsensitiveIdentifierPlusReservedWords">caseInsensitiveIdentifierPlusReservedWords</A>
6835 */

6836  final public String JavaDoc caseInsensitiveIdentifierPlusReservedWords() throws ParseException, StandardException {
6837        String JavaDoc str;
6838    switch (jj_nt.kind) {
6839    case BINARY:
6840    case COALESCE:
6841    case COUNT:
6842    case D:
6843    case MODULE:
6844    case T:
6845    case TS:
6846    case VALUE:
6847    case VARBINARY:
6848    case ABS:
6849    case ABSVAL:
6850    case ACTION:
6851    case ALWAYS:
6852    case BLOB:
6853    case C:
6854    case CALLED:
6855    case CLOB:
6856    case COBOL:
6857    case COMMITTED:
6858    case CONCAT:
6859    case CONTAINS:
6860    case DATA:
6861    case DATE:
6862    case DAY:
6863    case DYNAMIC:
6864    case FORTRAN:
6865    case GENERATED:
6866    case IDENTITY_VAL_LOCAL:
6867    case INCREMENT:
6868    case INITIAL:
6869    case INTERVAL:
6870    case LANGUAGE:
6871    case LARGE:
6872    case LENGTH:
6873    case LEVEL:
6874    case LOCKS:
6875    case LOCKSIZE:
6876    case LOGGED:
6877    case MOD:
6878    case MODIFIES:
6879    case MODIFY:
6880    case MONTH:
6881    case _MORE:
6882    case MUMPS:
6883    case NAME:
6884    case NCLOB:
6885    case NULLABLE:
6886    case NUMBER:
6887    case OBJECT:
6888    case PASCAL:
6889    case PLI:
6890    case PRECISION:
6891    case RELEASE:
6892    case REPEATABLE:
6893    case RESTART:
6894    case RETURNS:
6895    case ROW:
6896    case SAVEPOINT:
6897    case SCALE:
6898    case SERIALIZABLE:
6899    case SQL_TSI_FRAC_SECOND:
6900    case SQL_TSI_SECOND:
6901    case SQL_TSI_MINUTE:
6902    case SQL_TSI_HOUR:
6903    case SQL_TSI_DAY:
6904    case SQL_TSI_WEEK:
6905    case SQL_TSI_MONTH:
6906    case SQL_TSI_QUARTER:
6907    case SQL_TSI_YEAR:
6908    case START:
6909    case STATEMENT:
6910    case SYNONYM:
6911    case THEN:
6912    case TIME:
6913    case TIMESTAMP:
6914    case TIMESTAMPADD:
6915    case TIMESTAMPDIFF:
6916    case TRUNCATE:
6917    case TYPE:
6918    case UNCOMMITTED:
6919    case USAGE:
6920    case WHEN:
6921    case CURDATE:
6922    case CURTIME:
6923    case DATABASE:
6924    case LONG:
6925    case AFTER:
6926    case BEFORE:
6927    case CLASS:
6928    case COMPRESS:
6929    case CONTENT:
6930    case CS:
6931    case DB2SQL:
6932    case DIRTY:
6933    case DOCUMENT:
6934    case EACH:
6935    case EMPTY:
6936    case EXCLUSIVE:
6937    case FN:
6938    case INDEX:
6939    case JAVA:
6940    case LCASE:
6941    case LOCATE:
6942    case LOCK:
6943    case MESSAGE_LOCALE:
6944    case METHOD:
6945    case MODE:
6946    case NEW:
6947    case NEW_TABLE:
6948    case OJ:
6949    case OFF:
6950    case OLD:
6951    case OLD_TABLE:
6952    case PARAMETER:
6953    case PASSING:
6954    case PROPERTIES:
6955    case READS:
6956    case REF:
6957    case REFERENCING:
6958    case RENAME:
6959    case RESET:
6960    case RESULT:
6961    case RETAIN:
6962    case RETURNING:
6963    case RR:
6964    case RS:
6965    case SEQUENCE:
6966    case SEQUENTIAL:
6967    case SETS:
6968    case SHARE:
6969    case SQLID:
6970    case SPECIFIC:
6971    case SQRT:
6972    case STABILITY:
6973    case STRIP:
6974    case STYLE:
6975    case TRIGGER:
6976    case UCASE:
6977    case UR:
6978    case WHITESPACE:
6979    case IDENTIFIER:
6980    case DELIMITED_IDENTIFIER:
6981      str = identifier(Limits.MAX_IDENTIFIER_LENGTH, true);
6982                {if (true) return str;}
6983      break;
6984    case ADD:
6985    case ALL:
6986    case ALLOCATE:
6987    case ALTER:
6988    case AND:
6989    case ANY:
6990    case ARE:
6991    case AS:
6992    case ASC:
6993    case ASSERTION:
6994    case AT:
6995    case AUTHORIZATION:
6996    case AVG:
6997    case BEGIN:
6998    case BETWEEN:
6999    case BIT:
7000    case BOTH:
7001    case BY:
7002    case CASCADE:
7003    case CASCADED:
7004    case CASE:
7005    case CAST:
7006    case CHAR:
7007    case CHARACTER:
7008    case CHECK:
7009    case CLOSE:
7010    case COLLATE:
7011    case COLLATION:
7012    case COLUMN:
7013    case COMMIT:
7014    case CONNECT:
7015    case CONNECTION:
7016    case CONSTRAINT:
7017    case CONSTRAINTS:
7018    case CONTINUE:
7019    case CONVERT:
7020    case CORRESPONDING:
7021    case CREATE:
7022    case CURRENT:
7023    case CURRENT_DATE:
7024    case CURRENT_TIME:
7025    case CURRENT_TIMESTAMP:
7026    case CURRENT_USER:
7027    case CURSOR:
7028    case DEALLOCATE:
7029    case DEC:
7030    case DECIMAL:
7031    case DECLARE:
7032    case _DEFAULT:
7033    case DEFERRABLE:
7034    case DEFERRED:
7035    case DELETE:
7036    case DESC:
7037    case DESCRIBE:
7038    case DIAGNOSTICS:
7039    case DISCONNECT:
7040    case DISTINCT:
7041    case DOUBLE:
7042    case DROP:
7043    case ELSE:
7044    case END:
7045    case ENDEXEC:
7046    case ESCAPE:
7047    case EXCEPT:
7048    case EXCEPTION:
7049    case EXEC:
7050    case EXECUTE:
7051    case EXISTS:
7052    case EXTERNAL:
7053    case FALSE:
7054    case FETCH:
7055    case FIRST:
7056    case FLOAT:
7057    case FOR:
7058    case FOREIGN:
7059    case FOUND:
7060    case FROM:
7061    case FULL:
7062    case FUNCTION:
7063    case GET:
7064    case GLOBAL:
7065    case GO:
7066    case GOTO:
7067    case GRANT:
7068    case GROUP:
7069    case HAVING:
7070    case HOUR:
7071    case IDENTITY:
7072    case IMMEDIATE:
7073    case IN:
7074    case INDICATOR:
7075    case INITIALLY:
7076    case INNER:
7077    case INPUT:
7078    case INSENSITIVE:
7079    case INSERT:
7080    case INT:
7081    case INTEGER:
7082    case INTERSECT:
7083    case INTO:
7084    case IS:
7085    case ISOLATION:
7086    case JOIN:
7087    case KEY:
7088    case LAST:
7089    case LEFT:
7090    case LIKE:
7091    case LOWER:
7092    case MATCH:
7093    case MAX:
7094    case MIN:
7095    case MINUTE:
7096    case NATIONAL:
7097    case NATURAL:
7098    case NCHAR:
7099    case NEXT:
7100    case NO:
7101    case NOT:
7102    case NULL:
7103    case NULLIF:
7104    case NUMERIC:
7105    case OF:
7106    case ON:
7107    case ONLY:
7108    case OPEN:
7109    case OPTION:
7110    case OR:
7111    case ORDER:
7112    case OUTER:
7113    case OUTPUT:
7114    case OVERLAPS:
7115    case PAD:
7116    case PARTIAL:
7117    case PREPARE:
7118    case PRESERVE:
7119    case PRIMARY:
7120    case PRIOR:
7121    case PRIVILEGES:
7122    case PROCEDURE:
7123    case PUBLIC:
7124    case READ:
7125    case REAL:
7126    case REFERENCES:
7127    case RELATIVE:
7128    case RESTRICT:
7129    case REVOKE:
7130    case RIGHT:
7131    case ROLLBACK:
7132    case ROWS:
7133    case SCHEMA:
7134    case SCROLL:
7135    case SECOND:
7136    case SELECT:
7137    case SESSION_USER:
7138    case SET:
7139    case SMALLINT:
7140    case SOME:
7141    case SPACE:
7142    case SQL:
7143    case SQLCODE:
7144    case SQLERROR:
7145    case SQLSTATE:
7146    case SUBSTRING:
7147    case SUM:
7148    case SYSTEM_USER:
7149    case TABLE:
7150    case TEMPORARY:
7151    case TIMEZONE_HOUR:
7152    case TIMEZONE_MINUTE:
7153    case TO:
7154    case TRANSACTION:
7155    case TRANSLATE:
7156    case TRANSLATION:
7157    case TRUE:
7158    case UNION:
7159    case UNIQUE:
7160    case UNKNOWN:
7161    case UPDATE:
7162    case UPPER:
7163    case USER:
7164    case USING:
7165    case VALUES:
7166    case VARCHAR:
7167    case VARYING:
7168    case VIEW:
7169    case WHENEVER:
7170    case WHERE:
7171    case WITH:
7172    case WORK:
7173    case WRITE:
7174    case YEAR:
7175    case INOUT:
7176    case BOOLEAN:
7177    case CALL:
7178    case GET_CURRENT_CONNECTION:
7179    case EXPLAIN:
7180    case LONGINT:
7181    case LTRIM:
7182    case RTRIM:
7183    case SUBSTR:
7184    case XML:
7185    case XMLEXISTS:
7186    case XMLPARSE:
7187    case XMLQUERY:
7188    case XMLSERIALIZE:
7189    case NVARCHAR:
7190    case OUT:
7191      str = reservedKeyword();
7192                {if (true) return getLanguageConnectionContext().convertIdentifierCase( str);}
7193      break;
7194    default:
7195      jj_la1[304] = jj_gen;
7196      jj_consume_token(-1);
7197      throw new ParseException();
7198    }
7199    throw new Error JavaDoc("Missing return statement in function");
7200  }
7201
7202/*
7203 * <A NAME="caseSensitiveIdentifier">caseSensitiveIdentifier</A>
7204 */

7205  final public String JavaDoc caseSensitiveIdentifier() throws ParseException {
7206        String JavaDoc str;
7207        Token tok;
7208    switch (jj_nt.kind) {
7209    case IDENTIFIER:
7210      tok = jj_consume_token(IDENTIFIER);
7211                // Remember whether last token was a delimited identifier
7212
nextToLastTokenDelimitedIdentifier = lastTokenDelimitedIdentifier;
7213                lastTokenDelimitedIdentifier = Boolean.FALSE;
7214                {if (true) return tok.image;}
7215      break;
7216    case DELIMITED_IDENTIFIER:
7217      str = delimitedIdentifier();
7218                {if (true) return str;}
7219      break;
7220    case BINARY:
7221    case COALESCE:
7222    case COUNT:
7223    case D:
7224    case MODULE:
7225    case T:
7226    case TS:
7227    case VALUE:
7228    case VARBINARY:
7229    case ABS:
7230    case ABSVAL:
7231    case ACTION:
7232    case ALWAYS:
7233    case BLOB:
7234    case C:
7235    case CALLED:
7236    case CLOB:
7237    case COBOL:
7238    case COMMITTED:
7239    case CONCAT:
7240    case CONTAINS:
7241    case DATA:
7242    case DATE:
7243    case DAY:
7244    case DYNAMIC:
7245    case FORTRAN:
7246    case GENERATED:
7247    case IDENTITY_VAL_LOCAL:
7248    case INCREMENT:
7249    case INITIAL:
7250    case INTERVAL:
7251    case LANGUAGE:
7252    case LARGE:
7253    case LENGTH:
7254    case LEVEL:
7255    case LOCKS:
7256    case LOCKSIZE:
7257    case LOGGED:
7258    case MOD:
7259    case MODIFIES:
7260    case MODIFY:
7261    case MONTH:
7262    case _MORE:
7263    case MUMPS:
7264    case NAME:
7265    case NCLOB:
7266    case NULLABLE:
7267    case NUMBER:
7268    case OBJECT:
7269    case PASCAL:
7270    case PLI:
7271    case PRECISION:
7272    case RELEASE:
7273    case REPEATABLE:
7274    case RESTART:
7275    case RETURNS:
7276    case ROW:
7277    case SAVEPOINT:
7278    case SCALE:
7279    case SERIALIZABLE:
7280    case SQL_TSI_FRAC_SECOND:
7281    case SQL_TSI_SECOND:
7282    case SQL_TSI_MINUTE:
7283    case SQL_TSI_HOUR:
7284    case SQL_TSI_DAY:
7285    case SQL_TSI_WEEK:
7286    case SQL_TSI_MONTH:
7287    case SQL_TSI_QUARTER:
7288    case SQL_TSI_YEAR:
7289    case START:
7290    case STATEMENT:
7291    case SYNONYM:
7292    case THEN:
7293    case TIME:
7294    case TIMESTAMP:
7295    case TIMESTAMPADD:
7296    case TIMESTAMPDIFF:
7297    case TRUNCATE:
7298    case TYPE:
7299    case UNCOMMITTED:
7300    case USAGE:
7301    case WHEN:
7302    case CURDATE:
7303    case CURTIME:
7304    case DATABASE:
7305    case LONG:
7306    case AFTER:
7307    case BEFORE:
7308    case CLASS:
7309    case COMPRESS:
7310    case CONTENT:
7311    case CS:
7312    case DB2SQL:
7313    case DIRTY:
7314    case DOCUMENT:
7315    case EACH:
7316    case EMPTY:
7317    case EXCLUSIVE:
7318    case FN:
7319    case INDEX:
7320    case JAVA:
7321    case LCASE:
7322    case LOCATE:
7323    case LOCK:
7324    case MESSAGE_LOCALE:
7325    case METHOD:
7326    case MODE:
7327    case NEW:
7328    case NEW_TABLE:
7329    case OJ:
7330    case OFF:
7331    case OLD:
7332    case OLD_TABLE:
7333    case PARAMETER:
7334    case PASSING:
7335    case PROPERTIES:
7336    case READS:
7337    case REF:
7338    case REFERENCING:
7339    case RENAME:
7340    case RESET:
7341    case RESULT:
7342    case RETAIN:
7343    case RETURNING:
7344    case RR:
7345    case RS:
7346    case SEQUENCE:
7347    case SEQUENTIAL:
7348    case SETS:
7349    case SHARE:
7350    case SQLID:
7351    case SPECIFIC:
7352    case SQRT:
7353    case STABILITY:
7354    case STRIP:
7355    case STYLE:
7356    case TRIGGER:
7357    case UCASE:
7358    case UR:
7359    case WHITESPACE:
7360      str = nonReservedKeyword();
7361                {if (true) return str;}
7362      break;
7363    default:
7364      jj_la1[305] = jj_gen;
7365      jj_consume_token(-1);
7366      throw new ParseException();
7367    }
7368    throw new Error JavaDoc("Missing return statement in function");
7369  }
7370
7371  final private boolean jj_2_1(int xla) {
7372    jj_la = xla; jj_lastpos = jj_scanpos = token;
7373    try { return !jj_3_1(); }
7374    catch(LookaheadSuccess ls) { return true; }
7375    finally { jj_save(0, xla); }
7376  }
7377
7378  final private boolean jj_2_2(int xla) {
7379    jj_la = xla; jj_lastpos = jj_scanpos = token;
7380    try { return !jj_3_2(); }
7381    catch(LookaheadSuccess ls) { return true; }
7382    finally { jj_save(1, xla); }
7383  }
7384
7385  final private boolean jj_2_3(int xla) {
7386    jj_la = xla; jj_lastpos = jj_scanpos = token;
7387    try { return !jj_3_3(); }
7388    catch(LookaheadSuccess ls) { return true; }
7389    finally { jj_save(2, xla); }
7390  }
7391
7392  final private boolean jj_2_4(int xla) {
7393    jj_la = xla; jj_lastpos = jj_scanpos = token;
7394    try { return !jj_3_4(); }
7395    catch(LookaheadSuccess ls) { return true; }
7396    finally { jj_save(3, xla); }
7397  }
7398
7399  final private boolean jj_2_5(int xla) {
7400    jj_la = xla; jj_lastpos = jj_scanpos = token;
7401    try { return !jj_3_5(); }
7402    catch(LookaheadSuccess ls) { return true; }
7403    finally { jj_save(4, xla); }
7404  }
7405
7406  final private boolean jj_2_6(int xla) {
7407    jj_la = xla; jj_lastpos = jj_scanpos = token;
7408    try { return !jj_3_6(); }
7409    catch(LookaheadSuccess ls) { return true; }
7410    finally { jj_save(5, xla); }
7411  }
7412
7413  final private boolean jj_2_7(int xla) {
7414    jj_la = xla; jj_lastpos = jj_scanpos = token;
7415    try { return !jj_3_7(); }
7416    catch(LookaheadSuccess ls) { return true; }
7417    finally { jj_save(6, xla); }
7418  }
7419
7420  final private boolean jj_2_8(int xla) {
7421    jj_la = xla; jj_lastpos = jj_scanpos = token;
7422    try { return !jj_3_8(); }
7423    catch(LookaheadSuccess ls) { return true; }
7424    finally { jj_save(7, xla); }
7425  }
7426
7427  final private boolean jj_2_9(int xla) {
7428    jj_la = xla; jj_lastpos = jj_scanpos = token;
7429    try { return !jj_3_9(); }
7430    catch(LookaheadSuccess ls) { return true; }
7431    finally { jj_save(8, xla); }
7432  }
7433
7434  final private boolean jj_2_10(int xla) {
7435    jj_la = xla; jj_lastpos = jj_scanpos = token;
7436    try { return !jj_3_10(); }
7437    catch(LookaheadSuccess ls) { return true; }
7438    finally { jj_save(9, xla); }
7439  }
7440
7441  final private boolean jj_2_11(int xla) {
7442    jj_la = xla; jj_lastpos = jj_scanpos = token;
7443    try { return !jj_3_11(); }
7444    catch(LookaheadSuccess ls) { return true; }
7445    finally { jj_save(10, xla); }
7446  }
7447
7448  final private boolean jj_2_12(int xla) {
7449    jj_la = xla; jj_lastpos = jj_scanpos = token;
7450    try { return !jj_3_12(); }
7451    catch(LookaheadSuccess ls) { return true; }
7452    finally { jj_save(11, xla); }
7453  }
7454
7455  final private boolean jj_2_13(int xla) {
7456    jj_la = xla; jj_lastpos = jj_scanpos = token;
7457    try { return !jj_3_13(); }
7458    catch(LookaheadSuccess ls) { return true; }
7459    finally { jj_save(12, xla); }
7460  }
7461
7462  final private boolean jj_2_14(int xla) {
7463    jj_la = xla; jj_lastpos = jj_scanpos = token;
7464    try { return !jj_3_14(); }
7465    catch(LookaheadSuccess ls) { return true; }
7466    finally { jj_save(13, xla); }
7467  }
7468
7469  final private boolean jj_2_15(int xla) {
7470    jj_la = xla; jj_lastpos = jj_scanpos = token;
7471    try { return !jj_3_15(); }
7472    catch(LookaheadSuccess ls) { return true; }
7473    finally { jj_save(14, xla); }
7474  }
7475
7476  final private boolean jj_2_16(int xla) {
7477    jj_la = xla; jj_lastpos = jj_scanpos = token;
7478    try { return !jj_3_16(); }
7479    catch(LookaheadSuccess ls) { return true; }
7480    finally { jj_save(15, xla); }
7481  }
7482
7483  final private boolean jj_2_17(int xla) {
7484    jj_la = xla; jj_lastpos = jj_scanpos = token;
7485    try { return !jj_3_17(); }
7486    catch(LookaheadSuccess ls) { return true; }
7487    finally { jj_save(16, xla); }
7488  }
7489
7490  final private boolean jj_2_18(int xla) {
7491    jj_la = xla; jj_lastpos = jj_scanpos = token;
7492    try { return !jj_3_18(); }
7493    catch(LookaheadSuccess ls) { return true; }
7494    finally { jj_save(17, xla); }
7495  }
7496
7497  final private boolean jj_2_19(int xla) {
7498    jj_la = xla; jj_lastpos = jj_scanpos = token;
7499    try { return !jj_3_19(); }
7500    catch(LookaheadSuccess ls) { return true; }
7501    finally { jj_save(18, xla); }
7502  }
7503
7504  final private boolean jj_2_20(int xla) {
7505    jj_la = xla; jj_lastpos = jj_scanpos = token;
7506    try { return !jj_3_20(); }
7507    catch(LookaheadSuccess ls) { return true; }
7508    finally { jj_save(19, xla); }
7509  }
7510
7511  final private boolean jj_2_21(int xla) {
7512    jj_la = xla; jj_lastpos = jj_scanpos = token;
7513    try { return !jj_3_21(); }
7514    catch(LookaheadSuccess ls) { return true; }
7515    finally { jj_save(20, xla); }
7516  }
7517
7518  final private boolean jj_2_22(int xla) {
7519    jj_la = xla; jj_lastpos = jj_scanpos = token;
7520    try { return !jj_3_22(); }
7521    catch(LookaheadSuccess ls) { return true; }
7522    finally { jj_save(21, xla); }
7523  }
7524
7525  final private boolean jj_2_23(int xla) {
7526    jj_la = xla; jj_lastpos = jj_scanpos = token;
7527    try { return !jj_3_23(); }
7528    catch(LookaheadSuccess ls) { return true; }
7529    finally { jj_save(22, xla); }
7530  }
7531
7532  final private boolean jj_2_24(int xla) {
7533    jj_la = xla; jj_lastpos = jj_scanpos = token;
7534    try { return !jj_3_24(); }
7535    catch(LookaheadSuccess ls) { return true; }
7536    finally { jj_save(23, xla); }
7537  }
7538
7539  final private boolean jj_2_25(int xla) {
7540    jj_la = xla; jj_lastpos = jj_scanpos = token;
7541    try { return !jj_3_25(); }
7542    catch(LookaheadSuccess ls) { return true; }
7543    finally { jj_save(24, xla); }
7544  }
7545
7546  final private boolean jj_2_26(int xla) {
7547    jj_la = xla; jj_lastpos = jj_scanpos = token;
7548    try { return !jj_3_26(); }
7549    catch(LookaheadSuccess ls) { return true; }
7550    finally { jj_save(25, xla); }
7551  }
7552
7553  final private boolean jj_2_27(int xla) {
7554    jj_la = xla; jj_lastpos = jj_scanpos = token;
7555    try { return !jj_3_27(); }
7556    catch(LookaheadSuccess ls) { return true; }
7557    finally { jj_save(26, xla); }
7558  }
7559
7560  final private boolean jj_2_28(int xla) {
7561    jj_la = xla; jj_lastpos = jj_scanpos = token;
7562    try { return !jj_3_28(); }
7563    catch(LookaheadSuccess ls) { return true; }
7564    finally { jj_save(27, xla); }
7565  }
7566
7567  final private boolean jj_2_29(int xla) {
7568    jj_la = xla; jj_lastpos = jj_scanpos = token;
7569    try { return !jj_3_29(); }
7570    catch(LookaheadSuccess ls) { return true; }
7571    finally { jj_save(28, xla); }
7572  }
7573
7574  final private boolean jj_2_30(int xla) {
7575    jj_la = xla; jj_lastpos = jj_scanpos = token;
7576    try { return !jj_3_30(); }
7577    catch(LookaheadSuccess ls) { return true; }
7578    finally { jj_save(29, xla); }
7579  }
7580
7581  final private boolean jj_2_31(int xla) {
7582    jj_la = xla; jj_lastpos = jj_scanpos = token;
7583    try { return !jj_3_31(); }
7584    catch(LookaheadSuccess ls) { return true; }
7585    finally { jj_save(30, xla); }
7586  }
7587
7588  final private boolean jj_2_32(int xla) {
7589    jj_la = xla; jj_lastpos = jj_scanpos = token;
7590    try { return !jj_3_32(); }
7591    catch(LookaheadSuccess ls) { return true; }
7592    finally { jj_save(31, xla); }
7593  }
7594
7595  final private boolean jj_2_33(int xla) {
7596    jj_la = xla; jj_lastpos = jj_scanpos = token;
7597    try { return !jj_3_33(); }
7598    catch(LookaheadSuccess ls) { return true; }
7599    finally { jj_save(32, xla); }
7600  }
7601
7602  final private boolean jj_2_34(int xla) {
7603    jj_la = xla; jj_lastpos = jj_scanpos = token;
7604    try { return !jj_3_34(); }
7605    catch(LookaheadSuccess ls) { return true; }
7606    finally { jj_save(33, xla); }
7607  }
7608
7609  final private boolean jj_2_35(int xla) {
7610    jj_la = xla; jj_lastpos = jj_scanpos = token;
7611    try { return !jj_3_35(); }
7612    catch(LookaheadSuccess ls) { return true; }
7613    finally { jj_save(34, xla); }
7614  }
7615
7616  final private boolean jj_2_36(int xla) {
7617    jj_la = xla; jj_lastpos = jj_scanpos = token;
7618    try { return !jj_3_36(); }
7619    catch(LookaheadSuccess ls) { return true; }
7620    finally { jj_save(35, xla); }
7621  }
7622
7623  final private boolean jj_2_37(int xla) {
7624    jj_la = xla; jj_lastpos = jj_scanpos = token;
7625    try { return !jj_3_37(); }
7626    catch(LookaheadSuccess ls) { return true; }
7627    finally { jj_save(36, xla); }
7628  }
7629
7630  final private boolean jj_2_38(int xla) {
7631    jj_la = xla; jj_lastpos = jj_scanpos = token;
7632    try { return !jj_3_38(); }
7633    catch(LookaheadSuccess ls) { return true; }
7634    finally { jj_save(37, xla); }
7635  }
7636
7637  final private boolean jj_2_39(int xla) {
7638    jj_la = xla; jj_lastpos = jj_scanpos = token;
7639    try { return !jj_3_39(); }
7640    catch(LookaheadSuccess ls) { return true; }
7641    finally { jj_save(38, xla); }
7642  }
7643
7644  final private boolean jj_2_40(int xla) {
7645    jj_la = xla; jj_lastpos = jj_scanpos = token;
7646    try { return !jj_3_40(); }
7647    catch(LookaheadSuccess ls) { return true; }
7648    finally { jj_save(39, xla); }
7649  }
7650
7651  final private boolean jj_2_41(int xla) {
7652    jj_la = xla; jj_lastpos = jj_scanpos = token;
7653    try { return !jj_3_41(); }
7654    catch(LookaheadSuccess ls) { return true; }
7655    finally { jj_save(40, xla); }
7656  }
7657
7658  final private boolean jj_2_42(int xla) {
7659    jj_la = xla; jj_lastpos = jj_scanpos = token;
7660    try { return !jj_3_42(); }
7661    catch(LookaheadSuccess ls) { return true; }
7662    finally { jj_save(41, xla); }
7663  }
7664
7665  final private boolean jj_2_43(int xla) {
7666    jj_la = xla; jj_lastpos = jj_scanpos = token;
7667    try { return !jj_3_43(); }
7668    catch(LookaheadSuccess ls) { return true; }
7669    finally { jj_save(42, xla); }
7670  }
7671
7672  final private boolean jj_2_44(int xla) {
7673    jj_la = xla; jj_lastpos = jj_scanpos = token;
7674    try { return !jj_3_44(); }
7675    catch(LookaheadSuccess ls) { return true; }
7676    finally { jj_save(43, xla); }
7677  }
7678
7679  final private boolean jj_2_45(int xla) {
7680    jj_la = xla; jj_lastpos = jj_scanpos = token;
7681    try { return !jj_3_45(); }
7682    catch(LookaheadSuccess ls) { return true; }
7683    finally { jj_save(44, xla); }
7684  }
7685
7686  final private boolean jj_2_46(int xla) {
7687    jj_la = xla; jj_lastpos = jj_scanpos = token;
7688    try { return !jj_3_46(); }
7689    catch(LookaheadSuccess ls) { return true; }
7690    finally { jj_save(45, xla); }
7691  }
7692
7693  final private boolean jj_2_47(int xla) {
7694    jj_la = xla; jj_lastpos = jj_scanpos = token;
7695    try { return !jj_3_47(); }
7696    catch(LookaheadSuccess ls) { return true; }
7697    finally { jj_save(46, xla); }
7698  }
7699
7700  final private boolean jj_3R_193() {
7701    Token xsp;
7702    xsp = jj_scanpos;
7703    if (jj_3R_231()) {
7704    jj_scanpos = xsp;
7705    if (jj_3R_232()) return true;
7706    }
7707    return false;
7708  }
7709
7710  final private boolean jj_3R_231() {
7711    if (jj_scan_token(COUNT)) return true;
7712    return false;
7713  }
7714
7715  final private boolean jj_3R_238() {
7716    if (jj_scan_token(SQRT)) return true;
7717    return false;
7718  }
7719
7720  final private boolean jj_3R_237() {
7721    if (jj_scan_token(ABSVAL)) return true;
7722    return false;
7723  }
7724
7725  final private boolean jj_3R_197() {
7726    Token xsp;
7727    xsp = jj_scanpos;
7728    if (jj_3R_236()) {
7729    jj_scanpos = xsp;
7730    if (jj_3R_237()) {
7731    jj_scanpos = xsp;
7732    if (jj_3R_238()) {
7733    jj_scanpos = xsp;
7734    if (jj_3R_239()) {
7735    jj_scanpos = xsp;
7736    if (jj_3R_240()) return true;
7737    }
7738    }
7739    }
7740    }
7741    return false;
7742  }
7743
7744  final private boolean jj_3R_236() {
7745    if (jj_scan_token(ABS)) return true;
7746    return false;
7747  }
7748
7749  final private boolean jj_3R_105() {
7750    if (jj_3R_185()) return true;
7751    return false;
7752  }
7753
7754  final private boolean jj_3R_141() {
7755    if (jj_scan_token(CURRENT_TIMESTAMP)) return true;
7756    return false;
7757  }
7758
7759  final private boolean jj_3_7() {
7760    if (jj_3R_55()) return true;
7761    return false;
7762  }
7763
7764  final private boolean jj_3R_104() {
7765    if (jj_scan_token(VARCHAR)) return true;
7766    return false;
7767  }
7768
7769  final private boolean jj_3R_360() {
7770    if (jj_3R_332()) return true;
7771    return false;
7772  }
7773
7774  final private boolean jj_3R_205() {
7775    if (jj_3R_235()) return true;
7776    return false;
7777  }
7778
7779  final private boolean jj_3R_140() {
7780    if (jj_scan_token(CURRENT)) return true;
7781    return false;
7782  }
7783
7784  final private boolean jj_3R_303() {
7785    if (jj_scan_token(HEX_STRING)) return true;
7786    return false;
7787  }
7788
7789  final private boolean jj_3R_59() {
7790    Token xsp;
7791    xsp = jj_scanpos;
7792    if (jj_3R_104()) {
7793    jj_scanpos = xsp;
7794    if (jj_3R_105()) return true;
7795    }
7796    return false;
7797  }
7798
7799  final private boolean jj_3R_359() {
7800    if (jj_3R_331()) return true;
7801    return false;
7802  }
7803
7804  final private boolean jj_3R_139() {
7805    if (jj_scan_token(CURRENT_TIME)) return true;
7806    return false;
7807  }
7808
7809  final private boolean jj_3R_358() {
7810    if (jj_scan_token(IDENTIFIER)) return true;
7811    return false;
7812  }
7813
7814  final private boolean jj_3R_354() {
7815    Token xsp;
7816    xsp = jj_scanpos;
7817    if (jj_3R_358()) {
7818    jj_scanpos = xsp;
7819    if (jj_3R_359()) {
7820    jj_scanpos = xsp;
7821    if (jj_3R_360()) return true;
7822    }
7823    }
7824    return false;
7825  }
7826
7827  final private boolean jj_3R_175() {
7828    if (jj_3R_215()) return true;
7829    return false;
7830  }
7831
7832  final private boolean jj_3R_174() {
7833    if (jj_3R_214()) return true;
7834    return false;
7835  }
7836
7837  final private boolean jj_3R_138() {
7838    if (jj_scan_token(CURRENT)) return true;
7839    return false;
7840  }
7841
7842  final private boolean jj_3R_173() {
7843    if (jj_3R_213()) return true;
7844    return false;
7845  }
7846
7847  final private boolean jj_3R_60() {
7848    return false;
7849  }
7850
7851  final private boolean jj_3R_137() {
7852    if (jj_scan_token(CURRENT_DATE)) return true;
7853    return false;
7854  }
7855
7856  final private boolean jj_3R_58() {
7857    return false;
7858  }
7859
7860  final private boolean jj_3R_302() {
7861    if (jj_scan_token(STRING)) return true;
7862    return false;
7863  }
7864
7865  final private boolean jj_3R_171() {
7866    if (jj_3R_212()) return true;
7867    return false;
7868  }
7869
7870  final private boolean jj_3_13() {
7871    if (jj_3R_62()) return true;
7872    return false;
7873  }
7874
7875  final private boolean jj_3R_172() {
7876    if (jj_scan_token(BOOLEAN)) return true;
7877    return false;
7878  }
7879
7880  final private boolean jj_3_12() {
7881    Token xsp;
7882    xsp = jj_scanpos;
7883    lookingAhead = true;
7884    jj_semLA = getToken(3).kind != LARGE;
7885    lookingAhead = false;
7886    if (!jj_semLA || jj_3R_60()) return true;
7887    if (jj_3R_61()) return true;
7888    return false;
7889  }
7890
7891  final private boolean jj_3R_136() {
7892    if (jj_scan_token(CURRENT)) return true;
7893    return false;
7894  }
7895
7896  final private boolean jj_3R_73() {
7897    Token xsp;
7898    xsp = jj_scanpos;
7899    lookingAhead = true;
7900    jj_semLA = (getToken(1).kind == CURRENT && getToken(2).kind == DATE);
7901    lookingAhead = false;
7902    if (!jj_semLA || jj_3R_136()) {
7903    jj_scanpos = xsp;
7904    if (jj_3R_137()) {
7905    jj_scanpos = xsp;
7906    lookingAhead = true;
7907    jj_semLA = (getToken(1).kind == CURRENT && getToken(2).kind == TIME);
7908    lookingAhead = false;
7909    if (!jj_semLA || jj_3R_138()) {
7910    jj_scanpos = xsp;
7911    if (jj_3R_139()) {
7912    jj_scanpos = xsp;
7913    lookingAhead = true;
7914    jj_semLA = (getToken(1).kind == CURRENT && getToken(2).kind == TIMESTAMP);
7915    lookingAhead = false;
7916    if (!jj_semLA || jj_3R_140()) {
7917    jj_scanpos = xsp;
7918    if (jj_3R_141()) return true;
7919    }
7920    }
7921    }
7922    }
7923    }
7924    return false;
7925  }
7926
7927  final private boolean jj_3_11() {
7928    Token xsp;
7929    xsp = jj_scanpos;
7930    lookingAhead = true;
7931    jj_semLA = getToken(2).kind != LARGE;
7932    lookingAhead = false;
7933    if (!jj_semLA || jj_3R_58()) return true;
7934    if (jj_3R_59()) return true;
7935    return false;
7936  }
7937
7938  final private boolean jj_3R_343() {
7939    if (jj_scan_token(EXISTS)) return true;
7940    return false;
7941  }
7942
7943  final private boolean jj_3R_276() {
7944    if (jj_scan_token(TIMESTAMP)) return true;
7945    return false;
7946  }
7947
7948  final private boolean jj_3R_195() {
7949    if (jj_3R_235()) return true;
7950    return false;
7951  }
7952
7953  final private boolean jj_3R_351() {
7954    if (jj_3R_355()) return true;
7955    return false;
7956  }
7957
7958  final private boolean jj_3R_86() {
7959    Token xsp;
7960    xsp = jj_scanpos;
7961    if (jj_3_11()) {
7962    jj_scanpos = xsp;
7963    if (jj_3_12()) {
7964    jj_scanpos = xsp;
7965    if (jj_3_13()) {
7966    jj_scanpos = xsp;
7967    if (jj_3R_171()) {
7968    jj_scanpos = xsp;
7969    if (jj_3R_172()) {
7970    jj_scanpos = xsp;
7971    if (jj_3R_173()) {
7972    jj_scanpos = xsp;
7973    if (jj_3R_174()) {
7974    jj_scanpos = xsp;
7975    if (jj_3R_175()) return true;
7976    }
7977    }
7978    }
7979    }
7980    }
7981    }
7982    }
7983    return false;
7984  }
7985
7986  final private boolean jj_3R_350() {
7987    if (jj_3R_354()) return true;
7988    return false;
7989  }
7990
7991  final private boolean jj_3R_339() {
7992    Token xsp;
7993    xsp = jj_scanpos;
7994    if (jj_3R_350()) {
7995    jj_scanpos = xsp;
7996    if (jj_3R_351()) return true;
7997    }
7998    return false;
7999  }
8000
8001  final private boolean jj_3R_275() {
8002    if (jj_scan_token(TIME)) return true;
8003    return false;
8004  }
8005
8006  final private boolean jj_3R_212() {
8007    Token xsp;
8008    xsp = jj_scanpos;
8009    if (jj_3R_274()) {
8010    jj_scanpos = xsp;
8011    if (jj_3R_275()) {
8012    jj_scanpos = xsp;
8013    if (jj_3R_276()) return true;
8014    }
8015    }
8016    return false;
8017  }
8018
8019  final private boolean jj_3R_274() {
8020    if (jj_scan_token(DATE)) return true;
8021    return false;
8022  }
8023
8024  final private boolean jj_3R_216() {
8025    if (jj_scan_token(DELETE)) return true;
8026    return false;
8027  }
8028
8029  final private boolean jj_3_20() {
8030    if (jj_3R_68()) return true;
8031    return false;
8032  }
8033
8034  final private boolean jj_3R_357() {
8035    if (jj_scan_token(VALUES)) return true;
8036    return false;
8037  }
8038
8039  final private boolean jj_3R_95() {
8040    if (jj_scan_token(GRANT)) return true;
8041    return false;
8042  }
8043
8044  final private boolean jj_3R_181() {
8045    if (jj_3R_221()) return true;
8046    return false;
8047  }
8048
8049  final private boolean jj_3R_180() {
8050    if (jj_3R_220()) return true;
8051    return false;
8052  }
8053
8054  final private boolean jj_3R_94() {
8055    if (jj_scan_token(TRUNCATE)) return true;
8056    return false;
8057  }
8058
8059  final private boolean jj_3R_179() {
8060    if (jj_3R_219()) return true;
8061    return false;
8062  }
8063
8064  final private boolean jj_3R_178() {
8065    if (jj_3R_218()) return true;
8066    return false;
8067  }
8068
8069  final private boolean jj_3R_177() {
8070    if (jj_3R_217()) return true;
8071    return false;
8072  }
8073
8074  final private boolean jj_3R_93() {
8075    Token xsp;
8076    xsp = jj_scanpos;
8077    if (jj_3R_176()) {
8078    jj_scanpos = xsp;
8079    if (jj_3R_177()) {
8080    jj_scanpos = xsp;
8081    if (jj_3R_178()) {
8082    jj_scanpos = xsp;
8083    if (jj_3R_179()) {
8084    jj_scanpos = xsp;
8085    if (jj_3R_180()) {
8086    jj_scanpos = xsp;
8087    if (jj_3R_181()) return true;
8088    }
8089    }
8090    }
8091    }
8092    }
8093    return false;
8094  }
8095
8096  final private boolean jj_3R_176() {
8097    if (jj_3R_216()) return true;
8098    return false;
8099  }
8100
8101  final private boolean jj_3_6() {
8102    if (jj_3R_53()) return true;
8103    return false;
8104  }
8105
8106  final private boolean jj_3_5() {
8107    if (jj_3R_54()) return true;
8108    return false;
8109  }
8110
8111  final private boolean jj_3R_304() {
8112    if (jj_scan_token(LEFT_BRACE)) return true;
8113    return false;
8114  }
8115
8116  final private boolean jj_3_4() {
8117    if (jj_3R_54()) return true;
8118    return false;
8119  }
8120
8121  final private boolean jj_3R_88() {
8122    if (jj_scan_token(SET)) return true;
8123    return false;
8124  }
8125
8126  final private boolean jj_3_3() {
8127    if (jj_3R_53()) return true;
8128    return false;
8129  }
8130
8131  final private boolean jj_3R_87() {
8132    if (jj_scan_token(SET)) return true;
8133    return false;
8134  }
8135
8136  final private boolean jj_3R_43() {
8137    Token xsp;
8138    xsp = jj_scanpos;
8139    lookingAhead = true;
8140    jj_semLA = getToken(1).kind == SET && getToken(2).kind != CURRENT;
8141    lookingAhead = false;
8142    if (!jj_semLA || jj_3R_87()) {
8143    jj_scanpos = xsp;
8144    lookingAhead = true;
8145    jj_semLA = getToken(1).kind == SET && getToken(2).kind == CURRENT;
8146    lookingAhead = false;
8147    if (!jj_semLA || jj_3R_88()) return true;
8148    }
8149    return false;
8150  }
8151
8152  final private boolean jj_3R_150() {
8153    if (jj_3R_68()) return true;
8154    return false;
8155  }
8156
8157  final private boolean jj_3R_335() {
8158    if (jj_3R_343()) return true;
8159    return false;
8160  }
8161
8162  final private boolean jj_3_19() {
8163    if (jj_3R_68()) return true;
8164    return false;
8165  }
8166
8167  final private boolean jj_3R_249() {
8168    if (jj_scan_token(XMLQUERY)) return true;
8169    return false;
8170  }
8171
8172  final private boolean jj_3R_91() {
8173    if (jj_scan_token(ALTER)) return true;
8174    return false;
8175  }
8176
8177  final private boolean jj_3R_318() {
8178    Token xsp;
8179    xsp = jj_scanpos;
8180    if (jj_3_19()) {
8181    jj_scanpos = xsp;
8182    if (jj_3R_335()) return true;
8183    }
8184    return false;
8185  }
8186
8187  final private boolean jj_3R_248() {
8188    if (jj_scan_token(XMLEXISTS)) return true;
8189    return false;
8190  }
8191
8192  final private boolean jj_3R_79() {
8193    if (jj_3R_150()) return true;
8194    return false;
8195  }
8196
8197  final private boolean jj_3R_289() {
8198    if (jj_3R_308()) return true;
8199    return false;
8200  }
8201
8202  final private boolean jj_3R_247() {
8203    if (jj_scan_token(XMLSERIALIZE)) return true;
8204    return false;
8205  }
8206
8207  final private boolean jj_3_45() {
8208    if (jj_3R_68()) return true;
8209    return false;
8210  }
8211
8212  final private boolean jj_3R_199() {
8213    Token xsp;
8214    xsp = jj_scanpos;
8215    if (jj_3R_246()) {
8216    jj_scanpos = xsp;
8217    if (jj_3R_247()) {
8218    jj_scanpos = xsp;
8219    if (jj_3R_248()) {
8220    jj_scanpos = xsp;
8221    if (jj_3R_249()) return true;
8222    }
8223    }
8224    }
8225    return false;
8226  }
8227
8228  final private boolean jj_3R_246() {
8229    if (jj_scan_token(XMLPARSE)) return true;
8230    return false;
8231  }
8232
8233  final private boolean jj_3_36() {
8234    if (jj_3R_79()) return true;
8235    return false;
8236  }
8237
8238  final private boolean jj_3R_298() {
8239    if (jj_3R_318()) return true;
8240    return false;
8241  }
8242
8243  final private boolean jj_3R_90() {
8244    if (jj_scan_token(DROP)) return true;
8245    return false;
8246  }
8247
8248  final private boolean jj_3_24() {
8249    if (jj_3R_71()) return true;
8250    return false;
8251  }
8252
8253  final private boolean jj_3R_295() {
8254    if (jj_3R_205()) return true;
8255    return false;
8256  }
8257
8258  final private boolean jj_3R_273() {
8259    if (jj_scan_token(DROP)) return true;
8260    return false;
8261  }
8262
8263  final private boolean jj_3R_322() {
8264    if (jj_scan_token(APPROXIMATE_NUMERIC)) return true;
8265    return false;
8266  }
8267
8268  final private boolean jj_3R_143() {
8269    if (jj_3R_202()) return true;
8270    return false;
8271  }
8272
8273  final private boolean jj_3_33() {
8274    if (jj_3R_78()) return true;
8275    return false;
8276  }
8277
8278  final private boolean jj_3R_348() {
8279    if (jj_scan_token(MINUTE)) return true;
8280    return false;
8281  }
8282
8283  final private boolean jj_3R_332() {
8284    Token xsp;
8285    xsp = jj_scanpos;
8286    if (jj_scan_token(260)) {
8287    jj_scanpos = xsp;
8288    if (jj_scan_token(261)) {
8289    jj_scanpos = xsp;
8290    if (jj_scan_token(262)) {
8291    jj_scanpos = xsp;
8292    if (jj_scan_token(354)) {
8293    jj_scanpos = xsp;
8294    if (jj_scan_token(263)) {
8295    jj_scanpos = xsp;
8296    if (jj_scan_token(355)) {
8297    jj_scanpos = xsp;
8298    if (jj_scan_token(74)) {
8299    jj_scanpos = xsp;
8300    if (jj_scan_token(264)) {
8301    jj_scanpos = xsp;
8302    if (jj_scan_token(265)) {
8303    jj_scanpos = xsp;
8304    if (jj_scan_token(266)) {
8305    jj_scanpos = xsp;
8306    if (jj_scan_token(356)) {
8307    jj_scanpos = xsp;
8308    if (jj_scan_token(267)) {
8309    jj_scanpos = xsp;
8310    if (jj_scan_token(87)) {
8311    jj_scanpos = xsp;
8312    if (jj_scan_token(268)) {
8313    jj_scanpos = xsp;
8314    if (jj_scan_token(269)) {
8315    jj_scanpos = xsp;
8316    if (jj_scan_token(357)) {
8317    jj_scanpos = xsp;
8318    if (jj_scan_token(270)) {
8319    jj_scanpos = xsp;
8320    if (jj_scan_token(271)) {
8321    jj_scanpos = xsp;
8322    if (jj_scan_token(358)) {
8323    jj_scanpos = xsp;
8324    if (jj_scan_token(99)) {
8325    jj_scanpos = xsp;
8326    if (jj_scan_token(359)) {
8327    jj_scanpos = xsp;
8328    if (jj_scan_token(339)) {
8329    jj_scanpos = xsp;
8330    if (jj_scan_token(340)) {
8331    jj_scanpos = xsp;
8332    if (jj_scan_token(107)) {
8333    jj_scanpos = xsp;
8334    if (jj_scan_token(272)) {
8335    jj_scanpos = xsp;
8336    if (jj_scan_token(273)) {
8337    jj_scanpos = xsp;
8338    if (jj_scan_token(274)) {
8339    jj_scanpos = xsp;
8340    if (jj_scan_token(362)) {
8341    jj_scanpos = xsp;
8342    if (jj_scan_token(276)) {
8343    jj_scanpos = xsp;
8344    if (jj_scan_token(341)) {
8345    jj_scanpos = xsp;
8346    if (jj_scan_token(361)) {
8347    jj_scanpos = xsp;
8348    if (jj_scan_token(363)) {
8349    jj_scanpos = xsp;
8350    if (jj_scan_token(364)) {
8351    jj_scanpos = xsp;
8352    if (jj_scan_token(365)) {
8353    jj_scanpos = xsp;
8354    if (jj_scan_token(366)) {
8355    jj_scanpos = xsp;
8356    if (jj_scan_token(367)) {
8357    jj_scanpos = xsp;
8358    if (jj_scan_token(277)) {
8359    jj_scanpos = xsp;
8360    if (jj_scan_token(278)) {
8361    jj_scanpos = xsp;
8362    if (jj_scan_token(279)) {
8363    jj_scanpos = xsp;
8364    if (jj_scan_token(280)) {
8365    jj_scanpos = xsp;
8366    if (jj_scan_token(368)) {
8367    jj_scanpos = xsp;
8368    if (jj_scan_token(281)) {
8369    jj_scanpos = xsp;
8370    if (jj_scan_token(283)) {
8371    jj_scanpos = xsp;
8372    if (jj_scan_token(369)) {
8373    jj_scanpos = xsp;
8374    if (jj_scan_token(285)) {
8375    jj_scanpos = xsp;
8376    if (jj_scan_token(286)) {
8377    jj_scanpos = xsp;
8378    if (jj_scan_token(370)) {
8379    jj_scanpos = xsp;
8380    if (jj_scan_token(287)) {
8381    jj_scanpos = xsp;
8382    if (jj_scan_token(288)) {
8383    jj_scanpos = xsp;
8384    if (jj_scan_token(371)) {
8385    jj_scanpos = xsp;
8386    if (jj_scan_token(372)) {
8387    jj_scanpos = xsp;
8388    if (jj_scan_token(289)) {
8389    jj_scanpos = xsp;
8390    if (jj_scan_token(290)) {
8391    jj_scanpos = xsp;
8392    if (jj_scan_token(291)) {
8393    jj_scanpos = xsp;
8394    if (jj_scan_token(345)) {
8395    jj_scanpos = xsp;
8396    if (jj_scan_token(373)) {
8397    jj_scanpos = xsp;
8398    if (jj_scan_token(374)) {
8399    jj_scanpos = xsp;
8400    if (jj_scan_token(292)) {
8401    jj_scanpos = xsp;
8402    if (jj_scan_token(375)) {
8403    jj_scanpos = xsp;
8404    if (jj_scan_token(293)) {
8405    jj_scanpos = xsp;
8406    if (jj_scan_token(294)) {
8407    jj_scanpos = xsp;
8408    if (jj_scan_token(176)) {
8409    jj_scanpos = xsp;
8410    if (jj_scan_token(295)) {
8411    jj_scanpos = xsp;
8412    if (jj_scan_token(296)) {
8413    jj_scanpos = xsp;
8414    if (jj_scan_token(297)) {
8415    jj_scanpos = xsp;
8416    if (jj_scan_token(298)) {
8417    jj_scanpos = xsp;
8418    if (jj_scan_token(299)) {
8419    jj_scanpos = xsp;
8420    if (jj_scan_token(376)) {
8421    jj_scanpos = xsp;
8422    if (jj_scan_token(377)) {
8423    jj_scanpos = xsp;
8424    if (jj_scan_token(300)) {
8425    jj_scanpos = xsp;
8426    if (jj_scan_token(301)) {
8427    jj_scanpos = xsp;
8428    if (jj_scan_token(302)) {
8429    jj_scanpos = xsp;
8430    if (jj_scan_token(380)) {
8431    jj_scanpos = xsp;
8432    if (jj_scan_token(381)) {
8433    jj_scanpos = xsp;
8434    if (jj_scan_token(382)) {
8435    jj_scanpos = xsp;
8436    if (jj_scan_token(379)) {
8437    jj_scanpos = xsp;
8438    if (jj_scan_token(303)) {
8439    jj_scanpos = xsp;
8440    if (jj_scan_token(385)) {
8441    jj_scanpos = xsp;
8442    if (jj_scan_token(304)) {
8443    jj_scanpos = xsp;
8444    if (jj_scan_token(305)) {
8445    jj_scanpos = xsp;
8446    if (jj_scan_token(386)) {
8447    jj_scanpos = xsp;
8448    if (jj_scan_token(387)) {
8449    jj_scanpos = xsp;
8450    if (jj_scan_token(388)) {
8451    jj_scanpos = xsp;
8452    if (jj_scan_token(306)) {
8453    jj_scanpos = xsp;
8454    if (jj_scan_token(390)) {
8455    jj_scanpos = xsp;
8456    if (jj_scan_token(307)) {
8457    jj_scanpos = xsp;
8458    if (jj_scan_token(389)) {
8459    jj_scanpos = xsp;
8460    if (jj_scan_token(391)) {
8461    jj_scanpos = xsp;
8462    if (jj_scan_token(308)) {
8463    jj_scanpos = xsp;
8464    if (jj_scan_token(392)) {
8465    jj_scanpos = xsp;
8466    if (jj_scan_token(393)) {
8467    jj_scanpos = xsp;
8468    if (jj_scan_token(394)) {
8469    jj_scanpos = xsp;
8470    if (jj_scan_token(309)) {
8471    jj_scanpos = xsp;
8472    if (jj_scan_token(310)) {
8473    jj_scanpos = xsp;
8474    if (jj_scan_token(395)) {
8475    jj_scanpos = xsp;
8476    if (jj_scan_token(396)) {
8477    jj_scanpos = xsp;
8478    if (jj_scan_token(312)) {
8479    jj_scanpos = xsp;
8480    if (jj_scan_token(311)) {
8481    jj_scanpos = xsp;
8482    if (jj_scan_token(397)) {
8483    jj_scanpos = xsp;
8484    if (jj_scan_token(398)) {
8485    jj_scanpos = xsp;
8486    if (jj_scan_token(314)) {
8487    jj_scanpos = xsp;
8488    if (jj_scan_token(399)) {
8489    jj_scanpos = xsp;
8490    if (jj_scan_token(400)) {
8491    jj_scanpos = xsp;
8492    if (jj_scan_token(402)) {
8493    jj_scanpos = xsp;
8494    if (jj_scan_token(401)) {
8495    jj_scanpos = xsp;
8496    if (jj_scan_token(315)) {
8497    jj_scanpos = xsp;
8498    if (jj_scan_token(316)) {
8499    jj_scanpos = xsp;
8500    if (jj_scan_token(317)) {
8501    jj_scanpos = xsp;
8502    if (jj_scan_token(318)) {
8503    jj_scanpos = xsp;
8504    if (jj_scan_token(319)) {
8505    jj_scanpos = xsp;
8506    if (jj_scan_token(320)) {
8507    jj_scanpos = xsp;
8508    if (jj_scan_token(321)) {
8509    jj_scanpos = xsp;
8510    if (jj_scan_token(322)) {
8511    jj_scanpos = xsp;
8512    if (jj_scan_token(323)) {
8513    jj_scanpos = xsp;
8514    if (jj_scan_token(403)) {
8515    jj_scanpos = xsp;
8516    if (jj_scan_token(404)) {
8517    jj_scanpos = xsp;
8518    if (jj_scan_token(324)) {
8519    jj_scanpos = xsp;
8520    if (jj_scan_token(325)) {
8521    jj_scanpos = xsp;
8522    if (jj_scan_token(405)) {
8523    jj_scanpos = xsp;
8524    if (jj_scan_token(326)) {
8525    jj_scanpos = xsp;
8526    if (jj_scan_token(406)) {
8527    jj_scanpos = xsp;
8528    if (jj_scan_token(230)) {
8529    jj_scanpos = xsp;
8530    if (jj_scan_token(327)) {
8531    jj_scanpos = xsp;
8532    if (jj_scan_token(328)) {
8533    jj_scanpos = xsp;
8534    if (jj_scan_token(329)) {
8535    jj_scanpos = xsp;
8536    if (jj_scan_token(330)) {
8537    jj_scanpos = xsp;
8538    if (jj_scan_token(331)) {
8539    jj_scanpos = xsp;
8540    if (jj_scan_token(407)) {
8541    jj_scanpos = xsp;
8542    if (jj_scan_token(332)) {
8543    jj_scanpos = xsp;
8544    if (jj_scan_token(240)) {
8545    jj_scanpos = xsp;
8546    if (jj_scan_token(333)) {
8547    jj_scanpos = xsp;
8548    if (jj_scan_token(408)) {
8549    jj_scanpos = xsp;
8550    if (jj_scan_token(334)) {
8551    jj_scanpos = xsp;
8552    if (jj_scan_token(409)) {
8553    jj_scanpos = xsp;
8554    if (jj_scan_token(335)) {
8555    jj_scanpos = xsp;
8556    if (jj_scan_token(248)) {
8557    jj_scanpos = xsp;
8558    if (jj_scan_token(250)) {
8559    jj_scanpos = xsp;
8560    if (jj_scan_token(384)) {
8561    jj_scanpos = xsp;
8562    if (jj_scan_token(336)) {
8563    jj_scanpos = xsp;
8564    if (jj_scan_token(410)) return true;
8565    }
8566    }
8567    }
8568    }
8569    }
8570    }
8571    }
8572    }
8573    }
8574    }
8575    }
8576    }
8577    }
8578    }
8579    }
8580    }
8581    }
8582    }
8583    }
8584    }
8585    }
8586    }
8587    }
8588    }
8589    }
8590    }
8591    }
8592    }
8593    }
8594    }
8595    }
8596    }
8597    }
8598    }
8599    }
8600    }
8601    }
8602    }
8603    }
8604    }
8605    }
8606    }
8607    }
8608    }
8609    }
8610    }
8611    }
8612    }
8613    }
8614    }
8615    }
8616    }
8617    }
8618    }
8619    }
8620    }
8621    }
8622    }
8623    }
8624    }
8625    }
8626    }
8627    }
8628    }
8629    }
8630    }
8631    }
8632    }
8633    }
8634    }
8635    }
8636    }
8637    }
8638    }
8639    }
8640    }
8641    }
8642    }
8643    }
8644    }
8645    }
8646    }
8647    }
8648    }
8649    }
8650    }
8651    }
8652    }
8653    }
8654    }
8655    }
8656    }
8657    }
8658    }
8659    }
8660    }
8661    }
8662    }
8663    }
8664    }
8665    }
8666    }
8667    }
8668    }
8669    }
8670    }
8671    }
8672    }
8673    }
8674    }
8675    }
8676    }
8677    }
8678    }
8679    }
8680    }
8681    }
8682    }
8683    }
8684    }
8685    }
8686    }
8687    }
8688    }
8689    }
8690    }
8691    }
8692    }
8693    }
8694    }
8695    }
8696    }
8697    }
8698    }
8699    }
8700    }
8701    }
8702    }
8703    }
8704    return false;
8705  }
8706
8707  final private boolean jj_3R_347() {
8708    if (jj_scan_token(HOUR)) return true;
8709    return false;
8710  }
8711
8712  final private boolean jj_3R_103() {
8713    if (jj_scan_token(ON)) return true;
8714    return false;
8715  }
8716
8717  final private boolean jj_3R_346() {
8718    if (jj_scan_token(DAY)) return true;
8719    return false;
8720  }
8721
8722  final private boolean jj_3R_89() {
8723    if (jj_scan_token(CREATE)) return true;
8724    return false;
8725  }
8726
8727  final private boolean jj_3_28() {
8728    if (jj_3R_75()) return true;
8729    return false;
8730  }
8731
8732  final private boolean jj_3R_321() {
8733    if (jj_scan_token(EXACT_NUMERIC)) return true;
8734    return false;
8735  }
8736
8737  final private boolean jj_3R_301() {
8738    Token xsp;
8739    xsp = jj_scanpos;
8740    if (jj_3R_321()) {
8741    jj_scanpos = xsp;
8742    if (jj_3R_322()) return true;
8743    }
8744    return false;
8745  }
8746
8747  final private boolean jj_3R_102() {
8748    if (jj_scan_token(ON)) return true;
8749    return false;
8750  }
8751
8752  final private boolean jj_3R_250() {
8753    if (jj_3R_298()) return true;
8754    return false;
8755  }
8756
8757  final private boolean jj_3R_272() {
8758    if (jj_scan_token(DROP)) return true;
8759    return false;
8760  }
8761
8762  final private boolean jj_3R_101() {
8763    if (jj_scan_token(NOT)) return true;
8764    return false;
8765  }
8766
8767  final private boolean jj_3R_345() {
8768    if (jj_scan_token(MONTH)) return true;
8769    return false;
8770  }
8771
8772  final private boolean jj_3R_74() {
8773    Token xsp;
8774    xsp = jj_scanpos;
8775    if (jj_3R_142()) {
8776    jj_scanpos = xsp;
8777    if (jj_3_28()) {
8778    jj_scanpos = xsp;
8779    if (jj_3R_143()) return true;
8780    }
8781    }
8782    return false;
8783  }
8784
8785  final private boolean jj_3R_142() {
8786    if (jj_3R_201()) return true;
8787    return false;
8788  }
8789
8790  final private boolean jj_3R_344() {
8791    if (jj_scan_token(YEAR)) return true;
8792    return false;
8793  }
8794
8795  final private boolean jj_3R_336() {
8796    Token xsp;
8797    xsp = jj_scanpos;
8798    if (jj_3R_344()) {
8799    jj_scanpos = xsp;
8800    if (jj_3R_345()) {
8801    jj_scanpos = xsp;
8802    if (jj_3R_346()) {
8803    jj_scanpos = xsp;
8804    if (jj_3R_347()) {
8805    jj_scanpos = xsp;
8806    if (jj_3R_348()) return true;
8807    }
8808    }
8809    }
8810    }
8811    return false;
8812  }
8813
8814  final private boolean jj_3R_52() {
8815    if (jj_3R_97()) return true;
8816    return false;
8817  }
8818
8819  final private boolean jj_3R_51() {
8820    if (jj_3R_96()) return true;
8821    return false;
8822  }
8823
8824  final private boolean jj_3R_50() {
8825    if (jj_3R_95()) return true;
8826    return false;
8827  }
8828
8829  final private boolean jj_3R_57() {
8830    Token xsp;
8831    xsp = jj_scanpos;
8832    if (jj_3R_101()) {
8833    jj_scanpos = xsp;
8834    lookingAhead = true;
8835    jj_semLA = getToken(1).kind == ON && getToken(2).kind == COMMIT;
8836    lookingAhead = false;
8837    if (!jj_semLA || jj_3R_102()) {
8838    jj_scanpos = xsp;
8839    lookingAhead = true;
8840    jj_semLA = getToken(1).kind == ON && getToken(2).kind == ROLLBACK;
8841    lookingAhead = false;
8842    if (!jj_semLA || jj_3R_103()) return true;
8843    }
8844    }
8845    return false;
8846  }
8847
8848  final private boolean jj_3R_49() {
8849    if (jj_3R_94()) return true;
8850    return false;
8851  }
8852
8853  final private boolean jj_3R_271() {
8854    if (jj_scan_token(DROP)) return true;
8855    return false;
8856  }
8857
8858  final private boolean jj_3_1() {
8859    if (jj_3R_43()) return true;
8860    return false;
8861  }
8862
8863  final private boolean jj_3R_48() {
8864    if (jj_3R_93()) return true;
8865    return false;
8866  }
8867
8868  final private boolean jj_3R_47() {
8869    if (jj_3R_92()) return true;
8870    return false;
8871  }
8872
8873  final private boolean jj_3R_46() {
8874    if (jj_3R_91()) return true;
8875    return false;
8876  }
8877
8878  final private boolean jj_3R_45() {
8879    if (jj_3R_90()) return true;
8880    return false;
8881  }
8882
8883  final private boolean jj_3R_44() {
8884    if (jj_3R_89()) return true;
8885    return false;
8886  }
8887
8888  final private boolean jj_3R_134() {
8889    if (jj_3R_199()) return true;
8890    return false;
8891  }
8892
8893  final private boolean jj_3_10() {
8894    if (jj_3R_57()) return true;
8895    return false;
8896  }
8897
8898  final private boolean jj_3R_206() {
8899    if (jj_scan_token(LEFT_PAREN)) return true;
8900    return false;
8901  }
8902
8903  final private boolean jj_3R_264() {
8904    if (jj_3R_305()) return true;
8905    return false;
8906  }
8907
8908  final private boolean jj_3_2() {
8909    Token xsp;
8910    xsp = jj_scanpos;
8911    if (jj_3R_44()) {
8912    jj_scanpos = xsp;
8913    if (jj_3R_45()) {
8914    jj_scanpos = xsp;
8915    if (jj_3R_46()) {
8916    jj_scanpos = xsp;
8917    if (jj_3R_47()) {
8918    jj_scanpos = xsp;
8919    if (jj_3R_48()) {
8920    jj_scanpos = xsp;
8921    if (jj_3_1()) {
8922    jj_scanpos = xsp;
8923    if (jj_3R_49()) {
8924    jj_scanpos = xsp;
8925    if (jj_3R_50()) {
8926    jj_scanpos = xsp;
8927    if (jj_3R_51()) {
8928    jj_scanpos = xsp;
8929    if (jj_3R_52()) return true;
8930    }
8931    }
8932    }
8933    }
8934    }
8935    }
8936    }
8937    }
8938    }
8939    return false;
8940  }
8941
8942  final private boolean jj_3R_270() {
8943    if (jj_scan_token(DROP)) return true;
8944    return false;
8945  }
8946
8947  final private boolean jj_3R_263() {
8948    if (jj_3R_304()) return true;
8949    return false;
8950  }
8951
8952  final private boolean jj_3R_230() {
8953    if (jj_scan_token(CASE)) return true;
8954    return false;
8955  }
8956
8957  final private boolean jj_3R_200() {
8958    Token xsp;
8959    xsp = jj_scanpos;
8960    if (jj_scan_token(182)) jj_scanpos = xsp;
8961    if (jj_3R_250()) return true;
8962    return false;
8963  }
8964
8965  final private boolean jj_3R_262() {
8966    if (jj_3R_303()) return true;
8967    return false;
8968  }
8969
8970  final private boolean jj_3R_92() {
8971    if (jj_scan_token(DECLARE)) return true;
8972    return false;
8973  }
8974
8975  final private boolean jj_3R_308() {
8976    if (jj_3R_328()) return true;
8977    return false;
8978  }
8979
8980  final private boolean jj_3R_261() {
8981    if (jj_3R_302()) return true;
8982    return false;
8983  }
8984
8985  final private boolean jj_3R_133() {
8986    if (jj_scan_token(LENGTH)) return true;
8987    return false;
8988  }
8989
8990  final private boolean jj_3R_300() {
8991    if (jj_3R_291()) return true;
8992    return false;
8993  }
8994
8995  final private boolean jj_3R_207() {
8996    Token xsp;
8997    xsp = jj_scanpos;
8998    if (jj_3R_260()) {
8999    jj_scanpos = xsp;
9000    if (jj_3R_261()) {
9001    jj_scanpos = xsp;
9002    if (jj_3R_262()) {
9003    jj_scanpos = xsp;
9004    if (jj_3R_263()) {
9005    jj_scanpos = xsp;
9006    if (jj_3R_264()) return true;
9007    }
9008    }
9009    }
9010    }
9011    return false;
9012  }
9013
9014  final private boolean jj_3R_260() {
9015    Token xsp;
9016    xsp = jj_scanpos;
9017    if (jj_3R_300()) jj_scanpos = xsp;
9018    if (jj_3R_301()) return true;
9019    return false;
9020  }
9021
9022  final private boolean jj_3R_210() {
9023    Token xsp;
9024    xsp = jj_scanpos;
9025    lookingAhead = true;
9026    jj_semLA = getToken(2).kind == CONSTRAINT;
9027    lookingAhead = false;
9028    if (!jj_semLA || jj_3R_269()) {
9029    jj_scanpos = xsp;
9030    lookingAhead = true;
9031    jj_semLA = getToken(2).kind == PRIMARY;
9032    lookingAhead = false;
9033    if (!jj_semLA || jj_3R_270()) {
9034    jj_scanpos = xsp;
9035    lookingAhead = true;
9036    jj_semLA = getToken(2).kind == FOREIGN;
9037    lookingAhead = false;
9038    if (!jj_semLA || jj_3R_271()) {
9039    jj_scanpos = xsp;
9040    lookingAhead = true;
9041    jj_semLA = getToken(2).kind == UNIQUE;
9042    lookingAhead = false;
9043    if (!jj_semLA || jj_3R_272()) {
9044    jj_scanpos = xsp;
9045    if (jj_3R_273()) return true;
9046    }
9047    }
9048    }
9049    }
9050    return false;
9051  }
9052
9053  final private boolean jj_3R_269() {
9054    if (jj_scan_token(DROP)) return true;
9055    return false;
9056  }
9057
9058  final private boolean jj_3R_132() {
9059    if (jj_scan_token(VALUE)) return true;
9060    return false;
9061  }
9062
9063  final private boolean jj_3R_192() {
9064    if (jj_scan_token(NEW)) return true;
9065    return false;
9066  }
9067
9068  final private boolean jj_3R_131() {
9069    if (jj_scan_token(COALESCE)) return true;
9070    return false;
9071  }
9072
9073  final private boolean jj_3R_328() {
9074    if (jj_3R_339()) return true;
9075    return false;
9076  }
9077
9078  final private boolean jj_3_27() {
9079    if (jj_3R_74()) return true;
9080    return false;
9081  }
9082
9083  final private boolean jj_3R_229() {
9084    if (jj_scan_token(NULLIF)) return true;
9085    return false;
9086  }
9087
9088  final private boolean jj_3R_222() {
9089    if (jj_3R_289()) return true;
9090    return false;
9091  }
9092
9093  final private boolean jj_3R_130() {
9094    if (jj_3R_198()) return true;
9095    return false;
9096  }
9097
9098  final private boolean jj_3R_228() {
9099    if (jj_3R_293()) return true;
9100    return false;
9101  }
9102
9103  final private boolean jj_3R_160() {
9104    if (jj_3R_207()) return true;
9105    return false;
9106  }
9107
9108  final private boolean jj_3R_135() {
9109    if (jj_3R_200()) return true;
9110    return false;
9111  }
9112
9113  final private boolean jj_3R_129() {
9114    if (jj_3R_197()) return true;
9115    return false;
9116  }
9117
9118  final private boolean jj_3R_191() {
9119    Token xsp;
9120    xsp = jj_scanpos;
9121    if (jj_3R_227()) {
9122    jj_scanpos = xsp;
9123    if (jj_3R_228()) {
9124    jj_scanpos = xsp;
9125    if (jj_3R_229()) {
9126    jj_scanpos = xsp;
9127    if (jj_3R_230()) return true;
9128    }
9129    }
9130    }
9131    return false;
9132  }
9133
9134  final private boolean jj_3R_227() {
9135    if (jj_3R_207()) return true;
9136    return false;
9137  }
9138
9139  final private boolean jj_3_35() {
9140    if (jj_3R_68()) return true;
9141    return false;
9142  }
9143
9144  final private boolean jj_3R_342() {
9145    if (jj_scan_token(SESSION_USER)) return true;
9146    return false;
9147  }
9148
9149  final private boolean jj_3_43() {
9150    if (jj_3R_73()) return true;
9151    return false;
9152  }
9153
9154  final private boolean jj_3_23() {
9155    if (jj_3R_70()) return true;
9156    return false;
9157  }
9158
9159  final private boolean jj_3R_341() {
9160    if (jj_scan_token(CURRENT_USER)) return true;
9161    return false;
9162  }
9163
9164  final private boolean jj_3R_128() {
9165    if (jj_scan_token(GET_CURRENT_CONNECTION)) return true;
9166    return false;
9167  }
9168
9169  final private boolean jj_3R_71() {
9170    Token xsp;
9171    xsp = jj_scanpos;
9172    if (jj_3R_128()) {
9173    jj_scanpos = xsp;
9174    if (jj_3R_129()) {
9175    jj_scanpos = xsp;
9176    if (jj_3R_130()) {
9177    jj_scanpos = xsp;
9178    if (jj_3_27()) {
9179    jj_scanpos = xsp;
9180    if (jj_3R_131()) {
9181    jj_scanpos = xsp;
9182    if (jj_3R_132()) {
9183    jj_scanpos = xsp;
9184    if (jj_3R_133()) {
9185    jj_scanpos = xsp;
9186    if (jj_3R_134()) return true;
9187    }
9188    }
9189    }
9190    }
9191    }
9192    }
9193    }
9194    return false;
9195  }
9196
9197  final private boolean jj_3R_100() {
9198    Token xsp;
9199    xsp = jj_scanpos;
9200    lookingAhead = true;
9201    jj_semLA = javaClassFollows();
9202    lookingAhead = false;
9203    if (!jj_semLA || jj_3R_184()) {
9204    jj_scanpos = xsp;
9205    if (jj_3_23()) return true;
9206    }
9207    return false;
9208  }
9209
9210  final private boolean jj_3R_184() {
9211    if (jj_3R_222()) return true;
9212    return false;
9213  }
9214
9215  final private boolean jj_3R_340() {
9216    if (jj_scan_token(USER)) return true;
9217    return false;
9218  }
9219
9220  final private boolean jj_3R_330() {
9221    Token xsp;
9222    xsp = jj_scanpos;
9223    if (jj_3R_340()) {
9224    jj_scanpos = xsp;
9225    if (jj_3R_341()) {
9226    jj_scanpos = xsp;
9227    if (jj_3R_342()) return true;
9228    }
9229    }
9230    return false;
9231  }
9232
9233  final private boolean jj_3R_72() {
9234    if (jj_3R_135()) return true;
9235    return false;
9236  }
9237
9238  final private boolean jj_3R_159() {
9239    if (jj_3R_194()) return true;
9240    return false;
9241  }
9242
9243  final private boolean jj_3R_312() {
9244    if (jj_3R_330()) return true;
9245    return false;
9246  }
9247
9248  final private boolean jj_3R_211() {
9249    if (jj_scan_token(LOCKSIZE)) return true;
9250    return false;
9251  }
9252
9253  final private boolean jj_3R_311() {
9254    if (jj_3R_329()) return true;
9255    return false;
9256  }
9257
9258  final private boolean jj_3R_293() {
9259    Token xsp;
9260    xsp = jj_scanpos;
9261    if (jj_3R_311()) {
9262    jj_scanpos = xsp;
9263    if (jj_3R_312()) return true;
9264    }
9265    return false;
9266  }
9267
9268  final private boolean jj_3R_234() {
9269    if (jj_3R_295()) return true;
9270    return false;
9271  }
9272
9273  final private boolean jj_3R_158() {
9274    if (jj_3R_194()) return true;
9275    return false;
9276  }
9277
9278  final private boolean jj_3R_149() {
9279    if (jj_3R_204()) return true;
9280    return false;
9281  }
9282
9283  final private boolean jj_3_26() {
9284    if (jj_3R_73()) return true;
9285    return false;
9286  }
9287
9288  final private boolean jj_3R_78() {
9289    Token xsp;
9290    xsp = jj_scanpos;
9291    if (jj_3_22()) {
9292    jj_scanpos = xsp;
9293    if (jj_3R_149()) return true;
9294    }
9295    return false;
9296  }
9297
9298  final private boolean jj_3_22() {
9299    if (jj_3R_68()) return true;
9300    return false;
9301  }
9302
9303  final private boolean jj_3R_288() {
9304    if (jj_scan_token(RELEASE)) return true;
9305    return false;
9306  }
9307
9308  final private boolean jj_3R_157() {
9309    if (jj_scan_token(USER)) return true;
9310    return false;
9311  }
9312
9313  final private boolean jj_3R_287() {
9314    if (jj_scan_token(ROLLBACK)) return true;
9315    return false;
9316  }
9317
9318  final private boolean jj_3R_324() {
9319    if (jj_scan_token(FALSE)) return true;
9320    return false;
9321  }
9322
9323  final private boolean jj_3R_83() {
9324    Token xsp;
9325    xsp = jj_scanpos;
9326    lookingAhead = true;
9327    jj_semLA = getToken(2).kind == SCHEMA || getToken(2).kind == SQLID;
9328    lookingAhead = false;
9329    if (!jj_semLA || jj_3R_156()) {
9330    jj_scanpos = xsp;
9331    if (jj_3R_157()) {
9332    jj_scanpos = xsp;
9333    lookingAhead = true;
9334    jj_semLA = getToken(1).kind == DATE ||
9335                getToken(1).kind == TIME ||
9336                getToken(1).kind == TIMESTAMP;
9337    lookingAhead = false;
9338    if (!jj_semLA || jj_3R_158()) {
9339    jj_scanpos = xsp;
9340    lookingAhead = true;
9341    jj_semLA = getToken(2).kind == LEFT_PAREN ||
9342                       (getToken(4).kind == LEFT_PAREN &&
9343                        getToken(2).kind != COMMA);
9344    lookingAhead = false;
9345    if (!jj_semLA || jj_3R_159()) {
9346    jj_scanpos = xsp;
9347    if (jj_3_43()) {
9348    jj_scanpos = xsp;
9349    if (jj_3R_160()) return true;
9350    }
9351    }
9352    }
9353    }
9354    }
9355    return false;
9356  }
9357
9358  final private boolean jj_3R_156() {
9359    if (jj_scan_token(CURRENT)) return true;
9360    return false;
9361  }
9362
9363  final private boolean jj_3R_323() {
9364    if (jj_scan_token(TRUE)) return true;
9365    return false;
9366  }
9367
9368  final private boolean jj_3R_305() {
9369    Token xsp;
9370    xsp = jj_scanpos;
9371    if (jj_3R_323()) {
9372    jj_scanpos = xsp;
9373    if (jj_3R_324()) return true;
9374    }
9375    return false;
9376  }
9377
9378  final private boolean jj_3R_286() {
9379    if (jj_scan_token(SAVEPOINT)) return true;
9380    return false;
9381  }
9382
9383  final private boolean jj_3R_221() {
9384    Token xsp;
9385    xsp = jj_scanpos;
9386    if (jj_3R_286()) {
9387    jj_scanpos = xsp;
9388    if (jj_3R_287()) {
9389    jj_scanpos = xsp;
9390    if (jj_3R_288()) return true;
9391    }
9392    }
9393    return false;
9394  }
9395
9396  final private boolean jj_3R_215() {
9397    if (jj_scan_token(XML)) return true;
9398    return false;
9399  }
9400
9401  final private boolean jj_3R_67() {
9402    if (jj_3R_68()) return true;
9403    return false;
9404  }
9405
9406  final private boolean jj_3R_155() {
9407    if (jj_scan_token(LEFT_PAREN)) return true;
9408    return false;
9409  }
9410
9411  final private boolean jj_3_9() {
9412    if (jj_3R_56()) return true;
9413    return false;
9414  }
9415
9416  final private boolean jj_3R_183() {
9417    if (jj_scan_token(CURRENT)) return true;
9418    return false;
9419  }
9420
9421  final private boolean jj_3R_99() {
9422    Token xsp;
9423    xsp = jj_scanpos;
9424    if (jj_scan_token(214)) {
9425    jj_scanpos = xsp;
9426    lookingAhead = true;
9427    jj_semLA = getToken(1).kind == CURRENT && ( getToken(2).kind == SCHEMA || getToken(2).kind == SQLID );
9428    lookingAhead = false;
9429    if (!jj_semLA || jj_3R_183()) return true;
9430    }
9431    return false;
9432  }
9433
9434  final private boolean jj_3_42() {
9435    if (jj_3R_83()) return true;
9436    return false;
9437  }
9438
9439  final private boolean jj_3_18() {
9440    if (jj_3R_67()) return true;
9441    return false;
9442  }
9443
9444  final private boolean jj_3R_292() {
9445    if (jj_3R_295()) return true;
9446    return false;
9447  }
9448
9449  final private boolean jj_3R_226() {
9450    Token xsp;
9451    xsp = jj_scanpos;
9452    lookingAhead = true;
9453    jj_semLA = getToken(2).kind == PERIOD &&
9454                getToken(4).kind == LEFT_PAREN;
9455    lookingAhead = false;
9456    if (!jj_semLA || jj_3R_292()) {
9457    jj_scanpos = xsp;
9458    if (jj_3_9()) return true;
9459    }
9460    return false;
9461  }
9462
9463  final private boolean jj_3R_213() {
9464    if (jj_scan_token(LONG)) return true;
9465    return false;
9466  }
9467
9468  final private boolean jj_3R_194() {
9469    Token xsp;
9470    xsp = jj_scanpos;
9471    lookingAhead = true;
9472    jj_semLA = ( (getToken(1).kind == GET_CURRENT_CONNECTION ||
9473                getToken(1).kind == ABS ||
9474                getToken(1).kind == ABSVAL ||
9475                getToken(1).kind == SQRT ||
9476                getToken(1).kind == MOD ||
9477                getToken(1).kind == COALESCE ||
9478                getToken(1).kind == VALUE ||
9479                getToken(1).kind == IDENTITY_VAL_LOCAL ||
9480                getToken(1).kind == SUBSTRING ||
9481                getToken(1).kind == SUBSTR ||
9482                getToken(1).kind == UPPER ||
9483                getToken(1).kind == LOWER ||
9484                getToken(1).kind == UCASE ||
9485                getToken(1).kind == LCASE ||
9486                getToken(1).kind == LTRIM ||
9487                getToken(1).kind == RTRIM ||
9488                getToken(1).kind == DATE ||
9489                getToken(1).kind == TIME ||
9490                getToken(1).kind == TIMESTAMP ||
9491                getToken(1).kind == DOUBLE ||
9492                getToken(1).kind == CHAR ||
9493                getToken(1).kind == VARCHAR ||
9494                getToken(1).kind == INTEGER ||
9495                getToken(1).kind == INT ||
9496                getToken(1).kind == SMALLINT ||
9497                getToken(1).kind == LONGINT ||
9498                getToken(1).kind == YEAR ||
9499                getToken(1).kind == MONTH ||
9500                getToken(1).kind == DAY ||
9501                getToken(1).kind == HOUR ||
9502                getToken(1).kind == MINUTE ||
9503                getToken(1).kind == SECOND ||
9504                getToken(1).kind == LENGTH ||
9505                getToken(1).kind == LOCATE ||
9506                getToken(1).kind == XMLPARSE ||
9507                getToken(1).kind == XMLSERIALIZE ||
9508                getToken(1).kind == XMLEXISTS ||
9509                getToken(1).kind == XMLQUERY ) &&
9510              getToken(2).kind == LEFT_PAREN
9511              );
9512    lookingAhead = false;
9513    if (!jj_semLA || jj_3R_233()) {
9514    jj_scanpos = xsp;
9515    if (jj_3_26()) {
9516    jj_scanpos = xsp;
9517    if (jj_3R_234()) return true;
9518    }
9519    }
9520    return false;
9521  }
9522
9523  final private boolean jj_3R_233() {
9524    if (jj_3R_71()) return true;
9525    return false;
9526  }
9527
9528  final private boolean jj_3R_54() {
9529    if (jj_3R_99()) return true;
9530    return false;
9531  }
9532
9533  final private boolean jj_3R_254() {
9534    if (jj_3R_299()) return true;
9535    return false;
9536  }
9537
9538  final private boolean jj_3R_170() {
9539    if (jj_3R_211()) return true;
9540    return false;
9541  }
9542
9543  final private boolean jj_3R_112() {
9544    if (jj_scan_token(DOUBLE)) return true;
9545    return false;
9546  }
9547
9548  final private boolean jj_3R_253() {
9549    if (jj_scan_token(TIMESTAMP)) return true;
9550    return false;
9551  }
9552
9553  final private boolean jj_3R_115() {
9554    Token xsp;
9555    xsp = jj_scanpos;
9556    lookingAhead = true;
9557    jj_semLA = getToken(2).kind == PERIOD &&
9558                        (
9559                                getToken(3).kind == ASTERISK ||
9560                                (getToken(4).kind == PERIOD && getToken(5).kind == ASTERISK)
9561                        );
9562    lookingAhead = false;
9563    if (!jj_semLA || jj_3R_187()) {
9564    jj_scanpos = xsp;
9565    if (jj_3_18()) return true;
9566    }
9567    return false;
9568  }
9569
9570  final private boolean jj_3R_187() {
9571    if (jj_3R_205()) return true;
9572    return false;
9573  }
9574
9575  final private boolean jj_3R_64() {
9576    Token xsp;
9577    xsp = jj_scanpos;
9578    lookingAhead = true;
9579    jj_semLA = getToken(2).kind == PRECISION;
9580    lookingAhead = false;
9581    if (!jj_semLA || jj_3R_112()) {
9582    jj_scanpos = xsp;
9583    if (jj_scan_token(121)) return true;
9584    }
9585    return false;
9586  }
9587
9588  final private boolean jj_3_25() {
9589    if (jj_3R_72()) return true;
9590    return false;
9591  }
9592
9593  final private boolean jj_3R_127() {
9594    if (jj_3R_196()) return true;
9595    return false;
9596  }
9597
9598  final private boolean jj_3R_252() {
9599    if (jj_scan_token(DATE)) return true;
9600    return false;
9601  }
9602
9603  final private boolean jj_3_15() {
9604    if (jj_3R_64()) return true;
9605    return false;
9606  }
9607
9608  final private boolean jj_3R_169() {
9609    if (jj_3R_210()) return true;
9610    return false;
9611  }
9612
9613  final private boolean jj_3R_154() {
9614    if (jj_3R_206()) return true;
9615    return false;
9616  }
9617
9618  final private boolean jj_3R_201() {
9619    Token xsp;
9620    xsp = jj_scanpos;
9621    if (jj_3R_251()) {
9622    jj_scanpos = xsp;
9623    if (jj_3R_252()) {
9624    jj_scanpos = xsp;
9625    if (jj_3R_253()) {
9626    jj_scanpos = xsp;
9627    if (jj_3R_254()) return true;
9628    }
9629    }
9630    }
9631    return false;
9632  }
9633
9634  final private boolean jj_3R_251() {
9635    if (jj_scan_token(TIME)) return true;
9636    return false;
9637  }
9638
9639  final private boolean jj_3R_168() {
9640    if (jj_scan_token(ALTER)) return true;
9641    return false;
9642  }
9643
9644  final private boolean jj_3R_66() {
9645    if (jj_3R_115()) return true;
9646    return false;
9647  }
9648
9649  final private boolean jj_3R_111() {
9650    if (jj_scan_token(REAL)) return true;
9651    return false;
9652  }
9653
9654  final private boolean jj_3R_190() {
9655    if (jj_scan_token(PERIOD)) return true;
9656    return false;
9657  }
9658
9659  final private boolean jj_3_17() {
9660    if (jj_3R_66()) return true;
9661    return false;
9662  }
9663
9664  final private boolean jj_3R_126() {
9665    if (jj_scan_token(LEFT_PAREN)) return true;
9666    return false;
9667  }
9668
9669  final private boolean jj_3R_327() {
9670    if (jj_3R_329()) return true;
9671    return false;
9672  }
9673
9674  final private boolean jj_3R_85() {
9675    Token xsp;
9676    xsp = jj_scanpos;
9677    if (jj_3R_167()) {
9678    jj_scanpos = xsp;
9679    if (jj_3R_168()) {
9680    jj_scanpos = xsp;
9681    lookingAhead = true;
9682    jj_semLA = getToken(1).kind == DROP
9683                && (getToken(2).kind == CONSTRAINT
9684                        || getToken(2).kind == PRIMARY
9685                        || getToken(2).kind == FOREIGN
9686                        || getToken(2).kind == UNIQUE
9687                        || getToken(2).kind == CHECK);
9688    lookingAhead = false;
9689    if (!jj_semLA || jj_3R_169()) {
9690    jj_scanpos = xsp;
9691    if (jj_3R_170()) return true;
9692    }
9693    }
9694    }
9695    return false;
9696  }
9697
9698  final private boolean jj_3R_167() {
9699    if (jj_scan_token(ADD)) return true;
9700    return false;
9701  }
9702
9703  final private boolean jj_3R_144() {
9704    if (jj_3R_203()) return true;
9705    return false;
9706  }
9707
9708  final private boolean jj_3R_125() {
9709    if (jj_3R_195()) return true;
9710    return false;
9711  }
9712
9713  final private boolean jj_3R_75() {
9714    Token xsp;
9715    xsp = jj_scanpos;
9716    if (jj_3_32()) {
9717    jj_scanpos = xsp;
9718    if (jj_3R_144()) return true;
9719    }
9720    return false;
9721  }
9722
9723  final private boolean jj_3_32() {
9724    if (jj_3R_64()) return true;
9725    return false;
9726  }
9727
9728  final private boolean jj_3R_124() {
9729    if (jj_3R_194()) return true;
9730    return false;
9731  }
9732
9733  final private boolean jj_3R_355() {
9734    Token xsp;
9735    xsp = jj_scanpos;
9736    if (jj_scan_token(59)) {
9737    jj_scanpos = xsp;
9738    if (jj_scan_token(60)) {
9739    jj_scanpos = xsp;
9740    if (jj_scan_token(61)) {
9741    jj_scanpos = xsp;
9742    if (jj_scan_token(62)) {
9743    jj_scanpos = xsp;
9744    if (jj_scan_token(63)) {
9745    jj_scanpos = xsp;
9746    if (jj_scan_token(64)) {
9747    jj_scanpos = xsp;
9748    if (jj_scan_token(65)) {
9749    jj_scanpos = xsp;
9750    if (jj_scan_token(66)) {
9751    jj_scanpos = xsp;
9752    if (jj_scan_token(67)) {
9753    jj_scanpos = xsp;
9754    if (jj_scan_token(68)) {
9755    jj_scanpos = xsp;
9756    if (jj_scan_token(69)) {
9757    jj_scanpos = xsp;
9758    if (jj_scan_token(70)) {
9759    jj_scanpos = xsp;
9760    if (jj_scan_token(71)) {
9761    jj_scanpos = xsp;
9762    if (jj_scan_token(72)) {
9763    jj_scanpos = xsp;
9764    if (jj_scan_token(73)) {
9765    jj_scanpos = xsp;
9766    if (jj_scan_token(75)) {
9767    jj_scanpos = xsp;
9768    if (jj_scan_token(76)) {
9769    jj_scanpos = xsp;
9770    if (jj_scan_token(77)) {
9771    jj_scanpos = xsp;
9772    if (jj_scan_token(78)) {
9773    jj_scanpos = xsp;
9774    if (jj_scan_token(79)) {
9775    jj_scanpos = xsp;
9776    if (jj_scan_token(80)) {
9777    jj_scanpos = xsp;
9778    if (jj_scan_token(81)) {
9779    jj_scanpos = xsp;
9780    if (jj_scan_token(82)) {
9781    jj_scanpos = xsp;
9782    if (jj_scan_token(83)) {
9783    jj_scanpos = xsp;
9784    if (jj_scan_token(85)) {
9785    jj_scanpos = xsp;
9786    if (jj_scan_token(86)) {
9787    jj_scanpos = xsp;
9788    if (jj_scan_token(88)) {
9789    jj_scanpos = xsp;
9790    if (jj_scan_token(89)) {
9791    jj_scanpos = xsp;
9792    if (jj_scan_token(90)) {
9793    jj_scanpos = xsp;
9794    if (jj_scan_token(91)) {
9795    jj_scanpos = xsp;
9796    if (jj_scan_token(92)) {
9797    jj_scanpos = xsp;
9798    if (jj_scan_token(93)) {
9799    jj_scanpos = xsp;
9800    if (jj_scan_token(94)) {
9801    jj_scanpos = xsp;
9802    if (jj_scan_token(95)) {
9803    jj_scanpos = xsp;
9804    if (jj_scan_token(96)) {
9805    jj_scanpos = xsp;
9806    if (jj_scan_token(97)) {
9807    jj_scanpos = xsp;
9808    if (jj_scan_token(98)) {
9809    jj_scanpos = xsp;
9810    if (jj_scan_token(100)) {
9811    jj_scanpos = xsp;
9812    if (jj_scan_token(101)) {
9813    jj_scanpos = xsp;
9814    if (jj_scan_token(102)) {
9815    jj_scanpos = xsp;
9816    if (jj_scan_token(103)) {
9817    jj_scanpos = xsp;
9818    if (jj_scan_token(104)) {
9819    jj_scanpos = xsp;
9820    if (jj_scan_token(105)) {
9821    jj_scanpos = xsp;
9822    if (jj_scan_token(106)) {
9823    jj_scanpos = xsp;
9824    if (jj_scan_token(108)) {
9825    jj_scanpos = xsp;
9826    if (jj_scan_token(109)) {
9827    jj_scanpos = xsp;
9828    if (jj_scan_token(110)) {
9829    jj_scanpos = xsp;
9830    if (jj_scan_token(111)) {
9831    jj_scanpos = xsp;
9832    if (jj_scan_token(112)) {
9833    jj_scanpos = xsp;
9834    if (jj_scan_token(113)) {
9835    jj_scanpos = xsp;
9836    if (jj_scan_token(114)) {
9837    jj_scanpos = xsp;
9838    if (jj_scan_token(115)) {
9839    jj_scanpos = xsp;
9840    if (jj_scan_token(116)) {
9841    jj_scanpos = xsp;
9842    if (jj_scan_token(117)) {
9843    jj_scanpos = xsp;
9844    if (jj_scan_token(118)) {
9845    jj_scanpos = xsp;
9846    if (jj_scan_token(119)) {
9847    jj_scanpos = xsp;
9848    if (jj_scan_token(120)) {
9849    jj_scanpos = xsp;
9850    if (jj_scan_token(121)) {
9851    jj_scanpos = xsp;
9852    if (jj_scan_token(122)) {
9853    jj_scanpos = xsp;
9854    if (jj_scan_token(123)) {
9855    jj_scanpos = xsp;
9856    if (jj_scan_token(124)) {
9857    jj_scanpos = xsp;
9858    if (jj_scan_token(125)) {
9859    jj_scanpos = xsp;
9860    if (jj_scan_token(126)) {
9861    jj_scanpos = xsp;
9862    if (jj_scan_token(127)) {
9863    jj_scanpos = xsp;
9864    if (jj_scan_token(128)) {
9865    jj_scanpos = xsp;
9866    if (jj_scan_token(129)) {
9867    jj_scanpos = xsp;
9868    if (jj_scan_token(130)) {
9869    jj_scanpos = xsp;
9870    if (jj_scan_token(131)) {
9871    jj_scanpos = xsp;
9872    if (jj_scan_token(132)) {
9873    jj_scanpos = xsp;
9874    if (jj_scan_token(133)) {
9875    jj_scanpos = xsp;
9876    if (jj_scan_token(134)) {
9877    jj_scanpos = xsp;
9878    if (jj_scan_token(135)) {
9879    jj_scanpos = xsp;
9880    if (jj_scan_token(136)) {
9881    jj_scanpos = xsp;
9882    if (jj_scan_token(137)) {
9883    jj_scanpos = xsp;
9884    if (jj_scan_token(138)) {
9885    jj_scanpos = xsp;
9886    if (jj_scan_token(139)) {
9887    jj_scanpos = xsp;
9888    if (jj_scan_token(140)) {
9889    jj_scanpos = xsp;
9890    if (jj_scan_token(141)) {
9891    jj_scanpos = xsp;
9892    if (jj_scan_token(142)) {
9893    jj_scanpos = xsp;
9894    if (jj_scan_token(143)) {
9895    jj_scanpos = xsp;
9896    if (jj_scan_token(342)) {
9897    jj_scanpos = xsp;
9898    if (jj_scan_token(144)) {
9899    jj_scanpos = xsp;
9900    if (jj_scan_token(145)) {
9901    jj_scanpos = xsp;
9902    if (jj_scan_token(146)) {
9903    jj_scanpos = xsp;
9904    if (jj_scan_token(147)) {
9905    jj_scanpos = xsp;
9906    if (jj_scan_token(148)) {
9907    jj_scanpos = xsp;
9908    if (jj_scan_token(149)) {
9909    jj_scanpos = xsp;
9910    if (jj_scan_token(150)) {
9911    jj_scanpos = xsp;
9912    if (jj_scan_token(151)) {
9913    jj_scanpos = xsp;
9914    if (jj_scan_token(152)) {
9915    jj_scanpos = xsp;
9916    if (jj_scan_token(153)) {
9917    jj_scanpos = xsp;
9918    if (jj_scan_token(154)) {
9919    jj_scanpos = xsp;
9920    if (jj_scan_token(155)) {
9921    jj_scanpos = xsp;
9922    if (jj_scan_token(156)) {
9923    jj_scanpos = xsp;
9924    if (jj_scan_token(282)) {
9925    jj_scanpos = xsp;
9926    if (jj_scan_token(157)) {
9927    jj_scanpos = xsp;
9928    if (jj_scan_token(158)) {
9929    jj_scanpos = xsp;
9930    if (jj_scan_token(159)) {
9931    jj_scanpos = xsp;
9932    if (jj_scan_token(160)) {
9933    jj_scanpos = xsp;
9934    if (jj_scan_token(161)) {
9935    jj_scanpos = xsp;
9936    if (jj_scan_token(162)) {
9937    jj_scanpos = xsp;
9938    if (jj_scan_token(163)) {
9939    jj_scanpos = xsp;
9940    if (jj_scan_token(164)) {
9941    jj_scanpos = xsp;
9942    if (jj_scan_token(165)) {
9943    jj_scanpos = xsp;
9944    if (jj_scan_token(166)) {
9945    jj_scanpos = xsp;
9946    if (jj_scan_token(167)) {
9947    jj_scanpos = xsp;
9948    if (jj_scan_token(168)) {
9949    jj_scanpos = xsp;
9950    if (jj_scan_token(169)) {
9951    jj_scanpos = xsp;
9952    if (jj_scan_token(170)) {
9953    jj_scanpos = xsp;
9954    if (jj_scan_token(171)) {
9955    jj_scanpos = xsp;
9956    if (jj_scan_token(172)) {
9957    jj_scanpos = xsp;
9958    if (jj_scan_token(173)) {
9959    jj_scanpos = xsp;
9960    if (jj_scan_token(174)) {
9961    jj_scanpos = xsp;
9962    if (jj_scan_token(175)) {
9963    jj_scanpos = xsp;
9964    if (jj_scan_token(177)) {
9965    jj_scanpos = xsp;
9966    if (jj_scan_token(178)) {
9967    jj_scanpos = xsp;
9968    if (jj_scan_token(179)) {
9969    jj_scanpos = xsp;
9970    if (jj_scan_token(378)) {
9971    jj_scanpos = xsp;
9972    if (jj_scan_token(180)) {
9973    jj_scanpos = xsp;
9974    if (jj_scan_token(181)) {
9975    jj_scanpos = xsp;
9976    if (jj_scan_token(182)) {
9977    jj_scanpos = xsp;
9978    if (jj_scan_token(183)) {
9979    jj_scanpos = xsp;
9980    if (jj_scan_token(184)) {
9981    jj_scanpos = xsp;
9982    if (jj_scan_token(185)) {
9983    jj_scanpos = xsp;
9984    if (jj_scan_token(186)) {
9985    jj_scanpos = xsp;
9986    if (jj_scan_token(187)) {
9987    jj_scanpos = xsp;
9988    if (jj_scan_token(188)) {
9989    jj_scanpos = xsp;
9990    if (jj_scan_token(189)) {
9991    jj_scanpos = xsp;
9992    if (jj_scan_token(190)) {
9993    jj_scanpos = xsp;
9994    if (jj_scan_token(191)) {
9995    jj_scanpos = xsp;
9996    if (jj_scan_token(192)) {
9997    jj_scanpos = xsp;
9998    if (jj_scan_token(383)) {
9999    jj_scanpos = xsp;
0000    if (jj_scan_token(193)) {
0001    jj_scanpos = xsp;
0002    if (jj_scan_token(194)) {
0003    jj_scanpos = xsp;
0004    if (jj_scan_token(195)) {
0005    jj_scanpos = xsp;
0006    if (jj_scan_token(196)) {
0007    jj_scanpos = xsp;
0008    if (jj_scan_token(197)) {
0009    jj_scanpos = xsp;
0010    if (jj_scan_token(198)) {
0011    jj_scanpos = xsp;
0012    if (jj_scan_token(199)) {
0013    jj_scanpos = xsp;
0014    if (jj_scan_token(200)) {
0015    jj_scanpos = xsp;
0016    if (jj_scan_token(201)) {
0017    jj_scanpos = xsp;
0018    if (jj_scan_token(202)) {
0019    jj_scanpos = xsp;
0020    if (jj_scan_token(203)) {
0021    jj_scanpos = xsp;
0022    if (jj_scan_token(204)) {
0023    jj_scanpos = xsp;
0024    if (jj_scan_token(205)) {
0025    jj_scanpos = xsp;
0026    if (jj_scan_token(206)) {
0027    jj_scanpos = xsp;
0028    if (jj_scan_token(207)) {
0029    jj_scanpos = xsp;
0030    if (jj_scan_token(208)) {
0031    jj_scanpos = xsp;
0032    if (jj_scan_token(209)) {
0033    jj_scanpos = xsp;
0034    if (jj_scan_token(210)) {
0035    jj_scanpos = xsp;
0036    if (jj_scan_token(211)) {
0037    jj_scanpos = xsp;
0038    if (jj_scan_token(212)) {
0039    jj_scanpos = xsp;
0040    if (jj_scan_token(213)) {
0041    jj_scanpos = xsp;
0042    if (jj_scan_token(214)) {
0043    jj_scanpos = xsp;
0044    if (jj_scan_token(215)) {
0045    jj_scanpos = xsp;
0046    if (jj_scan_token(216)) {
0047    jj_scanpos = xsp;
0048    if (jj_scan_token(217)) {
0049    jj_scanpos = xsp;
0050    if (jj_scan_token(218)) {
0051    jj_scanpos = xsp;
0052    if (jj_scan_token(219)) {
0053    jj_scanpos = xsp;
0054    if (jj_scan_token(220)) {
0055    jj_scanpos = xsp;
0056    if (jj_scan_token(221)) {
0057    jj_scanpos = xsp;
0058    if (jj_scan_token(222)) {
0059    jj_scanpos = xsp;
0060    if (jj_scan_token(223)) {
0061    jj_scanpos = xsp;
0062    if (jj_scan_token(224)) {
0063    jj_scanpos = xsp;
0064    if (jj_scan_token(225)) {
0065    jj_scanpos = xsp;
0066    if (jj_scan_token(226)) {
0067    jj_scanpos = xsp;
0068    if (jj_scan_token(227)) {
0069    jj_scanpos = xsp;
0070    if (jj_scan_token(228)) {
0071    jj_scanpos = xsp;
0072    if (jj_scan_token(229)) {
0073    jj_scanpos = xsp;
0074    if (jj_scan_token(231)) {
0075    jj_scanpos = xsp;
0076    if (jj_scan_token(232)) {
0077    jj_scanpos = xsp;
0078    if (jj_scan_token(233)) {
0079    jj_scanpos = xsp;
0080    if (jj_scan_token(234)) {
0081    jj_scanpos = xsp;
0082    if (jj_scan_token(235)) {
0083    jj_scanpos = xsp;
0084    if (jj_scan_token(236)) {
0085    jj_scanpos = xsp;
0086    if (jj_scan_token(237)) {
0087    jj_scanpos = xsp;
0088    if (jj_scan_token(238)) {
0089    jj_scanpos = xsp;
0090    if (jj_scan_token(239)) {
0091    jj_scanpos = xsp;
0092    if (jj_scan_token(241)) {
0093    jj_scanpos = xsp;
0094    if (jj_scan_token(242)) {
0095    jj_scanpos = xsp;
0096    if (jj_scan_token(243)) {
0097    jj_scanpos = xsp;
0098    if (jj_scan_token(244)) {
0099    jj_scanpos = xsp;
0100    if (jj_scan_token(245)) {
0101    jj_scanpos = xsp;
0102    if (jj_scan_token(246)) {
0103    jj_scanpos = xsp;
0104    if (jj_scan_token(247)) {
0105    jj_scanpos = xsp;
0106    if (jj_scan_token(249)) {
0107    jj_scanpos = xsp;
0108    if (jj_scan_token(251)) {
0109    jj_scanpos = xsp;
0110    if (jj_scan_token(252)) {
0111    jj_scanpos = xsp;
0112    if (jj_scan_token(253)) {
0113    jj_scanpos = xsp;
0114    if (jj_scan_token(254)) {
0115    jj_scanpos = xsp;
0116    if (jj_scan_token(255)) {
0117    jj_scanpos = xsp;
0118    if (jj_scan_token(256)) {
0119    jj_scanpos = xsp;
0120    if (jj_scan_token(257)) {
0121    jj_scanpos = xsp;
0122    if (jj_scan_token(258)) {
0123    jj_scanpos = xsp;
0124    if (jj_scan_token(259)) {
0125    jj_scanpos = xsp;
0126    if (jj_scan_token(337)) {
0127    jj_scanpos = xsp;
0128    if (jj_scan_token(338)) {
0129    jj_scanpos = xsp;
0130    if (jj_scan_token(343)) {
0131    jj_scanpos = xsp;
0132    if (jj_scan_token(344)) {
0133    jj_scanpos = xsp;
0134    if (jj_scan_token(346)) {
0135    jj_scanpos = xsp;
0136    if (jj_scan_token(347)) {
0137    jj_scanpos = xsp;
0138    if (jj_scan_token(348)) {
0139    jj_scanpos = xsp;
0140    if (jj_scan_token(349)) {
0141    jj_scanpos = xsp;
0142    if (jj_scan_token(351)) {
0143    jj_scanpos = xsp;
0144    if (jj_scan_token(353)) {
0145    jj_scanpos = xsp;
0146    if (jj_scan_token(350)) {
0147    jj_scanpos = xsp;
0148    if (jj_scan_token(352)) return true;
0149    }
0150    }
0151    }
0152    }
0153    }
0154    }
0155    }
0156    }
0157    }
0158    }
0159    }
0160    }
0161    }
0162    }
0163    }
0164    }
0165    }
0166    }
0167    }
0168    }
0169    }
0170    }
0171    }
0172    }
0173    }
0174    }
0175    }
0176    }
0177    }
0178    }
0179    }
0180    }
0181    }
0182    }
0183    }
0184    }
0185    }
0186    }
0187    }
0188    }
0189    }
0190    }
0191    }
0192    }
0193    }
0194    }
0195    }
0196    }
0197    }
0198    }
0199    }
0200    }
0201    }
0202    }
0203    }
0204    }
0205    }
0206    }
0207    }
0208    }
0209    }
0210    }
0211    }
0212    }
0213    }
0214    }
0215    }
0216    }
0217    }
0218    }
0219    }
0220    }
0221    }
0222    }
0223    }
0224    }
0225    }
0226    }
0227    }
0228    }
0229    }
0230    }
0231    }
0232    }
0233    }
0234    }
0235    }
0236    }
0237    }
0238    }
0239    }
0240    }
0241    }
0242    }
0243    }
0244    }
0245    }
0246    }
0247    }
0248    }
0249    }
0250    }
0251    }
0252    }
0253    }
0254    }
0255    }
0256    }
0257    }
0258    }
0259    }
0260    }
0261    }
0262    }
0263    }
0264    }
0265    }
0266    }
0267    }
0268    }
0269    }
0270    }
0271    }
0272    }
0273    }
0274    }
0275    }
0276    }
0277    }
0278    }
0279    }
0280    }
0281    }
0282    }
0283    }
0284    }
0285    }
0286    }
0287    }
0288    }
0289    }
0290    }
0291    }
0292    }
0293    }
0294    }
0295    }
0296    }
0297    }
0298    }
0299    }
0300    }
0301    }
0302    }
0303    }
0304    }
0305    }
0306    }
0307    }
0308    }
0309    }
0310    }
0311    }
0312    }
0313    }
0314    }
0315    }
0316    }
0317    }
0318    }
0319    }
0320    }
0321    }
0322    }
0323    }
0324    }
0325    }
0326    }
0327    }
0328    }
0329    }
0330    }
0331    }
0332    }
0333    }
0334    }
0335    }
0336    }
0337    }
0338    }
0339    }
0340    }
0341    }
0342    }
0343    }
0344    }
0345    }
0346    }
0347    }
0348    }
0349    }
0350    }
0351    }
0352    }
0353    }
0354    }
0355    return false;
0356  }
0357
0358  final private boolean jj_3R_123() {
0359    if (jj_3R_193()) return true;
0360    return false;
0361  }
0362
0363  final private boolean jj_3R_326() {
0364    if (jj_scan_token(CALL)) return true;
0365    return false;
0366  }
0367
0368  final private boolean jj_3R_307() {
0369    Token xsp;
0370    xsp = jj_scanpos;
0371    if (jj_3R_326()) {
0372    jj_scanpos = xsp;
0373    if (jj_3R_327()) return true;
0374    }
0375    return false;
0376  }
0377
0378  final private boolean jj_3R_117() {
0379    Token xsp;
0380    xsp = jj_scanpos;
0381    lookingAhead = true;
0382    jj_semLA = getToken(3).kind == LEFT_PAREN;
0383    lookingAhead = false;
0384    if (!jj_semLA || jj_3R_189()) {
0385    jj_scanpos = xsp;
0386    if (jj_3R_190()) return true;
0387    }
0388    return false;
0389  }
0390
0391  final private boolean jj_3R_189() {
0392    Token xsp;
0393    xsp = jj_scanpos;
0394    if (jj_scan_token(441)) {
0395    jj_scanpos = xsp;
0396    if (jj_scan_token(423)) return true;
0397    }
0398    return false;
0399  }
0400
0401  final private boolean jj_3R_110() {
0402    if (jj_scan_token(FLOAT)) return true;
0403    return false;
0404  }
0405
0406  final private boolean jj_3R_63() {
0407    Token xsp;
0408    xsp = jj_scanpos;
0409    if (jj_3R_110()) {
0410    jj_scanpos = xsp;
0411    if (jj_3R_111()) {
0412    jj_scanpos = xsp;
0413    if (jj_3_15()) return true;
0414    }
0415    }
0416    return false;
0417  }
0418
0419  final private boolean jj_3R_268() {
0420    if (jj_scan_token(UR)) return true;
0421    return false;
0422  }
0423
0424  final private boolean jj_3R_122() {
0425    if (jj_3R_192()) return true;
0426    return false;
0427  }
0428
0429  final private boolean jj_3R_153() {
0430    if (jj_3R_205()) return true;
0431    return false;
0432  }
0433
0434  final private boolean jj_3R_267() {
0435    if (jj_scan_token(CS)) return true;
0436    return false;
0437  }
0438
0439  final private boolean jj_3R_266() {
0440    if (jj_scan_token(RS)) return true;
0441    return false;
0442  }
0443
0444  final private boolean jj_3R_285() {
0445    if (jj_scan_token(LEFT_BRACE)) return true;
0446    return false;
0447  }
0448
0449  final private boolean jj_3R_284() {
0450    if (jj_3R_307()) return true;
0451    return false;
0452  }
0453
0454  final private boolean jj_3R_114() {
0455    if (jj_scan_token(ALL)) return true;
0456    return false;
0457  }
0458
0459  final private boolean jj_3R_121() {
0460    if (jj_3R_191()) return true;
0461    return false;
0462  }
0463
0464  final private boolean jj_3R_265() {
0465    if (jj_scan_token(RR)) return true;
0466    return false;
0467  }
0468
0469  final private boolean jj_3R_166() {
0470    if (jj_scan_token(READ)) return true;
0471    return false;
0472  }
0473
0474  final private boolean jj_3R_69() {
0475    if (jj_3R_117()) return true;
0476    return false;
0477  }
0478
0479  final private boolean jj_3R_259() {
0480    if (jj_scan_token(LONGINT)) return true;
0481    return false;
0482  }
0483
0484  final private boolean jj_3R_220() {
0485    Token xsp;
0486    xsp = jj_scanpos;
0487    if (jj_3R_284()) {
0488    jj_scanpos = xsp;
0489    if (jj_3R_285()) return true;
0490    }
0491    return false;
0492  }
0493
0494  final private boolean jj_3R_120() {
0495    if (jj_scan_token(CURRENT)) return true;
0496    return false;
0497  }
0498
0499  final private boolean jj_3R_165() {
0500    if (jj_scan_token(READ)) return true;
0501    return false;
0502  }
0503
0504  final private boolean jj_3R_208() {
0505    Token xsp;
0506    xsp = jj_scanpos;
0507    if (jj_3R_265()) {
0508    jj_scanpos = xsp;
0509    if (jj_3R_266()) {
0510    jj_scanpos = xsp;
0511    if (jj_3R_267()) {
0512    jj_scanpos = xsp;
0513    if (jj_3R_268()) return true;
0514    }
0515    }
0516    }
0517    return false;
0518  }
0519
0520  final private boolean jj_3R_331() {
0521    if (jj_scan_token(DELIMITED_IDENTIFIER)) return true;
0522    return false;
0523  }
0524
0525  final private boolean jj_3R_258() {
0526    if (jj_scan_token(SMALLINT)) return true;
0527    return false;
0528  }
0529
0530  final private boolean jj_3_21() {
0531    if (jj_3R_69()) return true;
0532    return false;
0533  }
0534
0535  final private boolean jj_3R_203() {
0536    Token xsp;
0537    xsp = jj_scanpos;
0538    if (jj_3R_257()) {
0539    jj_scanpos = xsp;
0540    if (jj_3R_258()) {
0541    jj_scanpos = xsp;
0542    if (jj_3R_259()) return true;
0543    }
0544    }
0545    return false;
0546  }
0547
0548  final private boolean jj_3R_257() {
0549    Token xsp;
0550    xsp = jj_scanpos;
0551    if (jj_scan_token(161)) {
0552    jj_scanpos = xsp;
0553    if (jj_scan_token(160)) return true;
0554    }
0555    return false;
0556  }
0557
0558  final private boolean jj_3R_113() {
0559    if (jj_scan_token(DISTINCT)) return true;
0560    return false;
0561  }
0562
0563  final private boolean jj_3R_65() {
0564    Token xsp;
0565    xsp = jj_scanpos;
0566    lookingAhead = true;
0567    jj_semLA = getToken(1).kind == DISTINCT &&
0568                        !(
0569                                getToken(2).kind == PERIOD ||
0570                                getToken(2).kind == DOUBLE_COLON
0571                        );
0572    lookingAhead = false;
0573    if (!jj_semLA || jj_3R_113()) {
0574    jj_scanpos = xsp;
0575    lookingAhead = true;
0576    jj_semLA = getToken(1).kind == ALL &&
0577                        !(
0578                                getToken(2).kind == PERIOD ||
0579                                getToken(2).kind == DOUBLE_COLON
0580                        );
0581    lookingAhead = false;
0582    if (!jj_semLA || jj_3R_114()) return true;
0583    }
0584    return false;
0585  }
0586
0587  final private boolean jj_3R_119() {
0588    if (jj_scan_token(CURRENT)) return true;
0589    return false;
0590  }
0591
0592  final private boolean jj_3R_56() {
0593    if (jj_3R_100()) return true;
0594    return false;
0595  }
0596
0597  final private boolean jj_3R_164() {
0598    if (jj_scan_token(DIRTY)) return true;
0599    return false;
0600  }
0601
0602  final private boolean jj_3R_148() {
0603    if (jj_scan_token(RETURNING)) return true;
0604    return false;
0605  }
0606
0607  final private boolean jj_3R_163() {
0608    if (jj_scan_token(CURSOR)) return true;
0609    return false;
0610  }
0611
0612  final private boolean jj_3R_209() {
0613    if (jj_scan_token(REPEATABLE)) return true;
0614    return false;
0615  }
0616
0617  final private boolean jj_3R_224() {
0618    if (jj_3R_203()) return true;
0619    return false;
0620  }
0621
0622  final private boolean jj_3R_118() {
0623    if (jj_scan_token(LEFT_BRACE)) return true;
0624    return false;
0625  }
0626
0627  final private boolean jj_3R_70() {
0628    Token xsp;
0629    xsp = jj_scanpos;
0630    lookingAhead = true;
0631    jj_semLA = escapedValueFunctionFollows();
0632    lookingAhead = false;
0633    if (!jj_semLA || jj_3R_118()) {
0634    jj_scanpos = xsp;
0635    lookingAhead = true;
0636    jj_semLA = getToken(2).kind == SCHEMA || getToken(2).kind == SQLID;
0637    lookingAhead = false;
0638    if (!jj_semLA || jj_3R_119()) {
0639    jj_scanpos = xsp;
0640    lookingAhead = true;
0641    jj_semLA = getToken(2).kind == ISOLATION;
0642    lookingAhead = false;
0643    if (!jj_semLA || jj_3R_120()) {
0644    jj_scanpos = xsp;
0645    if (jj_3R_121()) {
0646    jj_scanpos = xsp;
0647    lookingAhead = true;
0648    jj_semLA = newInvocationFollows(1);
0649    lookingAhead = false;
0650    if (!jj_semLA || jj_3R_122()) {
0651    jj_scanpos = xsp;
0652    lookingAhead = true;
0653    jj_semLA = aggregateFollows();
0654    lookingAhead = false;
0655    if (!jj_semLA || jj_3R_123()) {
0656    jj_scanpos = xsp;
0657    lookingAhead = true;
0658    jj_semLA = miscBuiltinFollows();
0659    lookingAhead = false;
0660    if (!jj_semLA || jj_3R_124()) {
0661    jj_scanpos = xsp;
0662    if (jj_3R_125()) {
0663    jj_scanpos = xsp;
0664    if (jj_3R_126()) {
0665    jj_scanpos = xsp;
0666    if (jj_3R_127()) return true;
0667    }
0668    }
0669    }
0670    }
0671    }
0672    }
0673    }
0674    }
0675    }
0676    return false;
0677  }
0678
0679  final private boolean jj_3_16() {
0680    if (jj_3R_65()) return true;
0681    return false;
0682  }
0683
0684  final private boolean jj_3R_204() {
0685    if (jj_scan_token(NULL)) return true;
0686    return false;
0687  }
0688
0689  final private boolean jj_3R_162() {
0690    Token xsp;
0691    xsp = jj_scanpos;
0692    if (jj_3R_209()) {
0693    jj_scanpos = xsp;
0694    if (jj_scan_token(314)) return true;
0695    }
0696    return false;
0697  }
0698
0699  final private boolean jj_3R_161() {
0700    if (jj_3R_208()) return true;
0701    return false;
0702  }
0703
0704  final private boolean jj_3R_77() {
0705    Token xsp;
0706    xsp = jj_scanpos;
0707    lookingAhead = true;
0708    jj_semLA = getToken(2).kind == SEQUENCE;
0709    lookingAhead = false;
0710    if (!jj_semLA || jj_3R_147()) {
0711    jj_scanpos = xsp;
0712    if (jj_3R_148()) return true;
0713    }
0714    return false;
0715  }
0716
0717  final private boolean jj_3R_147() {
0718    if (jj_scan_token(RETURNING)) return true;
0719    return false;
0720  }
0721
0722  final private boolean jj_3R_235() {
0723    if (jj_3R_296()) return true;
0724    return false;
0725  }
0726
0727  final private boolean jj_3R_81() {
0728    Token xsp;
0729    xsp = jj_scanpos;
0730    lookingAhead = true;
0731    jj_semLA = newInvocationFollows(1);
0732    lookingAhead = false;
0733    if (!jj_semLA || jj_3R_152()) {
0734    jj_scanpos = xsp;
0735    if (jj_3R_153()) {
0736    jj_scanpos = xsp;
0737    lookingAhead = true;
0738    jj_semLA = getToken(1).kind == LEFT_PAREN &&
0739                                (
0740                                        getToken(2).kind == SELECT ||
0741                                        getToken(2).kind == VALUES
0742                                );
0743    lookingAhead = false;
0744    if (!jj_semLA || jj_3R_154()) {
0745    jj_scanpos = xsp;
0746    if (jj_3R_155()) return true;
0747    }
0748    }
0749    }
0750    return false;
0751  }
0752
0753  final private boolean jj_3R_152() {
0754    if (jj_3R_192()) return true;
0755    return false;
0756  }
0757
0758  final private boolean jj_3R_356() {
0759    if (jj_scan_token(SELECT)) return true;
0760    return false;
0761  }
0762
0763  final private boolean jj_3R_310() {
0764    if (jj_scan_token(MINUS_SIGN)) return true;
0765    return false;
0766  }
0767
0768  final private boolean jj_3_8() {
0769    if (jj_3R_55()) return true;
0770    return false;
0771  }
0772
0773  final private boolean jj_3R_84() {
0774    Token xsp;
0775    xsp = jj_scanpos;
0776    if (jj_3R_161()) {
0777    jj_scanpos = xsp;
0778    if (jj_3R_162()) {
0779    jj_scanpos = xsp;
0780    if (jj_3R_163()) {
0781    jj_scanpos = xsp;
0782    if (jj_3R_164()) {
0783    jj_scanpos = xsp;
0784    lookingAhead = true;
0785    jj_semLA = getToken(1).kind == READ && getToken(2).kind == COMMITTED;
0786    lookingAhead = false;
0787    if (!jj_semLA || jj_3R_165()) {
0788    jj_scanpos = xsp;
0789    lookingAhead = true;
0790    jj_semLA = getToken(1).kind == READ && getToken(2).kind == UNCOMMITTED;
0791    lookingAhead = false;
0792    if (!jj_semLA || jj_3R_166()) return true;
0793    }
0794    }
0795    }
0796    }
0797    }
0798    return false;
0799  }
0800
0801  final private boolean jj_3_44() {
0802    if (jj_3R_84()) return true;
0803    return false;
0804  }
0805
0806  final private boolean jj_3R_316() {
0807    if (jj_3R_332()) return true;
0808    return false;
0809  }
0810
0811  final private boolean jj_3_46() {
0812    if (jj_3R_85()) return true;
0813    return false;
0814  }
0815
0816  final private boolean jj_3R_309() {
0817    if (jj_scan_token(PLUS_SIGN)) return true;
0818    return false;
0819  }
0820
0821  final private boolean jj_3R_291() {
0822    Token xsp;
0823    xsp = jj_scanpos;
0824    if (jj_3R_309()) {
0825    jj_scanpos = xsp;
0826    if (jj_3R_310()) return true;
0827    }
0828    return false;
0829  }
0830
0831  final private boolean jj_3R_334() {
0832    if (jj_scan_token(LTRIM)) return true;
0833    return false;
0834  }
0835
0836  final private boolean jj_3R_315() {
0837    if (jj_3R_331()) return true;
0838    return false;
0839  }
0840
0841  final private boolean jj_3_34() {
0842    if (jj_3R_68()) return true;
0843    return false;
0844  }
0845
0846  final private boolean jj_3R_353() {
0847    if (jj_3R_357()) return true;
0848    return false;
0849  }
0850
0851  final private boolean jj_3R_333() {
0852    if (jj_scan_token(RTRIM)) return true;
0853    return false;
0854  }
0855
0856  final private boolean jj_3R_317() {
0857    Token xsp;
0858    xsp = jj_scanpos;
0859    if (jj_3R_333()) {
0860    jj_scanpos = xsp;
0861    if (jj_3R_334()) return true;
0862    }
0863    return false;
0864  }
0865
0866  final private boolean jj_3R_352() {
0867    if (jj_3R_356()) return true;
0868    return false;
0869  }
0870
0871  final private boolean jj_3R_349() {
0872    Token xsp;
0873    xsp = jj_scanpos;
0874    if (jj_3R_352()) {
0875    jj_scanpos = xsp;
0876    if (jj_3R_353()) return true;
0877    }
0878    return false;
0879  }
0880
0881  final private boolean jj_3R_314() {
0882    if (jj_scan_token(IDENTIFIER)) return true;
0883    return false;
0884  }
0885
0886  final private boolean jj_3R_296() {
0887    Token xsp;
0888    xsp = jj_scanpos;
0889    if (jj_3R_314()) {
0890    jj_scanpos = xsp;
0891    if (jj_3R_315()) {
0892    jj_scanpos = xsp;
0893    if (jj_3R_316()) return true;
0894    }
0895    }
0896    return false;
0897  }
0898
0899  final private boolean jj_3R_290() {
0900    if (jj_scan_token(NUMERIC)) return true;
0901    return false;
0902  }
0903
0904  final private boolean jj_3R_146() {
0905    if (jj_scan_token(BY)) return true;
0906    return false;
0907  }
0908
0909  final private boolean jj_3R_186() {
0910    Token xsp;
0911    xsp = jj_scanpos;
0912    if (jj_3R_223()) {
0913    jj_scanpos = xsp;
0914    if (jj_3R_224()) return true;
0915    }
0916    return false;
0917  }
0918
0919  final private boolean jj_3R_223() {
0920    Token xsp;
0921    xsp = jj_scanpos;
0922    if (jj_3R_290()) {
0923    jj_scanpos = xsp;
0924    if (jj_scan_token(110)) {
0925    jj_scanpos = xsp;
0926    if (jj_scan_token(109)) return true;
0927    }
0928    }
0929    return false;
0930  }
0931
0932  final private boolean jj_3R_297() {
0933    if (jj_3R_317()) return true;
0934    return false;
0935  }
0936
0937  final private boolean jj_3R_55() {
0938    if (jj_3R_72()) return true;
0939    return false;
0940  }
0941
0942  final private boolean jj_3R_338() {
0943    if (jj_scan_token(LEFT_PAREN)) return true;
0944    return false;
0945  }
0946
0947  final private boolean jj_3R_76() {
0948    Token xsp;
0949    xsp = jj_scanpos;
0950    lookingAhead = true;
0951    jj_semLA = getToken(2).kind == REF;
0952    lookingAhead = false;
0953    if (!jj_semLA || jj_3R_145()) {
0954    jj_scanpos = xsp;
0955    if (jj_3R_146()) return true;
0956    }
0957    return false;
0958  }
0959
0960  final private boolean jj_3R_145() {
0961    if (jj_scan_token(BY)) return true;
0962    return false;
0963  }
0964
0965  final private boolean jj_3R_182() {
0966    if (jj_scan_token(CURRENT)) return true;
0967    return false;
0968  }
0969
0970  final private boolean jj_3R_98() {
0971    Token xsp;
0972    xsp = jj_scanpos;
0973    if (jj_scan_token(165)) {
0974    jj_scanpos = xsp;
0975    lookingAhead = true;
0976    jj_semLA = getToken(1).kind == CURRENT && getToken(2).kind == ISOLATION;
0977    lookingAhead = false;
0978    if (!jj_semLA || jj_3R_182()) return true;
0979    }
0980    return false;
0981  }
0982
0983  final private boolean jj_3R_337() {
0984    if (jj_3R_349()) return true;
0985    return false;
0986  }
0987
0988  final private boolean jj_3R_325() {
0989    Token xsp;
0990    xsp = jj_scanpos;
0991    if (jj_3R_337()) {
0992    jj_scanpos = xsp;
0993    if (jj_3R_338()) return true;
0994    }
0995    return false;
0996  }
0997
0998  final private boolean jj_3R_225() {
0999    if (jj_3R_291()) return true;
1000    return false;
1001  }
1002
1003  final private boolean jj_3R_329() {
1004    if (jj_scan_token(QUESTION_MARK)) return true;
1005    return false;
1006  }
1007
1008  final private boolean jj_3R_53() {
1009    if (jj_3R_98()) return true;
1010    return false;
1011  }
1012
1013  final private boolean jj_3_14() {
1014    if (jj_3R_63()) return true;
1015    return false;
1016  }
1017
1018  final private boolean jj_3R_109() {
1019    if (jj_3R_186()) return true;
1020    return false;
1021  }
1022
1023  final private boolean jj_3R_62() {
1024    Token xsp;
1025    xsp = jj_scanpos;
1026    if (jj_3R_109()) {
1027    jj_scanpos = xsp;
1028    if (jj_3_14()) return true;
1029    }
1030    return false;
1031  }
1032
1033  final private boolean jj_3R_188() {
1034    Token xsp;
1035    xsp = jj_scanpos;
1036    if (jj_3R_225()) jj_scanpos = xsp;
1037    if (jj_3R_226()) return true;
1038    return false;
1039  }
1040
1041  final private boolean jj_3R_97() {
1042    if (jj_scan_token(EXECUTE)) return true;
1043    return false;
1044  }
1045
1046  final private boolean jj_3R_245() {
1047    if (jj_scan_token(LOCATE)) return true;
1048    return false;
1049  }
1050
1051  final private boolean jj_3R_151() {
1052    if (jj_scan_token(LEFT_BRACE)) return true;
1053    return false;
1054  }
1055
1056  final private boolean jj_3R_244() {
1057    if (jj_3R_297()) return true;
1058    return false;
1059  }
1060
1061  final private boolean jj_3_41() {
1062    if (jj_3R_68()) return true;
1063    return false;
1064  }
1065
1066  final private boolean jj_3R_282() {
1067    if (jj_scan_token(NATIONAL)) return true;
1068    return false;
1069  }
1070
1071  final private boolean jj_3R_80() {
1072    Token xsp;
1073    xsp = jj_scanpos;
1074    if (jj_3_38()) {
1075    jj_scanpos = xsp;
1076    if (jj_3R_151()) return true;
1077    }
1078    return false;
1079  }
1080
1081  final private boolean jj_3_38() {
1082    if (jj_3R_81()) return true;
1083    return false;
1084  }
1085
1086  final private boolean jj_3R_281() {
1087    if (jj_3R_185()) return true;
1088    return false;
1089  }
1090
1091  final private boolean jj_3R_243() {
1092    Token xsp;
1093    xsp = jj_scanpos;
1094    if (jj_scan_token(408)) {
1095    jj_scanpos = xsp;
1096    if (jj_scan_token(370)) return true;
1097    }
1098    return false;
1099  }
1100
1101  final private boolean jj_3R_280() {
1102    if (jj_scan_token(BINARY)) return true;
1103    return false;
1104  }
1105
1106  final private boolean jj_3R_256() {
1107    if (jj_scan_token(VARCHAR)) return true;
1108    return false;
1109  }
1110
1111  final private boolean jj_3_37() {
1112    if (jj_3R_80()) return true;
1113    return false;
1114  }
1115
1116  final private boolean jj_3R_219() {
1117    if (jj_scan_token(UPDATE)) return true;
1118    return false;
1119  }
1120
1121  final private boolean jj_3R_242() {
1122    Token xsp;
1123    xsp = jj_scanpos;
1124    if (jj_scan_token(245)) {
1125    jj_scanpos = xsp;
1126    if (jj_scan_token(171)) return true;
1127    }
1128    return false;
1129  }
1130
1131  final private boolean jj_3R_202() {
1132    Token xsp;
1133    xsp = jj_scanpos;
1134    if (jj_3R_255()) {
1135    jj_scanpos = xsp;
1136    if (jj_3R_256()) return true;
1137    }
1138    return false;
1139  }
1140
1141  final private boolean jj_3R_255() {
1142    if (jj_scan_token(CHAR)) return true;
1143    return false;
1144  }
1145
1146  final private boolean jj_3R_279() {
1147    if (jj_scan_token(NCLOB)) return true;
1148    return false;
1149  }
1150
1151  final private boolean jj_3_31() {
1152    if (jj_3R_76()) return true;
1153    return false;
1154  }
1155
1156  final private boolean jj_3R_198() {
1157    Token xsp;
1158    xsp = jj_scanpos;
1159    if (jj_3R_241()) {
1160    jj_scanpos = xsp;
1161    if (jj_3R_242()) {
1162    jj_scanpos = xsp;
1163    if (jj_3R_243()) {
1164    jj_scanpos = xsp;
1165    if (jj_3R_244()) {
1166    jj_scanpos = xsp;
1167    if (jj_3R_245()) return true;
1168    }
1169    }
1170    }
1171    }
1172    return false;
1173  }
1174
1175  final private boolean jj_3R_241() {
1176    if (jj_scan_token(SUBSTR)) return true;
1177    return false;
1178  }
1179
1180  final private boolean jj_3R_278() {
1181    if (jj_scan_token(CLOB)) return true;
1182    return false;
1183  }
1184
1185  final private boolean jj_3R_96() {
1186    if (jj_scan_token(REVOKE)) return true;
1187    return false;
1188  }
1189
1190  final private boolean jj_3R_277() {
1191    if (jj_scan_token(BLOB)) return true;
1192    return false;
1193  }
1194
1195  final private boolean jj_3R_214() {
1196    Token xsp;
1197    xsp = jj_scanpos;
1198    if (jj_3R_277()) {
1199    jj_scanpos = xsp;
1200    if (jj_3R_278()) {
1201    jj_scanpos = xsp;
1202    if (jj_3R_279()) {
1203    jj_scanpos = xsp;
1204    if (jj_3R_280()) {
1205    jj_scanpos = xsp;
1206    if (jj_3R_281()) {
1207    jj_scanpos = xsp;
1208    if (jj_3R_282()) return true;
1209    }
1210    }
1211    }
1212    }
1213    }
1214    return false;
1215  }
1216
1217  final private boolean jj_3R_320() {
1218    if (jj_scan_token(SECOND)) return true;
1219    return false;
1220  }
1221
1222  final private boolean jj_3R_319() {
1223    if (jj_3R_336()) return true;
1224    return false;
1225  }
1226
1227  final private boolean jj_3R_299() {
1228    Token xsp;
1229    xsp = jj_scanpos;
1230    if (jj_3R_319()) {
1231    jj_scanpos = xsp;
1232    if (jj_3R_320()) return true;
1233    }
1234    return false;
1235  }
1236
1237  final private boolean jj_3R_196() {
1238    if (jj_scan_token(CAST)) return true;
1239    return false;
1240  }
1241
1242  final private boolean jj_3R_116() {
1243    if (jj_3R_188()) return true;
1244    return false;
1245  }
1246
1247  final private boolean jj_3R_108() {
1248    if (jj_scan_token(NVARCHAR)) return true;
1249    return false;
1250  }
1251
1252  final private boolean jj_3R_218() {
1253    if (jj_scan_token(INSERT)) return true;
1254    return false;
1255  }
1256
1257  final private boolean jj_3R_313() {
1258    Token xsp;
1259    xsp = jj_scanpos;
1260    if (jj_scan_token(173)) {
1261    jj_scanpos = xsp;
1262    if (jj_scan_token(71)) {
1263    jj_scanpos = xsp;
1264    if (jj_scan_token(174)) {
1265    jj_scanpos = xsp;
1266    if (jj_scan_token(228)) return true;
1267    }
1268    }
1269    }
1270    return false;
1271  }
1272
1273  final private boolean jj_3R_306() {
1274    if (jj_3R_325()) return true;
1275    return false;
1276  }
1277
1278  final private boolean jj_3R_107() {
1279    if (jj_scan_token(NCHAR)) return true;
1280    return false;
1281  }
1282
1283  final private boolean jj_3R_106() {
1284    if (jj_scan_token(NATIONAL)) return true;
1285    return false;
1286  }
1287
1288  final private boolean jj_3R_294() {
1289    if (jj_3R_313()) return true;
1290    return false;
1291  }
1292
1293  final private boolean jj_3R_61() {
1294    Token xsp;
1295    xsp = jj_scanpos;
1296    if (jj_3R_106()) {
1297    jj_scanpos = xsp;
1298    if (jj_3R_107()) {
1299    jj_scanpos = xsp;
1300    if (jj_3R_108()) return true;
1301    }
1302    }
1303    return false;
1304  }
1305
1306  final private boolean jj_3_29() {
1307    if (jj_3R_76()) return true;
1308    return false;
1309  }
1310
1311  final private boolean jj_3R_217() {
1312    if (jj_3R_283()) return true;
1313    return false;
1314  }
1315
1316  final private boolean jj_3_40() {
1317    if (jj_3R_65()) return true;
1318    return false;
1319  }
1320
1321  final private boolean jj_3R_82() {
1322    Token xsp;
1323    xsp = jj_scanpos;
1324    if (jj_3_40()) jj_scanpos = xsp;
1325    if (jj_3R_68()) return true;
1326    return false;
1327  }
1328
1329  final private boolean jj_3R_283() {
1330    if (jj_3R_306()) return true;
1331    return false;
1332  }
1333
1334  final private boolean jj_3_30() {
1335    if (jj_3R_77()) return true;
1336    return false;
1337  }
1338
1339  final private boolean jj_3_39() {
1340    if (jj_3R_82()) return true;
1341    return false;
1342  }
1343
1344  final private boolean jj_3R_232() {
1345    if (jj_3R_294()) return true;
1346    return false;
1347  }
1348
1349  final private boolean jj_3_47() {
1350    if (jj_3R_86()) return true;
1351    return false;
1352  }
1353
1354  final private boolean jj_3R_240() {
1355    if (jj_scan_token(IDENTITY_VAL_LOCAL)) return true;
1356    return false;
1357  }
1358
1359  final private boolean jj_3R_68() {
1360    if (jj_3R_116()) return true;
1361    return false;
1362  }
1363
1364  final private boolean jj_3R_185() {
1365    Token xsp;
1366    xsp = jj_scanpos;
1367    if (jj_scan_token(82)) {
1368    jj_scanpos = xsp;
1369    if (jj_scan_token(83)) return true;
1370    }
1371    return false;
1372  }
1373
1374  final private boolean jj_3R_239() {
1375    if (jj_scan_token(MOD)) return true;
1376    return false;
1377  }
1378
1379  public SQLParserTokenManager token_source;
1380  public Token token, jj_nt;
1381  private Token jj_scanpos, jj_lastpos;
1382  private int jj_la;
1383  public boolean lookingAhead = false;
1384  private boolean jj_semLA;
1385  private int jj_gen;
1386  final private int[] jj_la1 = new int[306];
1387  static private int[] jj_la1_0;
1388  static private int[] jj_la1_1;
1389  static private int[] jj_la1_2;
1390  static private int[] jj_la1_3;
1391  static private int[] jj_la1_4;
1392  static private int[] jj_la1_5;
1393  static private int[] jj_la1_6;
1394  static private int[] jj_la1_7;
1395  static private int[] jj_la1_8;
1396  static private int[] jj_la1_9;
1397  static private int[] jj_la1_10;
1398  static private int[] jj_la1_11;
1399  static private int[] jj_la1_12;
1400  static private int[] jj_la1_13;
1401  static private int[] jj_la1_14;
1402  static {
1403      jj_la1_0();
1404      jj_la1_1();
1405      jj_la1_2();
1406      jj_la1_3();
1407      jj_la1_4();
1408      jj_la1_5();
1409      jj_la1_6();
1410      jj_la1_7();
1411      jj_la1_8();
1412      jj_la1_9();
1413      jj_la1_10();
1414      jj_la1_11();
1415      jj_la1_12();
1416      jj_la1_13();
1417      jj_la1_14();
1418   }
1419   private static void jj_la1_0() {
1420      jj_la1_0 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,};
1421   }
1422   private static void jj_la1_1() {
1423      jj_la1_1 = new int[] {0x0,0x0,0x40000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x200000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x200000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x10000000,0x10000000,0x10000000,0x10000000,0x0,0x0,0x10000000,0x10000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x80000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xf8000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x200000,0x0,0x0,0x0,0x0,0x10000000,0x0,0x0,0x0,0x0,0x200000,0x0,0x0,0x0,0x0,0x0,0x200000,0x0,0x200000,0x0,0x0,0x200000,0x0,0x0,0x200000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x200000,0x0,0x0,0x200000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x200000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x200000,0x200000,0x0,0x0,0x0,0x0,0x0,0x48000000,0x0,0x0,0x0,0x0,0x0,0x10000000,0x0,0x0,0x10000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x10000000,0x0,0xf8000000,0x0,0xf8000000,0xf8000000,0x0,};
1424   }
1425   private static void jj_la1_2() {
1426      jj_la1_2 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x4,0x0,0x0,0x0,0x0,0x0,0x0,0x800400,0x0,0x0,0x4,0x0,0x0,0x0,0x800400,0x0,0x0,0x0,0x0,0x800400,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x40a00400,0x40200000,0x40200000,0x40200000,0x0,0x40200000,0x40200000,0xc0400,0x0,0x0,0xc0000,0x0,0xc0000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xc0400,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x800404,0x4,0x0,0x0,0x0,0x0,0x0,0x0,0x200,0x0,0x0,0x200,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xffefffff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x10000,0x820400,0x800400,0x0,0x800000,0x0,0x0,0x40000,0x0,0x0,0x4,0x0,0x2000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x8,0x8,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x4,0x0,0x0,0x800404,0x0,0x4,0x0,0x0,0x4,0x0,0x0,0x800400,0x0,0x0,0x0,0x8,0x8,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x80,0x80,0x40000,0x0,0x0,0x40,0x800440,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x800400,0x0,0x0,0x0,0x0,0x800400,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x800400,0x10000,0x0,0x0,0x40000000,0x0,0x200000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x4000,0x40000000,0x0,0x0,0x200000,0x0,0x0,0x44a00400,0x4000000,0x0,0x0,0x4000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x800400,0x0,0x800400,0xff6ffbff,0x800400,0xffefffff,0xffefffff,0x800400,};
1427   }
1428   private static void jj_la1_3() {
1429      jj_la1_3 = new int[] {0x80000,0x0,0x4088010,0x0,0x0,0x0,0x0,0x0,0x0,0x80000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x808,0x0,0x0,0x0,0x0,0x20,0x0,0x808,0x0,0x0,0x0,0x0,0x808,0x0,0x0,0x0,0x0,0x0,0x80000,0x0,0x808,0x10000,0x0,0x0,0x10000,0x0,0x10000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x6000,0x6000,0x0,0x0,0x6000,0x0,0x0,0x0,0x0,0x2000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x80000000,0x1000000,0x1000000,0x1000000,0x1000000,0x80000000,0x0,0x1000000,0x1000000,0x0,0x0,0x0,0x0,0x808,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x40000000,0x40000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xffffffff,0x0,0x0,0x200,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x200,0x808,0x808,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x200,0x200,0x0,0x0,0x100000,0x100000,0x0,0x0,0x0,0x0,0x10000,0x0,0x0,0x10000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x808,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x808,0x0,0x0,0x0,0x100000,0x100000,0x0,0x0,0x0,0x0,0x0,0x40,0x80,0x100,0x0,0x8,0x0,0x0,0x0,0x0,0x0,0x808,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x808,0x0,0x0,0x0,0x0,0x808,0x0,0x0,0x0,0x0,0x80000,0x0,0x0,0x0,0x0,0x10000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x800,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x400,0x0,0x0,0x0,0x0,0x0,0x0,0x808,0x200,0x18000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x80000,0x0,0x10000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x808,0x0,0x0,0x0,0x0,0x0,0x4000000,0x0,0x80000,0x0,0x0,0x80000,0x0,0x0,0x0,0x0,0x0,0x0,0x80000,0x0,0x808,0x80000,0x808,0xfffff7f7,0x808,0xffffffff,0xffffffff,0x808,};
1430   }
1431   private static void jj_la1_4() {
1432      jj_la1_4 = new int[] {0x80000000,0x0,0x80000000,0x80004,0x0,0x0,0x4000,0x4000,0x0,0x80000000,0x0,0x0,0x0,0x0,0x1000,0x0,0x200,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x400,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x200,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x100,0x0,0x200,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x8,0x0,0x2000000,0x0,0x0,0x2000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xffffffff,0x400000,0x0,0x0,0x0,0x0,0x0,0x0,0x400000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x20,0x0,0x0,0x0,0x0,0x0,0x400000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x400000,0x0,0x20,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x40,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x100000,0x200000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x10000000,0x0,0x10000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x10,0x0,0x10,0x0,0x0,0x2000000,0x2000000,0x2000000,0x10,0x0,0x0,0x0,0x0,0x0,0x0,0x80000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x20,0x0,0x20,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x20,0x0,0x0,0x0,0x0,0x400,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x400,0x0,0x0,0x0,0x0,0x0,0x0,0x4000,0x80000004,0x0,0x0,0x80000000,0x4000,0x0,0x0,0x0,0x0,0x0,0x80000000,0x0,0x0,0x80000004,0x0,0xffffffff,0x0,0xffffffff,0xffffffff,0x0,};
1433   }
1434   private static void jj_la1_5() {
1435      jj_la1_5 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x10000,0x0,0x0,0x0,0x0,0x0,0x0,0x10000,0x0,0x0,0x8000000,0x0,0x10000,0x0,0x0,0x8000000,0x0,0x400000,0x0,0x0,0x10000,0x400000,0x400000,0x400000,0x0,0x400000,0x400000,0x20000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xa0000,0x0,0x0,0x0,0x0,0x20000,0x2000003,0x2000000,0x0,0x0,0x2000003,0x3,0x3,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x4,0x0,0x0,0x0,0x0,0x0,0x0,0x10000,0x0,0x80000000,0x0,0x400000,0x10,0x0,0x400000,0x400400,0x0,0x0,0x400,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x800000,0xffffffff,0x8000,0x0,0x0,0x0,0x0,0x0,0x0,0x8000,0x0,0x800,0x0,0x0,0x800,0x0,0x0,0x1000000,0x10000,0x10000,0x800,0x0,0x0,0x8000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x800000,0x3,0x8000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x4000000,0x0,0x0,0x0,0x800000,0x0,0x0,0x800000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x10000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x10000,0x0,0x0,0x0,0x0,0x0,0x200,0x0,0x200,0x200,0x0,0x0,0x0,0x0,0x0,0x6000,0x6000,0x0,0x800000,0x0,0x0,0x10000,0x0,0x0,0x0,0x0,0x200000,0x0,0x200000,0x0,0x0,0x10000,0x0,0x0,0x200000,0x0,0x10000,0x0,0x0,0x200000,0x4000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x20,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x10000,0x1000000,0x0,0x80000000,0x0,0x0,0x0,0x0,0x8000000,0x0,0x8000000,0x8000000,0x0,0x200000,0x800000,0x200000,0x0,0x0,0x0,0x400000,0x0,0x0,0x10000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x10000,0x0,0x10000,0xfffeffff,0x10000,0xffffffff,0xffffffff,0x10000,};
1436   }
1437   private static void jj_la1_6() {
1438      jj_la1_6 = new int[] {0x2000000,0x0,0x2100000,0x40000,0x0,0x400000,0x400800,0x400800,0x0,0x2100000,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x100000,0x0,0x0,0x0,0x80,0x0,0x100,0x8100,0x8100,0x8100,0x0,0x8100,0x8100,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x10000000,0x0,0x0,0x0,0x10000000,0x0,0x10000000,0x0,0x4000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2000000,0x2000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xffffffff,0x0,0x0,0x4000000,0x0,0x0,0x0,0x0,0x1000000,0x0,0x0,0x0,0x0,0x0,0x0,0x400000,0x4000000,0x0,0x0,0x0,0x0,0x0,0x1000000,0x0,0x0,0x80,0x0,0x0,0x0,0x0,0x0,0x10000000,0x1000000,0x0,0x0,0x4000000,0x4000000,0x0,0x0,0x0,0x0,0x0,0x2000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x20000000,0x20000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x80000,0x2,0x80000,0x80000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x400000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2000,0x0,0x0,0x400000,0x400000,0x0,0x4000000,0x0,0x0,0x0,0x0,0x100,0x100,0x0,0x0,0x0,0x0,0x0,0x20000,0x0,0x8020000,0x0,0x0,0x0,0x8100,0x0,0x0,0x100,0x0,0x0,0x0,0x0,0x0,0x0,0x800,0x2008000,0x0,0x0,0x2008000,0x800,0x0,0x0,0x0,0x0,0x0,0x2008000,0x0,0x1000,0x2008000,0x0,0xffffffff,0x0,0xffffffff,0xffffffff,0x0,};
1439   }
1440   private static void jj_la1_7() {
1441      jj_la1_7 = new int[] {0x2100000,0x0,0x2100000,0x0,0x0,0x20000000,0x20040080,0x20000080,0x0,0x2100000,0x80000000,0x0,0x0,0x80000000,0x0,0x0,0x0,0x0,0x5010040,0x80,0x80000000,0x0,0x0,0x0,0x80000000,0x5010040,0x0,0x0,0x40000,0x0,0x5010040,0x800,0x0,0x40000,0x0,0x0,0x0,0x0,0x5050040,0x40000,0x40000,0x40000,0x0,0x40000,0x40000,0x0,0x0,0x10000000,0x8000000,0x0,0x0,0x0,0x10000000,0x0,0x10000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x8000000,0x0,0x0,0x0,0x0,0x0,0x0,0x20000,0x0,0x0,0x0,0x0,0x20000,0x0,0x0,0x0,0x2000000,0x2000000,0x0,0x0,0x5010040,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xffffffff,0x0,0x0,0x400008,0x0,0x0,0x0,0x0,0x0,0x0,0x200000,0x0,0x0,0x200000,0x0,0x0,0x408000,0x5010040,0x5010040,0x200000,0x1000000,0x0,0x0,0x8000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x8000,0x400000,0x400000,0x0,0x0,0x0,0x0,0x0,0x100000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x80000000,0x0,0x0,0x0,0x0,0x80,0x0,0x0,0x0,0x0,0x5010040,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x5010040,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x10,0x10,0x8000000,0x0,0x0,0x0,0x5010040,0x0,0x80,0x40000,0x0,0x0,0x0,0x0,0x0,0x0,0x5010040,0x0,0x0,0x0,0x0,0x5010040,0x0,0x0,0x0,0x0,0x100000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x400000,0x8000,0x0,0x8000,0x0,0x10040,0x80,0x0,0x800,0x800,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x5410040,0x408000,0x0,0x0,0x0,0x0,0x40000,0x40000,0x0,0x0,0x0,0x0,0x100000,0x0,0x0,0x0,0x0,0x0,0x0,0x40000,0x0,0x0,0x5050040,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x100000,0x80,0x0,0x100000,0x0,0x0,0x0,0x0,0x0,0x0,0x100000,0x0,0x5010040,0x100000,0x5010040,0xfafeffbf,0x5010040,0xffffffff,0xffffffff,0x5010040,};
1442   }
1443   private static void jj_la1_8() {
1444      jj_la1_8 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0xebf7fff0,0x0,0x0,0x0,0x0,0x0,0x0,0xebf7fff0,0x0,0x0,0x0,0x2,0xebf7fff0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xebf7fff0,0x400001,0x0,0x0,0x400001,0x0,0x400001,0x20900,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x900,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x20000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xebf7fff0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xeff7ffff,0x40008,0x0,0x4000,0x0,0x0,0x800030,0x0,0x40008,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xebf7fff0,0xebf7fff0,0x800030,0x80000000,0x0,0x60008,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x60008,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xebf7fff0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xebf7fff0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xebf7fff0,0x0,0x0,0x0,0x0,0x20108400,0x100000,0x20108400,0x400,0x0,0xeff7fff0,0x4000000,0x4000000,0x20108400,0x0,0xebf7fff0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x400001,0x80,0x0,0x0,0x1000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2000,0x0,0x0,0x0,0xebf7fff0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xebf7fff0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xebf7fff0,0x0,0xebf7fff0,0x400000f,0xebf7fff0,0xeff7ffff,0xeff7ffff,0xebf7fff0,};
1445   }
1446   private static void jj_la1_9() {
1447      jj_la1_9 = new int[] {0x0,0x0,0x840000,0x0,0x0,0x0,0x0,0x0,0x0,0x840000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xfdffffff,0x0,0x0,0x0,0x0,0x0,0x0,0xfdffffff,0x0,0x0,0x0,0x0,0xfdffffff,0x0,0x840000,0x0,0x2,0x0,0x0,0x0,0xfdffffff,0x0,0x0,0x0,0x0,0x0,0x0,0x800,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x800,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xfdffffff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xfdffffff,0x80,0x0,0x0,0x0,0xf8000000,0x10,0x0,0x80,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xfdffffff,0xfdffffff,0x10,0x0,0x0,0x80,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x80,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xfdffffff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xfdffffff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xfdffffff,0x0,0x400000,0x0,0x0,0x200020,0x0,0x200020,0x200000,0x0,0xfdffffff,0x0,0x0,0x200020,0x0,0xfdffffff,0x0,0x0,0x0,0x0,0x0,0x400000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x4080000,0x4080000,0x0,0x4080000,0x0,0x0,0x0,0x0,0xfdffffff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xfdffffff,0x0,0x0,0x4,0x0,0x100000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xfdffffff,0x0,0xfdffffff,0x0,0xfdffffff,0xfdffffff,0xfdffffff,0xfdffffff,};
1448   }
1449   private static void jj_la1_10() {
1450      jj_la1_10 = new int[] {0x40000,0x0,0x40000,0x1000,0x0,0x40,0x40,0x40,0x0,0x40000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x239ffff,0x0,0x0,0x0,0x0,0x0,0x0,0x239ffff,0x40000,0x40000,0x0,0x0,0x239ffff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x239ffff,0x0,0x0,0x0,0x0,0x0,0x0,0x22020300,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1000000,0x0,0x0,0x0,0x1000000,0x0,0x1000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x300,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x239ffff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xffffffff,0x0,0x0,0x180c00,0xc00,0xf,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1c000000,0xc000000,0x0,0x0,0x239ffff,0x239ffff,0x1c400000,0xc0000000,0x0,0x300,0x0,0xc0000000,0x0,0x0,0x0,0x0,0x0,0x0,0x1000000,0x300,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x239ffff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x239ffff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x239ffff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x239ffff,0x0,0x0,0x0,0x0,0x239ffff,0x0,0x0,0x0,0x0,0x0,0x20,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x10,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x4000,0x0,0x0,0x0,0x239ffff,0x0,0x10000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x239ffff,0x0,0x0,0x0,0x0,0x0,0x0,0x40,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x239ffff,0x0,0x239ffff,0xfdc60000,0x239ffff,0xffffffff,0xffffffff,0x239ffff,};
1451   }
1452   private static void jj_la1_11() {
1453      jj_la1_11 = new int[] {0x0,0x100000,0x0,0x0,0x100000,0x0,0x10000,0x10000,0x200000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x7bfffefc,0x10000,0x0,0x0,0x0,0x0,0x0,0x7bfffefc,0x0,0x0,0x0,0x0,0x7bfffefc,0x0,0x0,0x0,0x100,0x0,0x0,0x0,0x7bfffefc,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x4000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x4000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x7bfffefc,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xfffffeff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x40000,0x0,0xc0000,0x0,0x0,0x0,0x7bfffefc,0x7bfffefc,0xc0000,0x3,0x0,0x0,0x0,0x3,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x7bfffefc,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x7bfffefc,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x7bfffefc,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xfbfffefc,0x80000000,0x80000000,0x0,0x0,0x7bfffefc,0x0,0x0,0x4,0x0,0x0,0x0,0x63000000,0x63000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x10000,0x4000,0x0,0x0,0x0,0x0,0x0,0x480,0x80,0x0,0x0,0x0,0x0,0x0,0x7bfffefc,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x20,0x7bfffefc,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x7bfffefc,0x0,0x7bfffefc,0x84000003,0x7bfffefc,0xfffffeff,0xfffffeff,0x7bfffefc,};
1454   }
1455   private static void jj_la1_12() {
1456      jj_la1_12 = new int[] {0x80000000,0x40,0x80000000,0x0,0x40,0x800000,0x800000,0x800000,0x0,0x80000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x7ffffff,0x0,0x0,0x0,0x0,0x0,0x0,0x7ffffff,0x80000000,0x0,0x0,0x0,0x7ffffff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x7ffffff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x7ffffff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x80000000,0x80000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x7ffffff,0x0,0x0,0x0,0x0,0x0,0x80000,0x0,0x0,0x0,0x0,0x1000000,0x0,0x1000000,0x0,0x20000,0x80000000,0x7ffffff,0x7ffffff,0x1080000,0x0,0x0,0x0,0x0,0x0,0x200000,0x0,0x0,0x0,0x400,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x80000000,0x0,0x0,0x0,0x7ffffff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x7ffffff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x7ffffff,0x0,0x0,0x0,0x0,0x40109,0x0,0x40109,0x0,0x0,0x7ffffff,0x0,0x0,0x40109,0x0,0x7ffffff,0x0,0x20,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x20000,0x0,0x80000000,0x0,0x80000000,0x0,0x0,0x0,0x10000,0x0,0x0,0x0,0x80,0x0,0x2001800,0x2001800,0x0,0x0,0x0,0x20000,0x0,0x7ffffff,0x80000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x4000,0x0,0x7ffffff,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x800000,0x0,0x0,0x800000,0x0,0x0,0x0,0x0,0x0,0x0,0x800000,0x0,0x7ffffff,0x800000,0x7ffffff,0x0,0x7ffffff,0x7ffffff,0x7ffffff,0x7ffffff,};
1457   }
1458   private static void jj_la1_13() {
1459      jj_la1_13 = new int[] {0x80002,0x0,0x80002,0x0,0x0,0x0,0x0,0x0,0x0,0x80002,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x4000000,0x0,0x0,0x0,0x0,0x0,0x0,0x4000000,0x80000,0x80000,0x0,0x0,0x4000000,0x0,0x0,0x0,0x0,0x0,0x0,0x20,0x4000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2,0x0,0x0,0x0,0x0,0x2,0x0,0x2,0x0,0x0,0x2,0x2,0x2,0x2,0x0,0x0,0x0,0x20,0x2,0x0,0x0,0x0,0x2,0x0,0x0,0x0,0x0,0x80,0x4000000,0x0,0x50,0x0,0x20,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2,0x0,0x8,0x20,0x4000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x7f000,0x0,0x0,0x0,0x7f000,0x50,0x50,0x1000108,0x1000108,0x50,0x2000080,0x80,0x0,0x4000000,0x0,0x20,0x0,0x0,0x0,0x0,0x20,0x0,0x20,0x0,0x0,0x20,0x0,0x0,0x0,0x80050,0x4000002,0x4000000,0x0,0x0,0x20,0x0,0x0,0x0,0x0,0x0,0x20,0x0,0x0,0x0,0x0,0x0,0x24,0x0,0x80000,0x0,0x20,0x20,0x0,0x0,0x0,0x0,0x20,0x20,0x0,0x0,0x20,0x0,0x20,0x20,0x0,0x0,0x0,0x0,0x0,0x0,0x20,0x0,0x0,0x0,0x2,0x0,0x4000000,0x0,0x0,0x2,0x0,0x0,0x2,0x0,0x4000000,0x2,0x20,0x20,0x0,0x0,0x0,0x0,0x0,0x0,0x20,0x0,0x0,0x0,0x8,0x0,0x0,0x0,0x0,0x20,0x0,0x4000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x20,0x4000000,0x0,0x0,0x0,0x20,0x4000000,0x2,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2,0x20,0x0,0x0,0x0,0x50,0x50,0x50,0x0,0x0,0x0,0x0,0x4000,0x4000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x4000,0x0,0x0,0x4080000,0x80050,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x4000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x20,0x0,0x0,0x2,0x20,0x2,0x2,0x2,0x0,0x20,0x4000000,0x0,0x4000000,0x0,0x0,0x4000000,0x4000000,0x4000000,};
1460   }
1461   private static void jj_la1_14() {
1462      jj_la1_14 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xa,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x72,0x1,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x72,0x0,0x72,0x42,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x11,0x72,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x1,0x0,0x0,0x1,0x1,0x1,};
1463   }
1464  final private JJCalls[] jj_2_rtns = new JJCalls[47];
1465  private boolean jj_rescan = false;
1466  private int jj_gc = 0;
1467
1468  public SQLParser(CharStream stream) {
1469    token_source = new SQLParserTokenManager(stream);
1470    token = new Token();
1471    token.next = jj_nt = token_source.getNextToken();
1472    jj_gen = 0;
1473    for (int i = 0; i < 306; i++) jj_la1[i] = -1;
1474    for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
1475  }
1476
1477  public void ReInit(CharStream stream) {
1478    token_source.ReInit(stream);
1479    token = new Token();
1480    token.next = jj_nt = token_source.getNextToken();
1481    jj_gen = 0;
1482    for (int i = 0; i < 306; i++) jj_la1[i] = -1;
1483    for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
1484  }
1485
1486  public SQLParser(SQLParserTokenManager tm) {
1487    token_source = tm;
1488    token = new Token();
1489    token.next = jj_nt = token_source.getNextToken();
1490    jj_gen = 0;
1491    for (int i = 0; i < 306; i++) jj_la1[i] = -1;
1492    for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
1493  }
1494
1495  public void ReInit(SQLParserTokenManager tm) {
1496    token_source = tm;
1497    token = new Token();
1498    token.next = jj_nt = token_source.getNextToken();
1499    jj_gen = 0;
1500    for (int i = 0; i < 306; i++) jj_la1[i] = -1;
1501    for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
1502  }
1503
1504  final private Token jj_consume_token(int kind) throws ParseException {
1505    Token oldToken = token;
1506    if ((token = jj_nt).next != null) jj_nt = jj_nt.next;
1507    else jj_nt = jj_nt.next = token_source.getNextToken();
1508    if (token.kind == kind) {
1509      jj_gen++;
1510      if (++jj_gc > 100) {
1511        jj_gc = 0;
1512        for (int i = 0; i < jj_2_rtns.length; i++) {
1513          JJCalls c = jj_2_rtns[i];
1514          while (c != null) {
1515            if (c.gen < jj_gen) c.first = null;
1516            c = c.next;
1517          }
1518        }
1519      }
1520      return token;
1521    }
1522    jj_nt = token;
1523    token = oldToken;
1524    jj_kind = kind;
1525    throw generateParseException();
1526  }
1527
1528  static private final class LookaheadSuccess extends java.lang.Error JavaDoc { }
1529  final private LookaheadSuccess jj_ls = new LookaheadSuccess();
1530  final private boolean jj_scan_token(int kind) {
1531    if (jj_scanpos == jj_lastpos) {
1532      jj_la--;
1533      if (jj_scanpos.next == null) {
1534        jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken();
1535      } else {
1536        jj_lastpos = jj_scanpos = jj_scanpos.next;
1537      }
1538    } else {
1539      jj_scanpos = jj_scanpos.next;
1540    }
1541    if (jj_rescan) {
1542      int i = 0; Token tok = token;
1543      while (tok != null && tok != jj_scanpos) { i++; tok = tok.next; }
1544      if (tok != null) jj_add_error_token(kind, i);
1545    }
1546    if (jj_scanpos.kind != kind) return true;
1547    if (jj_la == 0 && jj_scanpos == jj_lastpos) throw jj_ls;
1548    return false;
1549  }
1550
1551  final public Token getNextToken() {
1552    if ((token = jj_nt).next != null) jj_nt = jj_nt.next;
1553    else jj_nt = jj_nt.next = token_source.getNextToken();
1554    jj_gen++;
1555    return token;
1556  }
1557
1558  final public Token getToken(int index) {
1559    Token t = lookingAhead ? jj_scanpos : token;
1560    for (int i = 0; i < index; i++) {
1561      if (t.next != null) t = t.next;
1562      else t = t.next = token_source.getNextToken();
1563    }
1564    return t;
1565  }
1566
1567  private java.util.Vector JavaDoc jj_expentries = new java.util.Vector JavaDoc();
1568  private int[] jj_expentry;
1569  private int jj_kind = -1;
1570  private int[] jj_lasttokens = new int[100];
1571  private int jj_endpos;
1572
1573  private void jj_add_error_token(int kind, int pos) {
1574    if (pos >= 100) return;
1575    if (pos == jj_endpos + 1) {
1576      jj_lasttokens[jj_endpos++] = kind;
1577    } else if (jj_endpos != 0) {
1578      jj_expentry = new int[jj_endpos];
1579      for (int i = 0; i < jj_endpos; i++) {
1580        jj_expentry[i] = jj_lasttokens[i];
1581      }
1582      boolean exists = false;
1583      for (java.util.Enumeration JavaDoc e = jj_expentries.elements(); e.hasMoreElements();) {
1584        int[] oldentry = (int[])(e.nextElement());
1585        if (oldentry.length == jj_expentry.length) {
1586          exists = true;
1587          for (int i = 0; i < jj_expentry.length; i++) {
1588            if (oldentry[i] != jj_expentry[i]) {
1589              exists = false;
1590              break;
1591            }
1592          }
1593          if (exists) break;
1594        }
1595      }
1596      if (!exists) jj_expentries.addElement(jj_expentry);
1597      if (pos != 0) jj_lasttokens[(jj_endpos = pos) - 1] = kind;
1598    }
1599  }
1600
1601  public ParseException generateParseException() {
1602    jj_expentries.removeAllElements();
1603    boolean[] la1tokens = new boolean[467];
1604    for (int i = 0; i < 467; i++) {
1605      la1tokens[i] = false;
1606    }
1607    if (jj_kind >= 0) {
1608      la1tokens[jj_kind] = true;
1609      jj_kind = -1;
1610    }
1611    for (int i = 0; i < 306; i++) {
1612      if (jj_la1[i] == jj_gen) {
1613        for (int j = 0; j < 32; j++) {
1614          if ((jj_la1_0[i] & (1<<j)) != 0) {
1615            la1tokens[j] = true;
1616          }
1617          if ((jj_la1_1[i] & (1<<j)) != 0) {
1618            la1tokens[32+j] = true;
1619          }
1620          if ((jj_la1_2[i] & (1<<j)) != 0) {
1621            la1tokens[64+j] = true;
1622          }
1623          if ((jj_la1_3[i] & (1<<j)) != 0) {
1624            la1tokens[96+j] = true;
1625          }
1626          if ((jj_la1_4[i] & (1<<j)) != 0) {
1627            la1tokens[128+j] = true;
1628          }
1629          if ((jj_la1_5[i] & (1<<j)) != 0) {
1630            la1tokens[160+j] = true;
1631          }
1632          if ((jj_la1_6[i] & (1<<j)) != 0) {
1633            la1tokens[192+j] = true;
1634          }
1635          if ((jj_la1_7[i] & (1<<j)) != 0) {
1636            la1tokens[224+j] = true;
1637          }
1638          if ((jj_la1_8[i] & (1<<j)) != 0) {
1639            la1tokens[256+j] = true;
1640          }
1641          if ((jj_la1_9[i] & (1<<j)) != 0) {
1642            la1tokens[288+j] = true;
1643          }
1644          if ((jj_la1_10[i] & (1<<j)) != 0) {
1645            la1tokens[320+j] = true;
1646          }
1647          if ((jj_la1_11[i] & (1<<j)) != 0) {
1648            la1tokens[352+j] = true;
1649          }
1650          if ((jj_la1_12[i] & (1<<j)) != 0) {
1651            la1tokens[384+j] = true;
1652          }
1653          if ((jj_la1_13[i] & (1<<j)) != 0) {
1654            la1tokens[416+j] = true;
1655          }
1656          if ((jj_la1_14[i] & (1<<j)) != 0) {
1657            la1tokens[448+j] = true;
1658          }
1659        }
1660      }
1661    }
1662    for (int i = 0; i < 467; i++) {
1663      if (la1tokens[i]) {
1664        jj_expentry = new int[1];
1665        jj_expentry[0] = i;
1666        jj_expentries.addElement(jj_expentry);
1667      }
1668    }
1669    jj_endpos = 0;
1670    jj_rescan_token();
1671    jj_add_error_token(0, 0);
1672    int[][] exptokseq = new int[jj_expentries.size()][];
1673    for (int i = 0; i < jj_expentries.size(); i++) {
1674      exptokseq[i] = (int[])jj_expentries.elementAt(i);
1675    }
1676    return new ParseException(token, exptokseq, SQLParserConstants.tokenImage);
1677  }
1678
1679  final public void enable_tracing() {
1680  }
1681
1682  final public void disable_tracing() {
1683  }
1684
1685  final private void jj_rescan_token() {
1686    jj_rescan = true;
1687    for (int i = 0; i < 47; i++) {
1688    try {
1689      JJCalls p = jj_2_rtns[i];
1690      do {
1691        if (p.gen > jj_gen) {
1692          jj_la = p.arg; jj_lastpos = jj_scanpos = p.first;
1693          switch (i) {
1694            case 0: jj_3_1(); break;
1695            case 1: jj_3_2(); break;
1696            case 2: jj_3_3(); break;
1697            case 3: jj_3_4(); break;
1698            case 4: jj_3_5(); break;
1699            case 5: jj_3_6(); break;
1700            case 6: jj_3_7(); break;
1701            case 7: jj_3_8(); break;
1702            case 8: jj_3_9(); break;
1703            case 9: jj_3_10(); break;
1704            case 10: jj_3_11(); break;
1705            case 11: jj_3_12(); break;
1706            case 12: jj_3_13(); break;
1707            case 13: jj_3_14(); break;
1708            case 14: jj_3_15(); break;
1709            case 15: jj_3_16(); break;
1710            case 16: jj_3_17(); break;
1711            case 17: jj_3_18(); break;
1712            case 18: jj_3_19(); break;
1713            case 19: jj_3_20(); break;
1714            case 20: jj_3_21(); break;
1715            case 21: jj_3_22(); break;
1716            case 22: jj_3_23(); break;
1717            case 23: jj_3_24(); break;
1718            case 24: jj_3_25(); break;
1719            case 25: jj_3_26(); break;
1720            case 26: jj_3_27(); break;
1721            case 27: jj_3_28(); break;
1722            case 28: jj_3_29(); break;
1723            case 29: jj_3_30(); break;
1724            case 30: jj_3_31(); break;
1725            case 31: jj_3_32(); break;
1726            case 32: jj_3_33(); break;
1727            case 33: jj_3_34(); break;
1728            case 34: jj_3_35(); break;
1729            case 35: jj_3_36(); break;
1730            case 36: jj_3_37(); break;
1731            case 37: jj_3_38(); break;
1732            case 38: jj_3_39(); break;
1733            case 39: jj_3_40(); break;
1734            case 40: jj_3_41(); break;
1735            case 41: jj_3_42(); break;
1736            case 42: jj_3_43(); break;
1737            case 43: jj_3_44(); break;
1738            case 44: jj_3_45(); break;
1739            case 45: jj_3_46(); break;
1740            case 46: jj_3_47(); break;
1741          }
1742        }
1743        p = p.next;
1744      } while (p != null);
1745      } catch(LookaheadSuccess ls) { }
1746    }
1747    jj_rescan = false;
1748  }
1749
1750  final private void jj_save(int index, int xla) {
1751    JJCalls p = jj_2_rtns[index];
1752    while (p.gen > jj_gen) {
1753      if (p.next == null) { p = p.next = new JJCalls(); break; }
1754      p = p.next;
1755    }
1756    p.gen = jj_gen + xla - jj_la; p.first = token; p.arg = xla;
1757  }
1758
1759  static final class JJCalls {
1760    int gen;
1761    Token first;
1762    int arg;
1763    JJCalls next;
1764  }
1765
1766}
1767
Popular Tags