oasys::SQLTableFormat Class Reference

#include <SQLSerialize.h>

Inheritance diagram for oasys::SQLTableFormat:

oasys::SQLQuery oasys::SerializeAction oasys::Serialize List of all members.

Detailed Description

SQLTableFormat is a SerializeAction that builts up a SQL "CREATE TABLE" query statement based on the values in an object.

Definition at line 138 of file SQLSerialize.h.

Public Member Functions

 SQLTableFormat (const char *table_name, SQLImplementation *impl)
 Constructor.
virtual void begin_action ()
 Control the initialization done before executing an action.
virtual void end_action ()
 Control the cleanup after executing an action.
int action (const SerializableObject *const_object)
 Since table format doesn't modify the object, define a variant of action() that operates on a const SerializableObject.
void process (const char *name, SerializableObject *object)
 Process function for a contained SerializableObject.
void process (const char *name, u_int32_t *i)
 Process function for a 4 byte integer.
void process (const char *name, u_int16_t *i)
 Process function for a 2 byte integer.
void process (const char *name, u_int8_t *i)
 Process function for a byte.
void process (const char *name, bool *b)
 Process function for a boolean.
void process (const char *name, u_char *bp, size_t len)
void process (const char *name, u_char **bp, size_t *lenp, int flags)
void process (const char *name, std::string *s)
 Process function for a c++ string.

Protected Member Functions

void append (const char *name, const char *type)

Protected Attributes

StringBuffer column_prefix_


Constructor & Destructor Documentation

oasys::SQLTableFormat::SQLTableFormat ( const char *  table_name,
SQLImplementation impl 
)

Constructor.

Definition at line 288 of file SQLSerialize.cc.


Member Function Documentation

void oasys::SQLTableFormat::begin_action (  )  [virtual]

Control the initialization done before executing an action.

Reimplemented from oasys::SerializeAction.

Definition at line 298 of file SQLSerialize.cc.

References oasys::StringBuffer::appendf(), oasys::SQLQuery::query_, and oasys::SQLQuery::table_name_.

void oasys::SQLTableFormat::end_action (  )  [virtual]

Control the cleanup after executing an action.

Reimplemented from oasys::SerializeAction.

Definition at line 304 of file SQLSerialize.cc.

References oasys::StringBuffer::data(), oasys::StringBuffer::length(), and oasys::SQLQuery::query_.

int oasys::SQLTableFormat::action ( const SerializableObject const_object  )  [inline]

Since table format doesn't modify the object, define a variant of action() that operates on a const SerializableObject.

Definition at line 152 of file SQLSerialize.h.

References oasys::SerializeAction::action().

void oasys::SQLTableFormat::process ( const char *  name,
SerializableObject object 
) [virtual]

Process function for a contained SerializableObject.

The default implementation just calls serialize() on the contained object, ignoring the name value. However, a derived class can of course override it to make use of the name (as is done by SQLTableFormat, for example).

Reimplemented from oasys::SerializeAction.

Definition at line 313 of file SQLSerialize.cc.

References oasys::StringBuffer::appendf(), column_prefix_, oasys::StringBuffer::length(), oasys::SerializableObject::serialize(), and oasys::StringBuffer::trim().

void oasys::SQLTableFormat::process ( const char *  name,
u_int32_t *  i 
) [virtual]

Process function for a 4 byte integer.

Implements oasys::SerializeAction.

Definition at line 332 of file SQLSerialize.cc.

References append().

void oasys::SQLTableFormat::process ( const char *  name,
u_int16_t *  i 
) [virtual]

Process function for a 2 byte integer.

Implements oasys::SerializeAction.

Definition at line 339 of file SQLSerialize.cc.

References append().

void oasys::SQLTableFormat::process ( const char *  name,
u_int8_t *  i 
) [virtual]

Process function for a byte.

Implements oasys::SerializeAction.

Definition at line 346 of file SQLSerialize.cc.

References append().

void oasys::SQLTableFormat::process ( const char *  name,
bool b 
) [virtual]

Process function for a boolean.

Implements oasys::SerializeAction.

Definition at line 356 of file SQLSerialize.cc.

References append().

void oasys::SQLTableFormat::process ( const char *  name,
u_char *  bp,
size_t  len 
)

Definition at line 371 of file SQLSerialize.cc.

References append(), oasys::SQLImplementation::binary_datatype(), and oasys::SQLQuery::sql_impl_.

void oasys::SQLTableFormat::process ( const char *  name,
u_char **  bp,
size_t *  lenp,
int  flags 
)

Definition at line 379 of file SQLSerialize.cc.

References append(), oasys::SQLImplementation::binary_datatype(), NOTIMPLEMENTED, oasys::Serialize::NULL_TERMINATED, and oasys::SQLQuery::sql_impl_.

void oasys::SQLTableFormat::process ( const char *  name,
std::string *  s 
) [virtual]

Process function for a c++ string.

Implements oasys::SerializeAction.

Definition at line 364 of file SQLSerialize.cc.

References append().

void oasys::SQLTableFormat::append ( const char *  name,
const char *  type 
) [protected]

Definition at line 323 of file SQLSerialize.cc.

References oasys::StringBuffer::appendf(), column_prefix_, oasys::StringBuffer::data(), oasys::StringBuffer::length(), and oasys::SQLQuery::query_.

Referenced by process().


Member Data Documentation

StringBuffer oasys::SQLTableFormat::column_prefix_ [protected]

Definition at line 169 of file SQLSerialize.h.

Referenced by append(), and process().


The documentation for this class was generated from the following files:
Generated on Thu Jun 7 12:54:36 2007 for DTN Reference Implementation by  doxygen 1.5.1