private String readFromAlias(String alias, List<String> excludeIdentifiers) { if (readIf("AS")) { alias = readAliasIdentifier(); } else if (currentTokenType == IDENTIFIER && !isTokenInList(excludeIdentifiers)) { alias = readAliasIdentifier(); } return alias; }
private ArrayList<String> readDerivedColumnNames() { if (readIf("(")) { ArrayList<String> derivedColumnNames = New.arrayList(); do { derivedColumnNames.add(readAliasIdentifier()); } while (readIfMore(true)); return derivedColumnNames; } return null; }
private TableFilter readSimpleTableFilter(int orderInFrom, Collection<String> excludeTokens) { Table table = readTableOrView(); String alias = null; if (readIf("AS")) { alias = readAliasIdentifier(); } else if (currentTokenType == IDENTIFIER) { if (!equalsTokenIgnoreCase(currentToken, "SET") && (excludeTokens == null || !isTokenInList(excludeTokens))) { // SET is not a keyword (PostgreSQL supports it as a table name) alias = readAliasIdentifier(); } } return new TableFilter(session, table, alias, rightsChecked, currentSelect, orderInFrom, null); }
private Prepared parseUse() { readIfEqualOrTo(); Set command = new Set(session, SetTypes.SCHEMA); command.setString(readAliasIdentifier()); return command; }
private DeallocateProcedure parseDeallocate() { readIf("PLAN"); String procedureName = readAliasIdentifier(); DeallocateProcedure command = new DeallocateProcedure(session); command.setProcedureName(procedureName); return command; }
private Set parseSetBinaryCollation() { Set command = new Set(session, SetTypes.BINARY_COLLATION); String name = readAliasIdentifier(); command.setString(name); if (equalsToken(name, CompareMode.UNSIGNED) || equalsToken(name, CompareMode.SIGNED)) { return command; } throw DbException.getInvalidValueException("BINARY_COLLATION", name); }
private Prepared parseExecute() { ExecuteProcedure command = new ExecuteProcedure(session); String procedureName = readAliasIdentifier(); Procedure p = session.getProcedure(procedureName); if (p == null) { throw DbException.get(ErrorCode.FUNCTION_ALIAS_NOT_FOUND_1, procedureName); } command.setProcedure(p); if (readIf("(")) { for (int i = 0;; i++) { command.setExpression(i, readExpression()); if (readIf(")")) { break; } read(","); } } return command; }
private Prepared parsePrepare() { if (readIf("COMMIT")) { TransactionCommand command = new TransactionCommand(session, CommandInterface.PREPARE_COMMIT); command.setTransactionName(readUniqueIdentifier()); return command; } String procedureName = readAliasIdentifier(); if (readIf("(")) { ArrayList<Column> list = New.arrayList(); for (int i = 0;; i++) { Column column = parseColumnForTable("C" + i, true); list.add(column); if (readIf(")")) { break; } read(","); } } read("AS"); Prepared prep = parsePrepared(); PrepareProcedure command = new PrepareProcedure(session); command.setProcedureName(procedureName); command.setPrepared(prep); return command; }
Expression expr = readExpression(); if (readIf("AS") || currentTokenType == IDENTIFIER) { String alias = readAliasIdentifier(); boolean aliasColumnName = database.getSettings().aliasColumnName; aliasColumnName |= database.getMode().aliasColumnName;
private Set parseSetCollation() { Set command = new Set(session, SetTypes.COLLATION); String name = readAliasIdentifier(); command.setString(name); if (equalsToken(name, CompareMode.OFF)) { return command; } Collator coll = CompareMode.getCollator(name); if (coll == null) { throw DbException.getInvalidValueException("collation", name); } if (readIf("STRENGTH")) { if (readIf("PRIMARY")) { command.setInt(Collator.PRIMARY); } else if (readIf("SECONDARY")) { command.setInt(Collator.SECONDARY); } else if (readIf("TERTIARY")) { command.setInt(Collator.TERTIARY); } else if (readIf("IDENTICAL")) { command.setInt(Collator.IDENTICAL); } } else { command.setInt(coll.getStrength()); } return command; }
if (readIf("ON")) { if (readIf("SCHEMA")) { Schema schema = database.getSchema(readAliasIdentifier()); command.setSchema(schema); } else {
private Prepared parseSet() { if (readIf("@")) { Set command = new Set(session, SetTypes.VARIABLE); command.setString(readAliasIdentifier()); readIfEqualOrTo(); command.setExpression(readExpression()); readIfEqualOrTo(); Set command = new Set(session, SetTypes.MODE); command.setString(readAliasIdentifier()); return command; } else if (readIf("COMPRESS_LOB")) { readIfEqualOrTo(); Set command = new Set(session, SetTypes.SCHEMA); command.setString(readAliasIdentifier()); return command; } else if (readIf("DATESTYLE")) { Set command = new Set(session, SetTypes.SCHEMA_SEARCH_PATH); ArrayList<String> list = New.arrayList(); list.add(readAliasIdentifier()); while (readIf(",")) { list.add(readAliasIdentifier());
case AT: read(); r = new Variable(session, readAliasIdentifier()); if (readIf(":=")) { Expression value = readExpression();
ArrayList<Column> columns = New.arrayList(); do { String columnName = readAliasIdentifier(); Column column = parseColumnWithType(columnName); columns.add(column);
String readFromAlias(String alias) throws SQLException { if (readIf("AS")) { alias = readAliasIdentifier(); } else if (currentTokenType == IDENTIFIER) { // left and right are not keywords (because they are functions as // well) if (!isToken("LEFT") && !isToken("RIGHT") && !isToken("FULL")) { alias = readAliasIdentifier(); } } return alias; }
private DeallocateProcedure parseDeallocate() { readIf("PLAN"); String procedureName = readAliasIdentifier(); DeallocateProcedure command = new DeallocateProcedure(session); command.setProcedureName(procedureName); return command; }
private DeallocateProcedure parseDeallocate() { readIf("PLAN"); String procedureName = readAliasIdentifier(); DeallocateProcedure command = new DeallocateProcedure(session); command.setProcedureName(procedureName); return command; }
private Prepared parseUse() { readIfEqualOrTo(); Set command = new Set(session, SetTypes.SCHEMA); command.setString(readAliasIdentifier()); return command; }
private DeallocateProcedure parseDeallocate() throws SQLException { readIf("PLAN"); String procedureName = readAliasIdentifier(); DeallocateProcedure command = new DeallocateProcedure(session); command.setProcedureName(procedureName); return command; }
private Set parseSetBinaryCollation() { Set command = new Set(session, SetTypes.BINARY_COLLATION); String name = readAliasIdentifier(); command.setString(name); if (equalsToken(name, CompareMode.UNSIGNED) || equalsToken(name, CompareMode.SIGNED)) { return command; } throw DbException.getInvalidValueException("BINARY_COLLATION", name); }