本文整理汇总了Java中org.h2.message.DbException.throwInternalError方法的典型用法代码示例。如果您正苦于以下问题:Java DbException.throwInternalError方法的具体用法?Java DbException.throwInternalError怎么用?Java DbException.throwInternalError使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.h2.message.DbException
的用法示例。
在下文中一共展示了DbException.throwInternalError方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: deleteFile
import org.h2.message.DbException; //导入方法依赖的package包/类
/**
* Delete the given file now. This will remove the reference from the list.
*
* @param ref the reference as returned by addFile
* @param fileName the file name
*/
public synchronized void deleteFile(Reference<?> ref, String fileName) {
if (ref != null) {
String f2 = refMap.remove(ref);
if (f2 != null) {
if (SysProperties.CHECK) {
if (fileName != null && !f2.equals(fileName)) {
DbException.throwInternalError("f2:" + f2 + " f:" + fileName);
}
}
fileName = f2;
}
}
if (fileName != null && FileUtils.exists(fileName)) {
try {
IOUtils.trace("TempFileDeleter.deleteFile", fileName, null);
FileUtils.tryDelete(fileName);
} catch (Exception e) {
// TODO log such errors?
}
}
}
示例2: isEverything
import org.h2.message.DbException; //导入方法依赖的package包/类
@Override
public boolean isEverything(ExpressionVisitor visitor) {
switch(visitor.getType()) {
case ExpressionVisitor.EVALUATABLE:
case ExpressionVisitor.OPTIMIZABLE_MIN_MAX_COUNT_ALL:
case ExpressionVisitor.NOT_FROM_RESOLVER:
case ExpressionVisitor.GET_COLUMNS:
return true;
case ExpressionVisitor.DETERMINISTIC:
case ExpressionVisitor.READONLY:
case ExpressionVisitor.INDEPENDENT:
case ExpressionVisitor.QUERY_COMPARABLE:
return false;
case ExpressionVisitor.SET_MAX_DATA_MODIFICATION_ID:
visitor.addDataModificationId(sequence.getModificationId());
return true;
case ExpressionVisitor.GET_DEPENDENCIES:
visitor.addDependency(sequence);
return true;
default:
throw DbException.throwInternalError("type="+visitor.getType());
}
}
示例3: getCompareOperator
import org.h2.message.DbException; //导入方法依赖的package包/类
/**
* Get the comparison operator string ("=", ">",...).
*
* @param compareType the compare type
* @return the string
*/
static String getCompareOperator(int compareType) {
switch (compareType) {
case EQUAL:
return "=";
case EQUAL_NULL_SAFE:
return "IS";
case BIGGER_EQUAL:
return ">=";
case BIGGER:
return ">";
case SMALLER_EQUAL:
return "<=";
case SMALLER:
return "<";
case NOT_EQUAL:
return "<>";
case NOT_EQUAL_NULL_SAFE:
return "IS NOT";
case SPATIAL_INTERSECTS:
return "&&";
default:
throw DbException.throwInternalError("compareType=" + compareType);
}
}
示例4: rebuildIndexBuffered
import org.h2.message.DbException; //导入方法依赖的package包/类
private void rebuildIndexBuffered(Session session, Index index) {
Index scan = getScanIndex(session);
long remaining = scan.getRowCount(session);
long total = remaining;
Cursor cursor = scan.find(session, null, null);
long i = 0;
int bufferSize = (int) Math.min(total, database.getMaxMemoryRows());
ArrayList<Row> buffer = New.arrayList(bufferSize);
String n = getName() + ":" + index.getName();
int t = MathUtils.convertLongToInt(total);
while (cursor.next()) {
Row row = cursor.get();
buffer.add(row);
database.setProgress(DatabaseEventListener.STATE_CREATE_INDEX, n,
MathUtils.convertLongToInt(i++), t);
if (buffer.size() >= bufferSize) {
addRowsToIndex(session, buffer, index);
}
remaining--;
}
addRowsToIndex(session, buffer, index);
if (SysProperties.CHECK && remaining != 0) {
DbException.throwInternalError("rowcount remaining=" + remaining +
" " + getName());
}
}
示例5: PageDelegateIndex
import org.h2.message.DbException; //导入方法依赖的package包/类
public PageDelegateIndex(RegularTable table, int id, String name,
IndexType indexType, PageDataIndex mainIndex, boolean create,
Session session) {
IndexColumn[] cols = IndexColumn.wrap(
new Column[] { table.getColumn(mainIndex.getMainIndexColumn())});
this.initBaseIndex(table, id, name, cols, indexType);
this.mainIndex = mainIndex;
if (!database.isPersistent() || id < 0) {
throw DbException.throwInternalError("" + name);
}
PageStore store = database.getPageStore();
store.addIndex(this);
if (create) {
store.addMeta(this, session);
}
}
示例6: isEverything
import org.h2.message.DbException; //导入方法依赖的package包/类
@Override
public boolean isEverything(ExpressionVisitor visitor) {
switch (visitor.getType()) {
case ExpressionVisitor.OPTIMIZABLE_MIN_MAX_COUNT_ALL:
case ExpressionVisitor.DETERMINISTIC:
case ExpressionVisitor.READONLY:
case ExpressionVisitor.INDEPENDENT:
case ExpressionVisitor.EVALUATABLE:
case ExpressionVisitor.SET_MAX_DATA_MODIFICATION_ID:
case ExpressionVisitor.NOT_FROM_RESOLVER:
case ExpressionVisitor.GET_DEPENDENCIES:
case ExpressionVisitor.QUERY_COMPARABLE:
case ExpressionVisitor.GET_COLUMNS:
return true;
default:
throw DbException.throwInternalError("type=" + visitor.getType());
}
}
示例7: renameDatabaseObject
import org.h2.message.DbException; //导入方法依赖的package包/类
/**
* Rename a database object.
*
* @param session the session
* @param obj the object
* @param newName the new name
*/
public synchronized void renameDatabaseObject(Session session,
DbObject obj, String newName) {
checkWritingAllowed();
int type = obj.getType();
HashMap<String, DbObject> map = getMap(type);
if (SysProperties.CHECK) {
if (!map.containsKey(obj.getName())) {
DbException.throwInternalError("not found: " + obj.getName());
}
if (obj.getName().equals(newName) || map.containsKey(newName)) {
DbException.throwInternalError("object already exists: " + newName);
}
}
obj.checkRename();
int id = obj.getId();
lockMeta(session);
removeMeta(session, id);
map.remove(obj.getName());
obj.rename(newName);
map.put(newName, obj);
updateMetaAndFirstLevelChildren(session, obj);
}
示例8: getConstraintTypeOrder
import org.h2.message.DbException; //导入方法依赖的package包/类
private int getConstraintTypeOrder() {
String constraintType = getConstraintType();
if (CHECK.equals(constraintType)) {
return 0;
} else if (PRIMARY_KEY.equals(constraintType)) {
return 1;
} else if (UNIQUE.equals(constraintType)) {
return 2;
} else if (REFERENTIAL.equals(constraintType)) {
return 3;
} else {
throw DbException.throwInternalError("type: " + constraintType);
}
}
示例9: getSQL
import org.h2.message.DbException; //导入方法依赖的package包/类
@Override
public String getSQL() {
String sql;
switch (andOrType) {
case AND:
sql = left.getSQL() + "\n AND " + right.getSQL();
break;
case OR:
sql = left.getSQL() + "\n OR " + right.getSQL();
break;
default:
throw DbException.throwInternalError("andOrType=" + andOrType);
}
return "(" + sql + ")";
}
示例10: findFirstOrLast
import org.h2.message.DbException; //导入方法依赖的package包/类
@Override
public Cursor findFirstOrLast(Session session, boolean first) {
if (closed) {
throw DbException.throwInternalError();
}
if (!first) {
throw DbException.throwInternalError(
"Spatial Index can only be fetch by ascending order");
}
return find(session);
}
示例11: getRefAction
import org.h2.message.DbException; //导入方法依赖的package包/类
private static int getRefAction(int action) {
switch(action) {
case ConstraintReferential.CASCADE:
return DatabaseMetaData.importedKeyCascade;
case ConstraintReferential.RESTRICT:
return DatabaseMetaData.importedKeyRestrict;
case ConstraintReferential.SET_DEFAULT:
return DatabaseMetaData.importedKeySetDefault;
case ConstraintReferential.SET_NULL:
return DatabaseMetaData.importedKeySetNull;
default:
throw DbException.throwInternalError("action="+action);
}
}
示例12: prepare
import org.h2.message.DbException; //导入方法依赖的package包/类
/**
* Prepare reading rows. This method will remove all index conditions that
* can not be used, and optimize the conditions.
*/
public void prepare() {
// forget all unused index conditions
// the indexConditions list may be modified here
for (int i = 0; i < indexConditions.size(); i++) {
IndexCondition condition = indexConditions.get(i);
if (!condition.isAlwaysFalse()) {
Column col = condition.getColumn();
if (col.getColumnId() >= 0) {
if (index.getColumnIndex(col) < 0) {
indexConditions.remove(i);
i--;
}
}
}
}
if (nestedJoin != null) {
if (SysProperties.CHECK && nestedJoin == this) {
DbException.throwInternalError("self join");
}
nestedJoin.prepare();
}
if (join != null) {
if (SysProperties.CHECK && join == this) {
DbException.throwInternalError("self join");
}
join.prepare();
}
if (filterCondition != null) {
filterCondition = filterCondition.optimize(session);
}
if (joinCondition != null) {
joinCondition = joinCondition.optimize(session);
}
}
示例13: remove
import org.h2.message.DbException; //导入方法依赖的package包/类
@Override
public boolean remove(int pos) {
int index = pos & mask;
CacheObject rec = values[index];
if (rec == null) {
return false;
}
if (rec.getPos() == pos) {
values[index] = rec.cacheChained;
} else {
CacheObject last;
do {
last = rec;
rec = rec.cacheChained;
if (rec == null) {
return false;
}
} while (rec.getPos() != pos);
last.cacheChained = rec.cacheChained;
}
recordCount--;
memory -= rec.getMemory();
removeFromLinkedList(rec);
if (SysProperties.CHECK) {
rec.cacheChained = null;
CacheObject o = find(pos);
if (o != null) {
DbException.throwInternalError("not removed: " + o);
}
}
return true;
}
示例14: getProperty
import org.h2.message.DbException; //导入方法依赖的package包/类
/**
* Get the value of the given property.
*
* @param key the property key
* @param defaultValue the default value
* @return the value as a String
*/
int getProperty(String key, int defaultValue) {
if (SysProperties.CHECK && !isKnownSetting(key)) {
DbException.throwInternalError(key);
}
String s = getProperty(key);
return s == null ? defaultValue : Integer.parseInt(s);
}
示例15: reuse
import org.h2.message.DbException; //导入方法依赖的package包/类
/**
* Allow to re-use the prepared statement.
*
* @param sql the SQL statement
* @param prep the prepared statement
*/
void reuse(String sql, PreparedStatement prep) {
if (SysProperties.CHECK2) {
if (!Thread.holdsLock(database)) {
throw DbException.throwInternalError();
}
}
prepared.put(sql, prep);
}