|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.mysql.jdbc.ConnectionPropertiesImpl
com.mysql.jdbc.ConnectionImpl
public class ConnectionImpl
A Connection represents a session with a specific database. Within the context of a Connection, SQL statements are executed and results are returned.
A Connection's database is able to provide information describing its tables, its supported SQL grammar, its stored procedures, the capabilities of this connection, etc. This information is obtained with the getMetaData method.
Connection
,
Serialized FormNested Class Summary | |
---|---|
(package private) class |
ConnectionImpl.CompoundCacheKey
Used as a key for caching callable statements which (may) depend on current catalog...In 5.0.x, they don't (currently), but stored procedure names soon will, so current catalog is a (hidden) component of the name. |
(package private) class |
ConnectionImpl.ExceptionInterceptorChain
|
Field Summary | |
---|---|
static java.util.Map |
charsetMap
The mapping between MySQL charset names and Java charset names. |
protected static java.lang.String |
DEFAULT_LOGGER_CLASS
Default logger class name |
protected java.util.Properties |
props
Properties for this connection specified by user |
protected com.mysql.jdbc.util.LRUCache |
resultSetMetadataCache
Cache of ResultSet metadata |
Fields inherited from class com.mysql.jdbc.ConnectionPropertiesImpl |
---|
largeRowSizeThreshold, ZERO_DATETIME_BEHAVIOR_CONVERT_TO_NULL, ZERO_DATETIME_BEHAVIOR_EXCEPTION, ZERO_DATETIME_BEHAVIOR_ROUND |
Fields inherited from interface java.sql.Connection |
---|
TRANSACTION_NONE, TRANSACTION_READ_COMMITTED, TRANSACTION_READ_UNCOMMITTED, TRANSACTION_REPEATABLE_READ, TRANSACTION_SERIALIZABLE |
Constructor Summary | |
---|---|
protected |
ConnectionImpl()
' For the delegate only |
protected |
ConnectionImpl(java.lang.String hostToConnectTo,
int portToConnectTo,
java.util.Properties info,
java.lang.String databaseToConnectTo,
java.lang.String url)
Creates a connection to a MySQL Server. |
Method Summary | |
---|---|
protected void |
abortInternal()
Clobbers the physical network connection and marks this connection as closed. |
protected static java.sql.SQLException |
appendMessageToException(java.sql.SQLException sqlEx,
java.lang.String messageToAppend,
ExceptionInterceptor interceptor)
|
void |
changeUser(java.lang.String userName,
java.lang.String newPassword)
Changes the user on this connection by performing a re-authentication. |
protected void |
checkClosed()
|
void |
clearHasTriedMaster()
|
void |
clearWarnings()
After this call, getWarnings returns null until a new warning is reported for this connection. |
java.sql.PreparedStatement |
clientPrepareStatement(java.lang.String sql)
DOCUMENT ME! |
java.sql.PreparedStatement |
clientPrepareStatement(java.lang.String sql,
int autoGenKeyIndex)
Prepares a statement on the client, using client-side emulation (irregardless of the configuration property 'useServerPrepStmts') with the same semantics as the java.sql.Connection.prepareStatement() method with the same argument types. |
java.sql.PreparedStatement |
clientPrepareStatement(java.lang.String sql,
int[] autoGenKeyIndexes)
Prepares a statement on the client, using client-side emulation (irregardless of the configuration property 'useServerPrepStmts') with the same semantics as the java.sql.Connection.prepareStatement() method with the same argument types. |
java.sql.PreparedStatement |
clientPrepareStatement(java.lang.String sql,
int resultSetType,
int resultSetConcurrency)
DOCUMENT ME! |
protected java.sql.PreparedStatement |
clientPrepareStatement(java.lang.String sql,
int resultSetType,
int resultSetConcurrency,
boolean processEscapeCodesIfNeeded)
|
java.sql.PreparedStatement |
clientPrepareStatement(java.lang.String sql,
int resultSetType,
int resultSetConcurrency,
int resultSetHoldability)
Prepares a statement on the client, using client-side emulation (irregardless of the configuration property 'useServerPrepStmts') with the same semantics as the java.sql.Connection.prepareStatement() method with the same argument types. |
java.sql.PreparedStatement |
clientPrepareStatement(java.lang.String sql,
java.lang.String[] autoGenKeyColNames)
Prepares a statement on the client, using client-side emulation (irregardless of the configuration property 'useServerPrepStmts') with the same semantics as the java.sql.Connection.prepareStatement() method with the same argument types. |
void |
close()
In some cases, it is desirable to immediately release a Connection's database and JDBC resources instead of waiting for them to be automatically released (cant think why off the top of my head) Note: A Connection is automatically closed when it is garbage collected. |
void |
commit()
The method commit() makes all changes made since the previous commit/rollback permanent and releases any database locks currently held by the Connection. |
protected void |
createNewIO(boolean isForReconnect)
Creates an IO channel to the server |
java.sql.Statement |
createStatement()
SQL statements without parameters are normally executed using Statement objects. |
java.sql.Statement |
createStatement(int resultSetType,
int resultSetConcurrency)
JDBC 2.0 Same as createStatement() above, but allows the default result set type and result set concurrency type to be overridden. |
java.sql.Statement |
createStatement(int resultSetType,
int resultSetConcurrency,
int resultSetHoldability)
|
protected void |
dumpTestcaseQuery(java.lang.String query)
|
protected Connection |
duplicate()
|
(package private) ResultSetInternalMethods |
execSQL(StatementImpl callingStatement,
java.lang.String sql,
int maxRows,
Buffer packet,
int resultSetType,
int resultSetConcurrency,
boolean streamResults,
java.lang.String catalog,
Field[] cachedMetadata)
Send a query to the server. |
(package private) ResultSetInternalMethods |
execSQL(StatementImpl callingStatement,
java.lang.String sql,
int maxRows,
Buffer packet,
int resultSetType,
int resultSetConcurrency,
boolean streamResults,
java.lang.String catalog,
Field[] cachedMetadata,
boolean isBatch)
|
protected java.lang.String |
extractSqlFromPacket(java.lang.String possibleSqlQuery,
Buffer queryPacket,
int endOfQueryPacketPosition)
|
protected void |
finalize()
DOCUMENT ME! |
protected java.lang.StringBuffer |
generateConnectionCommentBlock(java.lang.StringBuffer buf)
|
int |
getActiveStatementCount()
Returns the number of statements active on this connection, which haven't been .close()d. |
boolean |
getAutoCommit()
Gets the current auto-commit state |
int |
getAutoIncrementIncrement()
Returns the -session- value of 'auto_increment_increment' from the server if it exists, or '1' if not. |
protected CachedResultSetMetaData |
getCachedMetaData(java.lang.String sql)
Returns cached metadata (or null if not cached) for the given query, which must match _exactly_. |
protected java.util.Calendar |
getCalendarInstanceForSessionOrNew()
Optimization to only use one calendar per-session, or calculate it for each call, depending on user configuration |
protected java.util.Timer |
getCancelTimer()
|
java.lang.String |
getCatalog()
Return the connections current catalog name, or null if no catalog name is set, or we dont support catalogs. |
protected java.lang.String |
getCharacterSetMetadata()
|
(package private) SingleByteCharsetConverter |
getCharsetConverter(java.lang.String javaEncodingName)
Returns the locally mapped instance of a charset converter (to avoid overhead of static synchronization). |
protected java.lang.String |
getCharsetNameForIndex(int charsetIndex)
Returns the Java character encoding name for the given MySQL server charset index |
protected java.util.TimeZone |
getDefaultTimeZone()
DOCUMENT ME! |
protected java.lang.String |
getErrorMessageEncoding()
|
ExceptionInterceptor |
getExceptionInterceptor()
|
int |
getHoldability()
|
(package private) long |
getId()
|
long |
getIdleFor()
NOT JDBC-Compliant, but clients can use this method to determine how long this connection has been idle. |
protected static Connection |
getInstance(java.lang.String hostToConnectTo,
int portToConnectTo,
java.util.Properties info,
java.lang.String databaseToConnectTo,
java.lang.String url)
Creates a connection instance -- We need to provide factory-style methods so we can support both JDBC3 (and older) and JDBC4 runtimes, otherwise the class verifier complains when it tries to load JDBC4-only interface classes that are present in JDBC4 method signatures. |
protected MysqlIO |
getIO()
Returns the IO channel to the server |
com.mysql.jdbc.log.Log |
getLog()
Returns the log mechanism that should be used to log information from/for this Connection. |
protected int |
getMaxBytesPerChar(java.lang.String javaCharsetName)
|
java.sql.DatabaseMetaData |
getMetaData()
A connection's database is able to provide information describing its tables, its supported SQL grammar, its stored procedures, the capabilities of this connection, etc. |
protected java.sql.Statement |
getMetadataSafeStatement()
|
(package private) java.lang.Object |
getMutex()
Returns the Mutex all queries are locked against |
(package private) int |
getNetBufferLength()
Returns the packet buffer size the MySQL server reported upon connection |
java.util.Properties |
getProperties()
Returns the parsed and passed in properties for this connection. |
boolean |
getRequiresEscapingEncoder()
|
java.lang.String |
getServerCharacterEncoding()
Returns the server's character set |
(package private) int |
getServerMajorVersion()
|
(package private) int |
getServerMinorVersion()
|
(package private) int |
getServerSubMinorVersion()
|
java.util.TimeZone |
getServerTimezoneTZ()
DOCUMENT ME! |
(package private) java.lang.String |
getServerVariable(java.lang.String variableName)
|
(package private) java.lang.String |
getServerVersion()
|
protected java.util.Calendar |
getSessionLockedCalendar()
|
java.lang.String |
getStatementComment()
Returns the comment that will be prepended to all statements sent to the server. |
protected java.util.List |
getStatementInterceptorsInstances()
|
int |
getTransactionIsolation()
Get this Connection's current transaction isolation mode. |
java.util.Map |
getTypeMap()
JDBC 2.0 Get the type-map object associated with this connection. |
(package private) java.lang.String |
getURL()
|
(package private) java.lang.String |
getUser()
|
protected java.util.Calendar |
getUtcCalendar()
|
java.sql.SQLWarning |
getWarnings()
The first warning reported by calls on this Connection is returned. |
boolean |
hasSameProperties(Connection c)
Does this connection have the same properties as another? |
boolean |
hasTriedMaster()
Has this connection tried to execute a query on the "master" server (first host in a multiple host list). |
protected void |
incrementNumberOfPreparedExecutes()
|
protected void |
incrementNumberOfPrepares()
|
protected void |
incrementNumberOfResultSetsCreated()
|
void |
initializeExtension(Extension ex)
|
protected void |
initializeResultsMetadataFromCache(java.lang.String sql,
CachedResultSetMetaData cachedMetaData,
ResultSetInternalMethods resultSet)
Caches CachedResultSetMetaData that has been placed in the cache using the given SQL as a key. |
protected void |
initializeSafeStatementInterceptors()
|
boolean |
isAbonormallyLongQuery(long millisOrNanos)
|
protected boolean |
isClientTzUTC()
|
boolean |
isClosed()
DOCUMENT ME! |
protected boolean |
isCursorFetchEnabled()
|
boolean |
isInGlobalTx()
Is this connection currently a participant in an XA transaction? |
boolean |
isMasterConnection()
Is this connection connected to the first host in the list if there is a list of servers in the URL? |
boolean |
isNoBackslashEscapesSet()
Is the server in a sql_mode that doesn't allow us to use \\ to escape things? |
(package private) boolean |
isReadInfoMsgEnabled()
|
boolean |
isReadOnly()
Tests to see if the connection is in Read Only Mode. |
protected boolean |
isRunningOnJDK13()
|
boolean |
isSameResource(Connection otherConnection)
Does this connection have the same resource name as the given connection (for XA)? |
protected boolean |
isServerTzUTC()
|
boolean |
lowerCaseTableNames()
Is the server configured to use lower-case table names only? |
(package private) void |
maxRowsChanged(Statement stmt)
Has the maxRows value changed? |
java.lang.String |
nativeSQL(java.lang.String sql)
A driver may convert the JDBC sql grammar into its system's native SQL grammar prior to sending it; nativeSQL returns the native form of the statement that the driver would have sent. |
boolean |
parserKnowsUnicode()
DOCUMENT ME! |
void |
ping()
Detect if the connection is still good |
protected void |
pingInternal(boolean checkForClosedConnection,
int timeoutMillis)
|
java.sql.CallableStatement |
prepareCall(java.lang.String sql)
DOCUMENT ME! |
java.sql.CallableStatement |
prepareCall(java.lang.String sql,
int resultSetType,
int resultSetConcurrency)
JDBC 2.0 Same as prepareCall() above, but allows the default result set type and result set concurrency type to be overridden. |
java.sql.CallableStatement |
prepareCall(java.lang.String sql,
int resultSetType,
int resultSetConcurrency,
int resultSetHoldability)
|
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql)
A SQL statement with or without IN parameters can be pre-compiled and stored in a PreparedStatement object. |
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql,
int autoGenKeyIndex)
|
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql,
int[] autoGenKeyIndexes)
|
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql,
int resultSetType,
int resultSetConcurrency)
JDBC 2.0 Same as prepareStatement() above, but allows the default result set type and result set concurrency type to be overridden. |
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql,
int resultSetType,
int resultSetConcurrency,
int resultSetHoldability)
|
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql,
java.lang.String[] autoGenKeyColNames)
|
protected void |
realClose(boolean calledExplicitly,
boolean issueRollback,
boolean skipLocalTeardown,
java.lang.Throwable reason)
Closes connection and frees resources. |
protected void |
recachePreparedStatement(ServerPreparedStatement pstmt)
|
protected void |
registerQueryExecutionTime(long queryTimeMs)
DOCUMENT ME! |
(package private) void |
registerStatement(Statement stmt)
Register a Statement instance as open. |
void |
releaseSavepoint(java.sql.Savepoint arg0)
|
protected void |
reportNumberOfTablesAccessed(int numTablesAccessed)
|
void |
reportQueryTime(long millisOrNanos)
|
void |
resetServerState()
Resets the server-side state of this connection. |
void |
rollback()
The method rollback() drops all changes made since the previous commit/rollback and releases any database locks currently held by the Connection. |
void |
rollback(java.sql.Savepoint savepoint)
|
java.sql.PreparedStatement |
serverPrepareStatement(java.lang.String sql)
Prepares a statement on the server (irregardless of the configuration property 'useServerPrepStmts') with the same semantics as the java.sql.Connection.prepareStatement() method with the same argument types. |
java.sql.PreparedStatement |
serverPrepareStatement(java.lang.String sql,
int autoGenKeyIndex)
Prepares a statement on the server (irregardless of the configuration property 'useServerPrepStmts') with the same semantics as the java.sql.Connection.prepareStatement() method with the same argument types. |
java.sql.PreparedStatement |
serverPrepareStatement(java.lang.String sql,
int[] autoGenKeyIndexes)
Prepares a statement on the server (irregardless of the configuration property 'useServerPrepStmts') with the same semantics as the java.sql.Connection.prepareStatement() method with the same argument types. |
java.sql.PreparedStatement |
serverPrepareStatement(java.lang.String sql,
int resultSetType,
int resultSetConcurrency)
Prepares a statement on the server (irregardless of the configuration property 'useServerPrepStmts') with the same semantics as the java.sql.Connection.prepareStatement() method with the same argument types. |
java.sql.PreparedStatement |
serverPrepareStatement(java.lang.String sql,
int resultSetType,
int resultSetConcurrency,
int resultSetHoldability)
Prepares a statement on the server (irregardless of the configuration property 'useServerPrepStmts') with the same semantics as the java.sql.Connection.prepareStatement() method with the same argument types. |
java.sql.PreparedStatement |
serverPrepareStatement(java.lang.String sql,
java.lang.String[] autoGenKeyColNames)
Prepares a statement on the server (irregardless of the configuration property 'useServerPrepStmts') with the same semantics as the java.sql.Connection.prepareStatement() method with the same argument types. |
protected boolean |
serverSupportsConvertFn()
|
void |
setAutoCommit(boolean autoCommitFlag)
If a connection is in auto-commit mode, than all its SQL statements will be executed and committed as individual transactions. |
void |
setCatalog(java.lang.String catalog)
A sub-space of this Connection's database may be selected by setting a catalog name. |
void |
setFailedOver(boolean flag)
|
void |
setHoldability(int arg0)
|
void |
setInGlobalTx(boolean flag)
Set the state of being in a global (XA) transaction. |
void |
setPreferSlaveDuringFailover(boolean flag)
|
(package private) void |
setReadInfoMsgEnabled(boolean flag)
|
void |
setReadOnly(boolean readOnlyFlag)
You can put a connection in read-only mode as a hint to enable database optimizations Note: setReadOnly cannot be called while in the middle of a transaction |
protected void |
setReadOnlyInternal(boolean readOnlyFlag)
|
java.sql.Savepoint |
setSavepoint()
|
java.sql.Savepoint |
setSavepoint(java.lang.String name)
|
void |
setStatementComment(java.lang.String comment)
Sets the comment that will be prepended to all statements sent to the server. |
void |
setTransactionIsolation(int level)
DOCUMENT ME! |
void |
setTypeMap(java.util.Map map)
JDBC 2.0 Install a type-map object as the default type-map for this connection |
void |
shutdownServer()
Used by MiniAdmin to shutdown a MySQL server |
boolean |
storesLowerCaseTableName()
|
boolean |
supportsIsolationLevel()
DOCUMENT ME! |
boolean |
supportsQuotedIdentifiers()
DOCUMENT ME! |
boolean |
supportsTransactions()
DOCUMENT ME! |
(package private) void |
throwConnectionClosedException()
|
protected void |
transactionBegun()
|
protected void |
transactionCompleted()
|
(package private) void |
unregisterStatement(Statement stmt)
Remove the given statement from the list of open statements |
protected void |
unSafeStatementInterceptors()
|
(package private) void |
unsetMaxRows(Statement stmt)
Called by statements on their .close() to let the connection know when it is safe to set the connection back to 'default' row limits. |
(package private) boolean |
useAnsiQuotedIdentifiers()
|
(package private) boolean |
useMaxRows()
Has maxRows() been set? |
boolean |
versionMeetsMinimum(int major,
int minor,
int subminor)
Does the server this connection is connected to meet or exceed the given version? |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface java.sql.Connection |
---|
createArrayOf, createBlob, createClob, createNClob, createSQLXML, createStruct, getClientInfo, getClientInfo, isValid, setClientInfo, setClientInfo |
Methods inherited from interface java.sql.Wrapper |
---|
isWrapperFor, unwrap |
Field Detail |
---|
public static java.util.Map charsetMap
protected static final java.lang.String DEFAULT_LOGGER_CLASS
protected java.util.Properties props
protected com.mysql.jdbc.util.LRUCache resultSetMetadataCache
Constructor Detail |
---|
protected ConnectionImpl()
protected ConnectionImpl(java.lang.String hostToConnectTo, int portToConnectTo, java.util.Properties info, java.lang.String databaseToConnectTo, java.lang.String url) throws java.sql.SQLException
hostToConnectTo
- the hostname of the database serverportToConnectTo
- the port number the server is listening oninfo
- a Properties[] list holding the user and passworddatabaseToConnectTo
- the database to connect tourl
- the URL of the connectiond
- the Driver instantation of the connection
java.sql.SQLException
- if a database access error occursMethod Detail |
---|
protected static java.sql.SQLException appendMessageToException(java.sql.SQLException sqlEx, java.lang.String messageToAppend, ExceptionInterceptor interceptor)
protected java.util.Timer getCancelTimer()
protected static Connection getInstance(java.lang.String hostToConnectTo, int portToConnectTo, java.util.Properties info, java.lang.String databaseToConnectTo, java.lang.String url) throws java.sql.SQLException
java.sql.SQLException
protected void unSafeStatementInterceptors() throws java.sql.SQLException
java.sql.SQLException
protected void initializeSafeStatementInterceptors() throws java.sql.SQLException
java.sql.SQLException
protected java.util.List getStatementInterceptorsInstances()
public void changeUser(java.lang.String userName, java.lang.String newPassword) throws java.sql.SQLException
userName
- the username to authenticate withnewPassword
- the password to authenticate with
java.sql.SQLException
- if authentication fails, or some other error occurs while
performing the command.protected void checkClosed() throws java.sql.SQLException
java.sql.SQLException
void throwConnectionClosedException() throws java.sql.SQLException
java.sql.SQLException
protected void abortInternal() throws java.sql.SQLException
java.sql.SQLException
public void clearHasTriedMaster()
public void clearWarnings() throws java.sql.SQLException
clearWarnings
in interface java.sql.Connection
java.sql.SQLException
- if a database access error occurspublic java.sql.PreparedStatement clientPrepareStatement(java.lang.String sql) throws java.sql.SQLException
sql
- DOCUMENT ME!
java.sql.SQLException
- DOCUMENT ME!Connection.prepareStatement(String)
public java.sql.PreparedStatement clientPrepareStatement(java.lang.String sql, int autoGenKeyIndex) throws java.sql.SQLException
Connection
java.sql.SQLException
Connection.prepareStatement(String, int)
public java.sql.PreparedStatement clientPrepareStatement(java.lang.String sql, int resultSetType, int resultSetConcurrency) throws java.sql.SQLException
sql
- DOCUMENT ME!resultSetType
- DOCUMENT ME!resultSetConcurrency
- DOCUMENT ME!
java.sql.SQLException
- DOCUMENT ME!Connection.prepareStatement(String, int, int)
protected java.sql.PreparedStatement clientPrepareStatement(java.lang.String sql, int resultSetType, int resultSetConcurrency, boolean processEscapeCodesIfNeeded) throws java.sql.SQLException
java.sql.SQLException
public java.sql.PreparedStatement clientPrepareStatement(java.lang.String sql, int[] autoGenKeyIndexes) throws java.sql.SQLException
Connection
java.sql.SQLException
Connection.prepareStatement(String, int[])
public java.sql.PreparedStatement clientPrepareStatement(java.lang.String sql, java.lang.String[] autoGenKeyColNames) throws java.sql.SQLException
Connection
java.sql.SQLException
Connection.prepareStatement(String, String[])
public java.sql.PreparedStatement clientPrepareStatement(java.lang.String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws java.sql.SQLException
Connection
java.sql.SQLException
Connection.prepareStatement(String, int, int, int)
public void close() throws java.sql.SQLException
close
in interface java.sql.Connection
java.sql.SQLException
- if a database access error occurspublic void commit() throws java.sql.SQLException
Note: MySQL does not support transactions, so this method is a no-op.
commit
in interface java.sql.Connection
java.sql.SQLException
- if a database access error occurssetAutoCommit
protected void createNewIO(boolean isForReconnect) throws java.sql.SQLException
isForReconnect
- is this request for a re-connect
java.sql.SQLException
- if a database access error occurs
CommunicationsException
- DOCUMENT ME!public java.sql.Statement createStatement() throws java.sql.SQLException
createStatement
in interface java.sql.Connection
java.sql.SQLException
- passed through from the constructorpublic java.sql.Statement createStatement(int resultSetType, int resultSetConcurrency) throws java.sql.SQLException
createStatement
in interface java.sql.Connection
resultSetType
- a result set type, see ResultSet.TYPE_XXXresultSetConcurrency
- a concurrency type, see ResultSet.CONCUR_XXX
java.sql.SQLException
- if a database-access error occurs.public java.sql.Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws java.sql.SQLException
createStatement
in interface java.sql.Connection
java.sql.SQLException
Connection.createStatement(int, int, int)
protected void dumpTestcaseQuery(java.lang.String query)
protected Connection duplicate() throws java.sql.SQLException
java.sql.SQLException
ResultSetInternalMethods execSQL(StatementImpl callingStatement, java.lang.String sql, int maxRows, Buffer packet, int resultSetType, int resultSetConcurrency, boolean streamResults, java.lang.String catalog, Field[] cachedMetadata) throws java.sql.SQLException
callingStatement
- DOCUMENT ME!sql
- the SQL statement to be executedmaxRows
- DOCUMENT ME!packet
- DOCUMENT ME!resultSetType
- DOCUMENT ME!resultSetConcurrency
- DOCUMENT ME!streamResults
- DOCUMENT ME!queryIsSelectOnly
- DOCUMENT ME!catalog
- DOCUMENT ME!unpackFields
- DOCUMENT ME!
java.sql.SQLException
- if a database error occursResultSetInternalMethods execSQL(StatementImpl callingStatement, java.lang.String sql, int maxRows, Buffer packet, int resultSetType, int resultSetConcurrency, boolean streamResults, java.lang.String catalog, Field[] cachedMetadata, boolean isBatch) throws java.sql.SQLException
java.sql.SQLException
protected java.lang.String extractSqlFromPacket(java.lang.String possibleSqlQuery, Buffer queryPacket, int endOfQueryPacketPosition) throws java.sql.SQLException
java.sql.SQLException
protected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
- DOCUMENT ME!protected java.lang.StringBuffer generateConnectionCommentBlock(java.lang.StringBuffer buf)
public int getActiveStatementCount()
Connection
public boolean getAutoCommit() throws java.sql.SQLException
getAutoCommit
in interface java.sql.Connection
java.sql.SQLException
- if an error occurssetAutoCommit
protected java.util.Calendar getCalendarInstanceForSessionOrNew()
public java.lang.String getCatalog() throws java.sql.SQLException
Note: MySQL's notion of catalogs are individual databases.
getCatalog
in interface java.sql.Connection
java.sql.SQLException
- if a database access error occursprotected java.lang.String getCharacterSetMetadata()
SingleByteCharsetConverter getCharsetConverter(java.lang.String javaEncodingName) throws java.sql.SQLException
javaEncodingName
- the encoding name to retrieve
java.sql.SQLException
protected java.lang.String getCharsetNameForIndex(int charsetIndex) throws java.sql.SQLException
charsetIndex
-
java.sql.SQLException
- if the character set index isn't known by the driverprotected java.util.TimeZone getDefaultTimeZone()
protected java.lang.String getErrorMessageEncoding()
public int getHoldability() throws java.sql.SQLException
getHoldability
in interface java.sql.Connection
java.sql.SQLException
Connection.getHoldability()
long getId()
public long getIdleFor()
protected MysqlIO getIO() throws java.sql.SQLException
java.sql.SQLException
- if the connection is closed.public com.mysql.jdbc.log.Log getLog() throws java.sql.SQLException
java.sql.SQLException
- if an error occursprotected int getMaxBytesPerChar(java.lang.String javaCharsetName) throws java.sql.SQLException
java.sql.SQLException
public java.sql.DatabaseMetaData getMetaData() throws java.sql.SQLException
getMetaData
in interface java.sql.Connection
java.sql.SQLException
- if a database access error occursprotected java.sql.Statement getMetadataSafeStatement() throws java.sql.SQLException
java.sql.SQLException
java.lang.Object getMutex() throws java.sql.SQLException
java.sql.SQLException
- DOCUMENT ME!int getNetBufferLength()
public java.lang.String getServerCharacterEncoding()
int getServerMajorVersion()
int getServerMinorVersion()
int getServerSubMinorVersion()
public java.util.TimeZone getServerTimezoneTZ()
java.lang.String getServerVariable(java.lang.String variableName)
java.lang.String getServerVersion()
protected java.util.Calendar getSessionLockedCalendar()
public int getTransactionIsolation() throws java.sql.SQLException
getTransactionIsolation
in interface java.sql.Connection
java.sql.SQLException
- if a database access error occurspublic java.util.Map getTypeMap() throws java.sql.SQLException
getTypeMap
in interface java.sql.Connection
java.sql.SQLException
- if a database error occursjava.lang.String getURL()
java.lang.String getUser()
protected java.util.Calendar getUtcCalendar()
public java.sql.SQLWarning getWarnings() throws java.sql.SQLException
getWarnings
in interface java.sql.Connection
java.sql.SQLException
- if a database access error occurspublic boolean hasSameProperties(Connection c)
Connection
public java.util.Properties getProperties()
Connection
public boolean hasTriedMaster()
Connection
protected void incrementNumberOfPreparedExecutes()
protected void incrementNumberOfPrepares()
protected void incrementNumberOfResultSetsCreated()
protected boolean isClientTzUTC()
public boolean isClosed()
isClosed
in interface java.sql.Connection
protected boolean isCursorFetchEnabled() throws java.sql.SQLException
java.sql.SQLException
public boolean isInGlobalTx()
Connection
public boolean isMasterConnection()
public boolean isNoBackslashEscapesSet()
boolean isReadInfoMsgEnabled()
public boolean isReadOnly() throws java.sql.SQLException
isReadOnly
in interface java.sql.Connection
java.sql.SQLException
- if a database access error occursprotected boolean isRunningOnJDK13()
public boolean isSameResource(Connection otherConnection)
Connection
protected boolean isServerTzUTC()
public int getAutoIncrementIncrement()
Connection
public boolean lowerCaseTableNames()
void maxRowsChanged(Statement stmt)
stmt
- DOCUMENT ME!public java.lang.String nativeSQL(java.lang.String sql) throws java.sql.SQLException
nativeSQL
in interface java.sql.Connection
sql
- a SQL statement that may contain one or more '?' parameter
placeholders
java.sql.SQLException
- if a database access error occurspublic boolean parserKnowsUnicode()
public void ping() throws java.sql.SQLException
java.sql.SQLException
- if the ping failsprotected void pingInternal(boolean checkForClosedConnection, int timeoutMillis) throws java.sql.SQLException
java.sql.SQLException
public java.sql.CallableStatement prepareCall(java.lang.String sql) throws java.sql.SQLException
prepareCall
in interface java.sql.Connection
sql
- DOCUMENT ME!
java.sql.SQLException
- DOCUMENT ME!public java.sql.CallableStatement prepareCall(java.lang.String sql, int resultSetType, int resultSetConcurrency) throws java.sql.SQLException
prepareCall
in interface java.sql.Connection
sql
- the SQL representing the callable statementresultSetType
- a result set type, see ResultSet.TYPE_XXXresultSetConcurrency
- a concurrency type, see ResultSet.CONCUR_XXX
java.sql.SQLException
- if a database-access error occurs.public java.sql.CallableStatement prepareCall(java.lang.String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws java.sql.SQLException
prepareCall
in interface java.sql.Connection
java.sql.SQLException
Connection.prepareCall(String, int, int, int)
public java.sql.PreparedStatement prepareStatement(java.lang.String sql) throws java.sql.SQLException
Note: This method is optimized for handling parametric SQL statements that benefit from precompilation if the driver supports precompilation. In this case, the statement is not sent to the database until the PreparedStatement is executed. This has no direct effect on users; however it does affect which method throws certain java.sql.SQLExceptions
MySQL does not support precompilation of statements, so they are handled by the driver.
prepareStatement
in interface java.sql.Connection
sql
- a SQL statement that may contain one or more '?' IN parameter
placeholders
java.sql.SQLException
- if a database access error occurs.public java.sql.PreparedStatement prepareStatement(java.lang.String sql, int autoGenKeyIndex) throws java.sql.SQLException
prepareStatement
in interface java.sql.Connection
java.sql.SQLException
Connection.prepareStatement(String, int)
public java.sql.PreparedStatement prepareStatement(java.lang.String sql, int resultSetType, int resultSetConcurrency) throws java.sql.SQLException
prepareStatement
in interface java.sql.Connection
sql
- the SQL query containing place holdersresultSetType
- a result set type, see ResultSet.TYPE_XXXresultSetConcurrency
- a concurrency type, see ResultSet.CONCUR_XXX
java.sql.SQLException
- if a database-access error occurs.public java.sql.PreparedStatement prepareStatement(java.lang.String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws java.sql.SQLException
prepareStatement
in interface java.sql.Connection
java.sql.SQLException
Connection.prepareStatement(String, int, int, int)
public java.sql.PreparedStatement prepareStatement(java.lang.String sql, int[] autoGenKeyIndexes) throws java.sql.SQLException
prepareStatement
in interface java.sql.Connection
java.sql.SQLException
Connection.prepareStatement(String, int[])
public java.sql.PreparedStatement prepareStatement(java.lang.String sql, java.lang.String[] autoGenKeyColNames) throws java.sql.SQLException
prepareStatement
in interface java.sql.Connection
java.sql.SQLException
Connection.prepareStatement(String, String[])
protected void realClose(boolean calledExplicitly, boolean issueRollback, boolean skipLocalTeardown, java.lang.Throwable reason) throws java.sql.SQLException
calledExplicitly
- is this being called from close()issueRollback
- should a rollback() be issued?
java.sql.SQLException
- if an error occursprotected void recachePreparedStatement(ServerPreparedStatement pstmt) throws java.sql.SQLException
java.sql.SQLException
protected void registerQueryExecutionTime(long queryTimeMs)
queryTimeMs
- void registerStatement(Statement stmt)
stmt
- the Statement instance to removepublic void releaseSavepoint(java.sql.Savepoint arg0) throws java.sql.SQLException
releaseSavepoint
in interface java.sql.Connection
java.sql.SQLException
Connection.releaseSavepoint(Savepoint)
protected void reportNumberOfTablesAccessed(int numTablesAccessed)
public void resetServerState() throws java.sql.SQLException
java.sql.SQLException
- if the operation fails while resetting server state.public void rollback() throws java.sql.SQLException
rollback
in interface java.sql.Connection
java.sql.SQLException
- if a database access error occurscommit
public void rollback(java.sql.Savepoint savepoint) throws java.sql.SQLException
rollback
in interface java.sql.Connection
java.sql.SQLException
Connection.rollback(Savepoint)
public java.sql.PreparedStatement serverPrepareStatement(java.lang.String sql) throws java.sql.SQLException
Connection
java.sql.SQLException
Connection.prepareStatement(String)
public java.sql.PreparedStatement serverPrepareStatement(java.lang.String sql, int autoGenKeyIndex) throws java.sql.SQLException
Connection
java.sql.SQLException
Connection.prepareStatement(String, int)
public java.sql.PreparedStatement serverPrepareStatement(java.lang.String sql, int resultSetType, int resultSetConcurrency) throws java.sql.SQLException
Connection
java.sql.SQLException
Connection.prepareStatement(String, int, int)
public java.sql.PreparedStatement serverPrepareStatement(java.lang.String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws java.sql.SQLException
Connection
java.sql.SQLException
Connection.prepareStatement(String, int, int, int)
public java.sql.PreparedStatement serverPrepareStatement(java.lang.String sql, int[] autoGenKeyIndexes) throws java.sql.SQLException
Connection
java.sql.SQLException
Connection.prepareStatement(String, int[])
public java.sql.PreparedStatement serverPrepareStatement(java.lang.String sql, java.lang.String[] autoGenKeyColNames) throws java.sql.SQLException
Connection
java.sql.SQLException
Connection.prepareStatement(String, String[])
protected boolean serverSupportsConvertFn() throws java.sql.SQLException
java.sql.SQLException
public void setAutoCommit(boolean autoCommitFlag) throws java.sql.SQLException
Note: MySQL does not support transactions, so this method is a no-op.
setAutoCommit
in interface java.sql.Connection
autoCommitFlag
- -
true enables auto-commit; false disables it
java.sql.SQLException
- if a database access error occurspublic void setCatalog(java.lang.String catalog) throws java.sql.SQLException
Note: MySQL's notion of catalogs are individual databases.
setCatalog
in interface java.sql.Connection
catalog
- the database for this connection to use
java.sql.SQLException
- if a database access error occurspublic void setFailedOver(boolean flag)
failedOver
- The failedOver to set.public void setHoldability(int arg0) throws java.sql.SQLException
setHoldability
in interface java.sql.Connection
java.sql.SQLException
Connection.setHoldability(int)
public void setInGlobalTx(boolean flag)
Connection
public void setPreferSlaveDuringFailover(boolean flag)
preferSlaveDuringFailover
- The preferSlaveDuringFailover to set.void setReadInfoMsgEnabled(boolean flag)
public void setReadOnly(boolean readOnlyFlag) throws java.sql.SQLException
setReadOnly
in interface java.sql.Connection
readOnlyFlag
- -
true enables read-only mode; false disables it
java.sql.SQLException
- if a database access error occursprotected void setReadOnlyInternal(boolean readOnlyFlag) throws java.sql.SQLException
java.sql.SQLException
public java.sql.Savepoint setSavepoint() throws java.sql.SQLException
setSavepoint
in interface java.sql.Connection
java.sql.SQLException
Connection.setSavepoint()
public java.sql.Savepoint setSavepoint(java.lang.String name) throws java.sql.SQLException
setSavepoint
in interface java.sql.Connection
java.sql.SQLException
Connection.setSavepoint(String)
public void setTransactionIsolation(int level) throws java.sql.SQLException
setTransactionIsolation
in interface java.sql.Connection
level
- DOCUMENT ME!
java.sql.SQLException
- DOCUMENT ME!public void setTypeMap(java.util.Map map) throws java.sql.SQLException
setTypeMap
in interface java.sql.Connection
map
- the type mapping
java.sql.SQLException
- if a database error occurs.public void shutdownServer() throws java.sql.SQLException
java.sql.SQLException
- if the command can not be issued.public boolean supportsIsolationLevel()
public boolean supportsQuotedIdentifiers()
public boolean supportsTransactions()
void unregisterStatement(Statement stmt)
stmt
- the Statement instance to removevoid unsetMaxRows(Statement stmt) throws java.sql.SQLException
stmt
- the statement releasing it's max-rows requirement
java.sql.SQLException
- if a database error occurs issuing the statement that sets
the limit default.boolean useAnsiQuotedIdentifiers()
boolean useMaxRows()
public boolean versionMeetsMinimum(int major, int minor, int subminor) throws java.sql.SQLException
Connection
java.sql.SQLException
protected CachedResultSetMetaData getCachedMetaData(java.lang.String sql)
sql
- the query that is the key to the cache
protected void initializeResultsMetadataFromCache(java.lang.String sql, CachedResultSetMetaData cachedMetaData, ResultSetInternalMethods resultSet) throws java.sql.SQLException
sql
- the query that the metadata pertains too.cachedMetaData
- metadata (if it exists) to populate the cache.resultSet
- the result set to retreive metadata from, or apply to.
java.sql.SQLException
public java.lang.String getStatementComment()
public void setStatementComment(java.lang.String comment)
comment
- the comment that will be prepended to all statements
sent to the server.public void reportQueryTime(long millisOrNanos)
public boolean isAbonormallyLongQuery(long millisOrNanos)
public void initializeExtension(Extension ex) throws java.sql.SQLException
java.sql.SQLException
protected void transactionBegun() throws java.sql.SQLException
java.sql.SQLException
protected void transactionCompleted() throws java.sql.SQLException
java.sql.SQLException
public boolean storesLowerCaseTableName()
public ExceptionInterceptor getExceptionInterceptor()
getExceptionInterceptor
in interface ConnectionProperties
getExceptionInterceptor
in class ConnectionPropertiesImpl
public boolean getRequiresEscapingEncoder()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |