make fixed
parent
1fe6b74ade
commit
f0e32527cc
|
@ -35,6 +35,7 @@ stvm DOM 进入域的维护
|
|||
|
||||
配置域完成后,可以stvm -c stvm.conf编译到$TVMCFG下
|
||||
然后在stvm -w启动即可
|
||||
|
||||
目前本版本为测试版本,建议以单机模式64位下运行,将性能发挥在极致。
|
||||
|
||||
**作者:Savens Liu**
|
||||
|
|
|
@ -55,5 +55,3 @@ int main(int argc, char *argv[])
|
|||
|
||||
return RC_SUCC;
|
||||
}
|
||||
|
||||
|
||||
|
|
14
src/stvm.c
14
src/stvm.c
|
@ -637,7 +637,7 @@ void vCreateStruck(TblDef *pstTde, bool bf)
|
|||
if(bf)
|
||||
{
|
||||
fprintf(stdout, "\nset TABLE=%d\n", pstTde->m_table);
|
||||
fprintf(stdout, "set TABLESPACE=%d\n\n", pstTde->m_lMaxRow);
|
||||
fprintf(stdout, "set TABLESPACE=%ld\n\n", pstTde->m_lMaxRow);
|
||||
}
|
||||
|
||||
fprintf(stdout, "typedef struct __%s\n{\n", supper(pstTde->m_szTable));
|
||||
|
@ -645,7 +645,7 @@ void vCreateStruck(TblDef *pstTde, bool bf)
|
|||
{
|
||||
pv = &pstTde->m_stKey[i];
|
||||
if(FIELD_CHAR == pv->m_lAttr)
|
||||
fprintf(stdout, " char %s[%d];\n", pv->m_szField, pv->m_lLen);
|
||||
fprintf(stdout, " char %s[%ld];\n", pv->m_szField, pv->m_lLen);
|
||||
else if(FIELD_LONG == pv->m_lAttr)
|
||||
{
|
||||
switch(pv->m_lLen)
|
||||
|
@ -860,7 +860,7 @@ long lCreateByFile(char *pszFile)
|
|||
if(NULL == (fp = fopen(pszFile, "r")))
|
||||
{
|
||||
TFree(pszFile);
|
||||
fprintf(stderr, "open file %s error, %s\n", strerror(errno));
|
||||
fprintf(stderr, "open file %s error, %s\n", pszFile, strerror(errno));
|
||||
return RC_FAIL;
|
||||
}
|
||||
|
||||
|
@ -3821,7 +3821,7 @@ void vConnectDomain(char *pszDomain, TBoot *pstBoot)
|
|||
}
|
||||
|
||||
conditinit(pstSavm, stDomain, SYS_TVM_DOMAIN);
|
||||
stringsetv(pstSavm, stDomain, m_szOwner, pszDomain);
|
||||
stringset(pstSavm, stDomain, m_szOwner, pszDomain);
|
||||
decorate(pstSavm, TDomain, m_szOwner, FIRST_ROW);
|
||||
if(RC_SUCC != lSelect(pstSavm, (void *)&stDomain))
|
||||
{
|
||||
|
@ -3868,7 +3868,7 @@ void vPullTableDomain(char *pszParam)
|
|||
}
|
||||
|
||||
conditinit(pstSavm, stDomain, SYS_TVM_DOMAIN);
|
||||
stringsetv(pstSavm, stDomain, m_szOwner, sgetvalue(pszParam, "/", 1));
|
||||
stringset(pstSavm, stDomain, m_szOwner, sgetvalue(pszParam, "/", 1));
|
||||
if(!strlen(strimall(stDomain.m_szOwner)))
|
||||
{
|
||||
fprintf(stderr, "*illegal domain name\n");
|
||||
|
@ -3880,7 +3880,7 @@ void vPullTableDomain(char *pszParam)
|
|||
strncpy(szTable, sgetvalue(szCmd, " ", 1), sizeof(szTable));
|
||||
strimall(szTable);
|
||||
|
||||
stringsetv(pstSavm, stDomain, m_szTable, sgetvalue(szTable, "@", 1));
|
||||
stringset(pstSavm, stDomain, m_szTable, sgetvalue(szTable, "@", 1));
|
||||
supper(stDomain.m_szTable);
|
||||
if(!strlen(stDomain.m_szTable))
|
||||
{
|
||||
|
@ -3888,7 +3888,7 @@ void vPullTableDomain(char *pszParam)
|
|||
return ;
|
||||
}
|
||||
|
||||
stringsetv(pstSavm, stDomain, m_szPart, sgetvalue(szTable, "@", 2));
|
||||
stringset(pstSavm, stDomain, m_szPart, sgetvalue(szTable, "@", 2));
|
||||
if(!strlen(stDomain.m_szPart))
|
||||
strcpy(stDomain.m_szPart, stDomain.m_szOwner);
|
||||
|
||||
|
|
62
src/tcp.c
62
src/tcp.c
|
@ -2119,7 +2119,7 @@ long lCacheDomain(SATvm *pstSavm, Benum eMode, long lPort)
|
|||
{
|
||||
fprintf(stderr, "get domain error, %s", sGetTError(pstSavm->m_lErrno));
|
||||
pthread_exit(NULL);
|
||||
return ;
|
||||
return RC_FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2135,7 +2135,7 @@ long lCacheDomain(SATvm *pstSavm, Benum eMode, long lPort)
|
|||
TFree(pstDom);
|
||||
fprintf(stderr, "add domain list error, %s", strerror(errno));
|
||||
pthread_exit(NULL);
|
||||
return ;
|
||||
return RC_FAIL;
|
||||
}
|
||||
}
|
||||
TFree(pstDom);
|
||||
|
@ -2558,7 +2558,7 @@ long lPullNotify(SATvm *pstSavm, TDomain *pstDom, size_t lCount)
|
|||
return RC_FAIL;
|
||||
}
|
||||
|
||||
fprintf(stdout, "\b\bcompleted .\nCopy table(%s) success, table maxrow:%d, valid:%ld "
|
||||
fprintf(stdout, "\b\bcompleted .\nCopy table(%s) success, table maxrow:%ld, valid:%ld "
|
||||
" completed .\n", stDet.m_szTable, stDet.m_lMaxRow, lValid);
|
||||
fflush(stdout);
|
||||
if(NULL == (pstSavm = (SATvm *)pInitSATvm(pstDom->m_table)))
|
||||
|
@ -3519,18 +3519,28 @@ void* pProtocaJava(SATvm *pstSavm, void *pstVoid, TFace *pstFace, void *pvBuf
|
|||
memcpy(szLen, pvData, 4);
|
||||
pvData += 4;
|
||||
|
||||
if(lLen < (len = strlen(szLen))) return NULL;
|
||||
if(lLen < (len = strlen(szLen)))
|
||||
{
|
||||
pstSavm->m_lErrno = SQL_SYNTX_ERR;
|
||||
return NULL;
|
||||
}
|
||||
lLen -= (len + 4);
|
||||
|
||||
if(NULL == (q = strstr(pvData, "=")))
|
||||
{
|
||||
pstSavm->m_lErrno = SQL_SYNTX_ERR;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
n = q - pvData;
|
||||
m = MIN(n, MAX_FIELD_LEN);
|
||||
memcpy(szField, pvData, m);
|
||||
szField[m] = 0x00;
|
||||
if(NULL == (pstKey = pFindField(pv, lGetIdxNum(pstFace->m_table), szField)))
|
||||
{
|
||||
pstSavm->m_lErrno = FLD_NOT_EXIST;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
vSetCodField(pstCond, pstKey->m_lLen, pstKey->m_lFrom);
|
||||
memcpy(pstVoid + pstKey->m_lFrom, pvData + n + 1, m);
|
||||
|
@ -3552,24 +3562,39 @@ void* pProtocaJava(SATvm *pstSavm, void *pstVoid, TFace *pstFace, void *pvBuf
|
|||
memcpy(szLen, pvData, 4);
|
||||
pvData += 4;
|
||||
|
||||
if(lLen < (len = strlen(szLen))) return NULL;
|
||||
if(lLen < (len = strlen(szLen)))
|
||||
{
|
||||
pstSavm->m_lErrno = SQL_SYNTX_ERR;
|
||||
return NULL;
|
||||
}
|
||||
lLen -= (len + 4);
|
||||
|
||||
if(NULL == (q = strstr(pvData, "=")))
|
||||
{
|
||||
pstSavm->m_lErrno = SQL_SYNTX_ERR;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
n = q - pvData;
|
||||
m = MIN(n, MAX_FIELD_LEN);
|
||||
memcpy(szField, pvData, m);
|
||||
szField[m] = 0x00;
|
||||
if(NULL == (pstKey = pFindField(pv, lGetIdxNum(pstFace->m_table), szField)))
|
||||
{
|
||||
pstSavm->m_lErrno = FLD_NOT_EXIST;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
vSetCodField(pstCond, pstKey->m_lLen, pstKey->m_lFrom);
|
||||
memcpy(pstVoid + pstKey->m_lFrom, pvData + n + 1, m);
|
||||
pvData += len;
|
||||
}
|
||||
if(lLen < 0) return NULL;
|
||||
|
||||
if(lLen < 0)
|
||||
{
|
||||
pstSavm->m_lErrno = SQL_SYNTX_ERR;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return memcpy(pvBuffer, pstVoid, pstFace->m_lDLen);
|
||||
case OPERATE_SELECT:
|
||||
|
@ -3578,7 +3603,11 @@ void* pProtocaJava(SATvm *pstSavm, void *pstVoid, TFace *pstFace, void *pvBuf
|
|||
case OPERATE_TRCATE:
|
||||
case OPERATE_GROUP:
|
||||
case OPERATE_EXTREM:
|
||||
if(lLen < 0) return NULL;
|
||||
if(lLen < 0)
|
||||
{
|
||||
pstSavm->m_lErrno = SQL_SYNTX_ERR;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
pstCond = &pstSavm->stUpdt;
|
||||
pstCond->uFldcmp = 0;
|
||||
|
@ -3589,18 +3618,28 @@ void* pProtocaJava(SATvm *pstSavm, void *pstVoid, TFace *pstFace, void *pvBuf
|
|||
memcpy(szLen, pvData, 4);
|
||||
pvData += 4;
|
||||
|
||||
if(lLen < (len = strlen(szLen))) return NULL;
|
||||
lLen -= (len + 4);
|
||||
|
||||
if(NULL == (q = strstr(pvData, "=")))
|
||||
if(lLen < (len = strlen(szLen)))
|
||||
{
|
||||
pstSavm->m_lErrno = SQL_SYNTX_ERR;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
lLen -= (len + 4);
|
||||
if(NULL == (q = strstr(pvData, "=")))
|
||||
{
|
||||
pstSavm->m_lErrno = SQL_SYNTX_ERR;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
n = q - pvData;
|
||||
m = MIN(n, MAX_FIELD_LEN);
|
||||
memcpy(szField, pvData, m);
|
||||
szField[m] = 0x00;
|
||||
if(NULL == (pstKey = pFindField(pv, lGetIdxNum(pstFace->m_table), szField)))
|
||||
{
|
||||
pstSavm->m_lErrno = FLD_NOT_EXIST;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
m = ((char *)pvData)[n + 1];
|
||||
vSetDecorate(pstCond, pstKey->m_lLen, pstKey->m_lFrom, (Uenum)m);
|
||||
|
@ -3613,6 +3652,7 @@ void* pProtocaJava(SATvm *pstSavm, void *pstVoid, TFace *pstFace, void *pvBuf
|
|||
return pvBuffer;
|
||||
}
|
||||
|
||||
pstSavm->m_lErrno = SQL_SYNTX_ERR;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue