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);
}
}
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;
}
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) {
}
}
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;
}
}
}
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;
}
Aggregations