add increase

pull/1/head
deffpuzzl 2018-05-31 21:36:12 +08:00
parent dca864525e
commit 2a92ba8a4b
2 changed files with 35 additions and 2 deletions

View File

@ -37,7 +37,7 @@ typedef long CREATE;
/*************************************************************************************************
custom macro
*************************************************************************************************/
#define FIELD_SEL 512
#define FIELD_INCR 512
#define FIRST_ROW 256
#define ORDER_DESC 128
#define ORDER_ASC 64
@ -358,7 +358,7 @@ typedef long CREATE;
(s).f = v;
#define decorate(p,d,f,v) vSetDecorate(&p->stUpdt, FLEN(d, f), FPOS(d, f), v); \
p->lFind = (v) & FIRST_ROW;
p->lFind = p->lFind | (v);
#define stringreset(s,f,v) strncpy((s).f, v, sizeof((s).f));
#define stringresetv(s,f,...) snprintf((s).f, sizeof((s).f), __VA_ARGS__);

View File

@ -6434,6 +6434,36 @@ long _lInsertTruck(SATvm *pstSavm, void *pvAddr, TABLE t, SHTruck *pstTruck,
return RC_SUCC;
}
/*************************************************************************************************
descriptionincreate field
parameters:
pstCond --decoreate condit
pvData --memory address
pe --Table struct define
return:
*************************************************************************************************/
void vIncrease(FdCond *pstCond, char *pvData, TblDef *pe)
{
register int i = 0;
FdKey *pFdKey;
if(0 == pstCond->uFldcmp)
return ;
for(i = 0; i < pstCond->uFldcmp; i ++)
{
pFdKey = &pstCond->stFdKey[i];
if(!(pFdKey->uDecorate & FIELD_INCR))
continue;
if(pFdKey->uFldlen < sizeof(llong))
continue;
pe->m_lExSeQ ++;
memcpy(pvData + pFdKey->uFldpos, &pe->m_lExSeQ, sizeof(llong));
}
}
/*************************************************************************************************
descriptioninsert data to table
parameters:
@ -6455,6 +6485,9 @@ long __lInsert(SATvm *pstSavm, void *pvAddr, TABLE t, ulong uTimes)
return RC_FAIL;
}
if(FIELD_INCR & pstSavm->lFind)
vIncrease(&pstSavm->stUpdt, (char *)pstSavm->pstVoid, (TblDef *)pvAddr);
if(HAVE_UNIQ_IDX(t))
{
if(RC_SUCC != _lInsertIndex(pstSavm, pvAddr, t, &pstTruck))