use of org.hsqldb_voltpatches.HsqlNameManager.HsqlName in project voltdb by VoltDB.
the class DatabaseInformationMain method addColumn.
protected final void addColumn(Table t, String name, Type type) {
HsqlName cn;
ColumnSchema c;
cn = database.nameManager.newInfoSchemaColumnName(name, t.getName());
c = new ColumnSchema(cn, type, true, false, null);
t.addColumn(c);
}
use of org.hsqldb_voltpatches.HsqlNameManager.HsqlName in project voltdb by VoltDB.
the class DatabaseInformationFull method SQL_SIZING_PROFILES.
Table SQL_SIZING_PROFILES() {
Table t = sysTables[SQL_SIZING_PROFILES];
if (t == null) {
t = createBlankTable(sysTableHsqlNames[SQL_SIZING_PROFILES]);
addColumn(t, "SIZING_ID", CARDINAL_NUMBER);
addColumn(t, "SIZING_NAME", CHARACTER_DATA);
addColumn(t, "PROFILE_ID", CARDINAL_NUMBER);
addColumn(t, "PROFILE_NAME", CHARACTER_DATA);
addColumn(t, "REQUIRED_VALUE", CARDINAL_NUMBER);
addColumn(t, "COMMENTS", CHARACTER_DATA);
HsqlName name = HsqlNameManager.newInfoSchemaObjectName(sysTableHsqlNames[SQL_SIZING_PROFILES].name, false, SchemaObject.INDEX);
t.createPrimaryKey(name, new int[] { 0 }, false);
return t;
}
PersistentStore store = database.persistentStoreCollection.getStore(t);
Session sys = database.sessionManager.newSysSession(SqlInvariants.INFORMATION_SCHEMA_HSQLNAME, session.getUser());
/*
Result rs = sys.executeDirectStatement(
"VALUES "
+ ";");
t.insertSys(store, rs);
*/
return t;
}
use of org.hsqldb_voltpatches.HsqlNameManager.HsqlName in project voltdb by VoltDB.
the class DatabaseInformationFull method ENABLED_ROLES.
/**
* ENABLED_ROLES<p>
*
* <b>Function</b><p>
*
* Identify the enabled roles for the current SQL-session.<p>
*
* Definition<p>
*
* <pre class="SqlCodeExample">
* CREATE RECURSIVE VIEW ENABLED_ROLES ( ROLE_NAME ) AS
* VALUES ( CURRENT_ROLE )
* UNION
* SELECT RAD.ROLE_NAME
* FROM DEFINITION_SCHEMA.ROLE_AUTHORIZATION_DESCRIPTORS RAD
* JOIN ENABLED_ROLES R
* ON RAD.GRANTEE = R.ROLE_NAME;
*
* GRANT SELECT ON TABLE ENABLED_ROLES
* TO PUBLIC WITH GRANT OPTION;
* </pre>
*/
Table ENABLED_ROLES() {
Table t = sysTables[ENABLED_ROLES];
if (t == null) {
t = createBlankTable(sysTableHsqlNames[ENABLED_ROLES]);
addColumn(t, "ROLE_NAME", SQL_IDENTIFIER);
// true PK
HsqlName name = HsqlNameManager.newInfoSchemaObjectName(sysTableHsqlNames[ENABLED_ROLES].name, false, SchemaObject.INDEX);
t.createPrimaryKey(name, new int[] { 0 }, true);
return t;
}
PersistentStore store = database.persistentStoreCollection.getStore(t);
// Intermediate holders
Iterator grantees;
Grantee grantee;
Object[] row;
// initialization
grantees = session.getGrantee().getAllRoles().iterator();
while (grantees.hasNext()) {
grantee = (Grantee) grantees.next();
row = t.getEmptyRowData();
row[0] = grantee.getNameString();
t.insertSys(store, row);
}
return t;
}
use of org.hsqldb_voltpatches.HsqlNameManager.HsqlName in project voltdb by VoltDB.
the class UserManager method getInitialSchemaSQL.
public String[] getInitialSchemaSQL() {
HsqlArrayList list = new HsqlArrayList(userList.size());
for (int i = 0; i < userList.size(); i++) {
User user = (User) userList.get(i);
if (user.isSystem) {
continue;
}
HsqlName name = user.getInitialSchema();
if (name == null) {
continue;
}
list.add(user.getInitialSchemaSQL());
}
String[] array = new String[list.size()];
list.toArray(array);
return array;
}
use of org.hsqldb_voltpatches.HsqlNameManager.HsqlName in project voltdb by VoltDB.
the class Right method removeDroppedColumns.
void removeDroppedColumns(OrderedHashSet columnSet, Table table) {
for (int i = 0; i < columnSet.size(); i++) {
HsqlName name = (HsqlName) columnSet.get(i);
if (table.findColumn(name.name) >= 0) {
columnSet.remove(i);
i--;
}
}
}
Aggregations