Package org.lealone.value

Examples of org.lealone.value.ValueLobDb


                    // zero length
                    small = new byte[0];
                }
                if (small != null) {
                    // CLOB: the precision will be fixed later
                    ValueLobDb v = ValueLobDb.createSmallLob(type, small, small.length);
                    return v;
                }
                return registerLob(type, lobId, TABLE_TEMP, length);
            } catch (IOException e) {
                if (lobId != -1) {
View Full Code Here


                prep.setLong(1, lobId);
                prep.setLong(2, byteCount);
                prep.setInt(3, tableId);
                prep.execute();
                reuse(sql, prep);
                ValueLobDb v = ValueLobDb.create(type, this, tableId, lobId, null, byteCount);
                return v;
            } catch (SQLException e) {
                throw DbException.convert(e);
            }
        }
View Full Code Here

                prep.setLong(2, tableId);
                prep.setLong(3, oldLobId);
                prep.executeUpdate();
                reuse(sql, prep);

                ValueLobDb v = ValueLobDb.create(type, this, tableId, lobId, null, length);
                return v;
            } catch (SQLException e) {
                throw DbException.convert(e);
            }
        }
View Full Code Here

                // to read a block while write something)
                return ValueLobDb.createTempClob(reader, maxLength, handler);
            }
            long max = maxLength == -1 ? Long.MAX_VALUE : maxLength;
            CountingReaderInputStream in = new CountingReaderInputStream(reader, max);
            ValueLobDb lob = addLob(in, Long.MAX_VALUE, Value.CLOB);
            lob.setPrecision(in.getLength());
            return lob;
        }
        return ValueLob.createClob(reader, maxLength, handler);
    }
View Full Code Here

                } else {
                    writeVarInt(small.length);
                    write(small, 0, small.length);
                }
            } else {
                ValueLobDb lob = (ValueLobDb) v;
                byte[] small = lob.getSmall();
                if (small == null) {
                    writeVarInt(-3);
                    writeVarInt(lob.getTableId());
                    writeVarLong(lob.getLobId());
                    writeVarLong(lob.getPrecision());
                } else {
                    writeVarInt(small.length);
                    write(small, 0, small.length);
                }
            }
View Full Code Here

            } else if (smallLen == -3) {
                int tableId = readVarInt();
                long lobId = readVarLong();
                long precision = readVarLong();
                LobStorage lobStorage = handler.getLobStorage();
                ValueLobDb lob = ValueLobDb.create(type, lobStorage, tableId, lobId, null, precision);
                return lob;
            } else {
                int tableId = readVarInt();
                int objectId = readVarInt();
                long precision = 0;
                boolean compression = false;
                // -1: regular
                // -2: regular, but not linked (in this case: including file name)
                if (smallLen == -1 || smallLen == -2) {
                    precision = readVarLong();
                    compression = readByte() == 1;
                }
                ValueLob lob = ValueLob.open(type, handler, tableId, objectId, precision, compression);
                if (smallLen == -2) {
                    lob.setFileName(readString(), false);
                }
                return lob;
            }
        }
        case Value.ARRAY: {
View Full Code Here

                } else {
                    len += getVarIntLen(small.length);
                    len += small.length;
                }
            } else {
                ValueLobDb lob = (ValueLobDb) v;
                byte[] small = lob.getSmall();
                if (small == null) {
                    len += getVarIntLen(-3);
                    len += getVarIntLen(lob.getTableId());
                    len += getVarLongLen(lob.getLobId());
                    len += getVarLongLen(lob.getPrecision());
                } else {
                    len += getVarIntLen(small.length);
                    len += small.length;
                }
            }
View Full Code Here

    }

    private void writeValue(Value v) throws IOException {
        if (v.getType() == Value.CLOB || v.getType() == Value.BLOB) {
            if (v instanceof ValueLobDb) {
                ValueLobDb lob = (ValueLobDb) v;
                if (lob.isStored()) {
                    long id = lob.getLobId();
                    lobs.put(id, new CachedInputStream(null));
                }
            }
        }
        transfer.writeValue(v);
View Full Code Here

TOP

Related Classes of org.lealone.value.ValueLobDb

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.