## org.apache.xalan.lib.sql
Class SQLQueryParser

    java.lang.Object
      org.apache.xalan.lib.sql.SQLQueryParser

    public class SQLQueryParser

extends java.lang.Object

Field Summary
`static int` `INLINE_PARSER`
`static int` `NO_INLINE_PARSER`
`static int` `NO_OVERRIDE`

Constructor Summary
`SQLQueryParser()` The SQLStatement Parser will be created as a psuedo SINGLETON per XConnection.

Method Summary
`java.util.Vector` `getParameters()`
`java.lang.String` `getSQLQuery()` Return a copy of the parsed SQL query that will be set to the Database system to execute.
`boolean` `hasParameters()` If a SQL Statement does not have any parameters, then it can be executed directly.
`boolean` `isCallable()` If the Inline Parser is used, the parser will note if this stastement is a plain SQL Statement or a Called Procedure.
`SQLQueryParser` `parse(XConnection xconn, java.lang.String query, int override)` Produce an SQL Statement Parser based on the incomming query.
`void` `populateStatement(java.sql.PreparedStatement stmt, ExpressionContext ctx)` The SQL Statement Parser, when an Inline Parser is used, tracks the XSL variables used to populate a statement.
`void` `registerOutputParameters(java.sql.CallableStatement cstmt)`
`void` `setParameters(java.util.Vector p)` The XConnection will use this method to store the Parameters that were supplied by the style sheet in the case where the inline parser was not used

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### NO_OVERRIDE

    public static final int NO_OVERRIDE

See Also:
  Constant Field Values

### NO_INLINE_PARSER

    public static final int NO_INLINE_PARSER

See Also:
  Constant Field Values

### INLINE_PARSER

    public static final int INLINE_PARSER

See Also:
  Constant Field Values

Constructor Detail

### SQLQueryParser

    public SQLQueryParser()

  The SQLStatement Parser will be created as a psuedo SINGLETON per XConnection. Since we are only caching the Query and its parsed results we may be able to use this as a real SINGLETON. It all depends on how Statement Caching will play out.

Method Detail

### parse

    public SQLQueryParser parse(XConnection xconn,
                                java.lang.String query,
                                int override)

  Produce an SQL Statement Parser based on the incomming query. For now we will just create a new object, in the future we may have this interface cache the queries so that we can take advantage of a preparsed String. If the Inline Parser is not enabled in the Options, no action will be taken on the parser. This option can be set by the Stylesheet. If the option is not set or cleared, a default value will be set determined by the way variables were passed into the system.

### hasParameters

    public boolean hasParameters()

  If a SQL Statement does not have any parameters, then it can be executed directly. Most SQL Servers use this as a performance advantage since no parameters need to be parsed then bound.

### isCallable

    public boolean isCallable()

  If the Inline Parser is used, the parser will note if this stastement is a plain SQL Statement or a Called Procedure. Called Procudures generally have output parameters and require special handling. Called Procudures that are not processed with the Inline Parser will still be executed but under the context of a PreparedStatement and not a CallableStatement. Called Procudures that have output parameters MUST be handled with the Inline Parser.

### getParameters

    public java.util.Vector getParameters()

### setParameters

    public void setParameters(java.util.Vector p)

  The XConnection will use this method to store the Parameters that were supplied by the style sheet in the case where the inline parser was not used

### getSQLQuery

    public java.lang.String getSQLQuery()

  Return a copy of the parsed SQL query that will be set to the Database system to execute. If the inline parser was not used, then the original query will be returned.

### populateStatement

    public void populateStatement(java.sql.PreparedStatement stmt,
                                  ExpressionContext ctx)

  The SQL Statement Parser, when an Inline Parser is used, tracks the XSL variables used to populate a statement. The data use to popoulate a can also be provided. If the data is provided, it will overide the populastion using XSL variables. When the Inline PArser is not used, then the Data will always be provided.

### registerOutputParameters

    public void registerOutputParameters(java.sql.CallableStatement cstmt)
                                  throws java.sql.SQLException

  Throws:
    `java.sql.SQLException`

Copyright © 2005 Apache XML Project. All Rights Reserved.