/** * 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. */ public SQLQueryParser parse(XConnection xconn, String query, int override) { SQLQueryParser parser = new SQLQueryParser(query); // Try to implement caching here, if we found a parser in the cache // then just return the instance otherwise parser.parse(xconn, override); return parser; }
private void executeSQLStatement() throws SQLException { m_ConnectionPool = m_XConnection.getConnectionPool(); Connection conn = m_ConnectionPool.getConnection(); if (! m_QueryParser.hasParameters() ) { m_Statement = conn.createStatement(); m_ResultSet = m_Statement.executeQuery(m_QueryParser.getSQLQuery()); } else if (m_QueryParser.isCallable()) { CallableStatement cstmt = conn.prepareCall(m_QueryParser.getSQLQuery()); m_QueryParser.registerOutputParameters(cstmt); m_QueryParser.populateStatement(cstmt, m_ExpressionContext); m_Statement = cstmt; if (! cstmt.execute()) throw new SQLException("Error in Callable Statement"); m_ResultSet = m_Statement.getResultSet(); } else { PreparedStatement stmt = conn.prepareStatement(m_QueryParser.getSQLQuery()); m_QueryParser.populateStatement(stmt, m_ExpressionContext); m_Statement = stmt; m_ResultSet = stmt.executeQuery(); } }
/** * 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. */ public SQLQueryParser() { init(); }
m_QueryParser.parse (this, queryString, SQLQueryParser.NO_OVERRIDE); query.setParameters(m_ParameterList);
/** * 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. */ private void parse(XConnection xconn, int override) { // Grab the Feature here. We could maintain it from the Parent Parser // but that may cause problems if a single XConnection wants to maintain // both Inline Variable Statemens along with NON inline variable statements. m_InlineVariables = "true".equals(xconn.getFeature("inline-variables")); if (override == NO_INLINE_PARSER) m_InlineVariables = false; else if (override == INLINE_PARSER) m_InlineVariables = true; if (m_InlineVariables) inlineParser(); }
m_QueryParser.parse (this, queryString, SQLQueryParser.NO_INLINE_PARSER);
Vector parameters = m_QueryParser.getParameters();
private SQLQueryParser m_QueryParser = new SQLQueryParser();
m_QueryParser.parse (this, queryString, SQLQueryParser.NO_OVERRIDE); query.setParameters(m_ParameterList);
/** * 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. */ private void parse(XConnection xconn, int override) { // Grab the Feature here. We could maintain it from the Parent Parser // but that may cause problems if a single XConnection wants to maintain // both Inline Variable Statemens along with NON inline variable statements. m_InlineVariables = "true".equals(xconn.getFeature("inline-variables")); if (override == NO_INLINE_PARSER) m_InlineVariables = false; else if (override == INLINE_PARSER) m_InlineVariables = true; if (m_InlineVariables) inlineParser(); }
m_QueryParser.parse (this, queryString, SQLQueryParser.NO_INLINE_PARSER);
Vector parameters = m_QueryParser.getParameters();
private SQLQueryParser m_QueryParser = new SQLQueryParser();
private void executeSQLStatement() throws SQLException { m_ConnectionPool = m_XConnection.getConnectionPool(); Connection conn = m_ConnectionPool.getConnection(); if (! m_QueryParser.hasParameters() ) { m_Statement = conn.createStatement(); m_ResultSet = m_Statement.executeQuery(m_QueryParser.getSQLQuery()); } else if (m_QueryParser.isCallable()) { CallableStatement cstmt = conn.prepareCall(m_QueryParser.getSQLQuery()); m_QueryParser.registerOutputParameters(cstmt); m_QueryParser.populateStatement(cstmt, m_ExpressionContext); m_Statement = cstmt; if (! cstmt.execute()) throw new SQLException("Error in Callable Statement"); m_ResultSet = m_Statement.getResultSet(); } else { PreparedStatement stmt = conn.prepareStatement(m_QueryParser.getSQLQuery()); m_QueryParser.populateStatement(stmt, m_ExpressionContext); m_Statement = stmt; m_ResultSet = stmt.executeQuery(); } }
/** * 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. */ public SQLQueryParser parse(XConnection xconn, String query, int override) { SQLQueryParser parser = new SQLQueryParser(query); // Try to implement caching here, if we found a parser in the cache // then just return the instance otherwise parser.parse(xconn, override); return parser; }
m_QueryParser.parse (this, queryString, SQLQueryParser.NO_OVERRIDE); query.setParameters(m_ParameterList);
/** * 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. */ public SQLQueryParser() { init(); }
/** * 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. */ private void parse(XConnection xconn, int override) { // Grab the Feature here. We could maintain it from the Parent Parser // but that may cause problems if a single XConnection wants to maintain // both Inline Variable Statemens along with NON inline variable statements. m_InlineVariables = "true".equals(xconn.getFeature("inline-variables")); if (override == NO_INLINE_PARSER) m_InlineVariables = false; else if (override == INLINE_PARSER) m_InlineVariables = true; if (m_InlineVariables) inlineParser(); }
m_QueryParser.parse (this, queryString, SQLQueryParser.NO_INLINE_PARSER);
Vector parameters = m_QueryParser.getParameters();