当前位置: 首页>>代码示例>>Java>>正文


Java DbException.get方法代码示例

本文整理汇总了Java中org.h2.message.DbException.get方法的典型用法代码示例。如果您正苦于以下问题:Java DbException.get方法的具体用法?Java DbException.get怎么用?Java DbException.get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.h2.message.DbException的用法示例。


在下文中一共展示了DbException.get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: init

import org.h2.message.DbException; //导入方法依赖的package包/类
@Override
public void init() {
    if (SysProperties.CHECK && checkInit) {
        DbException.throwInternalError();
    }
    checkInit = true;
    left.init();
    right.init();
    int len = left.getColumnCount();
    if (len != right.getColumnCount()) {
        throw DbException.get(ErrorCode.COLUMN_COUNT_DOES_NOT_MATCH);
    }
    ArrayList<Expression> le = left.getExpressions();
    // set the expressions to get the right column count and names,
    // but can't validate at this time
    expressions = New.arrayList();
    for (int i = 0; i < len; i++) {
        Expression l = le.get(i);
        expressions.add(l);
    }
}
 
开发者ID:vdr007,项目名称:ThriftyPaxos,代码行数:22,代码来源:SelectUnion.java

示例2: remove

import org.h2.message.DbException; //导入方法依赖的package包/类
@Override
SearchRow remove(SearchRow row) {
    int at = find(row, false, false, true);
    SearchRow delete = getRow(at);
    if (index.compareRows(row, delete) != 0 || delete.getKey() != row.getKey()) {
        throw DbException.get(ErrorCode.ROW_NOT_FOUND_WHEN_DELETING_1,
                index.getSQL() + ": " + row);
    }
    index.getPageStore().logUndo(this, data);
    if (entryCount == 1) {
        // the page is now empty
        return row;
    }
    removeRow(at);
    memoryChange();
    index.getPageStore().update(this);
    if (at == entryCount) {
        // the last row changed
        return getRow(at - 1);
    }
    // the last row didn't change
    return null;
}
 
开发者ID:vdr007,项目名称:ThriftyPaxos,代码行数:24,代码来源:PageBtreeLeaf.java

示例3: setPageSize

import org.h2.message.DbException; //导入方法依赖的package包/类
/**
 * Set the page size. The size must be a power of two. This method must be
 * called before opening.
 *
 * @param size the page size
 */
public void setPageSize(int size) {
    if (size < PAGE_SIZE_MIN || size > PAGE_SIZE_MAX) {
        throw DbException.get(ErrorCode.FILE_CORRUPTED_1,
                fileName + " pageSize: " + size);
    }
    boolean good = false;
    int shift = 0;
    for (int i = 1; i <= size;) {
        if (size == i) {
            good = true;
            break;
        }
        shift++;
        i += i;
    }
    if (!good) {
        throw DbException.get(ErrorCode.FILE_CORRUPTED_1, fileName);
    }
    pageSize = size;
    emptyPage = createData();
    pageSizeShift = shift;
}
 
开发者ID:vdr007,项目名称:ThriftyPaxos,代码行数:29,代码来源:PageStore.java

示例4: parseCreateFunctionAlias

import org.h2.message.DbException; //导入方法依赖的package包/类
private CreateFunctionAlias parseCreateFunctionAlias(boolean force) {
    boolean ifNotExists = readIfNoExists();
    String aliasName = readIdentifierWithSchema();
    if (isKeyword(aliasName) ||
            Function.getFunction(database, aliasName) != null ||
            getAggregateType(aliasName) >= 0) {
        throw DbException.get(ErrorCode.FUNCTION_ALIAS_ALREADY_EXISTS_1,
                aliasName);
    }
    CreateFunctionAlias command = new CreateFunctionAlias(session,
            getSchema());
    command.setForce(force);
    command.setAliasName(aliasName);
    command.setIfNotExists(ifNotExists);
    command.setDeterministic(readIf("DETERMINISTIC"));
    command.setBufferResultSetToLocalTemp(!readIf("NOBUFFER"));
    if (readIf("AS")) {
        command.setSource(readString());
    } else {
        read("FOR");
        command.setJavaClassMethod(readUniqueIdentifier());
    }
    return command;
}
 
开发者ID:vdr007,项目名称:ThriftyPaxos,代码行数:25,代码来源:Parser.java

示例5: hexToRaw

import org.h2.message.DbException; //导入方法依赖的package包/类
private static String hexToRaw(String s) {
    // TODO function hextoraw compatibility with oracle
    int len = s.length();
    if (len % 4 != 0) {
        throw DbException.get(ErrorCode.DATA_CONVERSION_ERROR_1, s);
    }
    StringBuilder buff = new StringBuilder(len / 4);
    for (int i = 0; i < len; i += 4) {
        try {
            char raw = (char) Integer.parseInt(s.substring(i, i + 4), 16);
            buff.append(raw);
        } catch (NumberFormatException e) {
            throw DbException.get(ErrorCode.DATA_CONVERSION_ERROR_1, s);
        }
    }
    return buff.toString();
}
 
开发者ID:vdr007,项目名称:ThriftyPaxos,代码行数:18,代码来源:Function.java

示例6: checkExistingData

import org.h2.message.DbException; //导入方法依赖的package包/类
@Override
public void checkExistingData(Session session) {
    if (session.getDatabase().isStarting()) {
        // don't check at startup
        return;
    }
    String sql = "SELECT 1 FROM " + filter.getTable().getSQL() +
            " WHERE NOT(" + expr.getSQL() + ")";
    ResultInterface r = session.prepare(sql).query(1);
    if (r.next()) {
        throw DbException.get(ErrorCode.CHECK_CONSTRAINT_VIOLATED_1, getName());
    }
}
 
开发者ID:vdr007,项目名称:ThriftyPaxos,代码行数:14,代码来源:ConstraintCheck.java

示例7: checkClosed

import org.h2.message.DbException; //导入方法依赖的package包/类
/**
 * INTERNAL.
 * Check if this connection is closed.
 *
 * @param write if the next operation is possibly writing
 * @throws DbException if the connection or session is closed
 */
protected void checkClosed(boolean write) {
    if (session == null) {
        throw DbException.get(ErrorCode.OBJECT_CLOSED);
    }
    if (session.isClosed()) {
        throw DbException.get(ErrorCode.DATABASE_CALLED_AT_SHUTDOWN);
    }
    if (session.isReconnectNeeded(write)) {
        trace.debug("reconnect");
        closePreparedCommands();
        session = session.reconnect(write);
        trace = session.getTrace();
    }
}
 
开发者ID:vdr007,项目名称:ThriftyPaxos,代码行数:22,代码来源:JdbcConnection.java

示例8: remove

import org.h2.message.DbException; //导入方法依赖的package包/类
@Override
public void remove(Session session, Row row) {
    // in-memory
    if (!database.isMultiVersion() && rowCount == 1) {
        rows = New.arrayList();
        firstFree = -1;
    } else {
        Row free = new Row(null, 1);
        free.setKey(firstFree);
        long key = row.getKey();
        if (rows.size() <= key) {
            throw DbException.get(ErrorCode.ROW_NOT_FOUND_WHEN_DELETING_1,
                    rows.size() + ": " + key);
        }
        rows.set((int) key, free);
        firstFree = key;
    }
    if (database.isMultiVersion()) {
        // if storage is null, the delete flag is not yet set
        row.setDeleted(true);
        if (delta == null) {
            delta = New.hashSet();
        }
        boolean wasAdded = delta.remove(row);
        if (!wasAdded) {
            delta.add(row);
        }
        incrementRowCount(session.getId(), -1);
    }
    rowCount--;
}
 
开发者ID:vdr007,项目名称:ThriftyPaxos,代码行数:32,代码来源:ScanIndex.java

示例9: addLocalTempTableConstraint

import org.h2.message.DbException; //导入方法依赖的package包/类
/**
 * Add a local temporary constraint to this session.
 *
 * @param constraint the constraint to add
 * @throws DbException if a constraint with the same name already exists
 */
public void addLocalTempTableConstraint(Constraint constraint) {
    if (localTempTableConstraints == null) {
        localTempTableConstraints = database.newStringMap();
    }
    String name = constraint.getName();
    if (localTempTableConstraints.get(name) != null) {
        throw DbException.get(ErrorCode.CONSTRAINT_ALREADY_EXISTS_1,
                constraint.getSQL());
    }
    localTempTableConstraints.put(name, constraint);
}
 
开发者ID:vdr007,项目名称:ThriftyPaxos,代码行数:18,代码来源:Session.java

示例10: checkRange

import org.h2.message.DbException; //导入方法依赖的package包/类
private static ValueShort checkRange(int x) {
    if (x < Short.MIN_VALUE || x > Short.MAX_VALUE) {
        throw DbException.get(ErrorCode.NUMERIC_VALUE_OUT_OF_RANGE_1,
                Integer.toString(x));
    }
    return ValueShort.get((short) x);
}
 
开发者ID:vdr007,项目名称:ThriftyPaxos,代码行数:8,代码来源:ValueShort.java

示例11: update

import org.h2.message.DbException; //导入方法依赖的package包/类
@Override
public int update() {
    session.getUser().checkAdmin();
    session.commit(true);
    Database db = session.getDatabase();
    FunctionAlias functionAlias = getSchema().findFunction(aliasName);
    if (functionAlias == null) {
        if (!ifExists) {
            throw DbException.get(ErrorCode.FUNCTION_ALIAS_NOT_FOUND_1, aliasName);
        }
    } else {
        db.removeSchemaObject(session, functionAlias);
    }
    return 0;
}
 
开发者ID:vdr007,项目名称:ThriftyPaxos,代码行数:16,代码来源:DropFunctionAlias.java

示例12: executeUpdate

import org.h2.message.DbException; //导入方法依赖的package包/类
/**
 * Calling this method is not legal on a PreparedStatement.
 *
 * @param sql ignored
 * @param columnNames ignored
 * @throws SQLException Unsupported Feature
 */
@Override
public int executeUpdate(String sql, String[] columnNames)
        throws SQLException {
    try {
        debugCode("executeUpdate(" + quote(sql) + ", " +
                quoteArray(columnNames) + ");");
        throw DbException.get(
                ErrorCode.METHOD_NOT_ALLOWED_FOR_PREPARED_STATEMENT);
    } catch (Exception e) {
        throw logAndConvert(e);
    }
}
 
开发者ID:vdr007,项目名称:ThriftyPaxos,代码行数:20,代码来源:JdbcPreparedStatement.java

示例13: remove

import org.h2.message.DbException; //导入方法依赖的package包/类
@Override
public void remove(Session session, Row row) {
    ValueArray array = convertToKey(row);
    TransactionMap<Value, Value> map = getMap(session);
    try {
        Value old = map.remove(array);
        if (old == null) {
            throw DbException.get(ErrorCode.ROW_NOT_FOUND_WHEN_DELETING_1,
                    getSQL() + ": " + row.getKey());
        }
    } catch (IllegalStateException e) {
        throw DbException.get(ErrorCode.CONCURRENT_UPDATE_1,
                e, table.getName());
    }
}
 
开发者ID:vdr007,项目名称:ThriftyPaxos,代码行数:16,代码来源:MVSecondaryIndex.java

示例14: checkLiterals

import org.h2.message.DbException; //导入方法依赖的package包/类
private void checkLiterals(boolean text) {
    if (!session.getAllowLiterals()) {
        int allowed = database.getAllowLiterals();
        if (allowed == Constants.ALLOW_LITERALS_NONE ||
                (text && allowed != Constants.ALLOW_LITERALS_ALL)) {
            throw DbException.get(ErrorCode.LITERALS_ARE_NOT_ALLOWED);
        }
    }
}
 
开发者ID:vdr007,项目名称:ThriftyPaxos,代码行数:10,代码来源:Parser.java

示例15: readSequence

import org.h2.message.DbException; //导入方法依赖的package包/类
private Sequence readSequence() {
    // same algorithm as readTableOrView
    String sequenceName = readIdentifierWithSchema(null);
    if (schemaName != null) {
        return getSchema().getSequence(sequenceName);
    }
    Sequence sequence = findSequence(session.getCurrentSchemaName(),
            sequenceName);
    if (sequence != null) {
        return sequence;
    }
    throw DbException.get(ErrorCode.SEQUENCE_NOT_FOUND_1, sequenceName);
}
 
开发者ID:vdr007,项目名称:ThriftyPaxos,代码行数:14,代码来源:Parser.java


注:本文中的org.h2.message.DbException.get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。