private void checkRunOver(int i, int len, String sql) throws SQLException { if (i >= len) { throw Message.getSyntaxError(sql, i); } }
private String readColumnIdentifier() throws SQLException { if (currentTokenType != IDENTIFIER) { throw Message.getSyntaxError(sqlCommand, parseIndex, "identifier"); } String s = currentToken; read(); return s; }
private void read(String expected) throws SQLException { if (!expected.equals(currentToken) || currentTokenQuoted) { throw Message.getSyntaxError(sqlCommand, parseIndex, expected); } read(); }
private SQLException getSyntaxError() { if (expected == null || expected.size() == 0) { return Message.getSyntaxError(sqlCommand, parseIndex); } else { StringBuffer buff = new StringBuffer(); for (int i = 0; i < expected.size(); i++) { if (i > 0) { buff.append(", "); } buff.append(expected.get(i)); } return Message.getSyntaxError(sqlCommand, parseIndex, buff.toString()); } }
public Query recompileQuery(Session session) throws SQLException { Prepared p = session.prepare(querySQL); if (!(p instanceof Query)) { throw Message.getSyntaxError(querySQL, 0); } Query query = (Query) p; querySQL = query.getPlanSQL(); return query; }
int j = sql.indexOf('\'', i + 1); if (j < 0) { throw Message.getSyntaxError(sql, i); int j = sql.indexOf('"', i + 1); if (j < 0) { throw Message.getSyntaxError(sql, i); throw Message.getSyntaxError(sql, i);
private String readIdentifierWithSchema(String defaultSchemaName) throws SQLException { if (currentTokenType != IDENTIFIER) { throw Message.getSyntaxError(sqlCommand, parseIndex, "identifier"); } String s = currentToken; read(); schemaName = defaultSchemaName; if (readIf(".")) { schemaName = s; if (currentTokenType != IDENTIFIER) { throw Message.getSyntaxError(sqlCommand, parseIndex, "identifier"); } s = currentToken; read(); } if (".".equals(currentToken)) { if (schemaName.equalsIgnoreCase(database.getShortName())) { read("."); schemaName = s; if (currentTokenType != IDENTIFIER) { throw Message.getSyntaxError(sqlCommand, parseIndex, "identifier"); } s = currentToken; read(); } } return s; }
private String readString() throws SQLException { Expression expr = readExpression().optimize(session); if (!(expr instanceof ValueExpression)) { throw Message.getSyntaxError(sqlCommand, parseIndex, "string"); } String s = expr.getValue(session).getString(); return s; }
private long readLong() throws SQLException { boolean minus = false; if (currentTokenType == MINUS) { minus = true; read(); } if (currentTokenType != VALUE || (currentValue.getType() != Value.INT && currentValue.getType() != Value.DECIMAL)) { throw Message.getSyntaxError(sqlCommand, parseIndex, "long"); } long i = currentValue.getLong(); read(); return minus ? -i : i; }
throw Message.getSyntaxError(sql, i, "="); case '}': if (--level < 0) { throw Message.getSyntaxError(sql, i); throw Message.getSyntaxError(sql, sql.length() - 1);
private int getInt() throws SQLException { boolean minus = false; if (currentTokenType == MINUS) { minus = true; read(); } else if (currentTokenType == PLUS) { read(); } if (currentTokenType != VALUE || currentValue.getType() != Value.INT) { throw Message.getSyntaxError(sqlCommand, parseIndex, "integer"); } int i = currentValue.getInt(); read(); return minus ? -i : i; }