|
|||||||||
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) static 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 |
java.util.Map<java.lang.Integer,java.lang.String> |
indexToCustomMysqlCharset
|
java.util.Map<java.lang.Integer,java.lang.String> |
indexToJavaCharset
We need this 'bootstrapped', because 4.1 and newer will send fields back with this even before we fill this dynamically from the server. |
protected java.util.Properties |
props
Properties for this connection specified by user |
protected com.mysql.jdbc.util.LRUCache |
resultSetMetadataCache
Cache of ResultSet metadata |
protected static java.util.Map<?,?> |
roundRobinStatsMap
|
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 | |
---|---|
void |
abort(java.util.concurrent.Executor executor)
|
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. |
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! |
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. |
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)
|
void |
dumpTestcaseQuery(java.lang.String query)
|
Connection |
duplicate()
|
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. |
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)
|
java.lang.String |
extractSqlFromPacket(java.lang.String possibleSqlQuery,
Buffer queryPacket,
int endOfQueryPacketPosition)
|
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. |
CachedResultSetMetaData |
getCachedMetaData(java.lang.String sql)
Returns cached metadata (or null if not cached) for the given query, which must match _exactly_. |
java.util.Calendar |
getCalendarInstanceForSessionOrNew()
Optimization to only use one calendar per-session, or calculate it for each call, depending on user configuration |
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. |
java.lang.String |
getCharacterSetMetadata()
|
SingleByteCharsetConverter |
getCharsetConverter(java.lang.String javaEncodingName)
Returns the locally mapped instance of a charset converter (to avoid overhead of static synchronization). |
java.lang.String |
getCharsetNameForIndex(int charsetIndex)
Returns the Java character encoding name for the given MySQL server charset index |
java.util.TimeZone |
getDefaultTimeZone()
DOCUMENT ME! |
java.lang.String |
getErrorMessageEncoding()
|
ExceptionInterceptor |
getExceptionInterceptor()
|
int |
getHoldability()
|
java.lang.String |
getHost()
|
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. |
MysqlIO |
getIO()
Returns the IO channel to the server |
java.lang.String |
getJavaEncodingForMysqlEncoding(java.lang.String mysqlEncoding)
|
MySQLConnection |
getLoadBalanceSafeProxy()
|
com.mysql.jdbc.log.Log |
getLog()
Returns the log mechanism that should be used to log information from/for this Connection. |
int |
getMaxBytesPerChar(java.lang.Integer charsetIndex,
java.lang.String javaCharsetName)
|
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. |
java.sql.Statement |
getMetadataSafeStatement()
|
int |
getNetBufferLength()
Returns the packet buffer size the MySQL server reported upon connection |
int |
getNetworkTimeout()
|
protected static int |
getNextRoundRobinHostIndex(java.lang.String url,
java.util.List<?> hostList)
|
java.util.Properties |
getProperties()
Returns the parsed and passed in properties for this connection. |
boolean |
getRequiresEscapingEncoder()
|
java.lang.String |
getSchema()
|
java.lang.String |
getServerCharacterEncoding()
Returns the server's character set |
int |
getServerMajorVersion()
|
int |
getServerMinorVersion()
|
int |
getServerSubMinorVersion()
|
java.util.TimeZone |
getServerTimezoneTZ()
DOCUMENT ME! |
java.lang.String |
getServerVariable(java.lang.String variableName)
|
java.lang.String |
getServerVersion()
|
java.util.Calendar |
getSessionLockedCalendar()
|
java.lang.String |
getStatementComment()
Returns the comment that will be prepended to all statements sent to the server. |
java.util.List<StatementInterceptorV2> |
getStatementInterceptorsInstances()
|
int |
getTransactionIsolation()
Get this Connection's current transaction isolation mode. |
java.util.Map<java.lang.String,java.lang.Class<?>> |
getTypeMap()
JDBC 2.0 Get the type-map object associated with this connection. |
java.lang.String |
getURL()
|
java.lang.String |
getUser()
|
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). |
void |
incrementNumberOfPreparedExecutes()
|
void |
incrementNumberOfPrepares()
|
void |
incrementNumberOfResultSetsCreated()
|
void |
initializeExtension(Extension ex)
|
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. |
void |
initializeSafeStatementInterceptors()
|
boolean |
isAbonormallyLongQuery(long millisOrNanos)
|
boolean |
isClientTzUTC()
|
boolean |
isClosed()
DOCUMENT ME! |
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? |
boolean |
isProxySet()
|
boolean |
isReadInfoMsgEnabled()
|
boolean |
isReadOnly()
Tests to see if the connection is in Read Only Mode. |
boolean |
isRunningOnJDK13()
|
boolean |
isSameResource(Connection otherConnection)
Does this connection have the same resource name as the given connection (for XA)? |
boolean |
isServerLocal()
Is the server this connection is connected to "local" (i.e. same host) as the application? |
boolean |
isServerTzUTC()
|
boolean |
lowerCaseTableNames()
Is the server configured to use lower-case table names only? |
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 |
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)
|
void |
realClose(boolean calledExplicitly,
boolean issueRollback,
boolean skipLocalTeardown,
java.lang.Throwable reason)
Closes connection and frees resources. |
void |
recachePreparedStatement(ServerPreparedStatement pstmt)
|
void |
registerQueryExecutionTime(long queryTimeMs)
DOCUMENT ME! |
void |
registerStatement(Statement stmt)
Register a Statement instance as open. |
void |
releaseSavepoint(java.sql.Savepoint arg0)
|
protected void |
reportMetricsIfNeeded()
Reports currently collected metrics if this feature is enabled and the timeout has passed. |
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. |
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 |
setNetworkTimeout(java.util.concurrent.Executor executor,
int milliseconds)
|
void |
setPreferSlaveDuringFailover(boolean flag)
|
void |
setProxy(MySQLConnection proxy)
|
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 |
void |
setReadOnlyInternal(boolean readOnlyFlag)
|
java.sql.Savepoint |
setSavepoint()
|
java.sql.Savepoint |
setSavepoint(java.lang.String name)
|
void |
setSchema(java.lang.String schema)
|
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<java.lang.String,java.lang.Class<?>> 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! |
void |
throwConnectionClosedException()
|
void |
transactionBegun()
|
void |
transactionCompleted()
|
void |
unregisterStatement(Statement stmt)
Remove the given statement from the list of open statements |
void |
unSafeStatementInterceptors()
|
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. |
boolean |
useAnsiQuotedIdentifiers()
|
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, finalize, 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 static java.util.Map<?,?> roundRobinStatsMap
public java.util.Map<java.lang.Integer,java.lang.String> indexToJavaCharset
public java.util.Map<java.lang.Integer,java.lang.String> indexToCustomMysqlCharset
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 |
---|
public java.lang.String getHost()
getHost
in interface MySQLConnection
public boolean isProxySet()
isProxySet
in interface MySQLConnection
public void setProxy(MySQLConnection proxy)
setProxy
in interface MySQLConnection
public MySQLConnection getLoadBalanceSafeProxy()
getLoadBalanceSafeProxy
in interface MySQLConnection
protected static java.sql.SQLException appendMessageToException(java.sql.SQLException sqlEx, java.lang.String messageToAppend, ExceptionInterceptor interceptor)
public java.util.Timer getCancelTimer()
getCancelTimer
in interface MySQLConnection
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 static int getNextRoundRobinHostIndex(java.lang.String url, java.util.List<?> hostList)
url
- hostList
-
public void unSafeStatementInterceptors() throws java.sql.SQLException
unSafeStatementInterceptors
in interface MySQLConnection
java.sql.SQLException
public void initializeSafeStatementInterceptors() throws java.sql.SQLException
initializeSafeStatementInterceptors
in interface MySQLConnection
java.sql.SQLException
public java.util.List<StatementInterceptorV2> getStatementInterceptorsInstances()
getStatementInterceptorsInstances
in interface MySQLConnection
public java.lang.String getJavaEncodingForMysqlEncoding(java.lang.String mysqlEncoding) throws java.sql.SQLException
java.sql.SQLException
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.public void checkClosed() throws java.sql.SQLException
checkClosed
in interface MySQLConnection
java.sql.SQLException
public void throwConnectionClosedException() throws java.sql.SQLException
throwConnectionClosedException
in interface MySQLConnection
java.sql.SQLException
public void abortInternal() throws java.sql.SQLException
abortInternal
in interface MySQLConnection
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)
public 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
public void createNewIO(boolean isForReconnect) throws java.sql.SQLException
createNewIO
in interface MySQLConnection
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)
public void dumpTestcaseQuery(java.lang.String query)
dumpTestcaseQuery
in interface MySQLConnection
public Connection duplicate() throws java.sql.SQLException
duplicate
in interface MySQLConnection
java.sql.SQLException
public 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
execSQL
in interface MySQLConnection
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 occurspublic 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) throws java.sql.SQLException
execSQL
in interface MySQLConnection
java.sql.SQLException
public java.lang.String extractSqlFromPacket(java.lang.String possibleSqlQuery, Buffer queryPacket, int endOfQueryPacketPosition) throws java.sql.SQLException
extractSqlFromPacket
in interface MySQLConnection
java.sql.SQLException
public java.lang.StringBuffer generateConnectionCommentBlock(java.lang.StringBuffer buf)
generateConnectionCommentBlock
in interface MySQLConnection
public int getActiveStatementCount()
Connection
getActiveStatementCount
in interface MySQLConnection
public boolean getAutoCommit() throws java.sql.SQLException
getAutoCommit
in interface java.sql.Connection
java.sql.SQLException
- if an error occurssetAutoCommit
public java.util.Calendar getCalendarInstanceForSessionOrNew()
getCalendarInstanceForSessionOrNew
in interface MySQLConnection
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 occurspublic java.lang.String getCharacterSetMetadata()
getCharacterSetMetadata
in interface MySQLConnection
public SingleByteCharsetConverter getCharsetConverter(java.lang.String javaEncodingName) throws java.sql.SQLException
getCharsetConverter
in interface MySQLConnection
javaEncodingName
- the encoding name to retrieve
java.sql.SQLException
public java.lang.String getCharsetNameForIndex(int charsetIndex) throws java.sql.SQLException
getCharsetNameForIndex
in interface MySQLConnection
charsetIndex
-
java.sql.SQLException
- if the character set index isn't known by the driverpublic java.util.TimeZone getDefaultTimeZone()
getDefaultTimeZone
in interface MySQLConnection
public java.lang.String getErrorMessageEncoding()
getErrorMessageEncoding
in interface MySQLConnection
public int getHoldability() throws java.sql.SQLException
getHoldability
in interface java.sql.Connection
java.sql.SQLException
Connection.getHoldability()
public long getId()
getId
in interface MySQLConnection
public long getIdleFor()
getIdleFor
in interface MySQLConnection
public MysqlIO getIO() throws java.sql.SQLException
getIO
in interface MySQLConnection
java.sql.SQLException
- if the connection is closed.public com.mysql.jdbc.log.Log getLog() throws java.sql.SQLException
getLog
in interface MySQLConnection
java.sql.SQLException
- if an error occurspublic int getMaxBytesPerChar(java.lang.String javaCharsetName) throws java.sql.SQLException
getMaxBytesPerChar
in interface MySQLConnection
java.sql.SQLException
public int getMaxBytesPerChar(java.lang.Integer charsetIndex, java.lang.String javaCharsetName) throws java.sql.SQLException
getMaxBytesPerChar
in interface MySQLConnection
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 occurspublic java.sql.Statement getMetadataSafeStatement() throws java.sql.SQLException
getMetadataSafeStatement
in interface MySQLConnection
java.sql.SQLException
public int getNetBufferLength()
getNetBufferLength
in interface MySQLConnection
public java.lang.String getServerCharacterEncoding()
getServerCharacterEncoding
in interface MySQLConnection
public int getServerMajorVersion()
getServerMajorVersion
in interface MySQLConnection
public int getServerMinorVersion()
getServerMinorVersion
in interface MySQLConnection
public int getServerSubMinorVersion()
getServerSubMinorVersion
in interface MySQLConnection
public java.util.TimeZone getServerTimezoneTZ()
getServerTimezoneTZ
in interface MySQLConnection
public java.lang.String getServerVariable(java.lang.String variableName)
getServerVariable
in interface MySQLConnection
public java.lang.String getServerVersion()
getServerVersion
in interface MySQLConnection
public java.util.Calendar getSessionLockedCalendar()
getSessionLockedCalendar
in interface MySQLConnection
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<java.lang.String,java.lang.Class<?>> getTypeMap() throws java.sql.SQLException
getTypeMap
in interface java.sql.Connection
java.sql.SQLException
- if a database error occurspublic java.lang.String getURL()
getURL
in interface MySQLConnection
public java.lang.String getUser()
getUser
in interface MySQLConnection
public java.util.Calendar getUtcCalendar()
getUtcCalendar
in interface MySQLConnection
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
getProperties
in interface MySQLConnection
public boolean hasTriedMaster()
Connection
public void incrementNumberOfPreparedExecutes()
incrementNumberOfPreparedExecutes
in interface MySQLConnection
public void incrementNumberOfPrepares()
incrementNumberOfPrepares
in interface MySQLConnection
public void incrementNumberOfResultSetsCreated()
incrementNumberOfResultSetsCreated
in interface MySQLConnection
public boolean isClientTzUTC()
isClientTzUTC
in interface MySQLConnection
public boolean isClosed()
isClosed
in interface java.sql.Connection
public boolean isCursorFetchEnabled() throws java.sql.SQLException
isCursorFetchEnabled
in interface MySQLConnection
java.sql.SQLException
public boolean isInGlobalTx()
Connection
public boolean isMasterConnection()
public boolean isNoBackslashEscapesSet()
public boolean isReadInfoMsgEnabled()
isReadInfoMsgEnabled
in interface MySQLConnection
public boolean isReadOnly() throws java.sql.SQLException
isReadOnly
in interface MySQLConnection
isReadOnly
in interface java.sql.Connection
java.sql.SQLException
- if a database access error occurspublic boolean isRunningOnJDK13()
isRunningOnJDK13
in interface MySQLConnection
public boolean isSameResource(Connection otherConnection)
Connection
public boolean isServerTzUTC()
isServerTzUTC
in interface MySQLConnection
public int getAutoIncrementIncrement()
Connection
getAutoIncrementIncrement
in interface MySQLConnection
public boolean lowerCaseTableNames()
lowerCaseTableNames
in interface MySQLConnection
public void maxRowsChanged(Statement stmt)
maxRowsChanged
in interface MySQLConnection
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 failspublic void pingInternal(boolean checkForClosedConnection, int timeoutMillis) throws java.sql.SQLException
pingInternal
in interface MySQLConnection
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[])
public void realClose(boolean calledExplicitly, boolean issueRollback, boolean skipLocalTeardown, java.lang.Throwable reason) throws java.sql.SQLException
realClose
in interface MySQLConnection
calledExplicitly
- is this being called from close()issueRollback
- should a rollback() be issued?
java.sql.SQLException
- if an error occurspublic void recachePreparedStatement(ServerPreparedStatement pstmt) throws java.sql.SQLException
recachePreparedStatement
in interface MySQLConnection
java.sql.SQLException
public void registerQueryExecutionTime(long queryTimeMs)
registerQueryExecutionTime
in interface MySQLConnection
queryTimeMs
- public void registerStatement(Statement stmt)
registerStatement
in interface MySQLConnection
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 reportMetricsIfNeeded()
public void reportNumberOfTablesAccessed(int numTablesAccessed)
reportNumberOfTablesAccessed
in interface MySQLConnection
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[])
public boolean serverSupportsConvertFn() throws java.sql.SQLException
serverSupportsConvertFn
in interface MySQLConnection
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.public void setReadInfoMsgEnabled(boolean flag)
setReadInfoMsgEnabled
in interface MySQLConnection
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 occurspublic void setReadOnlyInternal(boolean readOnlyFlag) throws java.sql.SQLException
setReadOnlyInternal
in interface MySQLConnection
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<java.lang.String,java.lang.Class<?>> 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
shutdownServer
in interface MySQLConnection
java.sql.SQLException
- if the command can not be issued.public boolean supportsIsolationLevel()
public boolean supportsQuotedIdentifiers()
public boolean supportsTransactions()
public void unregisterStatement(Statement stmt)
unregisterStatement
in interface MySQLConnection
stmt
- the Statement instance to removepublic void unsetMaxRows(Statement stmt) throws java.sql.SQLException
unsetMaxRows
in interface MySQLConnection
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.public boolean useAnsiQuotedIdentifiers()
useAnsiQuotedIdentifiers
in interface MySQLConnection
public boolean useMaxRows()
useMaxRows
in interface MySQLConnection
public boolean versionMeetsMinimum(int major, int minor, int subminor) throws java.sql.SQLException
Connection
java.sql.SQLException
public CachedResultSetMetaData getCachedMetaData(java.lang.String sql)
getCachedMetaData
in interface MySQLConnection
sql
- the query that is the key to the cache
public void initializeResultsMetadataFromCache(java.lang.String sql, CachedResultSetMetaData cachedMetaData, ResultSetInternalMethods resultSet) throws java.sql.SQLException
initializeResultsMetadataFromCache
in interface MySQLConnection
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()
getStatementComment
in interface MySQLConnection
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)
isAbonormallyLongQuery
in interface MySQLConnection
public void initializeExtension(Extension ex) throws java.sql.SQLException
java.sql.SQLException
public void transactionBegun() throws java.sql.SQLException
transactionBegun
in interface MySQLConnection
java.sql.SQLException
public void transactionCompleted() throws java.sql.SQLException
transactionCompleted
in interface MySQLConnection
java.sql.SQLException
public boolean storesLowerCaseTableName()
storesLowerCaseTableName
in interface MySQLConnection
public ExceptionInterceptor getExceptionInterceptor()
getExceptionInterceptor
in interface ConnectionProperties
getExceptionInterceptor
in interface MySQLConnection
getExceptionInterceptor
in class ConnectionPropertiesImpl
public boolean getRequiresEscapingEncoder()
getRequiresEscapingEncoder
in interface MySQLConnection
public boolean isServerLocal() throws java.sql.SQLException
Connection
java.sql.SQLException
public void setSchema(java.lang.String schema) throws java.sql.SQLException
java.sql.SQLException
public java.lang.String getSchema() throws java.sql.SQLException
java.sql.SQLException
public void abort(java.util.concurrent.Executor executor) throws java.sql.SQLException
java.sql.SQLException
public void setNetworkTimeout(java.util.concurrent.Executor executor, int milliseconds) throws java.sql.SQLException
java.sql.SQLException
public int getNetworkTimeout() throws java.sql.SQLException
java.sql.SQLException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |