From 780b92ada9afcf1d58085a83a0b9e6bc982203d1 Mon Sep 17 00:00:00 2001 From: Lorry Tar Creator Date: Tue, 17 Feb 2015 17:25:57 +0000 Subject: Imported from /home/lorry/working-area/delta_berkeleydb/db-6.1.23.tar.gz. --- docs/api_reference/C/blob.html | 210 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 210 insertions(+) create mode 100644 docs/api_reference/C/blob.html (limited to 'docs/api_reference/C/blob.html') diff --git a/docs/api_reference/C/blob.html b/docs/api_reference/C/blob.html new file mode 100644 index 00000000..8c4f2370 --- /dev/null +++ b/docs/api_reference/C/blob.html @@ -0,0 +1,210 @@ + + + + + + Chapter 13.  Binary Large Objects + + + + + + + + + +
+
+
+
+

Chapter 13.  + Binary Large Objects +

+
+
+
+

+ Binary Large Objects (BLOB) support is designed for efficient + storage of large objects. An object is considered to be large + if it is more than a third of the size of a page. Without BLOB + support, large objects must be broken up into smaller pieces, + and then reassembled and/or disassembled every time the record + is read or updated. Berkeley DB BLOB support avoids this + assembly/disassembly process by storing the large object in a + special directory set aside for the purpose. The data itself + is not kept in the database, nor is it placed into the + in-memory cache. +

+

+ BLOBs can only be stored using the data portion of a key/data + pair. They are supported only for Btree, Hash, and Heap + databases, and only so long as the database is not configured + for checksums, encryption, duplicate records, or duplicate + sorted records. In addition, the DBT that you use to + access the BLOB data cannot be configured as a partial + DBT if you want to access the data using the BLOB's + streaming interface (introduced below). +

+

+ Note that if the environment is transactionally-protected, then + all access to the BLOB is also transactionally protected. +

+

+ BLOBs are not supported for environments configured for + replication. Nor can BLOBs be used with in-memory-only + databases. +

+

+ In order to use Berkeley DB's BLOB support, you must set the + BLOB threshold to a non-zero positive value. (The default value + is 0, which means that BLOBs are not + enabled). You set the BLOB threshold using either + DB->set_blob_threshold() or DB_ENV->set_blob_threshold(). +

+

+ Once BLOBs are enabled, there are two ways to create a BLOB record: +

+
+
    +
  • +

    + Configure the DBT used to access the BLOB data + (that is, the DBT used for the data portion of + the record) with the + DB_DBT_BLOB + flag. This causes the data to be stored as a BLOB + regardless of its size, so long as the database + otherwise supports BLOBs. +

    +
  • +
  • +

    + Alternatively, creating a data item with a size greater + than the BLOB threshold will cause that data item to be + stored as a BLOB. Of course, for this method to work, + the BLOB threshold must be greater than + 0. +

    +
  • +
+
+

+ BLOBs may be accessed in the same way as other DBT + data, so long as the data itself will fit into memory. More + likely, you will find it necessary to use the BLOB streaming + API to read and write BLOB data. You open a BLOB stream using + the DBC->db_stream() method, close it with the DB_STREAM->close() + method, write to it using the the DB_STREAM->write() method, and + read it using the DB_STREAM->read() method. +

+
+
+
+
+

BLOBs and Related Methods

+
+
+
+ +
+
+ + + -- cgit v1.2.1