当前位置: 首页>>代码示例>>Java>>正文


Java StatementEvent类代码示例

本文整理汇总了Java中javax.sql.StatementEvent的典型用法代码示例。如果您正苦于以下问题:Java StatementEvent类的具体用法?Java StatementEvent怎么用?Java StatementEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


StatementEvent类属于javax.sql包,在下文中一共展示了StatementEvent类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: close

import javax.sql.StatementEvent; //导入依赖的package包/类
public synchronized void close() throws SQLException {
    if (this.pooledConnection == null) {
        // no-op
        return;
    }

    MysqlPooledConnection con = this.pooledConnection; // we need this later...

    try {
        super.close();
    } finally {
        try {
            StatementEvent e = new StatementEvent(con, this);
            // todo: pull this all up into base classes when we support *only* JDK6 or newer
            if (con instanceof JDBC4MysqlPooledConnection) {
                ((JDBC4MysqlPooledConnection) con).fireStatementEvent(e);
            } else if (con instanceof JDBC4MysqlXAConnection) {
                ((JDBC4MysqlXAConnection) con).fireStatementEvent(e);
            } else if (con instanceof JDBC4SuspendableXAConnection) {
                ((JDBC4SuspendableXAConnection) con).fireStatementEvent(e);
            }
        } finally {
            this.unwrappedInterfaces = null;
        }
    }
}
 
开发者ID:bragex,项目名称:the-vigilantes,代码行数:27,代码来源:JDBC4PreparedStatementWrapper.java

示例2: statementClosed

import javax.sql.StatementEvent; //导入依赖的package包/类
void statementClosed(CassandraPreparedStatement preparedStatement)
{
	StatementEvent event = new StatementEvent(this, preparedStatement);
	for (StatementEventListener listener : statementEventListeners)
	{
		listener.statementClosed(event);
	}

	String cql = preparedStatement.getCql();
	Set<CassandraPreparedStatement> freeStatements = freePreparedStatements.get(cql);
	Set<CassandraPreparedStatement> usedStatements = usedPreparedStatements.get(cql);

	usedStatements.remove(preparedStatement);
	
	preparedStatement.resetResults();
	try
	{
		preparedStatement.clearParameters();
		freeStatements.add(preparedStatement);
	}
	catch (SQLException e)
	{
		logger.error(e.getMessage());
	}

}
 
开发者ID:adejanovski,项目名称:cassandra-jdbc-wrapper,代码行数:27,代码来源:PooledCassandraConnection.java

示例3: statementErrorOccurred

import javax.sql.StatementEvent; //导入依赖的package包/类
void statementErrorOccurred(CassandraPreparedStatement preparedStatement, SQLException sqlException)
{
	StatementEvent event = new StatementEvent(this, preparedStatement, sqlException);
	for (StatementEventListener listener : statementEventListeners)
	{
		listener.statementErrorOccurred(event);
	}
	
	String cql = preparedStatement.getCql();
	Set<CassandraPreparedStatement> usedStatements = usedPreparedStatements.get(cql);
	
	if (!(event.getSQLException() instanceof SQLRecoverableException))
	{
		preparedStatement.close();
		usedStatements.remove(preparedStatement);
	}
}
 
开发者ID:adejanovski,项目名称:cassandra-jdbc-wrapper,代码行数:18,代码来源:PooledCassandraConnection.java

示例4: close

import javax.sql.StatementEvent; //导入依赖的package包/类
private void close() throws SQLException {
  try {
    this.statement.close();
  } catch (SQLException e) {
    this.handleException(e);
  }
  this.pooledConnection.removeStatement(this.statement);
  if (this.statement instanceof PreparedStatement) {
    List<StatementEventListener> statementEventListeners =
        this.pooledConnection.getStatementEventListeners();
    if (statementEventListeners != null) {
      StatementEvent event =
          new StatementEvent(this.pooledConnection, (PreparedStatement) this.statement);
      for (StatementEventListener listener : statementEventListeners) {
        listener.statementClosed(event);
      }
    }
  }
}
 
开发者ID:xionghuiCoder,项目名称:clearpool,代码行数:20,代码来源:StatementHandler.java

示例5: fireStatementEvent

import javax.sql.StatementEvent; //导入依赖的package包/类
void fireStatementEvent(StatementEvent event) throws SQLException {
    synchronized (this.statementEventListeners) {
        for (StatementEventListener listener : this.statementEventListeners.keySet()) {
            listener.statementClosed(event);
        }
    }
}
 
开发者ID:bragex,项目名称:the-vigilantes,代码行数:8,代码来源:JDBC4MysqlXAConnection.java

示例6: onStatementClose

import javax.sql.StatementEvent; //导入依赖的package包/类
/**
 *
 * Raise the statementClosed event for all the listeners when the 
 * corresponding events occurs.
 *
 * @param statement The PreparedStatement that was closed
 *
 */
public void onStatementClose(PreparedStatement statement) {
    if (!statementEventListeners.isEmpty()) {
        StatementEvent event = new StatementEvent(this,statement);
        for (StatementEventListener l : statementEventListeners) {
            l.statementClosed(event);
        }
    }
}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:17,代码来源:ClientPooledConnection40.java

示例7: onStatementClose

import javax.sql.StatementEvent; //导入依赖的package包/类
/**
 * Raise the statementClosed event for all the listeners when the 
 * corresponding events occurs
 * @param statement The PreparedStatement that was closed
 */
public void onStatementClose(PreparedStatement statement) {
    if (!statementEventListeners.isEmpty()) {
        StatementEvent event = new StatementEvent(this,statement);
        for (StatementEventListener l : statementEventListeners) {
            l.statementClosed(event);
        }
    }
}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:14,代码来源:ClientXAConnection40.java

示例8: onStatementClose

import javax.sql.StatementEvent; //导入依赖的package包/类
/**
 * Raise the statementClosed event for all the listeners when the
 * corresponding events occurs
 * @param statement PreparedStatement
 */
public void onStatementClose(PreparedStatement statement) {
    if (!statementEventListeners.isEmpty()){
        StatementEvent event = new StatementEvent(this,statement);
        for (StatementEventListener l : statementEventListeners) {
            l.statementClosed(event);
        }
    }
}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:14,代码来源:EmbedPooledConnection40.java

示例9: onStatementErrorOccurred

import javax.sql.StatementEvent; //导入依赖的package包/类
/**
 * Raise the statementErrorOccurred event for all the listeners when the
 * corresponding events occurs
 * @param statement PreparedStatement
 * @param sqle      SQLException
 */
public void onStatementErrorOccurred(PreparedStatement statement,SQLException sqle) {
    if (!statementEventListeners.isEmpty()){
        StatementEvent event = new StatementEvent(this,statement,sqle);
        for (StatementEventListener l : statementEventListeners) {
            l.statementErrorOccurred(event);
        }
    }
}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:15,代码来源:EmbedPooledConnection40.java


注:本文中的javax.sql.StatementEvent类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。