use of org.hsqldb_voltpatches.types.Type in project voltdb by VoltDB.
the class QuerySpecification method resolveTypesPartTwo.
@Override
void resolveTypesPartTwo(Session session) {
resolveGroups();
for (int i = 0; i < unionColumnMap.length; i++) {
Type type = unionColumnTypes[unionColumnMap[i]];
if (type == null) {
throw Error.error(ErrorCode.X_42567);
}
exprColumns[unionColumnMap[i]].setDataType(session, type);
}
for (int i = 0; i < indexStartOrderBy; i++) {
if (exprColumns[i].dataType == null) {
throw Error.error(ErrorCode.X_42567);
}
}
setReferenceableColumns();
setUpdatability();
createResultMetaData();
createTable(session);
if (isUpdatable) {
getMergedSelect();
}
}
use of org.hsqldb_voltpatches.types.Type 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;
}
use of org.hsqldb_voltpatches.types.Type in project voltdb by VoltDB.
the class Routine method getMethods.
static Method[] getMethods(String name) {
int i = name.lastIndexOf('.');
if (i == -1) {
throw Error.error(ErrorCode.X_42501, name);
}
String classname = name.substring(0, i);
String methodname = name.substring(i + 1);
Class classinstance = null;
try {
classinstance = Class.forName(classname);
} catch (Exception e) {
throw Error.error(ErrorCode.X_42501, ErrorCode.M_Message_Pair, new Object[] { classname, e });
}
Method[] methods = classinstance.getMethods();
HsqlArrayList list = new HsqlArrayList();
for (i = 0; i < methods.length; i++) {
int offset = 0;
Method m = methods[i];
int modifiers = m.getModifiers();
if (!m.getName().equals(methodname) || !Modifier.isStatic(modifiers) || !Modifier.isPublic(modifiers)) {
continue;
}
Class[] params = methods[i].getParameterTypes();
if (params.length > 0 && params[0].equals(java.sql.Connection.class)) {
offset = 1;
}
for (int j = offset; j < params.length; j++) {
Class param = params[j];
Type methodParamType = Type.getDefaultTypeWithSize(Types.getParameterSQLTypeNumber(param));
if (methodParamType == null) {
m = null;
break;
}
}
if (m == null) {
continue;
}
Type methodReturnType = Type.getDefaultTypeWithSize(Types.getParameterSQLTypeNumber(m.getReturnType()));
if (methodReturnType != null) {
list.add(methods[i]);
}
}
methods = new Method[list.size()];
list.toArray(methods);
return methods;
}
use of org.hsqldb_voltpatches.types.Type in project voltdb by VoltDB.
the class Table method checkColumnsMatch.
void checkColumnsMatch(ColumnSchema column, int colIndex) {
Type type = colTypes[colIndex];
Type otherType = column.getDataType();
if (type.typeComparisonGroup != otherType.typeComparisonGroup) {
throw Error.error(ErrorCode.X_42562);
}
}
use of org.hsqldb_voltpatches.types.Type in project voltdb by VoltDB.
the class TableBase method createIndexStructure.
final Index createIndexStructure(HsqlName name, int[] columns, boolean[] descending, boolean[] nullsLast, boolean unique, boolean constraint, boolean forward) {
if (primaryKeyCols == null) {
// A VoltDB extension to support matview-based indexes
primaryKeyCols = new int[0];
/* disable 1 line ...
throw Error.runtimeError(ErrorCode.U_S0500, "createIndex");
... disabled 1 line */
// End of VoltDB extension
}
int s = columns.length;
int[] cols = new int[s];
Type[] types = new Type[s];
for (int j = 0; j < s; j++) {
cols[j] = columns[j];
types[j] = colTypes[cols[j]];
}
long id = database.persistentStoreCollection.getNextId();
Index newIndex = new IndexAVL(name, id, this, cols, descending, nullsLast, types, false, unique, constraint, forward);
return newIndex;
}
Aggregations