UpdStatement Class Reference

#include <Statement.h>

Inheritance diagram for UpdStatement:

Inheritance graph
[legend]
Collaboration diagram for UpdStatement:

Collaboration graph
[legend]

Public Member Functions

DbRetVal execute (int &rowsAffected)
DbRetVal setParam (int paramNo, void *value)
DbRetVal setShortParam (int paramNo, short value)
DbRetVal setIntParam (int paramNo, int value)
DbRetVal setLongParam (int paramNo, long value)
DbRetVal setLongLongParam (int paramNo, long long value)
DbRetVal setByteIntParam (int paramNo, ByteInt value)
DbRetVal setFloatParam (int paramNo, float value)
DbRetVal setDoubleParam (int paramNo, double value)
DbRetVal setStringParam (int paramNo, char *value)
DbRetVal setDateParam (int paramNo, Date value)
DbRetVal setTimeParam (int paramNo, Time value)
DbRetVal setTimeStampParam (int paramNo, TimeStamp value)
DbRetVal getParamFldInfo (int paramPos, FieldInfo *&info)
DbRetVal resolve ()
 UpdStatement ()
 ~UpdStatement ()
DbRetVal resolveForAssignment ()
DbRetVal execute (int &rowsAffected)
DbRetVal setParam (int paramNo, void *value)
DbRetVal setShortParam (int paramNo, short value)
DbRetVal setIntParam (int paramNo, int value)
DbRetVal setLongParam (int paramNo, long value)
DbRetVal setLongLongParam (int paramNo, long long value)
DbRetVal setByteIntParam (int paramNo, ByteInt value)
DbRetVal setFloatParam (int paramNo, float value)
DbRetVal setDoubleParam (int paramNo, double value)
DbRetVal setStringParam (int paramNo, char *value)
DbRetVal setDateParam (int paramNo, Date value)
DbRetVal setTimeParam (int paramNo, Time value)
DbRetVal setTimeStampParam (int paramNo, TimeStamp value)
void * getParamValuePtr (int)
DbRetVal getParamFldInfo (int paramPos, FieldInfo *&info)
DbRetVal resolve ()
 UpdStatement ()
 ~UpdStatement ()
DbRetVal resolveForAssignment ()

Data Fields

int totalAssignParams

Detailed Description

Definition at line 162 of file Statement.h.


Constructor & Destructor Documentation

UpdStatement::UpdStatement (  ) 

Definition at line 19 of file UpdStatement.cxx.

References Statement::dbMgr, DmlStatement::params, DmlStatement::paramValues, Statement::parsedData, DmlStatement::table, totalAssignParams, and DmlStatement::totalParams.

00020 {
00021     parsedData = NULL; 
00022     dbMgr = NULL; 
00023     table = NULL;
00024     params = NULL;
00025     paramValues = NULL;
00026     totalParams = 0;
00027     totalAssignParams =0;
00028 }

UpdStatement::~UpdStatement (  ) 

Definition at line 30 of file UpdStatement.cxx.

References DatabaseManager::closeTable(), Statement::dbMgr, DmlStatement::params, DmlStatement::paramValues, Table::setCondition(), DmlStatement::table, and DmlStatement::totalParams.

00030                             {
00031     if (totalParams) {
00032         //TODO::below free cause memory corruption.
00033         free(params);
00034         params =  NULL;
00035         free(paramValues);
00036         paramValues = NULL;
00037         }
00038         if (table) {
00039             table->setCondition(NULL);
00040             if (dbMgr) dbMgr->closeTable(table);
00041         }
00042 }

Here is the call graph for this function:

UpdStatement::UpdStatement (  ) 

UpdStatement::~UpdStatement (  ) 


Member Function Documentation

DbRetVal UpdStatement::execute ( int &  rowsAffected  )  [virtual]

Implements DmlStatement.

DbRetVal UpdStatement::execute ( int &  rowsAffected  )  [virtual]

Implements DmlStatement.

Definition at line 79 of file UpdStatement.cxx.

References Table::close(), AllDataType::copyVal(), Table::execute(), Table::fetchNoBind(), ConditionValue::length, UpdateFieldValue::length, OK, DmlStatement::params, DmlStatement::paramValues, DmlStatement::table, totalAssignParams, DmlStatement::totalParams, ConditionValue::type, UpdateFieldValue::type, Table::updateTuple(), ConditionValue::value, and UpdateFieldValue::value.

00080 {
00081     DbRetVal rv = OK;
00082     //copy param values to binded buffer
00083     ConditionValue *cValue;
00084     UpdateFieldValue *uValue;
00085 
00086     for (int i = 0; i < totalParams; i ++)
00087     {
00088         if (i < totalAssignParams) {
00089             uValue = (UpdateFieldValue*) params[i];
00090             if (paramValues[i] == NULL) 
00091             {
00092                 continue;
00093                 //printError(ErrBadCall, "param values not set");
00094                 //return ErrBadCall;
00095             }
00096             AllDataType::copyVal(uValue->value, paramValues[i], uValue->type, uValue->length);
00097         } else {
00098             cValue = (ConditionValue*) params[i];
00099             if (paramValues[i] == NULL) 
00100             {
00101                 continue;
00102                 //printError(ErrBadCall, "param values not set");
00103                 //return ErrBadCall;
00104             }
00105             AllDataType::copyVal(cValue->value, paramValues[i], cValue->type, cValue->length);
00106         }
00107     }
00108     rv = table->execute();
00109     if (rv != OK) return rv;
00110     rowsAffected = 0;
00111     void *tuple;
00112     while(true)
00113     {
00114         tuple = (char*)table->fetchNoBind(rv);
00115         if (rv != OK) break;
00116         if (tuple == NULL) {break;}
00117         rv = table->updateTuple();
00118         if (rv != OK) break;
00119         rowsAffected++;
00120     }
00121     table->close();
00122     return rv;
00123 }

Here is the call graph for this function:

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

Implements DmlStatement.

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

Implements DmlStatement.

Definition at line 56 of file UpdStatement.cxx.

References ErrBadArg, ErrSysFatal, ConditionValue::length, UpdateFieldValue::length, FieldInfo::length, OK, DmlStatement::params, printError, totalAssignParams, DmlStatement::totalParams, ConditionValue::type, UpdateFieldValue::type, and FieldInfo::type.

00057 {
00058     if (paramPos <=0 || paramPos > totalParams) return ErrBadArg;
00059     if (NULL == params[paramPos-1])
00060     {
00061         printError(ErrSysFatal, "param not set. Should never happen");
00062         return ErrSysFatal;
00063     }
00064 
00065     ConditionValue *cValue;
00066     UpdateFieldValue *uValue;
00067     if (paramPos <= totalAssignParams) {
00068         uValue = (UpdateFieldValue*) params[paramPos-1];
00069         info->type = uValue->type;
00070         info->length = uValue->length;
00071     } else {
00072         cValue = (ConditionValue*) params[paramPos-1];
00073         info->type = cValue->type;
00074         info->length = cValue->length;
00075     }
00076     return OK;
00077 
00078 }

void * UpdStatement::getParamValuePtr ( int   )  [virtual]

Implements DmlStatement.

Definition at line 43 of file UpdStatement.cxx.

References DmlStatement::params, totalAssignParams, ConditionValue::value, and UpdateFieldValue::value.

00044 {
00045     ConditionValue *cValue;
00046     UpdateFieldValue *uValue;
00047     if (pos <= totalAssignParams) {
00048         uValue = (UpdateFieldValue*) params[pos-1];
00049       return( (void*) uValue->value );
00050     } else {
00051         cValue = (ConditionValue*) params[pos-1];
00052       return( (void*) cValue->value );
00053     }
00054 }

DbRetVal UpdStatement::resolve (  )  [virtual]

Implements DmlStatement.

DbRetVal UpdStatement::resolve (  )  [virtual]

Implements DmlStatement.

Definition at line 368 of file UpdStatement.cxx.

References DatabaseManager::closeTable(), Statement::dbMgr, ErrNoConnection, ErrNotExists, ParsedData::getCondition(), ParsedData::getTableName(), OK, DatabaseManager::openTable(), Statement::parsedData, printError, resolveForAssignment(), Table::setCondition(), and DmlStatement::table.

00369 {
00370     if (dbMgr == NULL) return ErrNoConnection;
00371     //check whether the table exists
00372     table = dbMgr->openTable(parsedData->getTableName());
00373     if (table == NULL) 
00374     {
00375         printError(ErrNotExists, "Unable to open the table:Table not exists");
00376         return ErrNotExists;
00377     }
00378 
00379     table->setCondition(parsedData->getCondition());
00380 
00381     DbRetVal rv = resolveForAssignment();
00382     if (rv != OK) 
00383     {
00384         //TODO::free memory allocated for params
00385         table->setCondition(NULL);
00386         dbMgr->closeTable(table);
00387         table = NULL;
00388     }
00389     return rv;
00390 }

Here is the call graph for this function:

DbRetVal UpdStatement::resolveForAssignment (  ) 

DbRetVal UpdStatement::resolveForAssignment (  ) 

Definition at line 392 of file UpdStatement.cxx.

References AllDataType::alloc(), Table::bindFld(), ErrNotFound, ErrNullViolation, ErrSyntaxError, ErrSysFatal, UpdateFieldValue::fldName, ConditionValue::fName, ParsedData::getConditionValueList(), Table::getFieldInfo(), List::getIterator(), ParsedData::getUpdateFieldValueList(), ListIterator::hasElement(), FieldInfo::isNull, ConditionValue::length, FieldInfo::length, UpdateFieldValue::length, Table::markFldNull(), ListIterator::nextElement(), OK, ConditionValue::paramNo, UpdateFieldValue::paramNo, DmlStatement::params, DmlStatement::paramValues, Statement::parsedData, ConditionValue::parsedString, UpdateFieldValue::parsedString, printError, ListIterator::reset(), AllDataType::strToValue(), DmlStatement::table, totalAssignParams, DmlStatement::totalParams, ConditionValue::type, FieldInfo::type, UpdateFieldValue::type, ConditionValue::value, and UpdateFieldValue::value.

Referenced by resolve().

00393 {
00394     //get the fieldname list and validate field names
00395     ListIterator iter = parsedData->getUpdateFieldValueList().getIterator();
00396 
00397     UpdateFieldValue *value;
00398     FieldInfo *fInfo = new FieldInfo();
00399     int paramPos =1;
00400     DbRetVal rv = OK;
00401     while (iter.hasElement())
00402     {
00403         value = (UpdateFieldValue*) iter.nextElement();
00404         if (NULL == value) 
00405         {
00406             delete fInfo;
00407             printError(ErrSysFatal, "Should never happen.");
00408             return ErrSysFatal;
00409         }
00410         rv = table->getFieldInfo(value->fldName, fInfo);
00411         if (ErrNotFound == rv)
00412         {
00413             delete fInfo;
00414             printError(ErrSyntaxError, "Field %s does not exist in table", 
00415                                         value->fldName);
00416             return ErrSyntaxError;
00417         }
00418         value->type = fInfo->type;
00419         value->length = fInfo->length;
00420         value->value = AllDataType::alloc(fInfo->type, fInfo->length);
00421         table->bindFld(value->fldName, value->value);
00422         if (value->parsedString == NULL) 
00423         {    
00424             if (fInfo->isNull) { delete fInfo; return ErrNullViolation; }
00425             table->markFldNull(value->fldName); 
00426             continue; 
00427         }
00428         if (value->parsedString[0] == '?')
00429         {
00430             value->paramNo = paramPos++;
00431         }
00432         if (!value->paramNo) 
00433             AllDataType::strToValue(value->value, value->parsedString, fInfo->type, value->length);
00434     }
00435     totalAssignParams = paramPos -1;
00436 
00437 
00438     //get the fieldname list and validate field names
00439     ListIterator cIter = parsedData->getConditionValueList().getIterator();
00440     ConditionValue *cValue = NULL;
00441     while (cIter.hasElement())
00442     {
00443         cValue = (ConditionValue*) cIter.nextElement();
00444         if (NULL == cValue) 
00445         {
00446             delete fInfo;
00447             printError(ErrSysFatal, "Should never happen.");
00448             return ErrSysFatal;
00449         }
00450         rv = table->getFieldInfo(cValue->fName, fInfo);
00451         if (ErrNotFound == rv)
00452         {
00453             delete fInfo;
00454             printError(ErrSyntaxError, "Field %s does not exist in table", 
00455                                         cValue->fName);
00456             return ErrSyntaxError;
00457         }
00458         cValue->type = fInfo->type;
00459         cValue->length = fInfo->length;
00460         cValue->value = AllDataType::alloc(fInfo->type, fInfo->length);
00461         if (cValue->parsedString == NULL)
00462         {
00463             delete fInfo;
00464             printError(ErrSyntaxError, "Condition value should not be NULL");
00465             return ErrSyntaxError;
00466         }
00467 
00468         if (cValue->parsedString[0] == '?')
00469         {
00470             cValue->paramNo = paramPos++;
00471         }
00472         if (!cValue->paramNo) 
00473             AllDataType::strToValue(cValue->value, cValue->parsedString, fInfo->type, fInfo->length);
00474     }
00475 
00476 
00477     delete fInfo;
00478     totalParams = paramPos -1;
00479     if (0 == totalParams) return OK;
00480     params = (void**) malloc ( totalParams * sizeof(FieldValue*));
00481     paramValues = (char**) malloc( totalParams * sizeof(char*));
00482 
00483     memset(params, 0, totalParams * sizeof(FieldValue*));
00484     memset(paramValues, 0, totalParams * sizeof(char*));
00485 
00486     iter.reset();
00487     while(iter.hasElement())
00488     {
00489         value = (UpdateFieldValue*) iter.nextElement();
00490         if (value == NULL) 
00491         {
00492             free(params); params = NULL;
00493             free(paramValues); paramValues = NULL;
00494             printError(ErrSysFatal, "Should never happen. value NULL after iteration");
00495             return ErrSysFatal;
00496         }
00497         if (0 == value->paramNo) continue;
00498         params[value->paramNo -1 ] = value;
00499     }
00500 
00501     cIter.reset();
00502     while(cIter.hasElement())
00503     {
00504         cValue = (ConditionValue*) cIter.nextElement();
00505         if (cValue == NULL) 
00506         {
00507             free(params); params = NULL;
00508             free(paramValues); paramValues = NULL;
00509             printError(ErrSysFatal, "Should never happen. value NULL after iteration");
00510             return ErrSysFatal;
00511         }
00512         if (0 == cValue->paramNo) continue;
00513         params[cValue->paramNo -1 ] = cValue;
00514     }
00515     return OK;
00516 }

Here is the call graph for this function:

Here is the caller graph for this function:

DbRetVal UpdStatement::setByteIntParam ( int  paramNo,
ByteInt  value 
) [virtual]

Implements DmlStatement.

DbRetVal UpdStatement::setByteIntParam ( int  paramNo,
ByteInt  value 
) [virtual]

Implements DmlStatement.

Definition at line 218 of file UpdStatement.cxx.

References ErrBadArg, ErrSysFatal, OK, DmlStatement::params, printError, totalAssignParams, DmlStatement::totalParams, ConditionValue::value, and UpdateFieldValue::value.

00219 {
00220     if (paramNo <=0 || paramNo > totalParams) return ErrBadArg;
00221     if (NULL == params[paramNo-1])
00222     {
00223         printError(ErrSysFatal, "param not set. Should never happen");
00224         return ErrSysFatal;
00225     }
00226 
00227     ConditionValue *cValue;
00228     UpdateFieldValue *uValue;
00229     if (paramNo <= totalAssignParams) {
00230         uValue = (UpdateFieldValue*) params[paramNo-1];
00231         *(ByteInt*)uValue->value = value; 
00232     } else {
00233         cValue = (ConditionValue*) params[paramNo-1];
00234         *(ByteInt*)cValue->value = value;
00235     }
00236     return OK;
00237 }

DbRetVal UpdStatement::setDateParam ( int  paramNo,
Date  value 
) [virtual]

Implements DmlStatement.

DbRetVal UpdStatement::setDateParam ( int  paramNo,
Date  value 
) [virtual]

Implements DmlStatement.

Definition at line 304 of file UpdStatement.cxx.

References ErrBadArg, ErrSysFatal, OK, DmlStatement::params, printError, totalAssignParams, DmlStatement::totalParams, ConditionValue::value, and UpdateFieldValue::value.

00305 {
00306     if (paramNo <=0 || paramNo > totalParams) return ErrBadArg;
00307     if (NULL == params[paramNo-1])
00308     {
00309         printError(ErrSysFatal, "param not set. Should never happen");
00310         return ErrSysFatal;
00311     }
00312 
00313     ConditionValue *cValue;
00314     UpdateFieldValue *uValue;
00315     if (paramNo <= totalAssignParams) {
00316         uValue = (UpdateFieldValue*) params[paramNo-1];
00317         *(Date*)uValue->value = value; 
00318     } else {
00319         cValue = (ConditionValue*) params[paramNo-1];
00320         *(Date*)cValue->value = value;
00321     }
00322     return OK;
00323 }

DbRetVal UpdStatement::setDoubleParam ( int  paramNo,
double  value 
) [virtual]

Implements DmlStatement.

DbRetVal UpdStatement::setDoubleParam ( int  paramNo,
double  value 
) [virtual]

Implements DmlStatement.

Definition at line 261 of file UpdStatement.cxx.

References ErrBadArg, ErrSysFatal, OK, DmlStatement::params, printError, totalAssignParams, DmlStatement::totalParams, ConditionValue::value, and UpdateFieldValue::value.

00262 {
00263     if (paramNo <=0 || paramNo > totalParams) return ErrBadArg;
00264     if (NULL == params[paramNo-1])
00265     {
00266         printError(ErrSysFatal, "param not set. Should never happen");
00267         return ErrSysFatal;
00268     }
00269 
00270     ConditionValue *cValue;
00271     UpdateFieldValue *uValue;
00272     if (paramNo <= totalAssignParams) {
00273         uValue = (UpdateFieldValue*) params[paramNo-1];
00274         *(double*)uValue->value = value; 
00275     } else {
00276         cValue = (ConditionValue*) params[paramNo-1];
00277         *(double*)cValue->value = value;
00278     }
00279     return OK;
00280 }

DbRetVal UpdStatement::setFloatParam ( int  paramNo,
float  value 
) [virtual]

Implements DmlStatement.

DbRetVal UpdStatement::setFloatParam ( int  paramNo,
float  value 
) [virtual]

Implements DmlStatement.

Definition at line 239 of file UpdStatement.cxx.

References ErrBadArg, ErrSysFatal, OK, DmlStatement::params, printError, totalAssignParams, DmlStatement::totalParams, ConditionValue::value, and UpdateFieldValue::value.

00240 {
00241     if (paramNo <=0 || paramNo > totalParams) return ErrBadArg;
00242     if (NULL == params[paramNo-1])
00243     {
00244         printError(ErrSysFatal, "param not set. Should never happen");
00245         return ErrSysFatal;
00246     }
00247 
00248     ConditionValue *cValue;
00249     UpdateFieldValue *uValue;
00250     if (paramNo <= totalAssignParams) {
00251         uValue = (UpdateFieldValue*) params[paramNo-1];
00252         *(float*)uValue->value = value; 
00253     } else {
00254         cValue = (ConditionValue*) params[paramNo-1];
00255         *(float*)cValue->value = value;
00256     }
00257     return OK;
00258 }

DbRetVal UpdStatement::setIntParam ( int  paramNo,
int  value 
) [virtual]

Implements DmlStatement.

DbRetVal UpdStatement::setIntParam ( int  paramNo,
int  value 
) [virtual]

Implements DmlStatement.

Definition at line 156 of file UpdStatement.cxx.

References ErrBadArg, ErrSysFatal, OK, DmlStatement::params, printError, totalAssignParams, DmlStatement::totalParams, ConditionValue::value, and UpdateFieldValue::value.

00157 {
00158     if (paramNo <=0 || paramNo > totalParams) return ErrBadArg;
00159     if (NULL == params[paramNo-1])
00160     {
00161         printError(ErrSysFatal, "param not set. Should never happen");
00162         return ErrSysFatal;
00163     }
00164     ConditionValue *cValue;
00165     UpdateFieldValue *uValue;
00166     if (paramNo <= totalAssignParams) {
00167         uValue = (UpdateFieldValue*) params[paramNo-1];
00168         *(int*)uValue->value = value; 
00169     } else {
00170         cValue = (ConditionValue*) params[paramNo-1];
00171         *(int*)cValue->value = value;
00172     }
00173     return OK;
00174 }

DbRetVal UpdStatement::setLongLongParam ( int  paramNo,
long long  value 
) [virtual]

Implements DmlStatement.

DbRetVal UpdStatement::setLongLongParam ( int  paramNo,
long long  value 
) [virtual]

Implements DmlStatement.

Definition at line 197 of file UpdStatement.cxx.

References ErrBadArg, ErrSysFatal, OK, DmlStatement::params, printError, totalAssignParams, DmlStatement::totalParams, ConditionValue::value, and UpdateFieldValue::value.

00198 {
00199     if (paramNo <=0 || paramNo > totalParams) return ErrBadArg;
00200     if (NULL == params[paramNo-1])
00201     {
00202         printError(ErrSysFatal, "param not set. Should never happen");
00203         return ErrSysFatal;
00204     }
00205 
00206     ConditionValue *cValue;
00207     UpdateFieldValue *uValue;
00208     if (paramNo <= totalAssignParams) {
00209         uValue = (UpdateFieldValue*) params[paramNo-1];
00210         *(long long*)uValue->value = value; 
00211     } else {
00212         cValue = (ConditionValue*) params[paramNo-1];
00213         *(long long*)cValue->value = value;
00214     }
00215     return OK;
00216 }

DbRetVal UpdStatement::setLongParam ( int  paramNo,
long  value 
) [virtual]

Implements DmlStatement.

DbRetVal UpdStatement::setLongParam ( int  paramNo,
long  value 
) [virtual]

Implements DmlStatement.

Definition at line 176 of file UpdStatement.cxx.

References ErrBadArg, ErrSysFatal, OK, DmlStatement::params, printError, totalAssignParams, DmlStatement::totalParams, ConditionValue::value, and UpdateFieldValue::value.

00177 {
00178     if (paramNo <=0 || paramNo > totalParams) return ErrBadArg;
00179     if (NULL == params[paramNo-1])
00180     {
00181         printError(ErrSysFatal, "param not set. Should never happen");
00182         return ErrSysFatal;
00183     }
00184 
00185     ConditionValue *cValue;
00186     UpdateFieldValue *uValue;
00187     if (paramNo <= totalAssignParams) {
00188         uValue = (UpdateFieldValue*) params[paramNo-1];
00189         *(long*)uValue->value = value; 
00190     } else {
00191         cValue = (ConditionValue*) params[paramNo-1];
00192         *(long*)cValue->value = value;
00193     }
00194     return OK;
00195 }

DbRetVal UpdStatement::setParam ( int  paramNo,
void *  value 
) [virtual]

Implements DmlStatement.

DbRetVal UpdStatement::setParam ( int  paramNo,
void *  value 
) [virtual]

Implements DmlStatement.

Definition at line 126 of file UpdStatement.cxx.

References ErrBadArg, OK, DmlStatement::paramValues, and DmlStatement::totalParams.

00127 {
00128     if (paramNo <=0 || paramNo > totalParams) return ErrBadArg;
00129     if (NULL == value) return ErrBadArg;
00130     paramValues[paramNo -1] = (char*) value; 
00131     return OK;
00132 }

DbRetVal UpdStatement::setShortParam ( int  paramNo,
short  value 
) [virtual]

Implements DmlStatement.

DbRetVal UpdStatement::setShortParam ( int  paramNo,
short  value 
) [virtual]

Implements DmlStatement.

Definition at line 134 of file UpdStatement.cxx.

References ErrBadArg, ErrSysFatal, OK, DmlStatement::params, printError, totalAssignParams, DmlStatement::totalParams, ConditionValue::value, and UpdateFieldValue::value.

00135 {
00136     if (paramNo <=0 || paramNo > totalParams) return ErrBadArg;
00137     if (NULL == params[paramNo-1])
00138     {
00139         printError(ErrSysFatal, "param not set. Should never happen");
00140         return ErrSysFatal;
00141     }
00142 
00143     ConditionValue *cValue;
00144     UpdateFieldValue *uValue;
00145     if (paramNo <= totalAssignParams) {
00146         uValue = (UpdateFieldValue*) params[paramNo-1];
00147         *(short*)uValue->value = value; 
00148     } else {
00149         cValue = (ConditionValue*) params[paramNo-1];
00150         *(short*)cValue->value = value;
00151     }
00152     return OK;
00153 }

DbRetVal UpdStatement::setStringParam ( int  paramNo,
char *  value 
) [virtual]

Implements DmlStatement.

DbRetVal UpdStatement::setStringParam ( int  paramNo,
char *  value 
) [virtual]

Implements DmlStatement.

Definition at line 282 of file UpdStatement.cxx.

References ErrBadArg, ErrSysFatal, OK, DmlStatement::params, printError, totalAssignParams, DmlStatement::totalParams, ConditionValue::value, and UpdateFieldValue::value.

00283 {
00284     if (paramNo <=0 || paramNo > totalParams) return ErrBadArg;
00285     if (NULL == params[paramNo-1])
00286     {
00287         printError(ErrSysFatal, "param not set. Should never happen");
00288         return ErrSysFatal;
00289     }
00290 
00291     ConditionValue *cValue;
00292     UpdateFieldValue *uValue;
00293     if (paramNo <= totalAssignParams) {
00294         uValue = (UpdateFieldValue*) params[paramNo-1];
00295         strcpy((char*)uValue->value, value); 
00296     } else {
00297         cValue = (ConditionValue*) params[paramNo-1];
00298         strcpy((char*)cValue->value, value);
00299     }
00300     return OK;
00301 }

DbRetVal UpdStatement::setTimeParam ( int  paramNo,
Time  value 
) [virtual]

Implements DmlStatement.

DbRetVal UpdStatement::setTimeParam ( int  paramNo,
Time  value 
) [virtual]

Implements DmlStatement.

Definition at line 325 of file UpdStatement.cxx.

References ErrBadArg, ErrSysFatal, OK, DmlStatement::params, printError, totalAssignParams, DmlStatement::totalParams, ConditionValue::value, and UpdateFieldValue::value.

00326 {
00327     if (paramNo <=0 || paramNo > totalParams) return ErrBadArg;
00328     if (NULL == params[paramNo-1])
00329     {
00330         printError(ErrSysFatal, "param not set. Should never happen");
00331         return ErrSysFatal;
00332     }
00333 
00334     ConditionValue *cValue;
00335     UpdateFieldValue *uValue;
00336     if (paramNo <= totalAssignParams) {
00337         uValue = (UpdateFieldValue*) params[paramNo-1];
00338         *(Time*)uValue->value = value; 
00339     } else {
00340         cValue = (ConditionValue*) params[paramNo-1];
00341         *(Time*)cValue->value = value;
00342     }
00343     return OK;
00344 }

DbRetVal UpdStatement::setTimeStampParam ( int  paramNo,
TimeStamp  value 
) [virtual]

Implements DmlStatement.

DbRetVal UpdStatement::setTimeStampParam ( int  paramNo,
TimeStamp  value 
) [virtual]

Implements DmlStatement.

Definition at line 347 of file UpdStatement.cxx.

References ErrBadArg, ErrSysFatal, OK, DmlStatement::params, printError, totalAssignParams, DmlStatement::totalParams, ConditionValue::value, and UpdateFieldValue::value.

00348 {
00349     if (paramNo <=0 || paramNo > totalParams) return ErrBadArg;
00350     if (NULL == params[paramNo-1])
00351     {
00352         printError(ErrSysFatal, "param not set. Should never happen");
00353         return ErrSysFatal;
00354     }
00355 
00356     ConditionValue *cValue;
00357     UpdateFieldValue *uValue;
00358     if (paramNo <= totalAssignParams) {
00359         uValue = (UpdateFieldValue*) params[paramNo-1];
00360         *(TimeStamp*)uValue->value = value; 
00361     } else {
00362         cValue = (ConditionValue*) params[paramNo-1];
00363         *(TimeStamp*)cValue->value = value;
00364     }
00365     return OK;
00366 }


Field Documentation

int UpdStatement::totalAssignParams

Definition at line 187 of file Statement.h.

Referenced by execute(), getParamFldInfo(), getParamValuePtr(), resolveForAssignment(), setByteIntParam(), setDateParam(), setDoubleParam(), setFloatParam(), setIntParam(), setLongLongParam(), setLongParam(), setShortParam(), setStringParam(), setTimeParam(), setTimeStampParam(), and UpdStatement().


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