Package com.sleepycat.db

Examples of com.sleepycat.db.DatabaseEntry


            if (entityBinding == null) {
                throw new IllegalStateException(
                    "EntityBinding required to derive key from value");
            }
            if (!dupsView && isSecondary()) {
                DatabaseEntry primaryKeyThang = new DatabaseEntry();
                entityBinding.objectToKey(value, primaryKeyThang);
                DatabaseEntry valueThang = new DatabaseEntry();
                entityBinding.objectToData(value, valueThang);
                secKeyCreator.createSecondaryKey(secDb, primaryKeyThang,
                                                 valueThang, keyThang);
            } else {
                entityBinding.objectToKey(value, keyThang);
View Full Code Here


            if (valueBinding != null) {
                valueBinding.objectToEntry(value, valueThang);
            } else if (entityBinding != null) {
                entityBinding.objectToData(value, valueThang);
                if (checkKeyThang != null) {
                    DatabaseEntry thang = new DatabaseEntry();
                    entityBinding.objectToKey(value, thang);
                    if (!KeyRange.equalBytes(thang, checkKeyThang)) {
                        throw new IllegalArgumentException(
                            "cannot change primary key");
                    }
View Full Code Here

    Object makeKey(DatabaseEntry keyThang, DatabaseEntry priKeyThang) {

        if (keyBinding == null) {
            throw new UnsupportedOperationException();
        } else {
            DatabaseEntry thang = dupsView ? priKeyThang : keyThang;
            if (thang.getSize() == 0) {
                return null;
            } else {
                return keyBinding.entryToObject(thang);
            }
        }
View Full Code Here

        }
        if (!ordered) {
            throw new UnsupportedOperationException(
                    "Cannot use key ranges on an unsorted database");
        }
        DatabaseEntry beginThang =
            (beginKey != null) ? makeRangeKey(beginKey) : null;
        DatabaseEntry endThang =
            (endKey != null) ? makeRangeKey(endKey) : null;

        return useRange.subRange(beginThang, beginInclusive,
                                 endThang, endInclusive);
    }
View Full Code Here

     * Given a key object, make a key entry that can be used in a range.
     */
    private DatabaseEntry makeRangeKey(Object key)
        throws DatabaseException {

        DatabaseEntry thang = new DatabaseEntry();
        if (keyBinding != null) {
            useKey(key, null, thang, null);
        } else {
            useKey(null, key, thang, null);
        }
View Full Code Here

        Dbc cursor = null;
        List list = new ArrayList();

        try {
            try {
                DatabaseEntry key = new DatabaseEntry(new byte[0]);
                DatabaseEntry data = new DatabaseEntry((byte[]) null);

                data.setPartial(true);

                cursor = files.cursor(txn, flags);

                if (cursor.get(key, data,
                               DbConstants.DB_SET_RANGE | flags) != DbConstants.DB_NOTFOUND)
View Full Code Here

    protected Block(File file)
        throws IOException
    {
        byte[] fileKey = file.getKey();

        key = new DatabaseEntry(new byte[fileKey.length + 8]);
        key.setUserBuffer(fileKey.length + 8, true);

        data = new DatabaseEntry(new byte[DbIndexOutput.BLOCK_LEN]);
        data.setUserBuffer(data.getSize(), true);

        System.arraycopy(fileKey, 0, key.getData(), 0, fileKey.length);
        seek(0L);
    }
View Full Code Here

    protected File(String name)
        throws IOException
    {
        setName(name);

        data = new DatabaseEntry(new byte[32]);
        data.setUserBuffer(data.getSize(), true);
    }
View Full Code Here

        {
            if (!create)
                throw new IOException("File does not exist: " + name);
            else
            {
                DatabaseEntry key = new DatabaseEntry(new byte[24]);
                DatabaseEntry data = new DatabaseEntry((byte[]) null);
                Db blocks = directory.blocks;
                DbTxn txn = directory.txn;
                int flags = directory.flags;

                key.setUserBuffer(24, true);
                data.setPartial(true);

                uuid = new byte[16];

                try {
                    do {
View Full Code Here

        DataOutputStream out = new DataOutputStream(buffer);

        out.writeUTF(name);
        out.close();

        key = new DatabaseEntry(buffer.toByteArray());
        key.setUserBuffer(key.getSize(), true);

        this.name = name;
    }
View Full Code Here

TOP

Related Classes of com.sleepycat.db.DatabaseEntry

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.