Search in sources :

Example 6 with CommandInterface

use of com.wplatform.ddal.command.CommandInterface in project jdbc-shards by wplatform.

the class JdbcStatement method cancel.

/**
 * Cancels a currently running statement.
 * This method must be called from within another
 * thread than the execute method.
 * Operations on large objects are not interrupted,
 * only operations that process many rows.
 *
 * @throws SQLException if this object is closed
 */
@Override
public void cancel() throws SQLException {
    try {
        debugCodeCall("cancel");
        checkClosed();
        // executingCommand can be reset  by another thread
        CommandInterface c = executingCommand;
        try {
            if (c != null) {
                c.cancel();
                cancelled = true;
            }
        } finally {
            setExecutingStatement(null);
        }
    } catch (Exception e) {
        throw logAndConvert(e);
    }
}
Also used : CommandInterface(com.wplatform.ddal.command.CommandInterface) DbException(com.wplatform.ddal.message.DbException)

Example 7 with CommandInterface

use of com.wplatform.ddal.command.CommandInterface in project jdbc-shards by wplatform.

the class JdbcConnection method setSavepoint.

/**
 * Creates a new unnamed savepoint.
 *
 * @return the new savepoint
 */
@Override
public Savepoint setSavepoint() throws SQLException {
    try {
        int id = getNextId(TraceObject.SAVEPOINT);
        if (isDebugEnabled()) {
            debugCodeAssign("Savepoint", TraceObject.SAVEPOINT, id, "setSavepoint()");
        }
        checkClosed();
        CommandInterface set = prepareCommand("SAVEPOINT " + JdbcSavepoint.getName(null, savepointId), Integer.MAX_VALUE);
        set.executeUpdate();
        JdbcSavepoint savepoint = new JdbcSavepoint(this, savepointId, null, trace, id);
        savepointId++;
        return savepoint;
    } catch (Exception e) {
        throw logAndConvert(e);
    }
}
Also used : CommandInterface(com.wplatform.ddal.command.CommandInterface) Savepoint(java.sql.Savepoint) SQLClientInfoException(java.sql.SQLClientInfoException) SQLException(java.sql.SQLException) DbException(com.wplatform.ddal.message.DbException)

Aggregations

CommandInterface (com.wplatform.ddal.command.CommandInterface)7 DbException (com.wplatform.ddal.message.DbException)5 ResultInterface (com.wplatform.ddal.result.ResultInterface)3 SQLClientInfoException (java.sql.SQLClientInfoException)3 SQLException (java.sql.SQLException)3 Savepoint (java.sql.Savepoint)2