| java.lang.Object net.sourceforge.jtds.jdbc.JtdsStatement net.sourceforge.jtds.jdbc.JtdsPreparedStatement
All known Subclasses: net.sourceforge.jtds.jdbc.JtdsCallableStatement,
JtdsPreparedStatement | public class JtdsPreparedStatement extends JtdsStatement implements PreparedStatement(Code) | | jTDS implementation of the java.sql.PreparedStatement interface.
Implementation notes:
- Generally a simple subclass of Statement mainly adding support for the
setting of parameters.
- The stream logic is taken over from the work Brian did to add Blob support
to the original jTDS.
- Use of Statement specific method calls eg executeQuery(sql) is blocked by
this version of the driver. This is unlike the original jTDS but inline
with all the other JDBC drivers that I have been able to test.
author: Mike Hutchinson author: Brian Heineman version: $Id: JtdsPreparedStatement.java,v 1.63 2007/07/12 21:03:23 bheineman Exp $ |
Method Summary | |
public void | addBatch() | public void | addBatch(String sql) | protected void | checkOpen() Check that this statement is still open. | public void | clearParameters() | public void | close() | public boolean | execute() | public boolean | execute(String sql) | public boolean | execute(String arg0, int arg1) | public boolean | execute(String arg0, int[] arg1) | public boolean | execute(String arg0, String[] arg1) | protected SQLException | executeMSBatch(int size, int executeSize, ArrayList counts) Execute the SQL batch on a MS server.
When running with prepareSQL=1 or 3 , the driver will first prepare temporary stored
procedures or statements for each parameter combination found in the batch. | public ResultSet | executeQuery() | public ResultSet | executeQuery(String sql) | protected SQLException | executeSybaseBatch(int size, int executeSize, ArrayList counts) Execute the SQL batch on a Sybase server.
Sybase needs to have the SQL concatenated into one TDS language packet followed by up to 1000 parameters. | public int | executeUpdate() | public int | executeUpdate(String sql) | public int | executeUpdate(String sql, int getKeys) | public int | executeUpdate(String arg0, int[] arg1) | public int | executeUpdate(String arg0, String[] arg1) | public ResultSetMetaData | getMetaData() | protected ParamInfo | getParameter(int parameterIndex) Check the supplied index and return the selected parameter.
Parameters: parameterIndex - the parameter index 1 to n. | public ParameterMetaData | getParameterMetaData() | protected static String | normalizeCall(String sql) This method converts native call syntax into (hopefully) valid JDBC
escape syntax.
Note: This method is required for backwards compatibility with
previous versions of jTDS. | protected void | notSupported(String method) Report that user tried to call a method not supported on this type of statement. | public void | setArray(int arg0, Array arg1) | public void | setAsciiStream(int parameterIndex, InputStream inputStream, int length) | public void | setBigDecimal(int parameterIndex, BigDecimal x) | public void | setBinaryStream(int parameterIndex, InputStream x, int length) | public void | setBlob(int parameterIndex, Blob x) | public void | setBoolean(int parameterIndex, boolean x) | public void | setByte(int parameterIndex, byte x) | public void | setBytes(int parameterIndex, byte[] x) | public void | setCharacterStream(int parameterIndex, Reader reader, int length) | public void | setClob(int parameterIndex, Clob x) | void | setColMetaData(ColInfo[] value) Update the cached column meta data information. | public void | setDate(int parameterIndex, Date x) | public void | setDate(int parameterIndex, Date x, Calendar cal) | public void | setDouble(int parameterIndex, double x) | public void | setFloat(int parameterIndex, float x) | public void | setInt(int parameterIndex, int x) | public void | setLong(int parameterIndex, long x) | public void | setNull(int parameterIndex, int sqlType) | public void | setNull(int parameterIndex, int sqlType, String typeName) | public void | setObject(int parameterIndex, Object x) | public void | setObject(int parameterIndex, Object x, int targetSqlType) | public void | setObject(int parameterIndex, Object x, int targetSqlType, int scale) | public void | setObjectBase(int parameterIndex, Object x, int targetSqlType, int scale) Generic setObject method. | void | setParamMetaData(ParamInfo[] value) Update the cached parameter meta data information. | protected void | setParameter(int parameterIndex, Object x, int targetSqlType, int scale, int length) Update the ParamInfo object for the specified parameter. | public void | setRef(int parameterIndex, Ref x) | public void | setShort(int parameterIndex, short x) | public void | setString(int parameterIndex, String x) | public void | setTime(int parameterIndex, Time x) | public void | setTime(int parameterIndex, Time x, Calendar cal) | public void | setTimestamp(int parameterIndex, Timestamp x) | public void | setTimestamp(int parameterIndex, Timestamp x, Calendar cal) | public void | setURL(int parameterIndex, URL url) | public void | setUnicodeStream(int parameterIndex, InputStream inputStream, int length) |
paramMetaData | protected ParamInfo[] paramMetaData(Code) | | The cached parameter meta data.
|
parameters | protected ParamInfo[] parameters(Code) | | The parameter list for the call.
|
procName | protected String procName(Code) | | The procedure name for CallableStatements.
|
sql | final protected String sql(Code) | | The SQL statement being prepared.
|
sqlWord | protected String sqlWord(Code) | | The first SQL keyword in the SQL string.
|
JtdsPreparedStatement | JtdsPreparedStatement(ConnectionJDBC2 connection, String sql, int resultSetType, int concurrency, boolean returnKeys) throws SQLException(Code) | | Construct a new preparedStatement object.
Parameters: connection - The parent connection. Parameters: sql - The SQL statement to prepare. Parameters: resultSetType - The result set type eg SCROLLABLE etc. Parameters: concurrency - The result set concurrency eg READONLY. Parameters: returnKeys - True if generated keys should be returned. throws: SQLException - |
executeMSBatch | protected SQLException executeMSBatch(int size, int executeSize, ArrayList counts) throws SQLException(Code) | | Execute the SQL batch on a MS server.
When running with prepareSQL=1 or 3 , the driver will first prepare temporary stored
procedures or statements for each parameter combination found in the batch. The handles to these pre-preared
statements will then be used to execute the actual batch statements.
Parameters: size - the total size of the batch Parameters: executeSize - the maximum number of statements to send in one request Parameters: counts - the returned update counts chained exceptions linked to a SQLException throws: SQLException - if a serious error occurs during execution |
executeSybaseBatch | protected SQLException executeSybaseBatch(int size, int executeSize, ArrayList counts) throws SQLException(Code) | | Execute the SQL batch on a Sybase server.
Sybase needs to have the SQL concatenated into one TDS language packet followed by up to 1000 parameters. This
method will be overriden for CallableStatements .
Parameters: size - the total size of the batch Parameters: executeSize - the maximum number of statements to send in one request Parameters: counts - the returned update counts chained exceptions linked to a SQLException throws: SQLException - if a serious error occurs during execution |
getParameter | protected ParamInfo getParameter(int parameterIndex) throws SQLException(Code) | | Check the supplied index and return the selected parameter.
Parameters: parameterIndex - the parameter index 1 to n. the parameter as a ParamInfo object. throws: SQLException - if the statement is closed;if parameterIndex is less than 0;if parameterIndex is greater than thenumber of parameters;if checkIfSet was true and the parameter was not set |
normalizeCall | protected static String normalizeCall(String sql)(Code) | | This method converts native call syntax into (hopefully) valid JDBC
escape syntax.
Note: This method is required for backwards compatibility with
previous versions of jTDS. Strictly speaking only the JDBC syntax needs
to be recognised, constructions such as "?=#testproc ?,?" are neither
valid native syntax nor valid escapes. All the substrings and trims
below are not as bad as they look. The objects created all refer back to
the original sql string it is just the start and length positions which
change.
Parameters: sql - the SQL statement to process the SQL, possibly in original form |
notSupported | protected void notSupported(String method) throws SQLException(Code) | | Report that user tried to call a method not supported on this type of statement.
Parameters: method - The method name to report in the error message. throws: SQLException - |
setCharacterStream | public void setCharacterStream(int parameterIndex, Reader reader, int length) throws SQLException(Code) | | |
setColMetaData | void setColMetaData(ColInfo[] value)(Code) | | Update the cached column meta data information.
Parameters: value - The Column meta data array. |
setObjectBase | public void setObjectBase(int parameterIndex, Object x, int targetSqlType, int scale) throws SQLException(Code) | | Generic setObject method.
Parameters: parameterIndex - Parameter index 1 to n. Parameters: x - The value to set. Parameters: targetSqlType - The java.sql.Types constant describing the data. Parameters: scale - The decimal scale -1 if not set. |
setParamMetaData | void setParamMetaData(ParamInfo[] value)(Code) | | Update the cached parameter meta data information.
Parameters: value - The Column meta data array. |
setParameter | protected void setParameter(int parameterIndex, Object x, int targetSqlType, int scale, int length) throws SQLException(Code) | | Update the ParamInfo object for the specified parameter.
Parameters: parameterIndex - Parameter index 1 to n. Parameters: x - The value to set. Parameters: targetSqlType - The java.sql.Types constant describing the data. Parameters: scale - The decimal scale -1 if not set. Parameters: length - The length of the data item. |
Methods inherited from net.sourceforge.jtds.jdbc.JtdsStatement | public void addBatch(String sql) throws SQLException(Code)(Java Doc) void addWarning(SQLWarning w)(Code)(Java Doc) protected void cacheResults() throws SQLException(Code)(Java Doc) public void cancel() throws SQLException(Code)(Java Doc) protected void checkCursorException(SQLException e) throws SQLException(Code)(Java Doc) protected void checkOpen() throws SQLException(Code)(Java Doc) public void clearBatch() throws SQLException(Code)(Java Doc) public void clearWarnings() throws SQLException(Code)(Java Doc) public void close() throws SQLException(Code)(Java Doc) void closeAllResultSets() throws SQLException(Code)(Java Doc) void closeCurrentResultSet() throws SQLException(Code)(Java Doc) public boolean execute(String sql) throws SQLException(Code)(Java Doc) public boolean execute(String sql, int autoGeneratedKeys) throws SQLException(Code)(Java Doc) public boolean execute(String sql, int[] columnIndexes) throws SQLException(Code)(Java Doc) public boolean execute(String sql, String[] columnNames) throws SQLException(Code)(Java Doc) public int[] executeBatch() throws SQLException, BatchUpdateException(Code)(Java Doc) protected SQLException executeMSBatch(int size, int executeSize, ArrayList counts) throws SQLException(Code)(Java Doc) public ResultSet executeQuery(String sql) throws SQLException(Code)(Java Doc) protected boolean executeSQL(String sql, String spName, ParamInfo[] params, boolean returnKeys, boolean update, boolean useCursor) throws SQLException(Code)(Java Doc) protected ResultSet executeSQLQuery(String sql, String spName, ParamInfo[] params, boolean useCursor) throws SQLException(Code)(Java Doc) protected SQLException executeSybaseBatch(int size, int executeSize, ArrayList counts) throws SQLException(Code)(Java Doc) public int executeUpdate(String sql) throws SQLException(Code)(Java Doc) public int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException(Code)(Java Doc) public int executeUpdate(String sql, int[] columnIndexes) throws SQLException(Code)(Java Doc) public int executeUpdate(String sql, String[] columnNames) throws SQLException(Code)(Java Doc) protected void finalize() throws Throwable(Code)(Java Doc) public Connection getConnection() throws SQLException(Code)(Java Doc) int getDefaultFetchSize()(Code)(Java Doc) public int getFetchDirection() throws SQLException(Code)(Java Doc) public int getFetchSize() throws SQLException(Code)(Java Doc) public ResultSet getGeneratedKeys() throws SQLException(Code)(Java Doc) public int getMaxFieldSize() throws SQLException(Code)(Java Doc) public int getMaxRows() throws SQLException(Code)(Java Doc) SQLDiagnostic getMessages()(Code)(Java Doc) public boolean getMoreResults() throws SQLException(Code)(Java Doc) public boolean getMoreResults(int current) throws SQLException(Code)(Java Doc) public int getQueryTimeout() throws SQLException(Code)(Java Doc) public ResultSet getResultSet() throws SQLException(Code)(Java Doc) public int getResultSetConcurrency() throws SQLException(Code)(Java Doc) public int getResultSetHoldability() throws SQLException(Code)(Java Doc) public int getResultSetType() throws SQLException(Code)(Java Doc) TdsCore getTds()(Code)(Java Doc) public int getUpdateCount() throws SQLException(Code)(Java Doc) public SQLWarning getWarnings() throws SQLException(Code)(Java Doc) protected void initialize() throws SQLException(Code)(Java Doc) static void notImplemented(String method) throws SQLException(Code)(Java Doc) public void setCursorName(String name) throws SQLException(Code)(Java Doc) public void setEscapeProcessing(boolean enable) throws SQLException(Code)(Java Doc) public void setFetchDirection(int direction) throws SQLException(Code)(Java Doc) public void setFetchSize(int rows) throws SQLException(Code)(Java Doc) public void setMaxFieldSize(int max) throws SQLException(Code)(Java Doc) public void setMaxRows(int max) throws SQLException(Code)(Java Doc) public void setQueryTimeout(int seconds) throws SQLException(Code)(Java Doc) protected boolean useCursor(boolean returnKeys, String sqlWord)(Code)(Java Doc)
|
|
|