本文整理汇总了Java中org.hsqldb.lib.ArrayUtil.hasNull方法的典型用法代码示例。如果您正苦于以下问题:Java ArrayUtil.hasNull方法的具体用法?Java ArrayUtil.hasNull怎么用?Java ArrayUtil.hasNull使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.hsqldb.lib.ArrayUtil
的用法示例。
在下文中一共展示了ArrayUtil.hasNull方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkHasMainRef
import org.hsqldb.lib.ArrayUtil; //导入方法依赖的package包/类
/**
* For the candidate table row, finds any referring node in the main table.
* This is used to check referential integrity when updating a node. We
* have to make sure that the main table still holds a valid main record.
* returns true If a valid row is found, false if there are null in the data
* Otherwise a 'INTEGRITY VIOLATION' Exception gets thrown.
*/
boolean checkHasMainRef(Session session, Object[] row) {
if (ArrayUtil.hasNull(row, core.refCols)) {
return false;
}
PersistentStore store =
session.sessionData.getRowStore(core.mainTable);
boolean exists = core.mainIndex.exists(session, store, row,
core.refCols);
if (!exists) {
String[] info = new String[] {
core.refName.name, core.mainTable.getName().name
};
throw Error.error(ErrorCode.X_23502, ErrorCode.CONSTRAINT, info);
}
return exists;
}
示例2: checkInsert
import org.hsqldb.lib.ArrayUtil; //导入方法依赖的package包/类
/**
* Checks for foreign key or check constraint violation when
* inserting a row into the child table.
*/
void checkInsert(Session session, Table table, Object[] data,
boolean isNew) {
switch (constType) {
case SchemaObject.ConstraintTypes.CHECK :
if (!isNotNull) {
checkCheckConstraint(session, table, data);
}
return;
case SchemaObject.ConstraintTypes.FOREIGN_KEY :
PersistentStore store = core.mainTable.getRowStore(session);
if (ArrayUtil.hasNull(data, core.refCols)) {
if (core.matchType == OpTypes.MATCH_SIMPLE) {
return;
}
if (core.refCols.length == 1) {
return;
}
if (ArrayUtil.hasAllNull(data, core.refCols)) {
return;
}
// core.matchType == OpTypes.MATCH_FULL
} else if (core.mainIndex.existsParent(session, store, data,
core.refCols)) {
return;
}
throw getException(data);
}
}
示例3: findUniqueRows
import org.hsqldb.lib.ArrayUtil; //导入方法依赖的package包/类
/**
* Finds a row matching the values in UNIQUE columns.
*/
RowIterator findUniqueRows(Session session, Object[] row) {
if (row == null || ArrayUtil.hasNull(row, core.mainCols)) {
return core.mainIndex.emptyIterator();
}
PersistentStore store = core.mainTable.getRowStore(session);
return core.mainIndex.findFirstRow(session, store, row, core.mainCols);
}
示例4: checkInsert
import org.hsqldb.lib.ArrayUtil; //导入方法依赖的package包/类
/**
* Checks for foreign key or check constraint violation when
* inserting a row into the child table.
*/
void checkInsert(Session session, Table table, Object[] row) {
switch (constType) {
case CHECK :
if (!isNotNull) {
checkCheckConstraint(session, table, row);
}
return;
case FOREIGN_KEY :
PersistentStore store =
session.sessionData.getRowStore(core.mainTable);
if (ArrayUtil.hasNull(row, core.refCols)) {
if (core.matchType == OpTypes.MATCH_SIMPLE) {
return;
}
if (core.refCols.length == 1) {
return;
}
if (ArrayUtil.hasAllNull(row, core.refCols)) {
return;
}
// core.matchType == OpTypes.MATCH_FULL
} else if (core.mainIndex.exists(session, store, row,
core.refCols)) {
return;
} else if (core.mainTable == core.refTable) {
// special case: self referencing table and self referencing row
int compare = core.mainIndex.compareRowNonUnique(row,
core.refCols, row);
if (compare == 0) {
return;
}
}
String[] info = new String[] {
core.refName.name, core.mainTable.getName().name
};
throw Error.error(ErrorCode.X_23502, ErrorCode.CONSTRAINT,
info);
}
}
示例5: checkReferencedRows
import org.hsqldb.lib.ArrayUtil; //导入方法依赖的package包/类
/**
* Check used before creating a new foreign key cosntraint, this method
* checks all rows of a table to ensure they all have a corresponding
* row in the main table.
*/
void checkReferencedRows(Session session, Table table, int[] rowColArray) {
Index mainIndex = getMainIndex();
PersistentStore store = session.sessionData.getRowStore(table);
RowIterator it = table.rowIterator(session);
while (true) {
Row row = it.getNextRow();
if (row == null) {
break;
}
Object[] rowData = row.getData();
if (ArrayUtil.hasNull(rowData, rowColArray)) {
if (core.matchType == OpTypes.MATCH_SIMPLE) {
continue;
}
} else if (mainIndex.exists(session, store, rowData,
rowColArray)) {
continue;
}
if (ArrayUtil.hasAllNull(rowData, rowColArray)) {
continue;
}
String colValues = "";
for (int i = 0; i < rowColArray.length; i++) {
Object o = rowData[rowColArray[i]];
colValues += table.getColumnTypes()[i].convertToString(o);
colValues += ",";
}
String[] info = new String[] {
getName().name, getMain().getName().name
};
throw Error.error(ErrorCode.X_23502, ErrorCode.CONSTRAINT, info);
}
}
示例6: findFkRef
import org.hsqldb.lib.ArrayUtil; //导入方法依赖的package包/类
/**
* New method to find any referencing row for a foreign key (finds row in
* child table). If ON DELETE CASCADE is specified for this constraint, then
* the method finds the first row among the rows of the table ordered by the
* index and doesn't throw. Without ON DELETE CASCADE, the method attempts
* to finds any row that exists. If no
* row is found, null is returned. ([email protected])
*
* @param session Session
* @param row array of objects for a database row
* @return iterator
*/
RowIterator findFkRef(Session session, Object[] row) {
if (row == null || ArrayUtil.hasNull(row, core.mainCols)) {
return core.refIndex.emptyIterator();
}
PersistentStore store = core.refTable.getRowStore(session);
return core.refIndex.findFirstRow(session, store, row, core.mainCols);
}
示例7: findFkRef
import org.hsqldb.lib.ArrayUtil; //导入方法依赖的package包/类
/**
* New method to find any referencing row for a foreign key (finds row in
* child table). If ON DELETE CASCADE is specified for this constraint, then
* the method finds the first row among the rows of the table ordered by the
* index and doesn't throw. Without ON DELETE CASCADE, the method attempts
* to finds any row that exists. If no
* row is found, null is returned. ([email protected])
*
* @param session Session
* @param row array of objects for a database row
* @param delete should we allow 'ON DELETE CASCADE' or 'ON UPDATE CASCADE'
* @return iterator
* @
*/
RowIterator findFkRef(Session session, Object[] row, boolean delete) {
if (row == null || ArrayUtil.hasNull(row, core.mainCols)) {
return core.refIndex.emptyIterator();
}
PersistentStore store = session.sessionData.getRowStore(core.refTable);
return core.refIndex.findFirstRow(session, store, row, core.mainCols);
}