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