Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1.4.0)

E13403-05

oracle.javatools.db.sql
Class ParserUtils

java.lang.Object
  extended by oracle.javatools.db.sql.ParserUtils

public class ParserUtils
extends java.lang.Object

Since:
10.1.3

Nested Class Summary
static class ParserUtils.ExpressionType
           
 
Method Summary
static void checkErrors(PlsqlRoot root, java.lang.String sql)
          Convert parser errors into a SQLQueryException
static java.util.Collection<java.lang.String[]> getColumnNames(SqlExpression sqlExpression)
          Returns a Collection of names of the columns used in sqlExpression The names are stored as an array of name components.
static java.util.Collection<java.lang.String[]> getColumnNames(java.lang.String expression, ParserUtils.ExpressionType type)
          Returns a Collection of names of the columns used in expression of SqlDriver type type.
static java.lang.String getConstant(PlsqlNode node)
          Returns the value of a string constant node(STRTCONS), or null if node isn't an instanceof SqlStrdef.
static java.lang.String getHexToRawString(PlsqlNode node)
          Get hextoraw String.
static java.lang.String getString(PlsqlNode node)
          Get a String constant.
static boolean isAllowedExpression(PlsqlNode node, java.util.List validOperators)
          Is this one of the allowed expression nodes
static boolean isAllowedStringType(PlsqlNode node, java.util.List validStringTypes)
          Is this one of the allowed String nodes
static boolean isConstant(PlsqlNode node)
          Is this a non null string or numeric constant
static boolean isDbObjectName(PlsqlNode node)
          Is this a database object name.
static boolean isNull(PlsqlNode node)
          Is this the value NULL
static PlsqlRoot parseQueryString(java.lang.String expression, int type)
          Parse an SQL expression
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getHexToRawString

public static java.lang.String getHexToRawString(PlsqlNode node)
Get hextoraw String. If this node is the hextoraw function, return the string argument, otherwise return null.


getString

public static java.lang.String getString(PlsqlNode node)
Get a String constant. If this node is a String constant, return the string, otherwise, return null.


isAllowedExpression

public static boolean isAllowedExpression(PlsqlNode node,
                                          java.util.List validOperators)
Is this one of the allowed expression nodes


isAllowedStringType

public static boolean isAllowedStringType(PlsqlNode node,
                                          java.util.List validStringTypes)
Is this one of the allowed String nodes


isConstant

public static boolean isConstant(PlsqlNode node)
Is this a non null string or numeric constant


isNull

public static boolean isNull(PlsqlNode node)
Is this the value NULL


isDbObjectName

public static boolean isDbObjectName(PlsqlNode node)
Is this a database object name.


getConstant

public static java.lang.String getConstant(PlsqlNode node)
Returns the value of a string constant node(STRTCONS), or null if node isn't an instanceof SqlStrdef.


getColumnNames

public static java.util.Collection<java.lang.String[]> getColumnNames(java.lang.String expression,
                                                                      ParserUtils.ExpressionType type)
                                                               throws SQLQueryException
Returns a Collection of names of the columns used in expression of SqlDriver type type. The names are stored as an array of name components. The meaning of the components depends upon the context in which the name is used. For example, the name A.B in a select list would mean table.column, but in a constraint or index context, it would mean column.attribute as table.column is invalid in such a context.

Parameters:
expression - the arithmetic expression to be parsed for column names
type - an expression type defined in oracle.javatools.parser.plsql.syntax.SqlDriver
Returns:
a Collection of column names defined as arrays of String, or a non-null empty Collection if there are no column names.
Throws:
SQLQueryException - when there are errors in expression

checkErrors

public static void checkErrors(PlsqlRoot root,
                               java.lang.String sql)
                        throws SQLQueryException
Convert parser errors into a SQLQueryException

Parameters:
root -
sql -
Throws:
SQLQueryException

getColumnNames

public static java.util.Collection<java.lang.String[]> getColumnNames(SqlExpression sqlExpression)
Returns a Collection of names of the columns used in sqlExpression The names are stored as an array of name components. The meaning of the components depends upon the context in which the name is used. For example, the name A.B in a select list would mean table.column, but in a constraint or index context, it would mean column.attribute as table.column is invalid in such a context.

Parameters:
sqlExpression - the SqlExpression to be searched for column names
Returns:
a Collection of column names defined as arrays of String, or a non-null empty Collection if there are no column names.

parseQueryString

public static PlsqlRoot parseQueryString(java.lang.String expression,
                                         int type)
                                  throws SQLQueryException
Parse an SQL expression

Parameters:
expression -
type - SqlDriver type eg SqlDriver.INPUT_AEX
Returns:
the operand tree
Throws:
SQLQueryException

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1.4.0)

E13403-05

Copyright © 1997, 2011, Oracle. All rights reserved.