/** * Rollback the current local transaction * * @param startTxn * @throws SQLException */ public void rollback(boolean startTxn) throws SQLException { // Check to see the connection is open checkConnection(); if (!autoCommitFlag) { try { if (this.inLocalTxn) { this.inLocalTxn = false; try { ResultsFuture<?> future = this.dqp.rollback(); future.get(); } catch (Exception e) { throw TeiidSQLException.create(e); } logger.fine(JDBCPlugin.Util.getString("MMConnection.Rollback_success")); // $NON-NLS-1$ } } finally { if (startTxn) { this.inLocalTxn = false; } else { this.autoCommitFlag = true; } } } }
String getVDBName() throws SQLException { // Check to see the connection is open checkConnection(); // get the virtual database name to which we are connected. return this.serverConn.getLogonResult().getVdbName(); }
protected void forgetTransaction(XidImpl arg0) throws SQLException { checkConnection(); try { ResultsFuture<?> future = this.dqp.forget(arg0); future.get(); } catch (Exception e) { throw TeiidSQLException.create(e); } }
public DatabaseMetaDataImpl getMetaData() throws SQLException { // Check to see the connection is open checkConnection(); if (dbmm == null) { dbmm = new DatabaseMetaDataImpl(this); } return dbmm; }
protected Xid[] recoverTransaction(int arg0) throws SQLException { checkConnection(); try { ResultsFuture<Xid[]> future = this.dqp.recover(arg0); return future.get(); } catch (Exception e) { throw TeiidSQLException.create(e); } }
/** * This method makes any changes involved in a transaction permanent and releases any locks held * by the connection object. This is only used when auto-commit is set to false. * * @throws SQLException if the transaction had been rolled back or marked to roll back. */ public void commit() throws SQLException { checkConnection(); if (!autoCommitFlag) { try { directCommit(); } finally { inLocalTxn = false; } } }
protected int prepareTransaction(XidImpl arg0) throws SQLException { checkConnection(); transactionXid = null; try { ResultsFuture<Integer> future = this.dqp.prepare(arg0); return future.get(); } catch (Exception e) { throw TeiidSQLException.create(e); } }
protected void endTransaction(XidImpl arg0, int arg1) throws SQLException { checkConnection(); this.autoCommitFlag = true; try { ResultsFuture<?> future = this.dqp.end(arg0, arg1); future.get(); } catch (Exception e) { throw TeiidSQLException.create(e); } }
protected void rollbackTransaction(XidImpl arg0) throws SQLException { checkConnection(); transactionXid = null; this.autoCommitFlag = true; try { ResultsFuture<?> future = this.dqp.rollback(arg0); future.get(); } catch (Exception e) { throw TeiidSQLException.create(e); } }
protected void startTransaction(XidImpl arg0, int arg1, int timeout) throws SQLException { checkConnection(); try { ResultsFuture<?> future = this.dqp.start(arg0, arg1, timeout); future.get(); } catch (Exception e) { throw TeiidSQLException.create(e); } transactionXid = arg0; this.autoCommitFlag = false; }
public StatementImpl createStatement( int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException { // Check to see the connection is open checkConnection(); validateResultSetType(resultSetType); validateResultSetConcurrency(resultSetConcurrency); // TODO: implement close cursors at commit // add the statement object to the map StatementImpl newStatement = new StatementImpl(this, resultSetType, resultSetConcurrency); addStatement(newStatement); return newStatement; }
public void setAutoCommit(boolean autoCommit) throws SQLException { // Check to see the connection is open checkConnection(); if (autoCommit == this.autoCommitFlag) { return; } this.autoCommitFlag = autoCommit; if (autoCommit) { directCommit(); } else { inLocalTxn = false; } }
public CallableStatementImpl prepareCall( String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException { // Check to see the connection is open checkConnection(); validateResultSetType(resultSetType); validateResultSetConcurrency(resultSetConcurrency); validateSQL(sql); // TODO: implement close cursors at commit // add the statement object to the map CallableStatementImpl newStatement = new CallableStatementImpl(this, sql, resultSetType, resultSetConcurrency); addStatement(newStatement); return newStatement; }
public ResultsFuture<?> submitSetAutoCommitTrue(boolean commit) throws SQLException { // Check to see the connection is open checkConnection(); if (this.autoCommitFlag) { return ResultsFuture.NULL_FUTURE; } this.autoCommitFlag = true; try { if (commit) { return dqp.commit(); } return dqp.rollback(); } catch (XATransactionException e) { throw TeiidSQLException.create(e); } }
public PreparedStatementImpl prepareStatement( String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability, int autoGeneratedKeys) throws SQLException { // Check to see the connection is open checkConnection(); validateResultSetType(resultSetType); validateResultSetConcurrency(resultSetConcurrency); validateSQL(sql); // add the statement object to the map PreparedStatementImpl newStatement = new PreparedStatementImpl(this, sql, resultSetType, resultSetConcurrency); newStatement.setAutoGeneratedKeys(autoGeneratedKeys == Statement.RETURN_GENERATED_KEYS); addStatement(newStatement); return newStatement; }
public boolean getAutoCommit() throws SQLException { // Check to see the connection is open checkConnection(); return autoCommitFlag; }
public String getCatalog() throws SQLException { // Check to see the connection is open checkConnection(); // catalogs are not supported return this.serverConn.getLogonResult().getVdbName(); }
/** * This method gets the ServerConnection object wrapped by this object. * * @return ServerConnection object */ public ServerConnection getServerConnection() throws SQLException { // Check to see the connection is open checkConnection(); return serverConn; }
public int getVDBVersion() throws SQLException { checkConnection(); return this.serverConn.getLogonResult().getVdbVersion(); }
/** * Get's the name of the user who got this connection. * * @return Sring object giving the user name * @throws SQLException if the connection is closed */ String getUserName() throws SQLException { checkConnection(); return this.serverConn.getLogonResult().getUserName(); }
/** * This method will return the first warning reported by calls on this connection, or null if none * exist. * * @return A SQLWarning object if there are any warnings. * @throws SQLException, should never occur */ public SQLWarning getWarnings() throws SQLException { // Check to see the connection is open checkConnection(); return null; // we don't have any warnings }