Package com.sleepycat.db

Examples of com.sleepycat.db.DbException


                    if (oldValues != null) {
                        oldValues.add(cursor.getCurrentValue());
                    }
                    err = cursor.delete();
                    if (err != 0)
                        throw new DbException(
                            "Unexpected error on delete", err);
                }
            }
        } finally {
            if (cursor != null) {
View Full Code Here


                    } else {
                        err = db.get(cursor, key, data,
                                     (pos == Db.DB_NEXT_NODUP)
                                     ? Db.DB_PREV_NODUP : Db.DB_PREV);
                        if (err != 0) {
                            throw new DbException("Range internal error", err);
                        }
                        err = Db.DB_NOTFOUND;
                    }
                }
            }
        } else if (pos == Db.DB_LAST || pos == Db.DB_PREV ||
                   pos == Db.DB_PREV_NODUP) {
            if (wasInvalid) pos = Db.DB_LAST;

            if (isSingleKey) {
                if (pos == Db.DB_PREV_NODUP) {
                    err = Db.DB_NOTFOUND;
                } else if (endKey == null) {
                    // create end key now for use in PREV processing below
                    endKey = new DataThang(beginKey);
                    endKey.increment();
                }
            }

            if (err != 0) {
            } else if (endKey == null) {
                err = db.get(cursor, key, data, pos | extraFlags);
            } else {
                if (pos == Db.DB_LAST) {
                    key.copy(endKey);
                    err = db.get(cursor, key, data,
                                 Db.DB_SET_RANGE | extraFlags);
                    if (err == 0) {
                        err = db.get(cursor, key, data,
                                     ((origPos == Db.DB_PREV_NODUP)
                                      ? Db.DB_PREV_NODUP : Db.DB_PREV)
                                     | extraFlags);
                    } else {
                        err = db.get(cursor, key, data,
                                     Db.DB_LAST | extraFlags);
                    }
                } else {
                    err = db.get(cursor, key, data, pos | extraFlags);
                }
            }

            if (err == 0 && beginKey != null) {
                int compare = key.compareTo(beginKey);
                if (isSingleKey ? (compare != 0) : (compare < 0)) {
                    if (pos == Db.DB_LAST) {
                        err = setInvalid(key, data);
                    } else {
                        err = db.get(cursor, key, data,
                                     (pos == Db.DB_PREV_NODUP)
                                     ? Db.DB_NEXT_NODUP : Db.DB_NEXT);
                        if (err != 0) {
                            throw new DbException("Range internal error", err);
                        }
                        err = Db.DB_NOTFOUND;
                    }
                }
            }
        } else if (pos == Db.DB_CONSUME) {
            err = db.get(cursor, key, data, flags);
        } else {
            throw new DbException("Unsupported flag", EINVAL);
        }

        if (err == 0) isCursorValid = true;

        return err;
View Full Code Here

    private void throwInvalid(DataThang key, DataThang data)
        throws DbException {

        setInvalid(key, data);
        throw new DbException("Cursor not initialized", EINVAL);
    }
View Full Code Here

TOP

Related Classes of com.sleepycat.db.DbException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.