SelStatement Class Reference

#include <Statement.h>

Inheritance diagram for SelStatement:

Inheritance graph
[legend]
Collaboration diagram for SelStatement:

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 close ()
DbRetVal resolve ()
 SelStatement ()
 ~SelStatement ()
DbRetVal setBindField (int pos, void *value)
int noOfProjFields ()
DbRetVal getProjFldInfo (int projpos, FieldInfo *&fInfo)
DbRetVal getParamFldInfo (int paramPos, FieldInfo *&info)
void * fetch ()
void * fetch (DbRetVal &rv)
void * fetchAndPrint (bool SQL)
void * next ()
void * getFieldValuePtr (int)
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 close ()
DbRetVal resolve ()
 SelStatement ()
 ~SelStatement ()
DbRetVal setBindField (int pos, void *value)
int noOfProjFields ()
DbRetVal getProjFldInfo (int projpos, FieldInfo *&fInfo)
DbRetVal getParamFldInfo (int paramPos, FieldInfo *&info)
void * getParamValuePtr (int)
DataType getFieldType (int)
int getFieldLength (int)
char * getFieldName (int)
void * fetch ()
void * fetch (DbRetVal &rv)
void * fetchAndPrint (bool SQL)
void * next ()
void * getFieldValuePtr (int)

Data Fields

FieldValue ** bindFields
char ** bindFieldValues
int totalFields
FieldValue ** bindFields
char ** bindFieldValues

Detailed Description

Definition at line 115 of file Statement.h.


Constructor & Destructor Documentation

SelStatement::SelStatement (  ) 

Definition at line 18 of file SelStatement.cxx.

References bindFields, bindFieldValues, Statement::dbMgr, DmlStatement::params, DmlStatement::paramValues, Statement::parsedData, DmlStatement::table, totalFields, and DmlStatement::totalParams.

00019 {
00020     parsedData = NULL; 
00021     dbMgr = NULL; 
00022     table = NULL;
00023     params = NULL;
00024     paramValues = NULL;
00025     totalParams = 0;
00026     bindFields = NULL;
00027     bindFieldValues = NULL;
00028     totalFields = 0;
00029 }

SelStatement::~SelStatement (  ) 

Definition at line 31 of file SelStatement.cxx.

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

00032 {
00033     if (table) {
00034         table->setCondition(NULL);
00035         if (dbMgr) dbMgr->closeTable(table);
00036     }
00037     if (totalParams) {
00038         free(params);
00039         params =  NULL;
00040         free(paramValues);
00041         paramValues = NULL;
00042     }
00043     if (totalFields)
00044     {
00045         free(bindFields);
00046         bindFields =  NULL;
00047         free(bindFieldValues);
00048         bindFieldValues = NULL;
00049 
00050     }
00051 }

Here is the call graph for this function:

SelStatement::SelStatement (  ) 

SelStatement::~SelStatement (  ) 


Member Function Documentation

DbRetVal SelStatement::close (  ) 

DbRetVal SelStatement::close (  ) 

Definition at line 492 of file SelStatement.cxx.

References Table::close(), and DmlStatement::table.

Referenced by SqlStatement::close().

00493 {
00494     return table->close();
00495 }

Here is the call graph for this function:

Here is the caller graph for this function:

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

Implements DmlStatement.

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

Implements DmlStatement.

Definition at line 65 of file SelStatement.cxx.

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

00066 {
00067     DbRetVal rv = OK;
00068     //copy param values to binded buffer
00069     ConditionValue *value;
00070     for (int i = 0; i < totalParams; i ++)
00071     {
00072         value = (ConditionValue*) params[i];
00073         if (paramValues[i] == NULL) 
00074         {
00075             continue;
00076             //printError(ErrBadCall, "param values not set");
00077             //return ErrBadCall;
00078         }
00079         AllDataType::copyVal(value->value, paramValues[i], value->type, value->length);
00080     }
00081     rv = table->execute();
00082     return rv;
00083 }

Here is the call graph for this function:

void* SelStatement::fetch ( DbRetVal rv  ) 

void* SelStatement::fetch (  ) 

void * SelStatement::fetch ( DbRetVal rv  ) 

Definition at line 473 of file SelStatement.cxx.

References bindFields, bindFieldValues, AllDataType::copyVal(), ErrBadCall, Table::fetch(), FieldValue::length, printError, DmlStatement::table, totalFields, FieldValue::type, and FieldValue::value.

00474 {
00475     void *tuple = table->fetch(rv);
00476     if (NULL == tuple) return NULL;
00477     //copy values to binded buffer
00478     FieldValue *value;
00479     for (int i = 0; i < totalFields; i++)
00480     {
00481         value = bindFields[i];
00482         if (bindFieldValues[i] == NULL) 
00483         {
00484             printError(ErrBadCall, "Fields are not binded properly. Should never happen");
00485             return NULL;
00486         }
00487         AllDataType::copyVal(bindFieldValues[i], value->value, value->type, value->length);
00488     }
00489     return tuple;
00490 }

Here is the call graph for this function:

void * SelStatement::fetch (  ) 

Definition at line 454 of file SelStatement.cxx.

References bindFields, bindFieldValues, AllDataType::copyVal(), ErrBadCall, Table::fetch(), FieldValue::length, printError, DmlStatement::table, totalFields, FieldValue::type, and FieldValue::value.

Referenced by SqlStatement::fetch().

00455 {
00456     void *tuple = table->fetch();
00457     if (NULL == tuple) return NULL;
00458     //copy values to binded buffer
00459     FieldValue *value;
00460     for (int i = 0; i < totalFields; i++)
00461     {
00462         value = bindFields[i];
00463         if (bindFieldValues[i] == NULL) 
00464         {
00465             printError(ErrBadCall, "Fields are not binded properly. Should never happen");
00466             return NULL;
00467         }
00468         AllDataType::copyVal(bindFieldValues[i], value->value, value->type, value->length);
00469     }
00470     return tuple;
00471 }

Here is the call graph for this function:

Here is the caller graph for this function:

void* SelStatement::fetchAndPrint ( bool  SQL  ) 

void * SelStatement::fetchAndPrint ( bool  SQL  ) 

Definition at line 536 of file SelStatement.cxx.

References bindFields, Table::fetch(), Table::getName(), Table::isFldNull(), FieldValue::length, AllDataType::printVal(), stmt, DmlStatement::table, totalFields, FieldValue::type, typeDate, typeString, typeTime, typeTimeStamp, and FieldValue::value.

Referenced by SqlStatement::fetchAndPrint().

00537 {
00538     void *tuple = table->fetch();
00539     if (NULL == tuple) return NULL;
00540     FieldValue *value;
00541     bool nullValueSet;
00542     char stmt[128];
00543     if (SQL) {
00544         sprintf(stmt, "INSERT INTO %s VALUES(", table->getName());
00545         printf("%s", stmt);
00546     }
00547     for (int i = 0; i < totalFields; i++)
00548     {
00549         value = bindFields[i];
00550         nullValueSet = table->isFldNull(i+1);
00551         if (nullValueSet) 
00552             if (SQL) { 
00553                 if (i==0) 
00554                     printf("NULL"); 
00555                 else
00556                     printf(", NULL"); 
00557             }
00558             else printf("NULL\t");
00559         else  {
00560             if (SQL) {
00561                 switch(value->type)
00562                 {
00563                     case typeString:
00564                     case typeDate:
00565                     case typeTime:
00566                     case typeTimeStamp:
00567                     {
00568                         if (i==0) 
00569                             printf(" '"); 
00570                         else
00571                             printf(", '");
00572                         break;
00573                     }
00574                     default:
00575                     {
00576                         if (i!=0) 
00577                            printf(",");
00578                     }
00579                 }
00580             }
00581             AllDataType::printVal(value->value, value->type, value->length);
00582             if (SQL) {
00583                 switch(value->type)
00584                 {
00585                     case typeString:
00586                     case typeDate:
00587                     case typeTime:
00588                     case typeTimeStamp:
00589                         printf("'");
00590                 }
00591             } else printf("\t");
00592         }
00593     }
00594     if (SQL) printf(");\n");
00595     return tuple;
00596 }

Here is the call graph for this function:

Here is the caller graph for this function:

int SelStatement::getFieldLength ( int   ) 

Definition at line 530 of file SelStatement.cxx.

References bindFields, and FieldValue::type.

Referenced by SqlStatement::getFieldLength().

00531 {
00532     FieldValue *v = bindFields[pos];
00533     return ( (int) v->type );
00534 }

Here is the caller graph for this function:

char * SelStatement::getFieldName ( int   ) 

Definition at line 502 of file SelStatement.cxx.

References ErrSysFatal, FieldName::fldName, ParsedData::getFieldNameList(), List::getIterator(), ListIterator::hasElement(), ListIterator::nextElement(), Statement::parsedData, and printError.

Referenced by SqlStatement::getFieldName().

00503 {
00504     //TODO::if not yet prepared return error
00505     //TODO::check the upper limit for projpos
00506     ListIterator iter = parsedData->getFieldNameList().getIterator();
00507     int position =0;
00508     while (iter.hasElement())
00509     {
00510         if (position == pos) {
00511               FieldName *name = (FieldName*) iter.nextElement();
00512               if (NULL == name)
00513               {
00514                   printError(ErrSysFatal, "Should never happen. Field Name list has NULL");
00515                   return (char*) 0;
00516               }
00517               return name->fldName;
00518       }
00519         position++;
00520     }
00521     return (char*) 0;
00522 }

Here is the call graph for this function:

Here is the caller graph for this function:

DataType SelStatement::getFieldType ( int   ) 

Definition at line 524 of file SelStatement.cxx.

References bindFields, and FieldValue::type.

Referenced by SqlStatement::getFieldType().

00525 {
00526     FieldValue *v = bindFields[pos];
00527     return ( (DataType) v->type );
00528 }

Here is the caller graph for this function:

void* SelStatement::getFieldValuePtr ( int   ) 

void * SelStatement::getFieldValuePtr ( int   ) 

Definition at line 603 of file SelStatement.cxx.

References bindFields, and FieldValue::value.

Referenced by SqlStatement::getFieldValuePtr().

00604 {
00605     FieldValue *v = bindFields[pos];
00606     return ( (void*) v->value );
00607 }

Here is the caller graph for this function:

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

Implements DmlStatement.

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

Implements DmlStatement.

Definition at line 52 of file SelStatement.cxx.

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

00053 {
00054     if (paramNo <=0 || paramNo > totalParams) return ErrBadArg;
00055     ConditionValue *cValue = (ConditionValue*) params [paramNo-1];
00056     if (NULL == cValue)
00057     {
00058         printError(ErrSysFatal, "condition value is null. Should never happen");
00059         return ErrSysFatal;
00060     }
00061     info->type = cValue->type;
00062     info->length = cValue->length;
00063     return OK;
00064 }

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

Implements DmlStatement.

Definition at line 496 of file SelStatement.cxx.

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

00497 {
00498     ConditionValue *p = (ConditionValue*) params [pos-1];
00499     return ( (void*) p->value );
00500 }

DbRetVal SelStatement::getProjFldInfo ( int  projpos,
FieldInfo *&  fInfo 
)

DbRetVal SelStatement::getProjFldInfo ( int  projpos,
FieldInfo *&  fInfo 
)

Definition at line 614 of file SelStatement.cxx.

References ErrSysFatal, FieldName::fldName, Table::getFieldInfo(), ParsedData::getFieldNameList(), List::getIterator(), ListIterator::hasElement(), ListIterator::nextElement(), OK, Statement::parsedData, printError, and DmlStatement::table.

Referenced by SqlStatement::getProjFldInfo().

00615 {
00616     //TODO::if not yet prepared return error
00617     //TODO::check the upper limit for projpos
00618     ListIterator iter = parsedData->getFieldNameList().getIterator();
00619     FieldName *name = NULL;
00620     DbRetVal rv = OK;
00621     int position =0;
00622     while (iter.hasElement())
00623     {
00624         name = (FieldName*)iter.nextElement();
00625         if (NULL == name) 
00626         {
00627             printError(ErrSysFatal, "Should never happen. Field Name list has NULL");
00628             return ErrSysFatal;
00629         }
00630         if (position == projpos) break;
00631         position++;
00632     }
00633 
00634     rv = table->getFieldInfo(name->fldName, fInfo);
00635 }

Here is the call graph for this function:

Here is the caller graph for this function:

void* SelStatement::next (  ) 

void * SelStatement::next (  ) 

Definition at line 598 of file SelStatement.cxx.

References Table::fetch(), and DmlStatement::table.

Referenced by SqlStatement::next().

00599 {
00600     return( table->fetch() );
00601 }

Here is the call graph for this function:

Here is the caller graph for this function:

int SelStatement::noOfProjFields (  ) 

int SelStatement::noOfProjFields (  ) 

Definition at line 609 of file SelStatement.cxx.

References totalFields.

Referenced by SqlStatement::noOfProjFields().

00610 {
00611     return totalFields;
00612 }

Here is the caller graph for this function:

DbRetVal SelStatement::resolve (  )  [virtual]

Implements DmlStatement.

DbRetVal SelStatement::resolve (  )  [virtual]

Implements DmlStatement.

Definition at line 238 of file SelStatement.cxx.

References AllDataType::alloc(), Table::bindFld(), DatabaseManager::closeTable(), Statement::dbMgr, ErrNoConnection, ErrNotExists, ErrNotFound, ErrSyntaxError, ErrSysFatal, FieldName::fldName, ParsedData::getCondition(), Table::getFieldInfo(), ParsedData::getFieldNameList(), List::getIterator(), ParsedData::getTableName(), ListIterator::hasElement(), ParsedData::insertFieldValue(), FieldInfo::length, FieldValue::length, ListIterator::nextElement(), OK, DatabaseManager::openTable(), FieldValue::paramNo, Statement::parsedData, FieldValue::parsedString, printError, ListIterator::reset(), Table::setCondition(), DmlStatement::table, FieldInfo::type, FieldValue::type, and FieldValue::value.

00239 {
00240     if (dbMgr == NULL) return ErrNoConnection;
00241     //check whether the table exists
00242     table = dbMgr->openTable(parsedData->getTableName());
00243     if (table == NULL) 
00244     {
00245         printError(ErrNotExists, "Unable to open the table:Table not exists");
00246         return ErrNotExists;
00247     }
00248     //get the fieldname list and validate field names
00249     ListIterator iter = parsedData->getFieldNameList().getIterator();
00250     FieldName *name = NULL;
00251     FieldInfo *fInfo = new FieldInfo();
00252     DbRetVal rv = OK;
00253     while (iter.hasElement())
00254     {
00255         name = (FieldName*)iter.nextElement();
00256         if (NULL == name) 
00257         {
00258             dbMgr->closeTable(table);
00259             table = NULL;
00260             delete fInfo;
00261             printError(ErrSysFatal, "Should never happen. Field Name list has NULL");
00262             return ErrSysFatal;
00263         }
00264         if ('*' == name->fldName[0]) 
00265         {
00266             iter.reset();
00267             while (iter.hasElement())
00268                 delete (FieldName *) iter.nextElement();
00269             rv = resolveStar();
00270             if (rv != OK)
00271             { 
00272                 dbMgr->closeTable(table);
00273                 table = NULL;
00274                 delete fInfo; 
00275                 return rv; 
00276             }
00277             //as soon as it encounters *, it breaks the loop negleting other field names
00278             //as they all are deleted during resolveStar method.
00279             break;
00280         } else {
00281             rv = table->getFieldInfo(name->fldName, fInfo);
00282             if (ErrNotFound == rv)
00283             {
00284                 dbMgr->closeTable(table);
00285                 table = NULL;
00286                 delete fInfo;
00287                 printError(ErrSyntaxError, "Field %s does not exist in table", 
00288                                         name->fldName);
00289                 return ErrSyntaxError;
00290             }
00291             FieldValue *newVal = new FieldValue();
00292             newVal->parsedString = NULL;
00293             newVal->paramNo = 0;
00294             newVal->type = fInfo->type;
00295             newVal->length = fInfo->length;
00296             newVal->value = AllDataType::alloc(fInfo->type, fInfo->length);
00297             parsedData->insertFieldValue(newVal);
00298             table->bindFld(name->fldName, newVal->value);
00299         }
00300     }
00301     delete fInfo;
00302 
00303     rv = setBindFieldAndValues();
00304     if (rv != OK) 
00305     {
00306         dbMgr->closeTable(table);
00307         table = NULL;
00308         return rv;
00309     }
00310 
00311     table->setCondition(parsedData->getCondition());
00312 
00313     rv = resolveForCondition();
00314     if (rv != OK) 
00315     {
00316         //TODO::free memory allocated for params
00317         table->setCondition(NULL);
00318         dbMgr->closeTable(table);
00319         table = NULL;
00320     }
00321     return rv;
00322 }

Here is the call graph for this function:

DbRetVal SelStatement::setBindField ( int  pos,
void *  value 
)

DbRetVal SelStatement::setBindField ( int  pos,
void *  value 
)

Definition at line 228 of file SelStatement.cxx.

References bindFieldValues, ErrBadArg, and OK.

Referenced by SqlStatement::bindField().

00229 {
00230     if (colNo <=0) return ErrBadArg;
00231     //TODO: check the upper limit
00232     //if (colNo > table->getFieldNameList().size()) return ErrBadArg;
00233     if (NULL == value) return ErrBadArg;
00234     bindFieldValues[colNo -1] = (char*) value; 
00235     return OK;
00236 }

Here is the caller graph for this function:

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

Implements DmlStatement.

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

Implements DmlStatement.

Definition at line 143 of file SelStatement.cxx.

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

00144 {
00145     if (paramNo <=0 || paramNo > totalParams) return ErrBadArg;
00146     ConditionValue *cValue = (ConditionValue*) params [paramNo-1];
00147     if (NULL == cValue)
00148     {
00149         printError(ErrSysFatal, "condition value is null. Should never happen");
00150         return ErrSysFatal;
00151     }
00152     *(ByteInt*)cValue->value = value; 
00153     return OK;
00154 }

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

Implements DmlStatement.

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

Implements DmlStatement.

Definition at line 191 of file SelStatement.cxx.

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

00192 {
00193     if (paramNo <=0 || paramNo > totalParams) return ErrBadArg;
00194     ConditionValue *cValue = (ConditionValue*) params [paramNo-1];
00195     if (NULL == cValue)
00196     {
00197         printError(ErrSysFatal, "condition value is null. Should never happen");
00198         return ErrSysFatal;
00199     }
00200     *(Date*)cValue->value = value; 
00201     return OK;
00202 }

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

Implements DmlStatement.

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

Implements DmlStatement.

Definition at line 167 of file SelStatement.cxx.

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

00168 {
00169     if (paramNo <=0 || paramNo > totalParams) return ErrBadArg;
00170     ConditionValue *cValue = (ConditionValue*) params [paramNo-1];
00171     if (NULL == cValue)
00172     {
00173         printError(ErrSysFatal, "condition value is null. Should never happen");
00174         return ErrSysFatal;
00175     }
00176     *(double*)cValue->value = value; 
00177     return OK;
00178 }

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

Implements DmlStatement.

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

Implements DmlStatement.

Definition at line 155 of file SelStatement.cxx.

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

00156 {
00157     if (paramNo <=0 || paramNo > totalParams) return ErrBadArg;
00158     ConditionValue *cValue = (ConditionValue*) params [paramNo-1];
00159     if (NULL == cValue)
00160     {
00161         printError(ErrSysFatal, "condition value is null. Should never happen");
00162         return ErrSysFatal;
00163     }
00164     *(float*)cValue->value = value; 
00165     return OK;
00166 }

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

Implements DmlStatement.

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

Implements DmlStatement.

Definition at line 106 of file SelStatement.cxx.

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

00107 {
00108     if (paramNo <=0 || paramNo > totalParams) return ErrBadArg;
00109     ConditionValue *cValue = (ConditionValue*) params [paramNo-1];
00110     if (NULL == cValue)
00111     {
00112         printError(ErrSysFatal, "condition value is null. Should never happen");
00113         return ErrSysFatal;
00114     }
00115     *(int*)cValue->value = value; 
00116     return OK;
00117 }

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

Implements DmlStatement.

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

Implements DmlStatement.

Definition at line 131 of file SelStatement.cxx.

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

00132 {
00133     if (paramNo <=0 || paramNo > totalParams) return ErrBadArg;
00134     ConditionValue *cValue = (ConditionValue*) params [paramNo-1];
00135     if (NULL == cValue)
00136     {
00137         printError(ErrSysFatal, "condition value is null. Should never happen");
00138         return ErrSysFatal;
00139     }
00140     *(long long*)cValue->value = value; 
00141     return OK;
00142 }

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

Implements DmlStatement.

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

Implements DmlStatement.

Definition at line 118 of file SelStatement.cxx.

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

00119 {
00120     if (paramNo <=0 || paramNo > totalParams) return ErrBadArg;
00121     ConditionValue *cValue = (ConditionValue*) params [paramNo-1];
00122     if (NULL == cValue)
00123     {
00124         printError(ErrSysFatal, "condition value is null. Should never happen");
00125         return ErrSysFatal;
00126     }
00127     *(long*)cValue->value = value; 
00128     return OK;
00129 }

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

Implements DmlStatement.

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

Implements DmlStatement.

Definition at line 85 of file SelStatement.cxx.

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

00086 {
00087     if (paramNo <=0 || paramNo > totalParams) return ErrBadArg;
00088     if (NULL == value) return ErrBadArg;
00089     paramValues[paramNo -1] = (char*) value; 
00090     return OK;
00091 }

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

Implements DmlStatement.

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

Implements DmlStatement.

Definition at line 93 of file SelStatement.cxx.

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

00094 {
00095     if (paramNo <=0 || paramNo > totalParams) return ErrBadArg;
00096     ConditionValue *cValue = (ConditionValue*) params [paramNo-1];
00097     if (NULL == cValue)
00098     {
00099         printError(ErrSysFatal, "field value is null. Should never happen");
00100         return ErrSysFatal;
00101     }
00102     *(short*)cValue->value = value; 
00103     return OK;
00104 }

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

Implements DmlStatement.

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

Implements DmlStatement.

Definition at line 179 of file SelStatement.cxx.

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

00180 {
00181     if (paramNo <=0 || paramNo > totalParams) return ErrBadArg;
00182     ConditionValue *cValue = (ConditionValue*) params [paramNo-1];
00183     if (NULL == cValue)
00184     {
00185         printError(ErrSysFatal, "condition value is null. Should never happen");
00186         return ErrSysFatal;
00187     }
00188     strcpy((char*)cValue->value, value);
00189     return OK;
00190 }

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

Implements DmlStatement.

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

Implements DmlStatement.

Definition at line 203 of file SelStatement.cxx.

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

00204 {
00205     if (paramNo <=0 || paramNo > totalParams) return ErrBadArg;
00206     ConditionValue *cValue = (ConditionValue*) params [paramNo-1];
00207     if (NULL == cValue)
00208     {
00209         printError(ErrSysFatal, "condition value is null. Should never happen");
00210         return ErrSysFatal;
00211     }
00212     *(Time*)cValue->value = value; 
00213     return OK;
00214 }

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

Implements DmlStatement.

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

Implements DmlStatement.

Definition at line 215 of file SelStatement.cxx.

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

00216 {
00217     if (paramNo <=0 || paramNo > totalParams) return ErrBadArg;
00218     ConditionValue *cValue = (ConditionValue*) params [paramNo-1];
00219     if (NULL == cValue)
00220     {
00221         printError(ErrSysFatal, "condition value is null. Should never happen");
00222         return ErrSysFatal;
00223     }
00224     *(TimeStamp*)cValue->value = value;
00225     return OK;
00226 }


Field Documentation

FieldValue** SelStatement::bindFields

Definition at line 125 of file Statement.h.

FieldValue** SelStatement::bindFields

Definition at line 123 of file Statement.h.

Referenced by fetch(), fetchAndPrint(), getFieldLength(), getFieldType(), getFieldValuePtr(), SelStatement(), and ~SelStatement().

char** SelStatement::bindFieldValues

Definition at line 126 of file Statement.h.

char** SelStatement::bindFieldValues

Definition at line 124 of file Statement.h.

Referenced by fetch(), SelStatement(), setBindField(), and ~SelStatement().

int SelStatement::totalFields

Definition at line 125 of file Statement.h.

Referenced by fetch(), fetchAndPrint(), noOfProjFields(), SelStatement(), and ~SelStatement().


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