oasys::SQLInsert Class Reference

#include <SQLSerialize.h>

Inheritance diagram for oasys::SQLInsert:

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

Detailed Description

SQLInsert is a SerializeAction that builts up a SQL "INSERT INTO" query statement based on the values in an object.

Definition at line 87 of file SQLSerialize.h.

Public Member Functions

 SQLInsert (const char *table_name, SQLImplementation *impl)
 Constructor.
virtual void begin_action ()
 Initialize the query buffer.
virtual void end_action ()
 Clean the query in the end, trimming the trailing ',' and adding a closing parenthesis.
int action (const SerializableObject *const_object)
 Since insert doesn't modify the object, define a variant of action() that operates on a const 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, int32_t *i)
 Adaptor functions for signed/unsigned compatibility.
void process (const char *name, int16_t *i)
 Adaptor functions for signed/unsigned compatibility.
void process (const char *name, int8_t *i)
 Adaptor functions for signed/unsigned compatibility.
void process (const char *name, bool *b)
 Process function for a boolean.
void process (const char *name, u_char *bp, size_t len)
 Process function for a constant length char buffer.
void process (const char *name, u_char **bp, size_t *lenp, int flags)
 Process function for a variable length char buffer.
void process (const char *name, std::string *s)
 Process function for a c++ string.


Constructor & Destructor Documentation

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

Constructor.

Definition at line 75 of file SQLSerialize.cc.


Member Function Documentation

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

Initialize the query buffer.

Reimplemented from oasys::SerializeAction.

Definition at line 87 of file SQLSerialize.cc.

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

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

Clean the query in the end, trimming the trailing ',' and adding a closing parenthesis.

Reimplemented from oasys::SerializeAction.

Definition at line 97 of file SQLSerialize.cc.

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

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

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

Definition at line 101 of file SQLSerialize.h.

References oasys::SerializeAction::action().

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

Process function for a 4 byte integer.

Implements oasys::SerializeAction.

Definition at line 106 of file SQLSerialize.cc.

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

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

Process function for a 2 byte integer.

Implements oasys::SerializeAction.

Definition at line 113 of file SQLSerialize.cc.

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

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

Process function for a byte.

Implements oasys::SerializeAction.

Definition at line 120 of file SQLSerialize.cc.

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

void oasys::SQLInsert::process ( const char *  name,
int32_t *  i 
) [virtual]

Adaptor functions for signed/unsigned compatibility.

Reimplemented from oasys::SerializeAction.

Definition at line 127 of file SQLSerialize.cc.

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

void oasys::SQLInsert::process ( const char *  name,
int16_t *  i 
) [virtual]

Adaptor functions for signed/unsigned compatibility.

Reimplemented from oasys::SerializeAction.

Definition at line 138 of file SQLSerialize.cc.

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

void oasys::SQLInsert::process ( const char *  name,
int8_t *  i 
) [virtual]

Adaptor functions for signed/unsigned compatibility.

Reimplemented from oasys::SerializeAction.

Definition at line 145 of file SQLSerialize.cc.

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

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

Process function for a boolean.

Implements oasys::SerializeAction.

Definition at line 152 of file SQLSerialize.cc.

References oasys::StringBuffer::append(), and oasys::SQLQuery::query_.

void oasys::SQLInsert::process ( const char *  name,
u_char *  bp,
size_t  len 
) [virtual]

Process function for a constant length char buffer.

Parameters:
name field name
bp buffer
len buffer length

Implements oasys::SerializeAction.

Definition at line 171 of file SQLSerialize.cc.

References oasys::StringBuffer::appendf(), oasys::SQLImplementation::escape_binary(), oasys::SQLQuery::query_, and oasys::SQLQuery::sql_impl_.

void oasys::SQLInsert::process ( const char *  name,
u_char **  bp,
size_t *  lenp,
int  flags 
) [virtual]

Process function for a variable length char buffer.

Parameters:
name field name
bp buffer, allocated by SerializeAction if ALLOC_MEM flag is set.
lenp IN: If ALLOC_MEM flags is set, then len is the length of the buffer allocated. OUT: contains the length of the buffer
flags ALLOC_MEM as above, NULL_TERMINATED specifies that the data stored will be a null-terminated C-string.

Implements oasys::SerializeAction.

Definition at line 178 of file SQLSerialize.cc.

References NOTIMPLEMENTED.

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

Process function for a c++ string.

Implements oasys::SerializeAction.

Definition at line 164 of file SQLSerialize.cc.

References oasys::StringBuffer::appendf(), oasys::SQLImplementation::escape_string(), oasys::SQLQuery::query_, and oasys::SQLQuery::sql_impl_.


The documentation for this class was generated from the following files:
Generated on Fri Dec 22 14:48:06 2006 for DTN Reference Implementation by  doxygen 1.5.1