#include <Network.h>
Inheritance diagram for PacketCommit:
Public Member Functions | |
PacketCommit () | |
~PacketCommit () | |
void | setExecPackets (int tid, List list) |
void | getExecPacketList (List stmtList, List &list) |
DbRetVal | marshall () |
DbRetVal | unmarshall () |
Data Fields | |
int | txnID |
int | noOfStmts |
int * | stmtBufSize |
char ** | stmtBuffer |
Definition at line 204 of file Network.h.
PacketCommit::PacketCommit | ( | ) | [inline] |
Definition at line 207 of file Network.h.
References BasePacket::buffer, BasePacket::bufferSize, noOfStmts, NW_PKT_COMMIT, BasePacket::pktType, stmtBuffer, stmtBufSize, and txnID.
00207 { txnID =0; noOfStmts = 0; stmtBufSize = NULL; stmtBuffer = NULL; 00208 buffer = NULL; bufferSize = 0; pktType = NW_PKT_COMMIT; }
PacketCommit::~PacketCommit | ( | ) | [inline] |
Definition at line 209 of file Network.h.
References BasePacket::buffer, and BasePacket::bufferSize.
00209 { free(buffer); bufferSize = 0; buffer = NULL; }
Definition at line 211 of file NetworkPacket.cxx.
References List::append(), noOfStmts, BasePacket::setBuffer(), BasePacket::setBufferSize(), PacketExecute::setStatementList(), stmtBuffer, stmtBufSize, and PacketExecute::unmarshall().
Referenced by SqlNetworkHandler::processCommit().
00212 { 00213 PacketExecute* pkt = NULL; 00214 for (int i = 0 ; i < noOfStmts; i++) 00215 { 00216 pkt = new PacketExecute(); 00217 pkt->setBuffer(stmtBuffer[i]); 00218 pkt->setBufferSize(stmtBufSize[i]); 00219 pkt->setStatementList(stmtList); 00220 pkt->unmarshall(); 00221 list.append(pkt); 00222 } 00223 00224 }
Here is the call graph for this function:
Here is the caller graph for this function:
DbRetVal PacketCommit::marshall | ( | ) | [virtual] |
Implements BasePacket.
Definition at line 178 of file NetworkPacket.cxx.
References BasePacket::buffer, BasePacket::bufferSize, noOfStmts, OK, stmtBuffer, stmtBufSize, and txnID.
00179 { 00180 buffer = (char*) malloc(bufferSize); 00181 *(int*)buffer = txnID; 00182 char* bufIter = (char*) buffer + sizeof(int); 00183 *(int*)bufIter = noOfStmts; 00184 bufIter = (char*) bufIter + sizeof(int); 00185 memcpy(bufIter, stmtBufSize, noOfStmts*sizeof(int)); 00186 bufIter = (char*) bufIter + noOfStmts* sizeof(int); 00187 for (int i=0; i < noOfStmts; i++) 00188 { 00189 memcpy(bufIter, stmtBuffer[i], stmtBufSize[i]); 00190 bufIter = bufIter + stmtBufSize[i]; 00191 } 00192 return OK; 00193 }
void PacketCommit::setExecPackets | ( | int | tid, | |
List | list | |||
) |
Definition at line 156 of file NetworkPacket.cxx.
References BasePacket::bufferSize, ErrSysFatal, List::get(), BasePacket::getBufferSize(), BasePacket::getMarshalledBuffer(), noOfStmts, printError, List::size(), stmtBuffer, stmtBufSize, and txnID.
00157 { 00158 txnID = tid; 00159 noOfStmts = list.size(); 00160 stmtBufSize = new int[noOfStmts]; 00161 stmtBuffer = new char*[noOfStmts]; 00162 PacketExecute* pkt = NULL; 00163 int totalSize =0; 00164 for (int i = 0 ; i < noOfStmts; i++) 00165 { 00166 pkt = (PacketExecute*) list.get(i+1); 00167 if (pkt == NULL) printError(ErrSysFatal, "pkt is null.should never happen\n"); 00168 stmtBufSize[i] = pkt->getBufferSize(); 00169 stmtBuffer[i] = pkt->getMarshalledBuffer(); 00170 // *(int*)(((char*)stmtBuffer[i]) + 4)); 00171 totalSize = totalSize + stmtBufSize[i]; 00172 } 00173 totalSize = sizeof(int) + sizeof(int) + noOfStmts * sizeof(int) + 00174 totalSize; 00175 bufferSize = totalSize; 00176 return; 00177 }
Here is the call graph for this function:
DbRetVal PacketCommit::unmarshall | ( | ) | [virtual] |
Implements BasePacket.
Definition at line 194 of file NetworkPacket.cxx.
References BasePacket::buffer, noOfStmts, stmtBuffer, stmtBufSize, and txnID.
Referenced by SqlNetworkHandler::processCommit().
00195 { 00196 txnID = *(int*)buffer; 00197 char *bufIter = buffer + sizeof(int); 00198 noOfStmts = *(int*)bufIter; 00199 bufIter = bufIter + sizeof(int); 00200 stmtBufSize = new int[noOfStmts]; 00201 memcpy(stmtBufSize, bufIter, noOfStmts*sizeof(int)); 00202 bufIter = bufIter + noOfStmts * sizeof(int); 00203 stmtBuffer = new char*[noOfStmts]; 00204 for (int i = 0 ; i <noOfStmts; i++) 00205 { 00206 stmtBuffer[i] = bufIter; 00207 bufIter = bufIter + stmtBufSize[i]; 00208 } 00209 }
Here is the caller graph for this function:
Definition at line 211 of file Network.h.
Referenced by getExecPacketList(), marshall(), PacketCommit(), setExecPackets(), and unmarshall().
char** PacketCommit::stmtBuffer |
Definition at line 213 of file Network.h.
Referenced by getExecPacketList(), marshall(), PacketCommit(), setExecPackets(), and unmarshall().
Definition at line 212 of file Network.h.
Referenced by getExecPacketList(), marshall(), PacketCommit(), setExecPackets(), and unmarshall().
Definition at line 210 of file Network.h.
Referenced by marshall(), PacketCommit(), setExecPackets(), and unmarshall().