add increase

pull/1/head
deffpuzzl 2018-06-01 13:04:49 +08:00
parent 2a92ba8a4b
commit 1ce47a8d64
17 changed files with 87 additions and 29 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
demo/drop

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -26,13 +26,14 @@ long lInsertUserInfo()
}
memset(&stUser, 0, sizeof(dbUser));
stUser.acct_id = 10021; // 对结构体赋值
// stUser.acct_id = 10021; // 对结构体赋值
strcpy(stUser.user_no, "20180223"); // 对结构体赋值
strcpy(stUser.user_type, "1"); // 对结构体赋值
strcpy(stUser.user_nm, "Savens Liu"); // 对结构体赋值
strcpy(stUser.user_addr, "China"); // 对结构体赋值
strcpy(stUser.user_phone, "18672911111"); // 对结构体赋值
defineinit(pstSavm, stUser, TBL_USER_INFO); // 绑定变量
decorate(pstSavm, dbUser, acct_id, FIELD_INCR); // 自增llong型
if(RC_SUCC != lInsert(pstSavm)) // 插入记录
{

View File

@ -1,6 +1,6 @@
INCDIR= -I/usr/include -I$(HOME)/include -I./ -I./include -I../include
LIBDIR= -L$(HOME)/lib -L../lib -lstvm -lm -lc -ldl -lpthread
CC=cc -fPIC
CC=cc -fPIC -g
CO=-c -pg
OUTLIB=../lib
OUTBIN=../bin

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -4,8 +4,9 @@ AR=ar
LD=ld
LN=ln
#CC=cc -fPIC -O2 -Wno-unused-result -m64 -march=native
CC=cc -fPIC -O2 -Wno-unused-result -march=native
CO=-c -g -O2 -DMAX_INDEX_LEN=64 -DMAX_FILED_NUM=64 -Wno-unused-result
#CC=cc -fPIC -O2 -Wno-unused-result -march=native
CC=cc -fPIC -Wno-unused-result
CO=-c -g -DMAX_INDEX_LEN=64 -DMAX_FILED_NUM=64 -Wno-unused-result
LDFLAG=-shared -g
OUTLIB=../lib
OUTBIN=../bin

View File

@ -1006,6 +1006,26 @@ long lDefineTable(char *pszCreate, char *pszTable)
return RC_SUCC;
}
/**************************************************************************************************
descriptionappend table to tab list
parameters
return
**************************************************************************************************/
void vAppendTabList(char *pszTable)
{
long lLen = 0;
lLen = strlen(g_stCustom.m_pszWord);
lLen += strlen(pszTable) + 1;
if(lLen > ALLOC_CMD_LEN)
return ;
strcat(g_stCustom.m_pszWord, supper(pszTable));
strcat(g_stCustom.m_pszWord, ",");
g_stCustom.m_lWord = lgetstrnum(g_stCustom.m_pszWord, ",");
return ;
}
/*************************************************************************************************
descriptioncreate table by file
parameters
@ -1067,7 +1087,7 @@ long lCreateByFile(char *pszFile)
return RC_FAIL;
fprintf(stdout, "---(%s) was created ---\n", szTable);
vAppendTabList(szTable);
TFree(pszCreate);
return RC_SUCC;
@ -3770,15 +3790,8 @@ void vInitTableList(SATvm *pstSavm, bool bRmt)
return ;
for(i = 0, lRet = strlen(g_stCustom.m_pszWord); i < lRows; i ++)
{
lRet += strlen(pstIndex[i].m_szTable) + 1;
if(lRet > ALLOC_CMD_LEN)
break;
strcat(g_stCustom.m_pszWord, pstIndex[i].m_szTable);
strcat(g_stCustom.m_pszWord, ",");
}
vAppendTabList(pstIndex[i].m_szTable);
g_stCustom.m_lWord = lgetstrnum(g_stCustom.m_pszWord, ",");
TFree(pstIndex);
return ;
}

View File

@ -1340,6 +1340,7 @@ long lEventOperate(SATvm *pstSavm, SKCon *pstCon, TFace *pstFace, char *pvDat
{
lData = pstFace->m_lDLen + sizeof(TFace);
pstFace->m_lRows = pstSavm->m_lEffect;
pstFace->m_lDLen = pstSavm->m_lEType;
}
lSendBuffer(pstCon->m_skSock, (void *)pstFace, lData);
@ -1347,8 +1348,12 @@ long lEventOperate(SATvm *pstSavm, SKCon *pstCon, TFace *pstFace, char *pvDat
case OPERATE_QUERY:
if(RC_SUCC != lQuery(pstSavm, (size_t *)&pstFace->m_lRows, (void *)&pvOut))
pstFace->m_lErrno = pstSavm->m_lErrno;
else
{
lData = pstFace->m_lDLen * pstFace->m_lRows;
pstFace->m_lDLen = pstSavm->m_lEType;
}
if(sizeof(TFace) != lSendBuffer(pstCon->m_skSock, (void *)pstFace, sizeof(TFace)))
{
TFree(pvOut);
@ -1359,13 +1364,28 @@ long lEventOperate(SATvm *pstSavm, SKCon *pstCon, TFace *pstFace, char *pvDat
TFree(pvOut);
return RC_SUCC;
case OPERATE_REPLACE:
pstSavm->m_bWork = pstCon->m_bWork;
pstSavm->m_pstWork = pstCon->m_pstWork;
if(RC_SUCC != lReplace(pstSavm, pvData))
pstFace->m_lErrno = pstSavm->m_lErrno;
else
{
pstFace->m_lRows = pstSavm->m_lEffect;
pstFace->m_lDLen = pstSavm->m_lEType;
}
pstCon->m_pstWork = pstSavm->m_pstWork;
lSendBuffer(pstCon->m_skSock, (void *)pstFace, sizeof(TFace));
return RC_SUCC;
case OPERATE_UPDATE:
pstSavm->m_bWork = pstCon->m_bWork;
pstSavm->m_pstWork = pstCon->m_pstWork;
if(RC_SUCC != lUpdate(pstSavm, pvData))
pstFace->m_lErrno = pstSavm->m_lErrno;
else
{
pstFace->m_lRows = pstSavm->m_lEffect;
pstFace->m_lDLen = pstSavm->m_lEType;
}
pstCon->m_pstWork = pstSavm->m_pstWork;
lSendBuffer(pstCon->m_skSock, (void *)pstFace, sizeof(TFace));
return RC_SUCC;
@ -1374,12 +1394,20 @@ long lEventOperate(SATvm *pstSavm, SKCon *pstCon, TFace *pstFace, char *pvDat
pstSavm->m_pstWork = pstCon->m_pstWork;
if(RC_SUCC != lDelete(pstSavm))
pstFace->m_lErrno = pstSavm->m_lErrno;
pstCon->m_pstWork = pstSavm->m_pstWork;
else
{
pstFace->m_lDLen = pstSavm->m_lEType;
pstFace->m_lRows = pstSavm->m_lEffect;
}
pstCon->m_pstWork = pstSavm->m_pstWork;
lSendBuffer(pstCon->m_skSock, (void *)pstFace, sizeof(TFace));
return RC_SUCC;
case OPERATS_REPLACE:
pstSavm->m_bWork = pstCon->m_bWork;
pstSavm->m_pstWork = pstCon->m_pstWork;
if(RC_SUCC == lReplace(pstSavm, pvData))
pstCon->m_pstWork = pstSavm->m_pstWork;
return RC_SUCC;
case OPERAYS_UPDATE:
pstSavm->m_bWork = pstCon->m_bWork;
pstSavm->m_pstWork = pstCon->m_pstWork;
@ -1418,6 +1446,8 @@ long lEventOperate(SATvm *pstSavm, SKCon *pstCon, TFace *pstFace, char *pvDat
case OPERATE_COUNT:
if(RC_SUCC != lCount(pstSavm, (size_t *)&pstFace->m_lRows))
pstFace->m_lErrno = pstSavm->m_lErrno;
else
pstFace->m_lDLen = pstSavm->m_lEType;
lSendBuffer(pstCon->m_skSock, (void *)pstFace, sizeof(TFace));
return RC_SUCC;
@ -1432,6 +1462,7 @@ long lEventOperate(SATvm *pstSavm, SKCon *pstCon, TFace *pstFace, char *pvDat
{
lData = pstFace->m_lDLen + sizeof(TFace);
pstFace->m_lRows = pstSavm->m_lEffect;
pstFace->m_lDLen = pstSavm->m_lEType;
}
lSendBuffer(pstCon->m_skSock, (void *)pstFace, lData);
return RC_SUCC;
@ -1479,8 +1510,12 @@ long lEventOperate(SATvm *pstSavm, SKCon *pstCon, TFace *pstFace, char *pvDat
case OPERATE_GROUP:
if(RC_SUCC != lGroup(pstSavm, (size_t *)&pstFace->m_lRows, (void *)&pvOut))
pstFace->m_lErrno = pstSavm->m_lErrno;
else
{
lData = pstFace->m_lDLen * pstFace->m_lRows;
pstFace->m_lDLen = pstSavm->m_lEType;
}
if(sizeof(TFace) != lSendBuffer(pstCon->m_skSock, (void *)pstFace, sizeof(TFace)))
{
TFree(pvOut);
@ -4002,6 +4037,7 @@ long lTvmSelect(SATvm *pstSavm, void *pvOut)
return RC_FAIL;
pstSavm->m_lEffect = pstFace->m_lRows;
pstSavm->m_lEType = pstFace->m_lDLen;
if(pstSavm->lSize != lRecvBuffer(pstSavm->m_skSock, (char *)pvOut, pstSavm->lSize))
{
pstSavm->m_lErrno = SOCK_COM_EXCP;
@ -4083,6 +4119,7 @@ long lTvmQuery(SATvm *pstSavm, size_t *plOut, void **ppvOut)
*plOut = pstFace->m_lRows;
pstSavm->m_lEffect = pstFace->m_lRows;
pstSavm->m_lEType = pstFace->m_lDLen;
return RC_SUCC;
}
@ -4406,11 +4443,12 @@ long lTvmDelete(SATvm *pstSavm)
return RC_FAIL;
}
pstSavm->m_lErrno = ((TFace *)pstRun->pstVoid)->m_lErrno;
pstSavm->m_lErrno = pstFace->m_lErrno;
if(0 != pstSavm->m_lErrno)
return RC_FAIL;
pstSavm->m_lEffect = ((TFace *)pstRun->pstVoid)->m_lRows;
pstSavm->m_lEffect = pstFace->m_lRows;
pstSavm->m_lEType = pstFace->m_lDLen;
return RC_SUCC;
}
@ -4474,11 +4512,12 @@ long lTvmUpdate(SATvm *pstSavm, void *pvData)
return RC_FAIL;
}
pstSavm->m_lErrno = ((TFace *)pstRun->pstVoid)->m_lErrno;
pstSavm->m_lErrno = pstFace->m_lErrno;
if(0 != pstSavm->m_lErrno)
return RC_FAIL;
pstSavm->m_lEffect = ((TFace *)pstRun->pstVoid)->m_lRows;
pstSavm->m_lEffect = pstFace->m_lRows;
pstSavm->m_lEType = pstFace->m_lDLen;
return RC_SUCC;
}
@ -4542,11 +4581,12 @@ long lTvmReplace(SATvm *pstSavm, void *pvData)
return RC_FAIL;
}
pstSavm->m_lErrno = ((TFace *)pstRun->pstVoid)->m_lErrno;
pstSavm->m_lErrno = pstFace->m_lErrno;
if(0 != pstSavm->m_lErrno)
return RC_FAIL;
pstSavm->m_lEffect = ((TFace *)pstRun->pstVoid)->m_lRows;
pstSavm->m_lEffect = pstFace->m_lRows;
pstSavm->m_lEType = pstFace->m_lDLen;
return RC_SUCC;
}
@ -4682,6 +4722,7 @@ long lTvmGroup(SATvm *pstSavm, size_t *plOut, void **ppvOut)
*plOut = pstFace->m_lRows;
pstSavm->m_lEffect = pstFace->m_lRows;
pstSavm->m_lEType = pstFace->m_lDLen;
return RC_SUCC;
}
@ -4742,6 +4783,7 @@ long lTvmCount(SATvm *pstSavm, size_t *plCount)
return RC_FAIL;
*plCount = pstFace->m_lRows;
pstSavm->m_lEType = pstFace->m_lDLen;
return RC_SUCC;
}
@ -4809,6 +4851,7 @@ long lTvmExtreme(SATvm *pstSavm, void *pvOut)
if(0 != pstSavm->m_lErrno)
return RC_FAIL;
pstSavm->m_lEType = pstFace->m_lDLen;
if(pstSavm->lSize != lRecvBuffer(pstSavm->m_skSock, (char *)pvOut, pstSavm->lSize))
{
pstSavm->m_lErrno = SOCK_COM_EXCP;