private void switchOffCluster() { CommandInterface ci = prepareCommand("SET CLUSTER ''", Integer.MAX_VALUE); ci.executeUpdate(false); }
private void rollbackInternal() { rollback = prepareCommand("ROLLBACK", rollback); rollback.executeUpdate(false); }
/** * Re-create the session state using the stored sessionState list. */ protected void recreateSessionState() { if (sessionState != null && !sessionState.isEmpty()) { sessionStateUpdating = true; try { for (String sql : sessionState) { CommandInterface ci = prepareCommand(sql, Integer.MAX_VALUE); ci.executeUpdate(false); } } finally { sessionStateUpdating = false; sessionStateChanged = false; } } }
private void checkClusterDisableAutoCommit(String serverList) { if (autoCommit && transferList.size() > 1) { setAutoCommitSend(false); CommandInterface c = prepareCommand( "SET CLUSTER " + serverList, Integer.MAX_VALUE); // this will set autoCommit to false c.executeUpdate(false); // so we need to switch it on autoCommit = true; cluster = true; } }
/** * Roll back to this savepoint. */ void rollback() { checkValid(); conn.prepareCommand( "ROLLBACK TO SAVEPOINT " + getName(name, savepointId), Integer.MAX_VALUE).executeUpdate(false); }
private synchronized void setAutoCommitSend(boolean autoCommit) { if (clientVersion >= Constants.TCP_PROTOCOL_VERSION_8) { for (int i = 0, count = 0; i < transferList.size(); i++) { Transfer transfer = transferList.get(i); try { traceOperation("SESSION_SET_AUTOCOMMIT", autoCommit ? 1 : 0); transfer.writeInt(SessionRemote.SESSION_SET_AUTOCOMMIT). writeBoolean(autoCommit); done(transfer); } catch (IOException e) { removeServer(e, i--, ++count); } } } else { if (autoCommit) { if (autoCommitTrue == null) { autoCommitTrue = prepareCommand( "SET AUTOCOMMIT TRUE", Integer.MAX_VALUE); } autoCommitTrue.executeUpdate(false); } else { if (autoCommitFalse == null) { autoCommitFalse = prepareCommand( "SET AUTOCOMMIT FALSE", Integer.MAX_VALUE); } autoCommitFalse.executeUpdate(false); } } }
/** * INTERNAL */ public void setQueryTimeout(int seconds) throws SQLException { try { debugCodeCall("setQueryTimeout", seconds); checkClosed(); setQueryTimeout = prepareCommand("SET QUERY_TIMEOUT ?", setQueryTimeout); setQueryTimeout.getParameters().get(0) .setValue(ValueInt.get(seconds * 1000), false); setQueryTimeout.executeUpdate(false); queryTimeoutCache = seconds; } catch (Exception e) { throw logAndConvert(e); } }
/** * Commits the current transaction. This call has only an effect if auto * commit is switched off. * * @throws SQLException if the connection is closed */ @Override public synchronized void commit() throws SQLException { try { debugCodeCall("commit"); checkClosedForWrite(); try { commit = prepareCommand("COMMIT", commit); commit.executeUpdate(false); } finally { afterWriting(); } } catch (Exception e) { throw logAndConvert(e); } }
private int executeUpdateInternal() throws SQLException { closeOldResultSet(); synchronized (session) { try { setExecutingStatement(command); ResultWithGeneratedKeys result = command.executeUpdate(generatedKeysRequest); updateCount = result.getUpdateCount(); ResultInterface gk = result.getGeneratedKeys(); if (gk != null) { int id = getNextId(TraceObject.RESULT_SET); generatedKeys = new JdbcResultSet(conn, this, command, gk, id, false, true, false); } } finally { setExecutingStatement(null); } } return updateCount; }
/** * 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(false); JdbcSavepoint savepoint = new JdbcSavepoint(this, savepointId, null, trace, id); savepointId++; return savepoint; } catch (Exception e) { throw logAndConvert(e); } }
setLockMode.getParameters().get(0).setValue(ValueInt.get(lockMode), false); setLockMode.executeUpdate(false); } catch (Exception e) { throw logAndConvert(e);
/** * Creates a new named savepoint. * * @param name the savepoint name * @return the new savepoint */ @Override public Savepoint setSavepoint(String name) throws SQLException { try { int id = getNextId(TraceObject.SAVEPOINT); if (isDebugEnabled()) { debugCodeAssign("Savepoint", TraceObject.SAVEPOINT, id, "setSavepoint(" + quote(name) + ")"); } checkClosed(); CommandInterface set = prepareCommand( "SAVEPOINT " + JdbcSavepoint.getName(name, 0), Integer.MAX_VALUE); set.executeUpdate(false); return new JdbcSavepoint(this, 0, name, trace, id); } catch (Exception e) { throw logAndConvert(e); } }
"SET " + Parser.quoteIdentifier(setting) + " " + value, Integer.MAX_VALUE); command.executeUpdate(false); } catch (DbException e) { if (e.getErrorCode() == ErrorCode.ADMIN_RIGHTS_REQUIRED) { CommandInterface command = session.prepareCommand(init, Integer.MAX_VALUE); command.executeUpdate(false); } catch (DbException e) { if (!ignoreUnknownSetting) {
private int executeUpdateInternal(String sql, Object generatedKeysRequest) throws SQLException { checkClosedForWrite(); try { closeOldResultSet(); sql = JdbcConnection.translateSQL(sql, escapeProcessing); CommandInterface command = conn.prepareCommand(sql, fetchSize); synchronized (session) { setExecutingStatement(command); try { ResultWithGeneratedKeys result = command.executeUpdate( conn.scopeGeneratedKeys() ? false : generatedKeysRequest); updateCount = result.getUpdateCount(); ResultInterface gk = result.getGeneratedKeys(); if (gk != null) { int id = getNextId(TraceObject.RESULT_SET); generatedKeys = new JdbcResultSet(conn, this, command, gk, id, false, true, false); } } finally { setExecutingStatement(null); } } command.close(); return updateCount; } finally { afterWriting(); } }
} else { returnsResultSet = false; ResultWithGeneratedKeys result = command.executeUpdate( conn.scopeGeneratedKeys() ? false : generatedKeysRequest); updateCount = result.getUpdateCount();
} else { returnsResultSet = false; ResultWithGeneratedKeys result = command.executeUpdate(generatedKeysRequest); updateCount = result.getUpdateCount(); ResultInterface gk = result.getGeneratedKeys();
private void checkClusterDisableAutoCommit(String serverList) { if (autoCommit && transferList.size() > 1) { setAutoCommitSend(false); CommandInterface c = prepareCommand( "SET CLUSTER " + serverList, Integer.MAX_VALUE); // this will set autoCommit to false c.executeUpdate(); // so we need to switch it on autoCommit = true; cluster = true; } }
private void checkClusterDisableAutoCommit(String serverList) { if (autoCommit && transferList.size() > 1) { setAutoCommitSend(false); CommandInterface c = prepareCommand( "SET CLUSTER " + serverList, Integer.MAX_VALUE); // this will set autoCommit to false c.executeUpdate(); // so we need to switch it on autoCommit = true; cluster = true; } }
private int executeUpdateInternal() throws SQLException { closeOldResultSet(); synchronized (session) { try { setExecutingStatement(command); updateCount = command.executeUpdate(); } finally { setExecutingStatement(null); } } return updateCount; }
private int executeUpdateInternal() throws SQLException { closeOld(); synchronized (session) { try { setExecutingStatement(command); updateCount = command.executeUpdate(); } finally { setExecutingStatement(null); } } return updateCount; }