Index

dkXDOBase (Extended Data Object Base)

Purpose:

dkXDOBase is an abstract class (a subclass of dkDataObjectBase) that represents a data value, ranging from a simple UDT (User Defined Type) to a complex LOB (Large Object). dkXDOBase provides a set of methods specifically used to communicate with dkDatastore objects. You should subclass from dkXDOBase and provide methods that correspond to their specific UDT or LOB behaviors.

Heirarchy:

dkDataObjectBase
 dkXDOBase

Class summary:

 class dkXDOBase : public dkDataObjectBase
 {
  public:
     virtual dkXDOBase();
     virtual void      setNull() = 0;
     virtual DKBoolean isNull() const = 0;
     virtual void  open();
     virtual void  open(const char* afileName);
     virtual dkDataObjectBase& operator= (const dkDataObjectBase& adkXDOBase);
virtual dkDataObjectBase& operator= (const dkDataObjectBase& adkXDOBase);
     virtual dkXDOBase& operator= (const dkXDOBase& aXDOBase);
     virtual DKBoolean  operator== (const dkXDOBase& aXDOBase) 
                                                 const = 0;
     virtual DKBoolean  operator!= (const dkXDOBase& aXDOBase) 
                                           const = 0;
     virtual short      protocol() const;
     virtual void       setInstanceOpenHandler(const char* ahandler,
DKBoolean newSynchronousFlag);
     virtual void       setClassOpenHandler(const char* ahandler,
DKBoolean newSynchronousFlag);
     virtual DKString   getOpenHandler();
     virtual DKBoolean  isOpenSynchronous();
 };

When defining a subclass, you should override the appropriate get/setValue() to match the corresponding type of the UDT or LOB in the datastore. For example, for a Date UDT with the database type of DB2 CHAR, you should override the get/setValueString() method. In addition, you should also override the deletingValue() method, if the object requires some clean-up procedures when the corresponding row is deleted. This method will be called by the datastore object before deleting the row in the database.

The methods protocol() and getObjectType() also need to be redefined in the subclass to return the appropriate value. Currently, XDO classes support two protocols:

DK_CM_XDO:
the XDO protocol. XDO classes which implement this protocol know how to store their contents in and out of a datastore; that is, they implement Add/Retrieve/Update/Delete methods. All subclasses of dkXDO implement this protocol.

Members:

Member functions

setNull
Set this object's value to null.
virtual void setNull();

isNull
Returns TRUE if this object's value is null.
virtual DKBoolean isNull() const;

open
This is a generic method to tell the object to perform a specific action to 'show' itself. For a LOB, the action may involves invoking a browser to show the object on the screen. The operation performed is implementation-dependent.
virtual void open();

Note:
DKUsageError exception thrown if method is not implemented.

open
The open(const char* afileName) will unload the content of the object to a file afileName provided by the application, then invokes a default handler against the file. Note: Not all handlers work the same for this operation. For example, the Microsoft Internet Explorer(TM) needs a full path name and the correct file extension to function correctly here.
virtual void open(const char* afileName);

protocol
Returns the protocol supported by this object, in this case DK_CM_XDO.
virtual short protocol() const;

setInstanceOpenHandler
Sets the executable handler program name, and whether this handler should be invoked synchronously or asynchronously for this object instance. The handler name must be accessible from the client application. An example of a blob handler is xv on AIX or ib.exe on OS/2. The synchronous flag is either DK_CM_SYNCHRONOUS or DK_CM_ASYNCHRONOUS.
virtual void setInstanceOpenHandler(const char* ahandler, DKBoolean newSynchronousFlag);

setClassOpenHandler
Sets the executable handler program name for the whole class instead of for this instance only.
virtual void setClassOpenHandler(const char* ahandler, DKBoolean newSynchronousFlag);

getOpenHandler
Returns the currently active handler program name for this object. It could be either class handler or instance handler.
virtual DKString  getOpenHandler();

isOpenSynchronous
Returns the current synchronization property TRUE or FALSE for this handler.
virtual DKBoolean isOpenSynchronous();

Exceptions:

DKXDOError

This exception is thrown if the get/setValue function is not overridden in the subclass.

(c) Copyright International Business Machines Corporation 1996, 2003. IBM Corp. All rights reserved.