AlexRO
Well Known Member
Hello all,
I have a little trouble with a cache fetch. Here is my scenario:
I initialize the cache, I insert records in it, but when I try to fetch a position based on a index it fails to retrieve anything and I know the record is inserted because if I don't find any record I try to insert it and it fails also (unique index)
. I'm attaching some source code for you all to diagnose.
Cache Initialization: <font color="green"> (works) </font>
Index->nNumSegments = 1;
Index->CacheKey[0].nOffset = offsetof(DSDQ480901, szCorrAccNumber1);
Index->CacheKey[0].nSize = DIM(dsCacheStruct.szCorrAccNumber1);
Index->CacheKey[0].idDataType = EVDT_STRING;
jdeCacheCode = jdeCacheInit (hUser, lphCache, lpDS->szCacheName, Index);
Cache write: <font color="green"> (works) </font>
jdeStrncpy(dsCacheStruct.szAccountId, (const JCHAR*)(lpDS->szAccountId), DIM(dsCacheStruct.szAccountId));
dsCacheStruct.mnDebitAmountField = (lpDS->mnDebitAmountField);
dsCacheStruct.mnCreditAmountField = (lpDS->mnCreditAmountField);
jdeStrncpy(dsCacheStruct.szCorrAccNumber1, (const JCHAR*)(lpDS->szCorrAccNumber1),DIM(dsCacheStruct.szCorrAccNumber1));
jdeCacheCode = jdeCacheAdd(hCache, (void*) &dsCacheStruct, sizeof(dsCacheStruct));
Cache Fetch: <font color="red"> (fails) </font>
jdeStrncpy(dsCacheKey.szCorrAccNumber1,lpDS->szCorrAccNumber1, DIM(dsCacheKey.szCorrAccNumber1));
jdeCacheCode = jdeCacheFetchPosition(hCache, hCursor,&dsCacheKey, (short) 1, &dsCacheStruct, sizeof(dsCacheStruct));
if (jdeCacheCode == JDECM_PASSED)
{
Cache write: <font color="red"> (fails) </font>
}
Alex.
I have a little trouble with a cache fetch. Here is my scenario:
I initialize the cache, I insert records in it, but when I try to fetch a position based on a index it fails to retrieve anything and I know the record is inserted because if I don't find any record I try to insert it and it fails also (unique index)
Cache Initialization: <font color="green"> (works) </font>
Index->nNumSegments = 1;
Index->CacheKey[0].nOffset = offsetof(DSDQ480901, szCorrAccNumber1);
Index->CacheKey[0].nSize = DIM(dsCacheStruct.szCorrAccNumber1);
Index->CacheKey[0].idDataType = EVDT_STRING;
jdeCacheCode = jdeCacheInit (hUser, lphCache, lpDS->szCacheName, Index);
Cache write: <font color="green"> (works) </font>
jdeStrncpy(dsCacheStruct.szAccountId, (const JCHAR*)(lpDS->szAccountId), DIM(dsCacheStruct.szAccountId));
dsCacheStruct.mnDebitAmountField = (lpDS->mnDebitAmountField);
dsCacheStruct.mnCreditAmountField = (lpDS->mnCreditAmountField);
jdeStrncpy(dsCacheStruct.szCorrAccNumber1, (const JCHAR*)(lpDS->szCorrAccNumber1),DIM(dsCacheStruct.szCorrAccNumber1));
jdeCacheCode = jdeCacheAdd(hCache, (void*) &dsCacheStruct, sizeof(dsCacheStruct));
Cache Fetch: <font color="red"> (fails) </font>
jdeStrncpy(dsCacheKey.szCorrAccNumber1,lpDS->szCorrAccNumber1, DIM(dsCacheKey.szCorrAccNumber1));
jdeCacheCode = jdeCacheFetchPosition(hCache, hCursor,&dsCacheKey, (short) 1, &dsCacheStruct, sizeof(dsCacheStruct));
if (jdeCacheCode == JDECM_PASSED)
{
Cache write: <font color="red"> (fails) </font>
}
Alex.