Search in sources :

Example 86 with HsqlName

use of org.hsqldb_voltpatches.HsqlNameManager.HsqlName in project voltdb by VoltDB.

the class QuerySpecification method getBaseTableNames.

@Override
void getBaseTableNames(OrderedHashSet set) {
    for (int i = 0; i < rangeVariables.length; i++) {
        Table rangeTable = rangeVariables[i].rangeTable;
        HsqlName name = rangeTable.getName();
        if (rangeTable.isReadOnly() || rangeTable.isTemp()) {
            continue;
        }
        if (name.schema == SqlInvariants.SYSTEM_SCHEMA_HSQLNAME) {
            continue;
        }
        set.add(name);
    }
}
Also used : HsqlName(org.hsqldb_voltpatches.HsqlNameManager.HsqlName)

Example 87 with HsqlName

use of org.hsqldb_voltpatches.HsqlNameManager.HsqlName in project voltdb by VoltDB.

the class QueryExpression method getResultColumnNames.

public HsqlName[] getResultColumnNames() {
    if (resultTable == null) {
        return leftQueryExpression.getResultColumnNames();
    }
    HashMappedList list = ((TableDerived) resultTable).columnList;
    HsqlName[] resultColumnNames = new HsqlName[list.size()];
    for (int i = 0; i < resultColumnNames.length; i++) {
        resultColumnNames[i] = ((ColumnSchema) list.get(i)).getName();
    }
    return resultColumnNames;
}
Also used : HashMappedList(org.hsqldb_voltpatches.lib.HashMappedList) HsqlName(org.hsqldb_voltpatches.HsqlNameManager.HsqlName)

Example 88 with HsqlName

use of org.hsqldb_voltpatches.HsqlNameManager.HsqlName in project voltdb by VoltDB.

the class QuerySpecification method createResultTable.

@Override
void createResultTable(Session session) {
    HsqlName tableName;
    HashMappedList columnList;
    int tableType;
    tableName = session.database.nameManager.getSubqueryTableName();
    tableType = persistenceScope == TableBase.SCOPE_STATEMENT ? TableBase.SYSTEM_SUBQUERY : TableBase.RESULT_TABLE;
    columnList = new HashMappedList();
    for (int i = 0; i < indexLimitVisible; i++) {
        Expression e = exprColumns[i];
        SimpleName simpleName = e.getSimpleName();
        String nameString = simpleName.name;
        HsqlName name = session.database.nameManager.newColumnSchemaHsqlName(tableName, simpleName);
        if (!accessibleColumns[i]) {
            nameString = HsqlNameManager.getAutoNoNameColumnString(i);
        }
        ColumnSchema column = new ColumnSchema(name, e.dataType, true, false, null);
        columnList.add(nameString, column);
    }
    try {
        resultTable = new TableDerived(session.database, tableName, tableType, columnTypes, columnList, null);
    } catch (Exception e) {
    }
}
Also used : HashMappedList(org.hsqldb_voltpatches.lib.HashMappedList) SimpleName(org.hsqldb_voltpatches.HsqlNameManager.SimpleName) HsqlName(org.hsqldb_voltpatches.HsqlNameManager.HsqlName)

Example 89 with HsqlName

use of org.hsqldb_voltpatches.HsqlNameManager.HsqlName in project voltdb by VoltDB.

the class ParserRoutine method readRoutineCharacteristics.

private void readRoutineCharacteristics(Routine routine) {
    OrderedIntHashSet set = new OrderedIntHashSet();
    boolean end = false;
    while (!end) {
        switch(token.tokenType) {
            case Tokens.LANGUAGE:
                {
                    if (!set.add(Tokens.LANGUAGE)) {
                        throw unexpectedToken();
                    }
                    read();
                    if (token.tokenType == Tokens.JAVA) {
                        read();
                        routine.setLanguage(Routine.LANGUAGE_JAVA);
                    } else if (token.tokenType == Tokens.SQL) {
                        read();
                        routine.setLanguage(Routine.LANGUAGE_SQL);
                    } else {
                        throw unexpectedToken();
                    }
                    break;
                }
            case Tokens.PARAMETER:
                {
                    if (!set.add(Tokens.PARAMETER)) {
                        throw unexpectedToken();
                    }
                    read();
                    readThis(Tokens.STYLE);
                    if (token.tokenType == Tokens.JAVA) {
                        read();
                        routine.setParameterStyle(Routine.PARAM_STYLE_JAVA);
                    } else {
                        readThis(Tokens.SQL);
                        routine.setParameterStyle(Routine.PARAM_STYLE_SQL);
                    }
                    break;
                }
            case Tokens.SPECIFIC:
                {
                    if (!set.add(Tokens.SPECIFIC)) {
                        throw unexpectedToken();
                    }
                    read();
                    HsqlName name = readNewSchemaObjectNameNoCheck(routine.getType());
                    routine.setSpecificName(name);
                    break;
                }
            case Tokens.DETERMINISTIC:
                {
                    if (!set.add(Tokens.DETERMINISTIC)) {
                        throw unexpectedToken();
                    }
                    read();
                    routine.setDeterministic(true);
                    break;
                }
            case Tokens.NOT:
                {
                    if (!set.add(Tokens.DETERMINISTIC)) {
                        throw unexpectedToken();
                    }
                    read();
                    readThis(Tokens.DETERMINISTIC);
                    routine.setDeterministic(false);
                    break;
                }
            case Tokens.MODIFIES:
                {
                    if (!set.add(Tokens.SQL)) {
                        throw unexpectedToken();
                    }
                    if (routine.getType() == SchemaObject.FUNCTION) {
                        throw unexpectedToken();
                    }
                    read();
                    readThis(Tokens.SQL);
                    readThis(Tokens.DATA);
                    routine.setDataImpact(Routine.MODIFIES_SQL);
                    break;
                }
            case Tokens.NO:
                {
                    if (!set.add(Tokens.SQL)) {
                        throw unexpectedToken();
                    }
                    read();
                    readThis(Tokens.SQL);
                    routine.setDataImpact(Routine.NO_SQL);
                    break;
                }
            case Tokens.READS:
                {
                    if (!set.add(Tokens.SQL)) {
                        throw unexpectedToken();
                    }
                    read();
                    readThis(Tokens.SQL);
                    readThis(Tokens.DATA);
                    routine.setDataImpact(Routine.READS_SQL);
                    break;
                }
            case Tokens.CONTAINS:
                {
                    if (!set.add(Tokens.SQL)) {
                        throw unexpectedToken();
                    }
                    read();
                    readThis(Tokens.SQL);
                    routine.setDataImpact(Routine.CONTAINS_SQL);
                    break;
                }
            case Tokens.RETURNS:
                {
                    if (!set.add(Tokens.NULL) || routine.isProcedure()) {
                        throw unexpectedToken();
                    }
                    read();
                    readThis(Tokens.NULL);
                    readThis(Tokens.ON);
                    readThis(Tokens.NULL);
                    readThis(Tokens.INPUT);
                    routine.setNullInputOutput(true);
                    break;
                }
            case Tokens.CALLED:
                {
                    if (!set.add(Tokens.NULL) || routine.isProcedure()) {
                        throw unexpectedToken();
                    }
                    read();
                    readThis(Tokens.ON);
                    readThis(Tokens.NULL);
                    readThis(Tokens.INPUT);
                    routine.setNullInputOutput(false);
                    break;
                }
            case Tokens.DYNAMIC:
                {
                    if (!set.add(Tokens.RESULT) || routine.isFunction()) {
                        throw unexpectedToken();
                    }
                    read();
                    readThis(Tokens.RESULT);
                    readThis(Tokens.SETS);
                    readBigint();
                    break;
                }
            case Tokens.NEW:
                {
                    if (routine.getType() == SchemaObject.FUNCTION || !set.add(Tokens.SAVEPOINT)) {
                        throw unexpectedToken();
                    }
                    read();
                    readThis(Tokens.SAVEPOINT);
                    readThis(Tokens.LEVEL);
                    routine.setNewSavepointLevel(true);
                    break;
                }
            case Tokens.OLD:
                {
                    if (routine.getType() == SchemaObject.FUNCTION || !set.add(Tokens.SAVEPOINT)) {
                        throw unexpectedToken();
                    }
                    read();
                    readThis(Tokens.SAVEPOINT);
                    readThis(Tokens.LEVEL);
                    routine.setNewSavepointLevel(false);
                    throw super.unsupportedFeature(Tokens.T_OLD);
                // break;
                }
            default:
                end = true;
                break;
        }
    }
}
Also used : OrderedIntHashSet(org.hsqldb_voltpatches.lib.OrderedIntHashSet) HsqlName(org.hsqldb_voltpatches.HsqlNameManager.HsqlName)

Example 90 with HsqlName

use of org.hsqldb_voltpatches.HsqlNameManager.HsqlName in project voltdb by VoltDB.

the class ParserRoutine method readRoutineParameter.

private ColumnSchema readRoutineParameter(Routine routine) {
    HsqlName hsqlName = null;
    byte parameterMode = SchemaObject.ParameterModes.PARAM_IN;
    switch(token.tokenType) {
        case Tokens.IN:
            read();
            break;
        case Tokens.OUT:
            if (routine.getType() != SchemaObject.PROCEDURE) {
                throw unexpectedToken();
            }
            read();
            parameterMode = SchemaObject.ParameterModes.PARAM_OUT;
            break;
        case Tokens.INOUT:
            if (routine.getType() != SchemaObject.PROCEDURE) {
                throw unexpectedToken();
            }
            read();
            parameterMode = SchemaObject.ParameterModes.PARAM_INOUT;
            break;
        default:
    }
    if (!isReservedKey()) {
        hsqlName = readNewDependentSchemaObjectName(routine.getName(), SchemaObject.PARAMETER);
    }
    Type typeObject = readTypeDefinition(true);
    ColumnSchema column = new ColumnSchema(hsqlName, typeObject, false, false, null);
    column.setParameterMode(parameterMode);
    return column;
}
Also used : Type(org.hsqldb_voltpatches.types.Type) HsqlName(org.hsqldb_voltpatches.HsqlNameManager.HsqlName)

Aggregations

HsqlName (org.hsqldb_voltpatches.HsqlNameManager.HsqlName)204 Table (org.hsqldb_voltpatches.Table)86 PersistentStore (org.hsqldb_voltpatches.persist.PersistentStore)73 TextTable (org.hsqldb_voltpatches.TextTable)65 Iterator (org.hsqldb_voltpatches.lib.Iterator)64 WrapperIterator (org.hsqldb_voltpatches.lib.WrapperIterator)61 SchemaObject (org.hsqldb_voltpatches.SchemaObject)60 Constraint (org.hsqldb_voltpatches.Constraint)59 OrderedHashSet (org.hsqldb_voltpatches.lib.OrderedHashSet)48 HsqlArrayList (org.hsqldb_voltpatches.lib.HsqlArrayList)22 HsqlException (org.hsqldb_voltpatches.HsqlException)20 Type (org.hsqldb_voltpatches.types.Type)20 Session (org.hsqldb_voltpatches.Session)16 Result (org.hsqldb_voltpatches.result.Result)15 Grantee (org.hsqldb_voltpatches.rights.Grantee)12 NumberType (org.hsqldb_voltpatches.types.NumberType)10 Routine (org.hsqldb_voltpatches.Routine)7 RoutineSchema (org.hsqldb_voltpatches.RoutineSchema)7 TriggerDef (org.hsqldb_voltpatches.TriggerDef)6 Index (org.hsqldb_voltpatches.index.Index)6