本文整理汇总了Java中org.hsqldb.lib.ArrayUtil.toAdjustedArray方法的典型用法代码示例。如果您正苦于以下问题:Java ArrayUtil.toAdjustedArray方法的具体用法?Java ArrayUtil.toAdjustedArray怎么用?Java ArrayUtil.toAdjustedArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.hsqldb.lib.ArrayUtil
的用法示例。
在下文中一共展示了ArrayUtil.toAdjustedArray方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: removeExportedKeys
import org.hsqldb.lib.ArrayUtil; //导入方法依赖的package包/类
/**
* Removes any foreign key Constraint objects (exported keys) held by any
* tables referenced by the specified table. <p>
*
* This method is called as the last step of a successful call to
* dropTable() in order to ensure that the dropped Table ceases to be
* referenced when enforcing referential integrity.
*
* @param toDrop The table to which other tables may be holding keys.
* This is a table that is in the process of being dropped.
*/
void removeExportedKeys(Table toDrop) {
Schema schema = (Schema) schemaMap.get(toDrop.getSchemaName());
for (int i = 0; i < schema.tableList.size(); i++) {
Table table = (Table) schema.tableList.get(i);
for (int j = table.constraintList.length - 1; j >= 0; j--) {
Table refTable = table.constraintList[j].getRef();
if (toDrop == refTable) {
table.constraintList =
(Constraint[]) ArrayUtil.toAdjustedArray(
table.constraintList, null, j, -1);
}
}
}
}
示例2: dropIndex
import org.hsqldb.lib.ArrayUtil; //导入方法依赖的package包/类
/**
* Performs Table structure modification and changes to the index nodes to
* remove a given index from a MEMORY or TEXT table. Not for PK index.
*/
public void dropIndex(Session session, String indexname) {
// find the array index for indexname and remove
int todrop = getIndexIndex(indexname);
indexList = (Index[]) ArrayUtil.toAdjustedArray(indexList, null, todrop, -1);
for (int i = 0; i < indexList.length; i++) {
indexList[i].setPosition(i);
}
setBestRowIdentifiers();
if (store != null) {
store.resetAccessorKeys(indexList);
}
}
示例3: addConstraint
import org.hsqldb.lib.ArrayUtil; //导入方法依赖的package包/类
/**
* Adds a constraint.
*/
public void addConstraint(Constraint c) {
int index = c.getConstraintType()
== SchemaObject.ConstraintTypes.PRIMARY_KEY ? 0
: constraintList
.length;
constraintList =
(Constraint[]) ArrayUtil.toAdjustedArray(constraintList, c, index,
1);
updateConstraintLists();
}
示例4: addTrigger
import org.hsqldb.lib.ArrayUtil; //导入方法依赖的package包/类
/**
* Adds a trigger.
*/
void addTrigger(TriggerDef td, HsqlName otherName) {
int index = triggerList.length;
if (otherName != null) {
int pos = getTriggerIndex(otherName.name);
if (pos != -1) {
index = pos + 1;
}
}
triggerList = (TriggerDef[]) ArrayUtil.toAdjustedArray(triggerList, td, index, 1);
TriggerDef[] list = triggerLists[td.vectorIndex];
index = list.length;
if (otherName != null) {
for (int i = 0; i < list.length; i++) {
TriggerDef trigger = list[i];
if (trigger.name.name.equals(otherName.name)) {
index = i + 1;
break;
}
}
}
list = (TriggerDef[]) ArrayUtil.toAdjustedArray(list, td, index, 1);
triggerLists[td.vectorIndex] = list;
}
示例5: dropIndex
import org.hsqldb.lib.ArrayUtil; //导入方法依赖的package包/类
/**
* Performs Table structure modification and changes to the index nodes
* to remove a given index from a MEMORY or TEXT table. Not for PK index.
*
*/
void dropIndex(Session session, String indexname) throws HsqlException {
// find the array index for indexname and remove
int todrop = getIndexIndex(indexname);
indexList = (Index[]) ArrayUtil.toAdjustedArray(indexList, null,
todrop, -1);
setBestRowIdentifiers();
dropIndexFromRows(session, todrop);
}
示例6: compileAlterTableAddForeignKeyConstraint
import org.hsqldb.lib.ArrayUtil; //导入方法依赖的package包/类
Statement compileAlterTableAddForeignKeyConstraint(Table table,
HsqlName name) {
if (name == null) {
name = database.nameManager.newAutoName("FK",
table.getSchemaName(), table.getName(),
SchemaObject.CONSTRAINT);
}
OrderedHashSet set = readColumnNames(false);
Constraint c = readFKReferences(table, name, set);
HsqlName mainTableName = c.getMainTableName();
c.core.mainTable = database.schemaManager.getTable(session,
mainTableName.name, mainTableName.schema.name);
c.setColumnsIndexes(table);
if (c.core.mainCols.length != c.core.refCols.length) {
throw Error.error(ErrorCode.X_42593);
}
String sql = getLastPart();
Object[] args = new Object[] {
StatementTypes.ADD_CONSTRAINT, table, c
};
HsqlName[] writeLockNames =
database.schemaManager.getCatalogAndBaseTableNames(
table.getName());
if (mainTableName != table.getName()) {
writeLockNames =
(HsqlName[]) ArrayUtil.toAdjustedArray(writeLockNames,
mainTableName, writeLockNames.length, 1);
}
return new StatementSchema(sql, StatementTypes.ALTER_TABLE, args,
null, writeLockNames);
}
示例7: compileAlterTableDropConstraint
import org.hsqldb.lib.ArrayUtil; //导入方法依赖的package包/类
private Statement compileAlterTableDropConstraint(Table table) {
boolean cascade = false;
SchemaObject object = readSchemaObjectName(table.getSchemaName(),
SchemaObject.CONSTRAINT);
if (token.tokenType == Tokens.RESTRICT) {
read();
} else if (token.tokenType == Tokens.CASCADE) {
read();
cascade = true;
}
String sql = getLastPart();
Object[] args = new Object[] {
object.getName(), ValuePool.getInt(SchemaObject.CONSTRAINT),
Boolean.valueOf(cascade), Boolean.FALSE
};
HsqlName[] writeLockNames =
database.schemaManager.getCatalogAndBaseTableNames(
table.getName());
HsqlName mainTableName = ((Constraint) object).getMainTableName();
if (mainTableName != null && mainTableName != table.getName()) {
writeLockNames =
(HsqlName[]) ArrayUtil.toAdjustedArray(writeLockNames,
mainTableName, writeLockNames.length, 1);
}
Statement cs = new StatementSchema(sql,
StatementTypes.DROP_CONSTRAINT,
args, null, writeLockNames);
return cs;
}
示例8: compileAlterTableAddForeignKeyConstraint
import org.hsqldb.lib.ArrayUtil; //导入方法依赖的package包/类
Statement compileAlterTableAddForeignKeyConstraint(Table table,
HsqlName name, Boolean ifNotExists) {
if (name == null) {
name = database.nameManager.newAutoName("FK",
table.getSchemaName(), table.getName(),
SchemaObject.CONSTRAINT);
}
OrderedHashSet set = readColumnNames(false);
Constraint c = readFKReferences(table, name, set);
HsqlName mainTableName = c.getMainTableName();
c.core.mainTable =
database.schemaManager.getUserTable(mainTableName.name,
mainTableName.schema.name);
c.setColumnsIndexes(table);
if (c.core.mainCols.length != c.core.refCols.length) {
throw Error.error(ErrorCode.X_42593);
}
String sql = getLastPart();
Object[] args = new Object[] {
StatementTypes.ADD_CONSTRAINT, table, c, ifNotExists
};
HsqlName[] writeLockNames =
database.schemaManager.getCatalogAndBaseTableNames(
table.getName());
if (mainTableName != table.getName()) {
writeLockNames =
(HsqlName[]) ArrayUtil.toAdjustedArray(writeLockNames,
mainTableName, writeLockNames.length, 1);
}
return new StatementSchema(sql, StatementTypes.ALTER_TABLE, args,
null, writeLockNames);
}
示例9: removeConstraint
import org.hsqldb.lib.ArrayUtil; //导入方法依赖的package包/类
public void removeConstraint(String name) {
for (int i = 0; i < constraints.length; i++) {
if (constraints[i].getName().name.equals(name)) {
constraints =
(Constraint[]) ArrayUtil.toAdjustedArray(constraints,
null, i, -1);
break;
}
}
setNotNull();
}
示例10: removeTrigger
import org.hsqldb.lib.ArrayUtil; //导入方法依赖的package包/类
/**
* Drops a trigger.
*/
void removeTrigger(TriggerDef trigger) {
TriggerDef td = null;
for (int i = 0; i < triggerList.length; i++) {
td = triggerList[i];
if (td.getName().name.equals(trigger.getName().name)) {
td.terminate();
triggerList =
(TriggerDef[]) ArrayUtil.toAdjustedArray(triggerList,
null, i, -1);
break;
}
}
if (td == null) {
return;
}
int index = td.triggerType;
// look in each trigger in list
for (int j = 0; j < triggerLists[index].length; j++) {
td = triggerLists[index][j];
if (td.getName().name.equals(trigger.getName().name)) {
triggerLists[index] = (TriggerDef[]) ArrayUtil.toAdjustedArray(
triggerLists[index], null, j, -1);
break;
}
}
}
示例11: addConstraint
import org.hsqldb.lib.ArrayUtil; //导入方法依赖的package包/类
/**
* Adds a constraint.
*/
void addConstraint(Constraint c) {
constraintList =
(Constraint[]) ArrayUtil.toAdjustedArray(constraintList, c,
constraintList.length, 1);
}
示例12: addIndex
import org.hsqldb.lib.ArrayUtil; //导入方法依赖的package包/类
final void addIndex(Index index) {
int i = 0;
for (; i < indexList.length; i++) {
Index current = indexList[i];
int order = index.getIndexOrderValue() - current.getIndexOrderValue();
if (order < 0) {
break;
}
}
indexList = (Index[]) ArrayUtil.toAdjustedArray(indexList, index, i, 1);
for (i = 0; i < indexList.length; i++) {
indexList[i].setPosition(i);
}
if (store != null) {
try {
store.resetAccessorKeys(indexList);
} catch (HsqlException e) {
indexList = (Index[]) ArrayUtil.toAdjustedArray(indexList, null, index.getPosition(), -1);
for (i = 0; i < indexList.length; i++) {
indexList[i].setPosition(i);
}
throw e;
}
}
setBestRowIdentifiers();
}
示例13: removeConstraint
import org.hsqldb.lib.ArrayUtil; //导入方法依赖的package包/类
/**
* remove a named constraint
*/
void removeConstraint(String name) {
int index = getConstraintIndex(name);
constraintList =
(Constraint[]) ArrayUtil.toAdjustedArray(constraintList, null,
index, -1);
}
示例14: addConstraint
import org.hsqldb.lib.ArrayUtil; //导入方法依赖的package包/类
/**
* Adds a constraint.
*/
public void addConstraint(Constraint c) {
int index = c.getConstraintType() == Constraint.PRIMARY_KEY ? 0 : constraintList.length;
constraintList = (Constraint[]) ArrayUtil.toAdjustedArray(constraintList, c, index, 1);
updateConstraintLists();
}
示例15: removeConstraint
import org.hsqldb.lib.ArrayUtil; //导入方法依赖的package包/类
void removeConstraint(int index) {
constraintList = (Constraint[]) ArrayUtil.toAdjustedArray(constraintList, null, index, -1);
updateConstraintLists();
}