Top Description Fields Constructors Methods
com.mysql.cj.jdbc

public Class CommentClientInfoProvider

extends Object
implements ClientInfoProvider
Class Inheritance
All Implemented Interfaces
com.mysql.cj.jdbc.ClientInfoProvider
Imports
java.sql.Connection, .SQLClientInfoException, .SQLException, java.util.Properties, java.util.stream.Collectors

An implementation of ClientInfoProvider that exposes the client info as a comment prepended to all statements issued by the driver. Client information is never read from the server with this implementation, it is always cached locally.

Field Summary

Modifier and TypeField and Description
private Properties

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public synchronized void
destroy()

Implements com.mysql.cj.jdbc.ClientInfoProvider.destroy.

Called once by the driver when the connection this provider instance belongs to is being closed.

public synchronized Properties
getClientInfo(Connection
connection object
conn
)

Implements com.mysql.cj.jdbc.ClientInfoProvider.getClientInfo.

Returns the client info for the connection that this provider instance belongs to.

public synchronized String
getClientInfo(Connection
connection object
conn
,
String
property name
name
)

Implements com.mysql.cj.jdbc.ClientInfoProvider.getClientInfo.

Returns the client info for the connection that this provider instance belongs to.

public synchronized void
initialize(Connection
the connection that the provider belongs too.
conn
,
Properties
a java.util.Properties instance that contains configuration information for the connection.
configurationProps
)

Implements com.mysql.cj.jdbc.ClientInfoProvider.initialize.

Called once by the driver when it needs to configure the provider.

public synchronized void
setClientInfo(Connection
connection object
conn
,
Properties
Properties object
properties
)

Implements com.mysql.cj.jdbc.ClientInfoProvider.setClientInfo.

Sets the client info for the connection that this provider instance belongs to.

public synchronized void
setClientInfo(Connection
connection object
conn
,
String
property name
name
,
String
property value
value
)

Implements com.mysql.cj.jdbc.ClientInfoProvider.setClientInfo.

Sets the client info for the connection that this provider instance belongs to.

private synchronized void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

clientInfoback to summary
private Properties clientInfo

Constructor Detail

CommentClientInfoProviderback to summary
public CommentClientInfoProvider()

Method Detail

destroyback to summary
public synchronized void destroy() throws SQLException

Implements com.mysql.cj.jdbc.ClientInfoProvider.destroy.

Doc from com.mysql.cj.jdbc.ClientInfoProvider.destroy.

Called once by the driver when the connection this provider instance belongs to is being closed. Implementations are expected to clean up and resources at this point in time.

Annotations
@Override
Exceptions
SQLException:
if an error occurs.
getClientInfoback to summary
public synchronized Properties getClientInfo(Connection conn) throws SQLException

Implements com.mysql.cj.jdbc.ClientInfoProvider.getClientInfo.

Doc from com.mysql.cj.jdbc.ClientInfoProvider.getClientInfo.

Returns the client info for the connection that this provider instance belongs to. The connection instance is passed as an argument for convenience's sake. Providers can use the connection to communicate with the database, but it will be within the scope of any ongoing transactions, so therefore implementations should not attempt to change isolation level, autocommit settings or call rollback() or commit() on the connection.

Parameters
conn:Connection

connection object

Returns:Properties

client info as Properties

Annotations
@Override
Exceptions
SQLException:
if an error occurs
getClientInfoback to summary
public synchronized String getClientInfo(Connection conn, String name) throws SQLException

Implements com.mysql.cj.jdbc.ClientInfoProvider.getClientInfo.

Doc from com.mysql.cj.jdbc.ClientInfoProvider.getClientInfo.

Returns the client info for the connection that this provider instance belongs to. The connection instance is passed as an argument for convenience's sake. Providers can use the connection to communicate with the database, but it will be within the scope of any ongoing transactions, so therefore implementations should not attempt to change isolation level, autocommit settings or call rollback() or commit() on the connection.

Parameters
conn:Connection

connection object

name:String

property name

Returns:String

the client info by given property name

Annotations
@Override
Exceptions
SQLException:
if an error occurs
initializeback to summary
public synchronized void initialize(Connection conn, Properties configurationProps) throws SQLException

Implements com.mysql.cj.jdbc.ClientInfoProvider.initialize.

Doc from com.mysql.cj.jdbc.ClientInfoProvider.initialize.

Called once by the driver when it needs to configure the provider.

Parameters
conn:Connection

the connection that the provider belongs too.

configurationProps:Properties

a java.util.Properties instance that contains configuration information for the connection.

Annotations
@Override
Exceptions
SQLException:
if initialization fails.
setClientInfoback to summary
public synchronized void setClientInfo(Connection conn, Properties properties) throws SQLClientInfoException

Implements com.mysql.cj.jdbc.ClientInfoProvider.setClientInfo.

Doc from com.mysql.cj.jdbc.ClientInfoProvider.setClientInfo.

Sets the client info for the connection that this provider instance belongs to. The connection instance is passed as an argument for convenience's sake. Providers can use the connection to communicate with the database, but it will be within the scope of any ongoing transactions, so therefore implementations should not attempt to change isolation level, autocommit settings or call rollback() or commit() on the connection.

Parameters
conn:Connection

connection object

properties:Properties

Properties object

Annotations
@Override
Exceptions
SQLClientInfoException:
if an error occurs
setClientInfoback to summary
public synchronized void setClientInfo(Connection conn, String name, String value) throws SQLClientInfoException

Implements com.mysql.cj.jdbc.ClientInfoProvider.setClientInfo.

Doc from com.mysql.cj.jdbc.ClientInfoProvider.setClientInfo.

Sets the client info for the connection that this provider instance belongs to. The connection instance is passed as an argument for convenience's sake. Providers can use the connection to communicate with the database, but it will be within the scope of any ongoing transactions, so therefore implementations should not attempt to change isolation level, autocommit settings or call rollback() or commit() on the connection.

Parameters
conn:Connection

connection object

name:String

property name

value:String

property value

Annotations
@Override
Exceptions
SQLClientInfoException:
if an error occurs
setCommentback to summary
private synchronized void setComment(Connection conn) throws SQLClientInfoException