/** * Add an untyped value to the parameter list. * @param value * */ public void addParameter( String value ) { addParameterWithType(value, null); }
/** * Provide access to the last error that occued. This error * may be over written when the next operation occurs. * */ public DTM getError( ) { if ( m_FullErrors ) { for ( int idx = 0 ; idx < m_OpenSQLDocuments.size() ; idx++ ) { SQLDocument doc = (SQLDocument)m_OpenSQLDocuments.elementAt(idx); SQLWarning warn = doc.checkWarnings(); if ( warn != null ) setError(null, doc, warn); } } return(buildErrorDocument()); }
/** * */ protected void finalize( ) { if (DEBUG) System.out.println("In XConnection, finalize"); try { close(); } catch(Exception e) { // Empty We are final Anyway } }
/** * @param exprContext * @param protocolElem * */ public XBooleanStatic connect( ExpressionContext exprContext, Element protocolElem ) { try { initFromElement(protocolElem); return new XBooleanStatic(true); } catch(SQLException e) { setError(e,exprContext); return new XBooleanStatic(false); } catch (Exception e) { setError(e,exprContext); return new XBooleanStatic(false); } }
/** * Create an XConnection object with just a driver and database URL. * @param exprContext * @param driver JDBC driver of the form foo.bar.Driver. * @param dbURL database URL of the form jdbc:subprotocol:subname. * */ public XBooleanStatic connect( ExpressionContext exprContext, String driver, String dbURL ) { try { init(driver, dbURL, new Properties()); return new XBooleanStatic(true); } catch(SQLException e) { setError(e,exprContext); return new XBooleanStatic(false); } catch (Exception e) { setError(e,exprContext); return new XBooleanStatic(false); } }
/** * @param exprContext * @param driver * @param dbURL */ public XConnection( ExpressionContext exprContext, String driver, String dbURL ) { connect(exprContext, driver, dbURL); }
addTypeToData(typeInfo); query.setParameters(m_ParameterList); setError(e, doc, doc.checkWarnings());
/** * 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(); }
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(); } }
init(driver, dbURL, prop);
for (int x=0; x<count; x++) addParameters( (Element) nl.item(x));
/** * Create an XConnection object with user ID and password. * @param exprContext * @param driver JDBC driver of the form foo.bar.Driver. * @param dbURL database URL of the form jdbc:subprotocol:subname. * @param user user ID. * @param password connection password. * */ public XBooleanStatic connect( ExpressionContext exprContext, String driver, String dbURL, String user, String password ) { try { Properties prop = new Properties(); prop.put("user", user); prop.put("password", password); init(driver, dbURL, prop); return new XBooleanStatic(true); } catch(SQLException e) { setError(e,exprContext); return new XBooleanStatic(false); } catch (Exception e) { setError(e,exprContext); return new XBooleanStatic(false); } }
/** * @param exprContext * @param list * */ public XBooleanStatic connect( ExpressionContext exprContext, NodeList list ) { try { initFromElement( (Element) list.item(0) ); return new XBooleanStatic(true); } catch(SQLException e) { setError(e, exprContext); return new XBooleanStatic(false); } catch (Exception e) { setError(e,exprContext); return new XBooleanStatic(false); } }
/** * @param exprContext * @param driver * @param dbURL * @param protocolElem */ public XConnection( ExpressionContext exprContext, String driver, String dbURL, Element protocolElem ) { connect(exprContext, driver, dbURL, protocolElem); }
addTypeToData(typeInfo); query.setParameters(m_ParameterList); setError(e, doc, doc.checkWarnings());
m_StreamingMode = "true".equals(xconn.getFeature("streaming")); m_MultipleResults = "true".equals(xconn.getFeature("multiple-results")); m_IsStatementCachingEnabled = "true".equals(xconn.getFeature("cache-statements")); m_XConnection = xconn; m_QueryParser = query;
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(); } }
init(driver, dbURL, prop);
for (int x=0; x<count; x++) addParameters( (Element) nl.item(x));