use of org.hsqldb_voltpatches.types.UserTypeModifier in project voltdb by VoltDB.
the class ParserDDL method compileCreateType.
StatementSchema compileCreateType() {
read();
HsqlName name = readNewSchemaObjectNameNoCheck(SchemaObject.TYPE);
readThis(Tokens.AS);
Type type = readTypeDefinition(false).duplicate();
readIfThis(Tokens.FINAL);
UserTypeModifier userTypeModifier = new UserTypeModifier(name, SchemaObject.TYPE, type);
type.userTypeModifier = userTypeModifier;
String sql = getLastPart();
Object[] args = new Object[] { type };
return new StatementSchema(sql, StatementTypes.CREATE_TYPE, args, null, null);
}
use of org.hsqldb_voltpatches.types.UserTypeModifier in project voltdb by VoltDB.
the class ParserDDL method compileCreateDomain.
StatementSchema compileCreateDomain() {
UserTypeModifier userTypeModifier = null;
HsqlName name;
read();
name = readNewSchemaObjectNameNoCheck(SchemaObject.DOMAIN);
readIfThis(Tokens.AS);
Type type = readTypeDefinition(false).duplicate();
Expression defaultClause = null;
if (readIfThis(Tokens.DEFAULT)) {
defaultClause = readDefaultClause(type);
}
userTypeModifier = new UserTypeModifier(name, SchemaObject.DOMAIN, type);
userTypeModifier.setDefaultClause(defaultClause);
type.userTypeModifier = userTypeModifier;
HsqlArrayList tempConstraints = new HsqlArrayList();
compileContext.currentDomain = type;
while (true) {
boolean end = false;
switch(token.tokenType) {
case Tokens.CONSTRAINT:
case Tokens.CHECK:
readConstraint(type, tempConstraints);
break;
default:
end = true;
break;
}
if (end) {
break;
}
}
compileContext.currentDomain = null;
for (int i = 0; i < tempConstraints.size(); i++) {
Constraint c = (Constraint) tempConstraints.get(i);
c.prepareCheckConstraint(session, null, false);
userTypeModifier.addConstraint(c);
}
String sql = getLastPart();
Object[] args = new Object[] { type };
return new StatementSchema(sql, StatementTypes.CREATE_DOMAIN, args, null, null);
}
Aggregations