/** * Set the SQL statement of the exception to the given row. * * @param e the exception * @param rowId the row number * @param values the values of the row * @return the exception */ protected DbException setRow(DbException e, int rowId, String values) { StringBuilder buff = new StringBuilder(); if (sqlStatement != null) { buff.append(sqlStatement); } buff.append(" -- "); if (rowId > 0) { buff.append("row #").append(rowId + 1).append(' '); } buff.append('(').append(values).append(')'); return e.addSQL(buff.toString()); }
private DbException getExceptionAlreadyInUse(String reason) { DbException e = DbException.get( ErrorCode.DATABASE_ALREADY_OPEN_1, reason); if (fileName != null) { try { Properties prop = load(); String server = prop.getProperty("server"); if (server != null) { String serverId = server + "/" + prop.getProperty("id"); e = e.addSQL(serverId); } } catch (DbException e2) { // ignore } } return e; }
/** * Parse a statement or a list of statements, and prepare it for execution. * * @param sql the SQL statement to parse * @return the command object */ public Command prepareCommand(String sql) { try { Prepared p = parse(sql); boolean hasMore = isToken(";"); if (!hasMore && currentTokenType != END) { throw getSyntaxError(); } p.prepare(); Command c = new CommandContainer(this, sql, p); if (hasMore) { String remaining = originalSQL.substring(parseIndex); if (remaining.trim().length() != 0) { c = new CommandList(this, sql, c, remaining); } } return c; } catch (DbException e) { throw e.addSQL(originalSQL); } }
private void execute(String sql) { try { Prepared command = session.prepare(sql); if (command.isQuery()) { command.query(0); } else { command.update(); } if (session.getAutoCommit()) { session.commit(false); } } catch (DbException e) { throw e.addSQL(sql); } }
/** * 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; }
/** * Execute the meta data statement. * * @param db the database * @param systemSession the system session * @param listener the database event listener */ void execute(Database db, Session systemSession, DatabaseEventListener listener) { try { Prepared command = systemSession.prepare(sql); command.setObjectId(id); command.update(); } catch (DbException e) { e = e.addSQL(sql); SQLException s = e.getSQLException(); db.getTrace(Trace.DATABASE).error(s, sql); if (listener != null) { listener.exceptionThrown(s, sql); // continue startup in this case } else { throw e; } } }
DbException e = DbException.get( ErrorCode.DATABASE_ALREADY_OPEN_1, "Server is running"); throw e.addSQL(server + "/" + id);
e = e.addSQL(sql); SQLException s = e.getSQLException(); database.exceptionThrown(s, sql);
viewQuery = compiledQuery; } catch (DbException e) { e.addSQL(getCreateSQL()); createException = e;
e = e.addSQL(sql); SQLException s = e.getSQLException(); database.exceptionThrown(s, sql);
ValueEnum.check(enumerators); } catch (DbException e) { throw e.addSQL(original);
/** * Set the SQL statement of the exception to the given row. * * @param e the exception * @param rowId the row number * @param values the values of the row * @return the exception */ protected DbException setRow(DbException e, int rowId, String values) { StringBuilder buff = new StringBuilder(); if (sqlStatement != null) { buff.append(sqlStatement); } buff.append(" -- "); if (rowId > 0) { buff.append("row #").append(rowId + 1).append(' '); } buff.append('(').append(values).append(')'); return e.addSQL(buff.toString()); }
/** * Set the SQL statement of the exception to the given row. * * @param e the exception * @param rowId the row number * @param values the values of the row * @return the exception */ protected DbException setRow(DbException e, int rowId, String values) { StringBuilder buff = new StringBuilder(); if (sqlStatement != null) { buff.append(sqlStatement); } buff.append(" -- "); if (rowId > 0) { buff.append("row #").append(rowId + 1).append(' '); } buff.append('(').append(values).append(')'); return e.addSQL(buff.toString()); }
private DbException getExceptionAlreadyInUse(String reason) { DbException e = DbException.get( ErrorCode.DATABASE_ALREADY_OPEN_1, reason); if (fileName != null) { try { Properties prop = load(); String server = prop.getProperty("server"); if (server != null) { String serverId = server + "/" + prop.getProperty("id"); e = e.addSQL(serverId); } } catch (DbException e2) { // ignore } } return e; }
private DbException getExceptionAlreadyInUse(String reason) { DbException e = DbException.get( ErrorCode.DATABASE_ALREADY_OPEN_1, reason); if (fileName != null) { try { Properties prop = load(); String server = prop.getProperty("server"); if (server != null) { String serverId = server + "/" + prop.getProperty("id"); e = e.addSQL(serverId); } } catch (DbException e2) { // ignore } } return e; }
private void execute(String sql) { try { Prepared command = session.prepare(sql); if (command.isQuery()) { command.query(0); } else { command.update(); } if (session.getAutoCommit()) { session.commit(false); } } catch (DbException e) { throw e.addSQL(sql); } }
private void execute(String sql) { try { Prepared command = session.prepare(sql); if (command.isQuery()) { command.query(0); } else { command.update(); } if (session.getAutoCommit()) { session.commit(false); } } catch (DbException e) { throw e.addSQL(sql); } }
/** * 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; }
/** * Execute the meta data statement. * * @param db the database * @param systemSession the system session * @param listener the database event listener */ void execute(Database db, Session systemSession, DatabaseEventListener listener) { try { Prepared command = systemSession.prepare(sql); command.setObjectId(id); command.update(); } catch (DbException e) { e = e.addSQL(sql); SQLException s = e.getSQLException(); db.getTrace(Trace.DATABASE).error(s, sql); if (listener != null) { listener.exceptionThrown(s, sql); // continue startup in this case } else { throw e; } } }
/** * Execute the meta data statement. * * @param db the database * @param systemSession the system session * @param listener the database event listener */ void execute(Database db, Session systemSession, DatabaseEventListener listener) { try { Prepared command = systemSession.prepare(sql); command.setObjectId(id); command.update(); } catch (DbException e) { e = e.addSQL(sql); SQLException s = e.getSQLException(); db.getTrace(Trace.DATABASE).error(s, sql); if (listener != null) { listener.exceptionThrown(s, sql); // continue startup in this case } else { throw e; } } }