PacketPrepare Class Reference

#include <Network.h>

Inheritance diagram for PacketPrepare:

Inheritance graph
[legend]
Collaboration diagram for PacketPrepare:

Collaboration graph
[legend]

Public Member Functions

 PacketPrepare ()
 ~PacketPrepare ()
DbRetVal marshall ()
DbRetVal unmarshall ()

Data Fields

int stmtID
int syncMode
int stmtLength
int noParams
int * type
int * length
char * stmtString

Detailed Description

Definition at line 158 of file Network.h.


Constructor & Destructor Documentation

PacketPrepare::PacketPrepare (  )  [inline]

Definition at line 161 of file Network.h.

References BasePacket::buffer, BasePacket::bufferSize, length, noParams, NW_PKT_PREPARE, BasePacket::pktType, and type.

00161                     { buffer=NULL; bufferSize =0; noParams = 0;
00162                       type = NULL; length = NULL; pktType = NW_PKT_PREPARE;}

PacketPrepare::~PacketPrepare (  )  [inline]

Definition at line 163 of file Network.h.

References BasePacket::buffer, and BasePacket::bufferSize.

00163 { free(buffer); bufferSize = 0; buffer = NULL; }


Member Function Documentation

DbRetVal PacketPrepare::marshall (  )  [virtual]

Implements BasePacket.

Definition at line 25 of file NetworkPacket.cxx.

References BasePacket::buffer, BasePacket::bufferSize, DM_Network, length, noParams, OK, printDebug, stmtID, stmtString, syncMode, and type.

Referenced by SqlLogStatement::prepare().

00026 {
00027     printDebug(DM_Network, "PacketPrepare::marshall called\n");
00028     bufferSize  = sizeof(int) * 4 + strlen(stmtString) + 1;
00029     printDebug(DM_Network, "NOOFPARAMS %d buffer size %d\n", noParams, bufferSize);
00030     printDebug(DM_Network, "stmt %s size %d\n", stmtString, strlen(stmtString));
00031     printDebug(DM_Network, "noParams is %d\n", noParams);
00032     if (noParams >0)
00033         bufferSize = bufferSize + 2 * sizeof(int) * noParams;
00034     buffer = (char*) malloc(bufferSize);
00035     *(int*)buffer = stmtID;
00036     char *bufIter = buffer + sizeof(int);
00037     *(int*)bufIter = syncMode;
00038     bufIter = bufIter + sizeof(int); 
00039     *(int*)bufIter = strlen(stmtString);
00040     bufIter = bufIter + sizeof(int);
00041     *(int*)bufIter = noParams;
00042     bufIter = bufIter + sizeof(int); 
00043     if (noParams >0) { 
00044        memcpy(bufIter, type, sizeof(int) * noParams);
00045        bufIter = bufIter + sizeof(int)* noParams; 
00046        memcpy(bufIter, length, sizeof(int) * noParams);
00047        bufIter = bufIter + sizeof(int)* noParams; 
00048     }
00049     strcpy(bufIter, stmtString);
00050     printDebug(DM_Network, "PacketPrepare::marshall ended\n");
00051     return OK;
00052 }

Here is the caller graph for this function:

DbRetVal PacketPrepare::unmarshall (  )  [virtual]

Implements BasePacket.

Definition at line 53 of file NetworkPacket.cxx.

References BasePacket::buffer, DM_Network, length, noParams, OK, printDebug, stmtID, stmtLength, stmtString, syncMode, and type.

Referenced by SqlNetworkHandler::processPrepare().

00054 {
00055     printDebug(DM_Network, "PacketPrepare::unmarshall called\n");
00056     stmtID = *(int*)buffer;
00057     printDebug(DM_Network, "start of the buffer is %x\n", buffer);
00058     char *bufIter = buffer + sizeof (int);
00059     syncMode = *(int*)bufIter;
00060     bufIter = bufIter + sizeof(int);
00061     stmtLength = *(int*)bufIter;
00062     bufIter = bufIter + sizeof(int);
00063     noParams = *(int*)bufIter;
00064     bufIter = bufIter + sizeof(int);
00065     if (noParams >0) { 
00066         type = (int*) bufIter;
00067         bufIter = bufIter + sizeof(int) * noParams;
00068         length = (int*) bufIter;
00069         bufIter = bufIter + sizeof(int) * noParams;
00070     }
00071     stmtString = bufIter;
00072     printDebug(DM_Network, "stmtString ptr is %x\n", stmtString);
00073     stmtString[stmtLength+1] = '\0';
00074     printDebug(DM_Network, "PacketPrepare::unmarshall ended\n");
00075     return OK;
00076 }

Here is the caller graph for this function:


Field Documentation

int* PacketPrepare::length

Definition at line 169 of file Network.h.

Referenced by marshall(), PacketPrepare(), SqlLogStatement::prepare(), SqlNetworkHandler::processPrepare(), and unmarshall().

int PacketPrepare::noParams

Definition at line 167 of file Network.h.

Referenced by marshall(), PacketPrepare(), SqlLogStatement::prepare(), SqlNetworkHandler::processPrepare(), and unmarshall().

int PacketPrepare::stmtID

Definition at line 164 of file Network.h.

Referenced by marshall(), SqlLogStatement::prepare(), SqlNetworkHandler::processPrepare(), SqlLogConnection::removePreparePacket(), and unmarshall().

int PacketPrepare::stmtLength

Definition at line 166 of file Network.h.

Referenced by unmarshall().

char* PacketPrepare::stmtString

Definition at line 170 of file Network.h.

Referenced by marshall(), SqlLogStatement::prepare(), SqlNetworkHandler::processPrepare(), and unmarshall().

int PacketPrepare::syncMode

Definition at line 165 of file Network.h.

Referenced by marshall(), SqlLogStatement::prepare(), and unmarshall().

int* PacketPrepare::type

Definition at line 168 of file Network.h.

Referenced by marshall(), PacketPrepare(), SqlLogStatement::prepare(), SqlNetworkHandler::processPrepare(), and unmarshall().


The documentation for this class was generated from the following files:
Generated on Mon Jun 9 22:49:33 2008 for csql by  doxygen 1.4.7