Logo Search packages:      
Sourcecode: mysql-connector-java version File versions

com::mysql::jdbc::PreparedStatement Class Reference

Inheritance diagram for com::mysql::jdbc::PreparedStatement:

com::mysql::jdbc::Statement com::mysql::jdbc::CallableStatement com::mysql::jdbc::ServerPreparedStatement

List of all members.


Detailed Description

A SQL Statement is pre-compiled and stored in a PreparedStatement object. This object can then be used to efficiently execute this statement multiple times.

Note: The setXXX methods for setting IN parameter values must specify types that are compatible with the defined SQL type of the input parameter. For instance, if the IN parameter has SQL type Integer, then setInt should be used.

If arbitrary parameter type conversions are required, then the setObject method should be used with a target SQL type.

Author:
Mark Matthews
Version:
Id
PreparedStatement.java,v 1.27.4.58 2005/02/14 16:44:04 mmatthews Exp

See also:
java.sql.ResultSet

java.sql.PreparedStatement

Definition at line 83 of file PreparedStatement.java.


Public Member Functions

synchronized void addBatch (String sql) throws SQLException
void addBatch () throws SQLException
void cancel () throws SQLException
synchronized void clearBatch () throws SQLException
void clearParameters () throws SQLException
synchronized void clearWarnings () throws SQLException
void close () throws SQLException
void enableStreamingResults () throws SQLException
boolean execute (String sql, String[] generatedKeyNames) throws SQLException
boolean execute (String sql, int[] generatedKeyIndices) throws SQLException
boolean execute (String sql, int returnGeneratedKeys) throws SQLException
synchronized boolean execute (String sql) throws SQLException
boolean execute () throws SQLException
int[] executeBatch () throws SQLException
synchronized java.sql.ResultSet executeQuery (String sql) throws SQLException
synchronized java.sql.ResultSet executeQuery () throws SQLException
int executeUpdate (String sql, String[] generatedKeyNames) throws SQLException
int executeUpdate (String sql, int[] generatedKeyIndices) throws SQLException
int executeUpdate (String sql, int returnGeneratedKeys) throws SQLException
synchronized int executeUpdate (String sql) throws SQLException
synchronized int executeUpdate () throws SQLException
byte[] getBytesRepresentation (int parameterIndex) throws SQLException
synchronized java.sql.Connection getConnection () throws SQLException
int getFetchDirection () throws SQLException
synchronized int getFetchSize () throws SQLException
synchronized java.sql.ResultSet getGeneratedKeys () throws SQLException
synchronized long getLastInsertID ()
synchronized long getLongUpdateCount ()
synchronized int getMaxFieldSize () throws SQLException
synchronized int getMaxRows () throws SQLException
synchronized
java.sql.ResultSetMetaData 
getMetaData () throws SQLException
synchronized boolean getMoreResults (int current) throws SQLException
boolean getMoreResults () throws SQLException
ParameterMetaData getParameterMetaData () throws SQLException
int getQueryTimeout () throws SQLException
synchronized java.sql.ResultSet getResultSet () throws SQLException
synchronized int getResultSetConcurrency () throws SQLException
int getResultSetHoldability () throws SQLException
synchronized int getResultSetType () throws SQLException
synchronized int getUpdateCount () throws SQLException
synchronized java.sql.SQLWarning getWarnings () throws SQLException
 PreparedStatement (Connection conn, String sql, String catalog, ParseInfo cachedParseInfo) throws SQLException
 PreparedStatement (Connection conn, String sql, String catalog) throws SQLException
void setArray (int i, Array x) throws SQLException
synchronized void setAsciiStream (int parameterIndex, InputStream x, int length) throws SQLException
void setBigDecimal (int parameterIndex, BigDecimal x) throws SQLException
void setBinaryStream (int parameterIndex, InputStream x, int length) throws SQLException
void setBlob (int i, java.sql.Blob x) throws SQLException
void setBoolean (int parameterIndex, boolean x) throws SQLException
void setByte (int parameterIndex, byte x) throws SQLException
void setBytes (int parameterIndex, byte[] x) throws SQLException
void setCharacterStream (int parameterIndex, java.io.Reader reader, int length) throws SQLException
void setClob (int i, Clob x) throws SQLException
void setCursorName (String name) throws SQLException
void setDate (int parameterIndex, java.sql.Date x, Calendar cal) throws SQLException
void setDate (int parameterIndex, java.sql.Date x) throws java.sql.SQLException
void setDouble (int parameterIndex, double x) throws SQLException
synchronized void setEscapeProcessing (boolean enable) throws SQLException
void setFetchDirection (int direction) throws SQLException
synchronized void setFetchSize (int rows) throws SQLException
void setFloat (int parameterIndex, float x) throws SQLException
void setInt (int parameterIndex, int x) throws SQLException
void setLong (int parameterIndex, long x) throws SQLException
synchronized void setMaxFieldSize (int max) throws SQLException
synchronized void setMaxRows (int max) throws SQLException
void setNull (int parameterIndex, int sqlType, String arg) throws SQLException
void setNull (int parameterIndex, int sqlType) throws SQLException
void setObject (int parameterIndex, Object parameterObj) throws SQLException
void setObject (int parameterIndex, Object parameterObj, int targetSqlType) throws SQLException
void setObject (int parameterIndex, Object parameterObj, int targetSqlType, int scale) throws SQLException
void setQueryTimeout (int seconds) throws SQLException
void setRef (int i, Ref x) throws SQLException
void setShort (int parameterIndex, short x) throws SQLException
void setString (int parameterIndex, String x) throws SQLException
void setTime (int parameterIndex, java.sql.Time x, Calendar cal) throws SQLException
void setTime (int parameterIndex, Time x) throws java.sql.SQLException
void setTimestamp (int parameterIndex, Timestamp x) throws java.sql.SQLException
void setTimestamp (int parameterIndex, java.sql.Timestamp x, Calendar cal) throws SQLException
void setUnicodeStream (int parameterIndex, InputStream x, int length) throws SQLException
void setURL (int parameterIndex, URL arg) throws SQLException
String toString ()

Static Public Attributes

static final byte USES_VARIABLES_FALSE = 0
static final byte USES_VARIABLES_TRUE = 1
static final byte USES_VARIABLES_UNKNOWN = -1

Protected Member Functions

String asSql ()
void checkClosed () throws SQLException
void checkForDml (String sql, char firstStatementChar) throws SQLException
void checkNullOrEmptyQuery (String sql) throws SQLException
void closeAllOpenResults ()
boolean createStreamingResultSet ()
ResultSet executeInternal (int maxRowsToRetrieve, Buffer sendPacket, boolean createStreamingResultSet, boolean queryIsSelectOnly, boolean unpackFields) throws SQLException
synchronized int executeUpdate (byte[][] batchedParameterStrings, InputStream[] batchedParameterStreams, boolean[] batchedIsStream, int[] batchedStreamLengths, boolean[] batchedIsNull) throws SQLException
synchronized int executeUpdate (boolean clearBatchedGeneratedKeysAndWarnings) throws SQLException
Buffer fillSendPacket (byte[][] batchedParameterStrings, InputStream[] batchedParameterStreams, boolean[] batchedIsStream, int[] batchedStreamLengths) throws SQLException
Buffer fillSendPacket () throws SQLException
CachedResultSetMetaData getCachedMetaData (String sql)
synchronized java.sql.ResultSet getGeneratedKeysInternal () throws SQLException
int getId ()
void initializeResultsMetadataFromCache (String sql, CachedResultSetMetaData cachedMetaData, ResultSet resultSet) throws SQLException
 PreparedStatement (Connection conn, String catalog) throws SQLException
void realClose (boolean calledExplicitly) throws SQLException
void setBytes (int parameterIndex, byte[] x, boolean checkForIntroducer, boolean escapeForMBChars) throws SQLException
void setBytesNoEscape (int parameterIndex, byte[] parameterAsBytes) throws SQLException
void setBytesNoEscapeNoQuotes (int parameterIndex, byte[] parameterAsBytes) throws SQLException
void setRetrieveGeneratedKeys (boolean retrieveGeneratedKeys)

Protected Attributes

List batchedArgs
ArrayList batchedGeneratedKeys = null
SingleByteCharsetConverter charConverter = null
String charEncoding = null
Connection connection = null
String currentCatalog = null
boolean doEscapeProcessing = true
ProfileEventSink eventSink = null
char firstCharOfStmt = 0
boolean hasLimitClause = false
boolean isClosed = false
boolean isLoadDataQuery = false
long lastInsertId = -1
int maxFieldSize = MysqlIO.getMaxBuf()
int maxRows = -1
boolean maxRowsChanged = false
int numberOfExecutions = 0
List openResults = new ArrayList()
String originalSql = null
int parameterCount
boolean pedantic = false
Throwable pointOfOrigin
boolean profileSQL = false
ResultSet results = null
int resultSetConcurrency = 0
LRUCache resultSetMetadataCache
int resultSetType = 0
boolean retrieveGeneratedKeys = false
int statementId
int timeout = 0
long updateCount = -1
boolean useTrueBoolean = false
boolean useUsageAdvisor = false
SQLWarning warningChain = null

Static Protected Attributes

static int statementCounter = 1

Package Functions

ParseInfo getParseInfo ()
boolean isNull (int paramIndex)
void setResultSetConcurrency (int concurrencyFlag)
void setResultSetType (int typeFlag)

Private Member Functions

final void escapeblockFast (byte[] buf, Buffer packet, int size) throws SQLException
final void escapeblockFast (byte[] buf, ByteArrayOutputStream bytesOut, int size)
final String getDateTimePattern (String dt, boolean toTime) throws Exception
final char getSuccessor (char c, int n)
final void hexEscapeBlock (byte[] buf, Buffer packet, int size) throws SQLException
void initializeFromParseInfo () throws SQLException
final int readblock (InputStream i, byte[] b) throws SQLException
final int readblock (InputStream i, byte[] b, int length) throws SQLException
final void setInternal (int paramIndex, String val) throws SQLException
final void setInternal (int paramIndex, byte[] val) throws SQLException
final void setSerializableObject (int parameterIndex, Object parameterObj) throws SQLException
void setTimeInternal (int parameterIndex, Time x, TimeZone tz, boolean rollForward) throws java.sql.SQLException
synchronized void setTimestampInternal (int parameterIndex, Timestamp x, TimeZone tz, boolean rollForward) throws SQLException
final void streamToBytes (Buffer packet, InputStream in, boolean escape, int streamLength, boolean useLength) throws SQLException
final byte[] streamToBytes (InputStream in, boolean escape, int streamLength, boolean useLength) throws SQLException

Static Private Member Functions

static int readFully (Reader reader, char[] buf, int length) throws IOException

Private Attributes

java.sql.DatabaseMetaData dbmd = null
boolean[] isNull = null
boolean[] isStream = null
InputStream[] parameterStreams = null
byte[][] parameterValues = null
ParseInfo parseInfo
java.sql.ResultSetMetaData pstmtResultMetaData
byte[][] staticSqlStrings = null
byte[] streamConvertBuf = new byte[4096]
int[] streamLengths = null
SimpleDateFormat tsdf = null
boolean usingAnsiMode

Static Private Attributes

static final byte[] HEX_DIGITS = new byte[] { (byte) '0', (byte) '1', (byte) '2', (byte) '3', (byte) '4', (byte) '5', (byte) '6', (byte) '7', (byte) '8', (byte) '9', (byte) 'A', (byte) 'B', (byte) 'C', (byte) 'D', (byte) 'E', (byte) 'F' }

Classes

class  BatchParams
class  EndPoint
class  ParseInfo

The documentation for this class was generated from the following file:

Generated by  Doxygen 1.6.0   Back to index