/** * Parse the statement and prepare it for execution. * * @param sql the SQL statement to parse * @return the prepared object */ public Prepared prepare(String sql) { Prepared p = parse(sql); p.prepare(); if (currentTokenType != END) { throw getSyntaxError(); } return p; }
.append(" WHERE ").append(command.getOnCondition().getSQL()); command.setTargetMatchQuery( (Select) parse(targetMatchQuerySQL.toString()));
/** * 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; }
/** * 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 recompileIfRequired() { if (prepared.needRecompile()) { // TODO test with 'always recompile' prepared.setModificationMetaId(0); String sql = prepared.getSQL(); ArrayList<Parameter> oldParams = prepared.getParameters(); Parser parser = new Parser(session); prepared = parser.parse(sql); long mod = prepared.getModificationMetaId(); prepared.setModificationMetaId(0); ArrayList<Parameter> newParams = prepared.getParameters(); for (int i = 0, size = newParams.size(); i < size; i++) { Parameter old = oldParams.get(i); if (old.isValueSet()) { Value v = old.getValue(session); Parameter p = newParams.get(i); p.setValue(v); } } prepared.prepare(); prepared.setModificationMetaId(mod); prepareJoinBatch(); } }
/** * Parse the statement, but don't prepare it for execution. * * @param sql the SQL statement to parse * @return the prepared object */ public Prepared parseOnly(String sql) throws SQLException { try { return parse(sql); } catch (Exception e) { throw Message.convert(e); } }
private Prepared parse(String sql) throws SQLException { Prepared p; try { // first, try the fast variant p = parse(sql, false); } catch (SQLException e) { if (e.getErrorCode() == ErrorCode.SYNTAX_ERROR_1) { // now, get the detailed exception p = parse(sql, true); } else { throw Message.addSQL(e, sql); } } p.setPrepareAlways(recompileAlways); p.setParameterList(parameters); return p; }
/** * Parse the statement and prepare it for execution. * * @param sql the SQL statement to parse * @return the prepared object */ public Prepared prepare(String sql) { Prepared p = parse(sql); p.prepare(); if (currentTokenType != END) { throw getSyntaxError(); } return p; }
/** * Parse the statement and prepare it for execution. * * @param sql the SQL statement to parse * @return the prepared object */ public Prepared prepare(String sql) { Prepared p = parse(sql); p.prepare(); if (currentTokenType != END) { throw getSyntaxError(); } return p; }
/** * Parse the statement and prepare it for execution. * * @param sql the SQL statement to parse * @return the prepared object */ public Prepared prepare(String sql) throws SQLException { try { Prepared p = parse(sql); p.prepare(); return p; } catch (Exception e) { throw Message.convert(e); } }
/** * 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; }
/** * 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; }
Prepared p = parse(sql); boolean hasMore = isToken(";"); if (!hasMore && currentTokenType != END) {
Prepared p = parse(sql); boolean hasMore = isToken(";"); if (!hasMore && currentTokenType != END) {
Prepared p = parse(sql); p.prepare(); Command c = new CommandContainer(this, sql, p);
private void recompileIfRequired() { if (prepared.needRecompile()) { // TODO test with 'always recompile' prepared.setModificationMetaId(0); String sql = prepared.getSQL(); ArrayList<Parameter> oldParams = prepared.getParameters(); Parser parser = new Parser(session); prepared = parser.parse(sql); long mod = prepared.getModificationMetaId(); prepared.setModificationMetaId(0); ArrayList<Parameter> newParams = prepared.getParameters(); for (int i = 0, size = newParams.size(); i < size; i++) { Parameter old = oldParams.get(i); if (old.isValueSet()) { Value v = old.getValue(session); Parameter p = newParams.get(i); p.setValue(v); } } prepared.prepare(); prepared.setModificationMetaId(mod); prepareJoinBatch(); } }
private void recompileIfRequired() { if (prepared.needRecompile()) { // TODO test with 'always recompile' prepared.setModificationMetaId(0); String sql = prepared.getSQL(); ArrayList<Parameter> oldParams = prepared.getParameters(); Parser parser = new Parser(session); prepared = parser.parse(sql); long mod = prepared.getModificationMetaId(); prepared.setModificationMetaId(0); ArrayList<Parameter> newParams = prepared.getParameters(); for (int i = 0, size = newParams.size(); i < size; i++) { Parameter old = oldParams.get(i); if (old.isValueSet()) { Value v = old.getValue(session); Parameter p = newParams.get(i); p.setValue(v); } } prepared.prepare(); prepared.setModificationMetaId(mod); prepareJoinBatch(); } }