/** * Does exception indicate query recursion? */ private boolean isRecursiveQueryExceptionDetected(DbException exception) { if (exception == null) { return false; } if (exception.getErrorCode() != ErrorCode.TABLE_OR_VIEW_NOT_FOUND_1) { return false; } return exception.getMessage().contains("\"" + this.getName() + "\""); }
private void throwLastBackgroundException() { if (backgroundException != null) { // we don't care too much about concurrency here, // we just want to make sure the exception is _normally_ // not just logged to the .trace.db file DbException b = backgroundException; backgroundException = null; if (b != null) { // wrap the exception, so we see it was thrown here throw DbException.get(b.getErrorCode(), b, b.getMessage()); } } }
p = store.getPage(next); } catch (DbException e) { if (e.getErrorCode() == ErrorCode.FILE_CORRUPTED_1) {
&& ((DbException) e).getErrorCode() == ErrorCode.DATABASE_ALREADY_OPEN_1; if (alreadyOpen) { stopServer();
/** * Parse the statement, but don't prepare it for execution. * * @param sql the SQL statement to parse * @return the prepared object */ Prepared parse(String sql) { Prepared p; try { // first, try the fast variant p = parse(sql, false); } catch (DbException e) { if (e.getErrorCode() == ErrorCode.SYNTAX_ERROR_1) { // now, get the detailed exception p = parse(sql, true); } else { throw e.addSQL(sql); } } p.setPrepareAlways(recompileAlways); p.setParameterList(parameters); return p; }
break; } catch (DbException e) { if (e.getErrorCode() != ErrorCode.DATABASE_IS_IN_EXCLUSIVE_MODE) { throw e;
/** * Convert a value to this column's type using the given {@link Mode}. * <p> * Use this method in case the conversion is Mode-dependent. * * @param v the value * @param mode the database {@link Mode} to use * @return the value */ public Value convert(Value v, Mode mode) { try { return v.convertTo(type, MathUtils.convertLongToInt(precision), mode, this, getEnumerators()); } catch (DbException e) { if (e.getErrorCode() == ErrorCode.DATA_CONVERSION_ERROR_1) { String target = (table == null ? "" : table.getName() + ": ") + getCreateSQL(); throw DbException.get( ErrorCode.DATA_CONVERSION_ERROR_1, e, v.getSQL() + " (" + target + ")"); } throw e; } }
} catch (Exception re) { DbException e = DbException.convert(re); if (e.getErrorCode() == ErrorCode.DATABASE_ALREADY_OPEN_1) { if (autoServerMode) { String serverKey = ((JdbcSQLException) e.getSQLException()).
if (de.getErrorCode() == ErrorCode.DUPLICATE_KEY_1) { for (Index index : indexes) { if (index.getIndexType().isUnique() && index instanceof MultiVersionIndex) {
if (de.getErrorCode() != ErrorCode.DUPLICATE_KEY_1) { throw de;
private Session createSessionAndValidate(ConnectionInfo ci) { try { ConnectionInfo backup = null; String lockMethodName = ci.getProperty("FILE_LOCK", null); FileLockMethod fileLockMethod = FileLock.getFileLockMethod(lockMethodName); if (fileLockMethod == FileLockMethod.SERIALIZED) { // In serialized mode, database instance sharing is not possible ci.setProperty("OPEN_NEW", "TRUE"); try { backup = ci.clone(); } catch (CloneNotSupportedException e) { throw DbException.convert(e); } } Session session = openSession(ci); validateUserAndPassword(true); if (backup != null) { session.setConnectionInfo(backup); } return session; } catch (DbException e) { if (e.getErrorCode() == ErrorCode.WRONG_USER_OR_PASSWORD) { validateUserAndPassword(false); } throw e; } }
int code = e.getErrorCode(); if (code != ErrorCode.DATABASE_IS_CLOSED && code != ErrorCode.LOCK_TIMEOUT_1 &&
@Override public void addRow(Session session, Row row) { lastModificationId = database.getNextModificationDataId(); Transaction t = session.getTransaction(); long savepoint = t.setSavepoint(); try { for (Index index : indexes) { index.add(session, row); } } catch (Throwable e) { t.rollbackToSavepoint(savepoint); DbException de = DbException.convert(e); if (de.getErrorCode() == ErrorCode.DUPLICATE_KEY_1) { for (Index index : indexes) { if (index.getIndexType().isUnique() && index instanceof MultiVersionIndex) { MultiVersionIndex mv = (MultiVersionIndex) index; if (mv.isUncommittedFromOtherSession(session, row)) { throw DbException.get( ErrorCode.CONCURRENT_UPDATE_1, index.getName()); } } } } throw de; } analyzeIfRequired(session); }
removeRow(session, o); } catch (DbException e) { if (e.getErrorCode() == ErrorCode.CONCURRENT_UPDATE_1) { session.rollbackTo(rollback, false); session.startStatementWithinTransaction(); addRow(session, n); } catch (DbException e) { if (e.getErrorCode() == ErrorCode.CONCURRENT_UPDATE_1) { session.rollbackTo(rollback, false); session.startStatementWithinTransaction();
} catch (DbException e) { if (session.getDatabase().getLockMode() == Constants.LOCK_MODE_OFF && e.getErrorCode() == ErrorCode.ROW_NOT_FOUND_WHEN_DELETING_1) {
if (e.getErrorCode() == ErrorCode.DUPLICATE_KEY_1) {
if (e.getErrorCode() != ErrorCode.CONNECTION_BROKEN_1) { throw e;
if (e.getErrorCode() == ErrorCode.DUPLICATE_KEY_1) {
file = database.openFile(fileName, accessMode, true); } catch (DbException e) { if (e.getErrorCode() == ErrorCode.IO_EXCEPTION_2) { if (e.getMessage().contains("locked")) {
command.executeUpdate(false); } catch (DbException e) { if (e.getErrorCode() == ErrorCode.ADMIN_RIGHTS_REQUIRED) { session.getTrace().error(e, "admin rights required; user: \"" + ci.getUserName() + "\"");