1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
| requete de lecture
cmd.prints(" select CNCT_SCHED_TYPE, CNCT_START_TIME, CNCT_STOP_TIME, "
" CNCT_OVBOOK_FACT "
" from CNCT "
" where CNCT_ID = %d",
itsCnctId);
if (itsDBMgrPtr->ACOMDBM_Select(cmd.gets()))
{
if (itsDBMgrPtr->ACOMDBM_NextRow())
{
int schedType;
tm startTime;
tm stopTime;
itsDBMgrPtr->ACOMDBM_Get(schedType);
itsDBMgrPtr->ACOMDBM_GetDate(startTime);
itsDBMgrPtr->ACOMDBM_GetDate(stopTime);
itsDBMgrPtr->ACOMDBM_Get(itsOverBookingFactor);
// Clear database process buffer
itsDBMgrPtr->ACOMDBM_CancelRequest();
itsScheduleType = (Schedule_Type) schedType;
itsStartTime = startTime;
itsStopTime = stopTime;
}
================================================
code de la méthode ACOMDBM_Get(itsOverBookingFactor);
int ACOMDBM_DataBaseManager::ACOMDBM_Get(double& reel)
{
char str[8196];
if (! ACOMDBM_Get(str)) return 0;
reel = atof(str);
return 1;
}
int ACOMDBM_DataBaseManager::ACOMDBM_Get(char* str)
{
if (num_col > nbr_col) {
itsLogMgr->error("error ACOMDBM_Get() : no more column");
return 0;
}
DBINT data_len = dbdatlen(dbproc, num_col);
int data_type = dbcoltype(dbproc, num_col);
BYTE* data = dbdata(dbproc, num_col);
if (data) {
DBINT maxcollen = dbcollen(dbproc, num_col);
DBINT result = dbconvert(dbproc, data_type, data, data_len, SYBCHAR,(BYTE*) str, -1);
if ((result == FAIL) || (result == -1)) {
itsLogMgr->error("error ACOMDBM_Get(char* str) sur dbconvert()");
return 0;
}
}
else {
*str = 0;
}
num_col++;
return 1;
} |
Partager