SqlLogStatement Class Reference

#include <SqlLogStatement.h>

Inheritance diagram for SqlLogStatement:

Inheritance graph
[legend]
Collaboration diagram for SqlLogStatement:

Collaboration graph
[legend]

Public Member Functions

 SqlLogStatement ()
void setConnection (AbsSqlConnection *conn)
 sets connection handle to be used for subsequent operations
bool isNonSelectDML (char *stmtstr)
DbRetVal prepare (char *stmt)
 compiles the sql statement.
DbRetVal execute (int &rowsAffect)
 executes the sql statement.
DbRetVal bindParam (int pos, void *)
 binds application buffer to the specified parameter position in the sql statement.
DbRetVal bindField (int pos, void *val)
 binds application buffer to the specified field position of the projection list in the select query or for fields in the insert statement.
void * fetch ()
 fetches the next tuple from the result of the execution of sql select query.
void * fetchAndPrint (bool SQL)
 fetches the next tuple from the result of the execution of sql select query and prints it to stdout.
void * next ()
 same as fetch, but does not populate bindFieldValues
DbRetVal close ()
 Closes the iterator and makes the statement ready for another execution.
int noOfProjFields ()
 Retrieves the total number of projection fields in the statement.
void * getFieldValuePtr (int pos)
 get FieldValue->value ptr after fetch is done.
DbRetVal free ()
 Frees all the resources held for the sql statement.
int noOfParamFields ()
 Retrieves the total number of parameters in the statement.
DbRetVal getProjFldInfo (int projPos, FieldInfo *&info)
 Retrieves the field info for the required projection field position in statement.
DbRetVal getParamFldInfo (int paramPos, FieldInfo *&info)
 Retrieves the field info for the required parameter position in statement.
void setShortParam (int paramPos, short value)
 Sets the value for the required parameter position in statement.
void setIntParam (int paramPos, int value)
 Sets the value for the required parameter position in statement.
void setLongParam (int paramPos, long value)
 Sets the value for the required parameter position in statement.
void setLongLongParam (int paramPos, long long value)
 Sets the value for the required parameter position in statement.
void setByteIntParam (int paramPos, ByteInt value)
 Sets the value for the required parameter position in statement.
void setFloatParam (int paramPos, float value)
 Sets the value for the required parameter position in statement.
void setDoubleParam (int paramPos, double value)
 Sets the value for the required parameter position in statement.
void setStringParam (int paramPos, char *value)
 Sets the value for the required parameter position in statement.
void setDateParam (int paramPos, Date value)
 Sets the value for the required parameter position in statement.
void setTimeParam (int paramPos, Time value)
 Sets the value for the required parameter position in statement.
void setTimeStampParam (int paramPos, TimeStamp value)
 Sets the value for the required parameter position in statement.
bool isSelect ()
 Returns whether the statement prepared is select statement.

Data Fields

bool isCached
TableSyncMode mode

Friends

class SqlFactory

Detailed Description

Definition at line 26 of file SqlLogStatement.h.


Constructor & Destructor Documentation

SqlLogStatement::SqlLogStatement (  )  [inline]

Definition at line 29 of file SqlLogStatement.h.

References AbsSqlStatement::con, and AbsSqlStatement::innerStmt.

00029 {innerStmt = NULL; con = NULL; needLog= false; sid=0; }


Member Function Documentation

DbRetVal SqlLogStatement::bindField ( int  pos,
void *  val 
) [virtual]

binds application buffer to the specified field position of the projection list in the select query or for fields in the insert statement.

This method should be called for select queries, insert, update statements. Before executing select queries, required fields must be binded first. Before executing insert statement, required fields must be binded first. Before executing update statement, required fields to be updated must be binded first.

Parameters:
pos position in the projection list
val address of the application buffer. Memory should be allocated by the application before binding the buffer.

Implements AbsSqlStatement.

Definition at line 131 of file SqlLogStatement.cxx.

References AbsSqlStatement::bindField(), AbsSqlStatement::innerStmt, and OK.

Referenced by prepare(), setByteIntParam(), setDateParam(), setDoubleParam(), setFloatParam(), setIntParam(), setLongLongParam(), setLongParam(), setShortParam(), setStringParam(), setTimeParam(), and setTimeStampParam().

00132 {
00133     DbRetVal rv = OK;
00134     if (innerStmt) rv = innerStmt->bindField(pos,value);
00135     if (rv != OK) return rv;
00136     return rv;
00137 }

Here is the call graph for this function:

Here is the caller graph for this function:

DbRetVal SqlLogStatement::bindParam ( int  pos,
void *   
) [virtual]

binds application buffer to the specified parameter position in the sql statement.

This method should be called for all the parameters in the sql statement. Parameters shall be specified for predicate for select, update, delete statements. Parameters shall be specified for field list value in SET of update statements. If value is not set for all parameters, execute will return error.

Parameters:
pos position of the parameter in the statement
val address of the application buffer. Memory should be allocated by the application before binding the buffer.

Implements AbsSqlStatement.

Definition at line 122 of file SqlLogStatement.cxx.

References AbsSqlStatement::bindParam(), ErrWarning, AbsSqlStatement::innerStmt, OK, and printError.

00123 {
00124     DbRetVal rv = OK;
00125     if (innerStmt) rv = innerStmt->bindParam(pos,value);
00126     if (rv != OK) return rv;
00127     printError(ErrWarning, "Deprecated and does not replicate or cache");
00128     return rv;
00129 }

Here is the call graph for this function:

DbRetVal SqlLogStatement::close (  )  [virtual]

Closes the iterator and makes the statement ready for another execution.

Returns:
DbRetVal

Implements AbsSqlStatement.

Definition at line 156 of file SqlLogStatement.cxx.

References AbsSqlStatement::close(), AbsSqlStatement::innerStmt, and OK.

00157 {
00158     if (innerStmt) return innerStmt->close();
00159     return OK;
00160 }

Here is the call graph for this function:

DbRetVal SqlLogStatement::execute ( int &  rowsAffect  )  [virtual]

executes the sql statement.

For insert, update, delete queries execute performs the required operation on the table. For Select queries, application should call execute before they start fetching the values from the table.This starts scan on the table.

Parameters:
rowsAffect number of rows affected by the sql statement
Returns:
DbRetVal

Implements AbsSqlStatement.

Definition at line 94 of file SqlLogStatement.cxx.

References SqlLogConnection::addPacket(), AbsSqlStatement::con, AbsSqlStatement::execute(), BasePacket::getMarshalledBuffer(), SqlLogConnection::getSyncMode(), AbsSqlStatement::innerStmt, isCached, PacketExecute::marshall(), AbsSqlStatement::noOfParamFields(), PacketExecute::noParams, OK, OSYNC, PacketExecute::setParams(), and PacketExecute::stmtID.

00095 {
00096 
00097     SqlLogConnection* logConn = (SqlLogConnection*)con;
00098 
00099     DbRetVal rv = OK;
00100     if (innerStmt) rv = innerStmt->execute(rowsAffected);
00101     if (rv != OK) return rv;
00102 
00103     //no need to generate log if it does not actually modify the table
00104     if (rowsAffected == 0 ) return OK;
00105     if (!isCached) return OK;
00106     if (logConn->getSyncMode() == OSYNC) return OK;
00107 
00108     //printf("LOG:execute\n");
00109     PacketExecute *pkt = new PacketExecute();
00110     pkt->stmtID= sid;
00111     pkt->noParams = innerStmt->noOfParamFields();
00112     pkt->setParams(paramList);
00113     pkt->marshall();
00114     int *p = (int*)pkt->getMarshalledBuffer();
00115     //printf("After EXEC packet marshall %d %d size %d\n", *p, *(p+1),
00116     //                pkt->getBufferSize());
00117    // printf("EXEC pkt ptr is %x\n", pkt);
00118     logConn->addPacket(pkt);
00119     return rv;
00120 }

Here is the call graph for this function:

void * SqlLogStatement::fetch (  )  [virtual]

fetches the next tuple from the result of the execution of sql select query.

execute should be called before calling this method. Application buffer should be binded to get the tuple values.

Returns:
void* NULL if there is no tuple.

Implements AbsSqlStatement.

Definition at line 138 of file SqlLogStatement.cxx.

References AbsSqlStatement::fetch(), and AbsSqlStatement::innerStmt.

00139 {
00140     if (innerStmt) return innerStmt->fetch();
00141     return NULL;
00142 }

Here is the call graph for this function:

void * SqlLogStatement::fetchAndPrint ( bool  SQL  )  [virtual]

fetches the next tuple from the result of the execution of sql select query and prints it to stdout.

execute should be called before calling this method.

Returns:
void* NULL if there is no tuple.

Implements AbsSqlStatement.

Definition at line 144 of file SqlLogStatement.cxx.

References AbsSqlStatement::fetchAndPrint(), and AbsSqlStatement::innerStmt.

00145 {
00146     if (innerStmt) return innerStmt->fetchAndPrint(SQL);
00147     return NULL;
00148 }

Here is the call graph for this function:

DbRetVal SqlLogStatement::free (  )  [virtual]

Frees all the resources held for the sql statement.

Needs to be called before calling prepare again on the same statement handle.

Returns:
DbRetVal

Implements AbsSqlStatement.

Definition at line 192 of file SqlLogStatement.cxx.

References AbsSqlStatement::con, AbsSqlStatement::free(), AbsSqlStatement::innerStmt, isCached, OK, SqlLogConnection::removePreparePacket(), and List::reset().

00193 {
00194     DbRetVal rv = OK;
00195     if (innerStmt) rv = innerStmt->free();
00196     //TODO::DEBUG::always innsrStmt->free() returns error
00197     //if (rv != OK) return rv;
00198     SqlLogConnection* logConn = (SqlLogConnection*)con;
00199     if (sid != 0 ) logConn->removePreparePacket(sid);
00200     if (!isCached) return rv;
00201 
00202     //TODO
00203     //If statement is freed before the txn commits, it will lead to issue 
00204     //incase of async mode. when the other site goes down and comes back,
00205     //it will not have the cached SqlStatement objects, so in that case 
00206     //we need to send all the prepare packets again, so we should not free
00207     //the statement straight away in client side as well as in server side
00208 
00209 
00210 
00211     /*PacketFree *pkt = new PacketFree();
00212     pkt->stmtID= sid;
00213     pkt->marshall();
00214     SqlLogConnection* logConn = (SqlLogConnection*)con;
00215     logConn->sendAndReceiveAllPeers(NW_PKT_FREE, pkt->getMarshalledBuffer(), pkt->getBufferSize());
00216     delete pkt;*/
00217     isCached= false;
00218     sid = 0;
00219     paramList.reset();
00220     return OK;
00221 }

Here is the call graph for this function:

void * SqlLogStatement::getFieldValuePtr ( int  pos  )  [virtual]

get FieldValue->value ptr after fetch is done.

Returns:
address void*

Implements AbsSqlStatement.

Definition at line 162 of file SqlLogStatement.cxx.

References AbsSqlStatement::getFieldValuePtr(), and AbsSqlStatement::innerStmt.

00163 {
00164     if (innerStmt) return innerStmt->getFieldValuePtr(pos);
00165     return NULL;
00166 }

Here is the call graph for this function:

DbRetVal SqlLogStatement::getParamFldInfo ( int  paramPos,
FieldInfo *&  info 
) [virtual]

Retrieves the field info for the required parameter position in statement.

Parameters:
projPos int - parameter position
info FieldInfo*& - OUT parameter
Returns:
DbRetVal

Implements AbsSqlStatement.

Definition at line 186 of file SqlLogStatement.cxx.

References AbsSqlStatement::getParamFldInfo(), AbsSqlStatement::innerStmt, and OK.

00187 {
00188     if (innerStmt) return innerStmt->getParamFldInfo(parampos, fInfo);
00189     return OK;
00190 }

Here is the call graph for this function:

DbRetVal SqlLogStatement::getProjFldInfo ( int  projPos,
FieldInfo *&  info 
) [virtual]

Retrieves the field info for the required projection field position in statement.

Parameters:
projPos int - projection field position
info FieldInfo*& - OUT parameter
Returns:
DbRetVal

Implements AbsSqlStatement.

Definition at line 180 of file SqlLogStatement.cxx.

References AbsSqlStatement::getProjFldInfo(), AbsSqlStatement::innerStmt, and OK.

00181 {
00182     if (innerStmt) return innerStmt->getProjFldInfo(projpos, fInfo);
00183     return OK;
00184 }

Here is the call graph for this function:

bool SqlLogStatement::isNonSelectDML ( char *  stmtstr  ) 

Definition at line 24 of file SqlLogStatement.cxx.

Referenced by prepare().

00025 {
00026     if (strlen(stmtstr) <= 6) return false;
00027     if (strncasecmp(stmtstr,"INSERT", 6) == 0) return true;
00028     else if (strncasecmp(stmtstr, "UPDATE", 6) ==0) return true;
00029     else if (strncasecmp(stmtstr, "DELETE", 6) ==0) return true;
00030     return false;
00031 }

Here is the caller graph for this function:

bool SqlLogStatement::isSelect (  )  [virtual]

Returns whether the statement prepared is select statement.

Returns:
bool true if it is select stmt, false otherwise

Implements AbsSqlStatement.

Definition at line 88 of file SqlLogStatement.cxx.

References AbsSqlStatement::innerStmt, and AbsSqlStatement::isSelect().

00089 {
00090     if (innerStmt) return innerStmt->isSelect();
00091     return false;
00092 }

Here is the call graph for this function:

void * SqlLogStatement::next (  )  [virtual]

same as fetch, but does not populate bindFieldValues

Returns:
address void*

Implements AbsSqlStatement.

Definition at line 150 of file SqlLogStatement.cxx.

References AbsSqlStatement::innerStmt, and AbsSqlStatement::next().

00151 {
00152     if (innerStmt) return innerStmt->next();
00153     return NULL;
00154 }

Here is the call graph for this function:

int SqlLogStatement::noOfParamFields (  )  [virtual]

Retrieves the total number of parameters in the statement.

Returns:
int no of parameters

Implements AbsSqlStatement.

Definition at line 174 of file SqlLogStatement.cxx.

References AbsSqlStatement::innerStmt, and AbsSqlStatement::noOfParamFields().

00175 {
00176     if (innerStmt) return innerStmt->noOfParamFields();
00177     return 0;
00178 }

Here is the call graph for this function:

int SqlLogStatement::noOfProjFields (  )  [virtual]

Retrieves the total number of projection fields in the statement.

Returns:
int no of projection fields

Implements AbsSqlStatement.

Definition at line 168 of file SqlLogStatement.cxx.

References AbsSqlStatement::innerStmt, and AbsSqlStatement::noOfProjFields().

00169 {
00170     if (innerStmt) return innerStmt->noOfProjFields();
00171     return 0;
00172 }

Here is the call graph for this function:

DbRetVal SqlLogStatement::prepare ( char *  stmt  )  [virtual]

compiles the sql statement.

It calls the parser and tokenizes the statement into logical plan. This method sets the statement string which needs to be executed. free method needs to be called, if application wants to use the same handle to compile another sql statement.

Parameters:
stmt sql statement string
Returns:
DbRetVal

Implements AbsSqlStatement.

Definition at line 33 of file SqlLogStatement.cxx.

References SqlLogConnection::addPreparePacket(), AllDataType::alloc(), List::append(), ASYNC, bindField(), AbsSqlStatement::con, Conf::config, UniqueID::getID(), AbsSqlStatement::getParamFldInfo(), AbsSqlStatement::getTableName(), AbsSqlStatement::innerStmt, isCached, isNonSelectDML(), SqlLogConnection::isTableCached(), FieldInfo::length, PacketPrepare::length, PacketPrepare::marshall(), mode, AbsSqlStatement::noOfParamFields(), PacketPrepare::noParams, OK, AbsSqlStatement::prepare(), PacketPrepare::stmtID, PacketPrepare::stmtString, PacketPrepare::syncMode, TABLE_OSYNC, FieldInfo::type, and PacketPrepare::type.

00034 {
00035     DbRetVal rv = OK;
00036     if (innerStmt) rv = innerStmt->prepare(stmtstr);
00037     if (rv != OK) return rv;
00038 
00039     isCached = false;
00040     //check if it is INSERT UPDATE DELETE statement
00041     //if not, then no need to generate logs
00042     if (!isNonSelectDML(stmtstr)) { return rv;}
00043     if (!Conf::config.useReplication() && !Conf::config.useCache()) return OK;
00044     SqlLogConnection* logConn = (SqlLogConnection*)con;
00045     if (!logConn->isTableCached(innerStmt->getTableName())) return OK;
00046     isCached = true;
00047     mode = TABLE_OSYNC;//TEMP::support only OSYNC 
00048 
00049     sid  = SqlLogStatement::stmtUID.getID();
00050     //TODO::if connected to peer then only send this packet
00051     PacketPrepare *pkt = new PacketPrepare();
00052     pkt->stmtID= sid;
00053     pkt->syncMode = ASYNC;
00054     pkt->stmtString = stmtstr;
00055     pkt->noParams = innerStmt->noOfParamFields();
00056     FieldInfo *info = new FieldInfo();
00057     if (pkt->noParams > 0) {
00058       pkt->type = new int [pkt->noParams];
00059       pkt->length = new int [pkt->noParams];
00060       BindSqlField *bindField = NULL;
00061       for (int i = 0; i < innerStmt->noOfParamFields(); i++)
00062       {
00063         innerStmt->getParamFldInfo(i+1, info);
00064         bindField = new BindSqlField();
00065         bindField->type = info->type;
00066         bindField->length = info->length;
00067         pkt->type[i] =  info->type;
00068         pkt->length[i] =  info->length;
00069         bindField->value = AllDataType::alloc(info->type, info->length);
00070         paramList.append(bindField);
00071       }
00072     }
00073     pkt->marshall();
00074     /*logConn->connectIfNotConnected();
00075     //printf("Sending PREPARE packet of size %d\n", pkt->getBufferSize());
00076     rv = logConn->sendAndReceive(NW_PKT_PREPARE, pkt->getMarshalledBuffer(), pkt->getBufferSize());
00077     printf("RV from PREPARE SQLLOG %d\n", rv);
00078     if (rv != OK) { 
00079        logConn->addPreparePacket(pkt); 
00080        delete info; 
00081        return OK;
00082     }*/
00083     logConn->addPreparePacket(pkt); 
00084     delete info;
00085     return rv;
00086 }

Here is the call graph for this function:

void SqlLogStatement::setByteIntParam ( int  paramPos,
ByteInt  value 
) [virtual]

Sets the value for the required parameter position in statement.

Parameters:
paramPos int - parameter position
value ByteInt - value to be set

Implements AbsSqlStatement.

Definition at line 267 of file SqlLogStatement.cxx.

References bindField(), AbsSqlStatement::con, List::get(), SqlLogConnection::getSyncMode(), AbsSqlStatement::innerStmt, isCached, OSYNC, AbsSqlStatement::setByteIntParam(), and typeByteInt.

00268 {
00269     if (innerStmt) innerStmt->setByteIntParam(paramPos,value);
00270     SqlLogConnection* logConn = (SqlLogConnection*)con;
00271     if (logConn->getSyncMode() == OSYNC) return ;
00272     if (!isCached) return;
00273     BindSqlField *bindField = (BindSqlField*)paramList.get(paramPos);
00274     if (bindField->type != typeByteInt) return;
00275     *(char*)(bindField->value) = value;
00276 
00277 }

Here is the call graph for this function:

void SqlLogStatement::setConnection ( AbsSqlConnection conn  )  [inline, virtual]

sets connection handle to be used for subsequent operations

Parameters:
con SqlConnection*

Reimplemented from AbsSqlStatement.

Definition at line 31 of file SqlLogStatement.h.

References AbsSqlStatement::con, conn, AbsSqlStatement::innerStmt, and AbsSqlStatement::setConnection().

00032     {
00033         if (innerStmt) innerStmt->setConnection(conn->getInnerConnection());
00034         con = conn;
00035     }

Here is the call graph for this function:

void SqlLogStatement::setDateParam ( int  paramPos,
Date  value 
) [virtual]

Sets the value for the required parameter position in statement.

Parameters:
paramPos int - parameter position
value Date - value to be set

Implements AbsSqlStatement.

Definition at line 313 of file SqlLogStatement.cxx.

References bindField(), AbsSqlStatement::con, List::get(), SqlLogConnection::getSyncMode(), AbsSqlStatement::innerStmt, isCached, OSYNC, AbsSqlStatement::setDateParam(), and typeDate.

00314 {
00315     if (innerStmt) innerStmt->setDateParam(paramPos,value);
00316     SqlLogConnection* logConn = (SqlLogConnection*)con;
00317     if (logConn->getSyncMode() == OSYNC) return ;
00318     if (!isCached) return;
00319     BindSqlField *bindField = (BindSqlField*)paramList.get(paramPos);
00320     if (bindField->type != typeDate) return;
00321     *(Date*)(bindField->value) = value;
00322 
00323 }

Here is the call graph for this function:

void SqlLogStatement::setDoubleParam ( int  paramPos,
double  value 
) [virtual]

Sets the value for the required parameter position in statement.

Parameters:
paramPos int - parameter position
value double - value to be set

Implements AbsSqlStatement.

Definition at line 289 of file SqlLogStatement.cxx.

References bindField(), AbsSqlStatement::con, List::get(), SqlLogConnection::getSyncMode(), AbsSqlStatement::innerStmt, isCached, OSYNC, AbsSqlStatement::setDoubleParam(), and typeDouble.

00290 {
00291     if (innerStmt) innerStmt->setDoubleParam(paramPos,value);
00292     SqlLogConnection* logConn = (SqlLogConnection*)con;
00293     if (logConn->getSyncMode() == OSYNC) return ;
00294     if (!isCached) return;
00295     BindSqlField *bindField = (BindSqlField*)paramList.get(paramPos);
00296     if (bindField->type != typeDouble) return;
00297     *(double*)(bindField->value) = value;
00298 
00299 }

Here is the call graph for this function:

void SqlLogStatement::setFloatParam ( int  paramPos,
float  value 
) [virtual]

Sets the value for the required parameter position in statement.

Parameters:
paramPos int - parameter position
value float - value to be set

Implements AbsSqlStatement.

Definition at line 278 of file SqlLogStatement.cxx.

References bindField(), AbsSqlStatement::con, List::get(), SqlLogConnection::getSyncMode(), AbsSqlStatement::innerStmt, isCached, OSYNC, AbsSqlStatement::setFloatParam(), and typeFloat.

00279 {
00280     if (innerStmt) innerStmt->setFloatParam(paramPos,value);
00281     SqlLogConnection* logConn = (SqlLogConnection*)con;
00282     if (logConn->getSyncMode() == OSYNC) return ;
00283     if (!isCached) return;
00284     BindSqlField *bindField = (BindSqlField*)paramList.get(paramPos);
00285     if (bindField->type != typeFloat) return;
00286     *(float*)(bindField->value) = value;
00287 
00288 }

Here is the call graph for this function:

void SqlLogStatement::setIntParam ( int  paramPos,
int  value 
) [virtual]

Sets the value for the required parameter position in statement.

Parameters:
paramPos int - parameter position
value int - value to be set

Implements AbsSqlStatement.

Definition at line 232 of file SqlLogStatement.cxx.

References bindField(), AbsSqlStatement::con, List::get(), SqlLogConnection::getSyncMode(), AbsSqlStatement::innerStmt, isCached, OSYNC, AbsSqlStatement::setIntParam(), and typeInt.

00233 {
00234     if (innerStmt) innerStmt->setIntParam(paramPos,value);
00235     SqlLogConnection* logConn = (SqlLogConnection*)con;
00236     if (logConn->getSyncMode() == OSYNC) return ;
00237     if (!isCached) return;
00238     BindSqlField *bindField = (BindSqlField*)paramList.get(paramPos);
00239     if (bindField->type != typeInt) return;
00240     *(int*)(bindField->value) = value;
00241     return;
00242 
00243 }

Here is the call graph for this function:

void SqlLogStatement::setLongLongParam ( int  paramPos,
long long  value 
) [virtual]

Sets the value for the required parameter position in statement.

Parameters:
paramPos int - parameter position
value long long - value to be set

Implements AbsSqlStatement.

Definition at line 256 of file SqlLogStatement.cxx.

References bindField(), AbsSqlStatement::con, List::get(), SqlLogConnection::getSyncMode(), AbsSqlStatement::innerStmt, isCached, OSYNC, AbsSqlStatement::setLongLongParam(), and typeLongLong.

00257 {
00258     if (innerStmt) innerStmt->setLongLongParam(paramPos,value);
00259     SqlLogConnection* logConn = (SqlLogConnection*)con;
00260     if (logConn->getSyncMode() == OSYNC) return ;
00261     if (!isCached) return;
00262     BindSqlField *bindField = (BindSqlField*)paramList.get(paramPos);
00263     if (bindField->type != typeLongLong) return;
00264     *(long long*)(bindField->value) = value;
00265     return;
00266 }

Here is the call graph for this function:

void SqlLogStatement::setLongParam ( int  paramPos,
long  value 
) [virtual]

Sets the value for the required parameter position in statement.

Parameters:
paramPos int - parameter position
value long - value to be set

Implements AbsSqlStatement.

Definition at line 244 of file SqlLogStatement.cxx.

References bindField(), AbsSqlStatement::con, List::get(), SqlLogConnection::getSyncMode(), AbsSqlStatement::innerStmt, isCached, OSYNC, AbsSqlStatement::setLongParam(), and typeLong.

00245 {
00246     if (innerStmt) innerStmt->setLongParam(paramPos,value);
00247     SqlLogConnection* logConn = (SqlLogConnection*)con;
00248     if (logConn->getSyncMode() == OSYNC) return ;
00249     if (!isCached) return;
00250     BindSqlField *bindField = (BindSqlField*)paramList.get(paramPos);
00251     if (bindField->type != typeLong) return;
00252     *(long*)(bindField->value) = value;
00253     return;
00254 
00255 }

Here is the call graph for this function:

void SqlLogStatement::setShortParam ( int  paramPos,
short  value 
) [virtual]

Sets the value for the required parameter position in statement.

Parameters:
paramPos int - parameter position
value short - value to be set

Implements AbsSqlStatement.

Definition at line 222 of file SqlLogStatement.cxx.

References bindField(), AbsSqlStatement::con, List::get(), SqlLogConnection::getSyncMode(), AbsSqlStatement::innerStmt, OSYNC, AbsSqlStatement::setShortParam(), and typeShort.

00223 {
00224     if (innerStmt) innerStmt->setShortParam(paramPos,value);
00225     SqlLogConnection* logConn = (SqlLogConnection*)con;
00226     if (logConn->getSyncMode() == OSYNC) return ;
00227     BindSqlField *bindField = (BindSqlField*)paramList.get(paramPos);
00228     if (bindField->type != typeShort) return;
00229     *(short*)(bindField->value) = value;
00230     return;
00231 }

Here is the call graph for this function:

void SqlLogStatement::setStringParam ( int  paramPos,
char *  value 
) [virtual]

Sets the value for the required parameter position in statement.

Parameters:
paramPos int - parameter position
value char* - value to be set

Implements AbsSqlStatement.

Definition at line 300 of file SqlLogStatement.cxx.

References bindField(), AbsSqlStatement::con, List::get(), SqlLogConnection::getSyncMode(), AbsSqlStatement::innerStmt, isCached, OSYNC, AbsSqlStatement::setStringParam(), and typeString.

00301 {
00302     if (innerStmt) innerStmt->setStringParam(paramPos,value);
00303     SqlLogConnection* logConn = (SqlLogConnection*)con;
00304     if (logConn->getSyncMode() == OSYNC) return ;
00305     if (!isCached) return;
00306     BindSqlField *bindField = (BindSqlField*)paramList.get(paramPos);
00307     if (bindField->type != typeString) return;
00308     char *dest = (char*)bindField->value;
00309     strncpy(dest, value, bindField->length);
00310     dest[ bindField->length - 1] ='\0';
00311     return;
00312 }

Here is the call graph for this function:

void SqlLogStatement::setTimeParam ( int  paramPos,
Time  value 
) [virtual]

Sets the value for the required parameter position in statement.

Parameters:
paramPos int - parameter position
value Time - value to be set

Implements AbsSqlStatement.

Definition at line 324 of file SqlLogStatement.cxx.

References bindField(), AbsSqlStatement::con, List::get(), SqlLogConnection::getSyncMode(), AbsSqlStatement::innerStmt, isCached, OSYNC, AbsSqlStatement::setTimeParam(), and typeTime.

00325 {
00326     if (innerStmt) innerStmt->setTimeParam(paramPos,value);
00327     SqlLogConnection* logConn = (SqlLogConnection*)con;
00328     if (logConn->getSyncMode() == OSYNC) return ;
00329     if (!isCached) return;
00330     BindSqlField *bindField = (BindSqlField*)paramList.get(paramPos);
00331     if (bindField->type != typeTime) return;
00332     *(Time*)(bindField->value) = value;
00333 
00334 }

Here is the call graph for this function:

void SqlLogStatement::setTimeStampParam ( int  paramPos,
TimeStamp  value 
) [virtual]

Sets the value for the required parameter position in statement.

Parameters:
paramPos int - parameter position
value TimeStamp - value to be set

Implements AbsSqlStatement.

Definition at line 335 of file SqlLogStatement.cxx.

References bindField(), AbsSqlStatement::con, List::get(), SqlLogConnection::getSyncMode(), AbsSqlStatement::innerStmt, isCached, OSYNC, AbsSqlStatement::setTimeStampParam(), and typeTimeStamp.

00336 {
00337     if (innerStmt) innerStmt->setTimeStampParam(paramPos,value);
00338     SqlLogConnection* logConn = (SqlLogConnection*)con;
00339     if (logConn->getSyncMode() == OSYNC) return ;
00340     if (!isCached) return;
00341     BindSqlField *bindField = (BindSqlField*) paramList.get(paramPos);
00342     if (bindField->type != typeTimeStamp) return;
00343     *(TimeStamp*)(bindField->value) = value;
00344 }

Here is the call graph for this function:


Friends And Related Function Documentation

friend class SqlFactory [friend]

Definition at line 83 of file SqlLogStatement.h.


Field Documentation

bool SqlLogStatement::isCached

Definition at line 74 of file SqlLogStatement.h.

Referenced by execute(), free(), prepare(), setByteIntParam(), setDateParam(), setDoubleParam(), setFloatParam(), setIntParam(), setLongLongParam(), setLongParam(), setStringParam(), setTimeParam(), and setTimeStampParam().

TableSyncMode SqlLogStatement::mode

Definition at line 75 of file SqlLogStatement.h.

Referenced by prepare().


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