Rogue Wave banner
Previous fileTop of DocumentContentsIndex pageNext file
DB Interface Module Reference Guide
Rogue Wave web site:  Home Page  |  Main Documentation Page

RWDBBlob

Module:  DB Interface Module   Group:  Data Type Classes


RWDBBlob RWCollectable

Local Index

Members

Synopsis

#include <rw/db/blob.h>

RWDBBlob b;          // default; zero capacity and length
RWDBBlob b(2048);
RWDBBlob b((void*)&myGif.data(),myGif.size());

Description

Most database vendors supply one or more data types that can store binary data of any length. These data types are commonly known as Binary Large Objects, or Blobs. The DB Interface Module stores data of these types as RWDBBlob. Class RWDBBlob provides storage and rudimentary access to the binary data. Applications may want to derive from RWDBBlob to add semantics to the data.

This class is implemented using a technique called copy on write. With this technique, the copy constructor and assignment operators still reference the old object and hence are very fast. An actual copy is made only when a write is performed, that is, if the object is about to be changed. The net result is excellent performance, but with easy-to-understand value semantics.

The member function putBytes() is used to populate an RWDBBlob. This method is safe and robust, but can be inconvenient in cases where large objects have already been loaded into memory. The constructor RWDBBlob(void* data, size_t length) is provided to allow applications to wrap existing data blocks in an RWDBBlob interface. Blobs built with this constructor do not manage the memory addressed by the data pointer; your application continues to be responsible for it.

RWDBBlob inherits from class RWCollectable. The virtual functions of the base class RWCollectable have been redefined.

Public Constructors

RWDBBlob();
RWDBBlob(size_t size);
RWDBBlob(void* data, size_t length);
RWDBBlob(const RWDBBlob& blob);

Public Member Operator

virtual RWDBBlob&
operator=(const RWDBBlob& blob);

Public Member Functions

void
acquire() const;
virtual RWspace
binaryStoreSize()const;
size_t
capacity()const;
void
clear(size_t size=0);
virtual int
compareTo(const RWCollectable* c) const; 
unsigned char*
data() const;
void
getBytes(void* buffer, size_t size, 
         size_t offset = 0) const; 
virtual unsigned
hash()const;
virtual RWClassID
isA()const;
virtual bool
isEqual(const RWCollectable* c) const;
size_t
length() const;
void
putBytes(const void* buffer, size_t size, size_t offset = 0
         size_t resize = 256);
void
release() const;
virtual void
restoreGuts(RWFile& file) const;
virtual void
restoreGuts(RWvistream& stream) const;
virtual void
saveGuts(RWFile& file) const;
virtual void
saveGuts(RWvostream& stream) const;


Previous fileTop of DocumentContentsIndex pageNext file

© Copyright Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave and SourcePro are registered trademarks of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.