Rational Developer for Power Systems Software
V7.6

com.ibm.etools.iseries.edit.sql.SQLStatements
Class SQLStatements

java.lang.Object
  extended by com.ibm.etools.iseries.edit.sql.SQLStatements.SQLStatements

public class SQLStatements
extends Object


Field Summary
static String Copyright
           
static String[] SQL_STATEMENTS
           
 
Constructor Summary
SQLStatements()
           
 
Method Summary
static SQLStatement getKwd(String text)
          Indicates whether or not the specified text is a valid statement keyword
static SQLStatement getKwd(String text, boolean isIncludePredicates)
           
static SQLStatement getNestedElse()
          Retrieves the WHEN statement to use when formatting nested CASE statements
static SQLStatement getNestedWhen()
          Retrieves the WHEN statement to use when formatting nested CASE statements
protected static SQLStatement getSQLStatement(String statement)
          Creates and retrieves the statement object for the specified SQL statement name
protected static SQLStatement getSQLStatement(String statement, boolean isControlStatement)
          Creates and retrieves the statement object for the specified SQL statement name
static SQLStatement getStartCtlKwd(String text)
          Retrieves the start control keyword specified
static SQLStatement getStartKwd(String text)
          Indicates whether or not the specified text is a statement name
static boolean isIntermediateWordsRequired(SQLStatement statement)
          Indicates whether or not this statement type has mandatory intermediate words
static boolean isIntermediateWordsSufficient(SQLStatement statement, String intermediateWords)
          Indicates whether the intermediate words specified are valid for the statement
static boolean isNestedControlStatementAllowed(SQLStatement statement)
          Indicates whether or not control statements are allowed as nested statement
static boolean isNestedStatementAllowed(SQLStatement statement1, SQLStatement statement2)
          Indicates whether or not the statement2 is allowed to be a nested statement for statement1
static boolean isOption(ISQLItem item, String testOption)
          Indicates whether or not the specified option is a valid option
static boolean isOptionalWords(String firstWord, String optionalWords, boolean checkForAny)
          Indicates whether or not the test kewyword is an optional word for the first word
static boolean isStartKwd(String text)
          Indicates whether or not the specified text is the start of a statement
static boolean isStartOfOptionalWords(String firstWord, String nextWords)
          Indicates if the specfied set of words are valid words for the first word
static boolean isStatementControlKwd(String text)
          Indicates whether or not the specified text is a statement control keyword
static boolean isStatementFirstKwd(String text)
          Indicates whether or not the specified kwd is a first word of a two word statement
static boolean isStatementKwd(String text)
          Indicates whether or not the specified text is a statement keyword
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

Copyright

public static final String Copyright
See Also:
Constant Field Values

SQL_STATEMENTS

public static final String[] SQL_STATEMENTS
Constructor Detail

SQLStatements

public SQLStatements()
Method Detail

getKwd

public static SQLStatement getKwd(String text)
Indicates whether or not the specified text is a valid statement keyword

Parameters:
text - the text to check
Returns:
true if the text is a keyword, false otherwise

getKwd

public static SQLStatement getKwd(String text,
                                  boolean isIncludePredicates)

getNestedElse

public static SQLStatement getNestedElse()
Retrieves the WHEN statement to use when formatting nested CASE statements

Returns:
the nested when statement

getNestedWhen

public static SQLStatement getNestedWhen()
Retrieves the WHEN statement to use when formatting nested CASE statements

Returns:
the nested when statement

getSQLStatement

protected static SQLStatement getSQLStatement(String statement)
Creates and retrieves the statement object for the specified SQL statement name

Parameters:
statement - the statement name
Returns:
the statment object

getSQLStatement

protected static SQLStatement getSQLStatement(String statement,
                                              boolean isControlStatement)
Creates and retrieves the statement object for the specified SQL statement name

Parameters:
statement - the statement name
isControlStatement - whether or not the statement is a control statement
Returns:
true if the statement is a control statement, false otherwise

getStartCtlKwd

public static SQLStatement getStartCtlKwd(String text)
Retrieves the start control keyword specified

Parameters:
text - the name of the control keyword
Returns:
the statement object representing the control keyword or null if the text is an invalid name

getStartKwd

public static SQLStatement getStartKwd(String text)
Indicates whether or not the specified text is a statement name

Parameters:
text - the text to check
Returns:
true if the text is the start of a statement, false otherwise.

isIntermediateWordsRequired

public static boolean isIntermediateWordsRequired(SQLStatement statement)
Indicates whether or not this statement type has mandatory intermediate words

Parameters:
statement - the statement to check
Returns:
true if the statement needs intermediate words, false otherwise

isIntermediateWordsSufficient

public static boolean isIntermediateWordsSufficient(SQLStatement statement,
                                                    String intermediateWords)
Indicates whether the intermediate words specified are valid for the statement

Parameters:
statement - the statement to check
intermediateWords - the intermediate words to verify
Returns:
true if the necessary intermediate words are specified.

isNestedControlStatementAllowed

public static boolean isNestedControlStatementAllowed(SQLStatement statement)
Indicates whether or not control statements are allowed as nested statement

Parameters:
statement - the statement to check
Returns:
true if nested control statements are allowed, false otherwise

isNestedStatementAllowed

public static boolean isNestedStatementAllowed(SQLStatement statement1,
                                               SQLStatement statement2)
Indicates whether or not the statement2 is allowed to be a nested statement for statement1

Parameters:
statement1 - the statement that nesting is being checked for
statement2 - the statement that may be a nested statement of statement 1
Returns:
true if the statement name allows nested statements, false otherwise

isOption

public static boolean isOption(ISQLItem item,
                               String testOption)
Indicates whether or not the specified option is a valid option

Parameters:
item - the SQL statement to check the option for
testOption - the option to check
Returns:
true if it is a valid option false otherwise

isOptionalWords

public static boolean isOptionalWords(String firstWord,
                                      String optionalWords,
                                      boolean checkForAny)
Indicates whether or not the test kewyword is an optional word for the first word

Parameters:
firstWord - the first word of a statement
optionalWords - The optional words to test
checkForAny - whether or not *ANY should be checked
Returns:
true if the test keyword is an option keyword for the first word

isStartKwd

public static boolean isStartKwd(String text)
Indicates whether or not the specified text is the start of a statement

Parameters:
text - the text to check
Returns:
true if the text is the start of a statement, false otherwise

isStartOfOptionalWords

public static boolean isStartOfOptionalWords(String firstWord,
                                             String nextWords)
Indicates if the specfied set of words are valid words for the first word

Parameters:
firstWord - the first word of a statement
nextWords - a set of next words to check
Returns:
true if the next words are a valid start to optional words

isStatementControlKwd

public static boolean isStatementControlKwd(String text)
Indicates whether or not the specified text is a statement control keyword

Parameters:
text - the text to check
Returns:
true if a control keyword, false otherwise

isStatementFirstKwd

public static boolean isStatementFirstKwd(String text)
Indicates whether or not the specified kwd is a first word of a two word statement

Parameters:
text - the keyword to check
Returns:
true if it is a first word of a 2 word statement, false otherwise

isStatementKwd

public static boolean isStatementKwd(String text)
Indicates whether or not the specified text is a statement keyword

Parameters:
text - the text to check
Returns:
true if a statement keyword, false otherwise

Rational Developer for Power Systems Software
V7.6

Copyright © 2011 IBM Corp. All Rights Reserved.

Note: This documentation is for part of an interim API that is still under development and expected to change significantly before reaching stability. It is being made available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.