Merge branch '1.2.3'
commit
e03d885647
|
@ -35,6 +35,7 @@ stvm DOM 进入域的维护
|
|||
|
||||
配置域完成后,可以stvm -c stvm.conf编译到$TVMCFG下
|
||||
然后在stvm -w启动即可
|
||||
|
||||
目前本版本为测试版本,建议以单机模式64位下运行,将性能发挥在极致。
|
||||
|
||||
**作者:Savens Liu**
|
||||
|
|
|
@ -17,9 +17,10 @@ GROUP=group
|
|||
EXTREME=extreme
|
||||
TRUNCATE=truncate
|
||||
DROP=drop
|
||||
CLICK=click
|
||||
PRESSURE=press_demo
|
||||
|
||||
all: $(CREATE) $(INSERT) $(SELECT) $(QUERY) $(DELETE) $(UPDATE) $(COUNT) $(GROUP) $(EXTREME) $(TRUNCATE) $(DROP) $(PRESSURE) clean
|
||||
all: $(CREATE) $(INSERT) $(SELECT) $(QUERY) $(DELETE) $(UPDATE) $(COUNT) $(GROUP) $(EXTREME) $(TRUNCATE) $(DROP) $(PRESSURE) $(CLICK) clean
|
||||
$(CREATE): create.o
|
||||
$(CC) -o $@ $< $(LIBDIR)
|
||||
$(INSERT): insert.o
|
||||
|
@ -42,6 +43,8 @@ $(TRUNCATE): truncate.o
|
|||
$(CC) -o $@ $< $(LIBDIR)
|
||||
$(DROP): drop.o
|
||||
$(CC) -o $@ $< $(LIBDIR)
|
||||
$(CLICK): click.o
|
||||
$(CC) -o $@ $< $(LIBDIR)
|
||||
$(PRESSURE): press_demo.o
|
||||
$(CC) -o $@ $< $(LIBDIR)
|
||||
|
||||
|
|
|
@ -55,5 +55,3 @@ int main(int argc, char *argv[])
|
|||
|
||||
return RC_SUCC;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -713,6 +713,7 @@ extern long lImportFile(TABLE t, char *pszFile, char *pszFlag);
|
|||
extern long lExportFile(TABLE t, char *pszFile, char *pszFlag);
|
||||
extern long lImportTable(TABLE t, size_t lCount, void *psvOut);
|
||||
extern long lExportTable(TABLE t, size_t *plOut, void **ppsvOut);
|
||||
extern long lDumpTable(SATvm *pstSavm, TABLE t);
|
||||
|
||||
extern long lRenameTable(SATvm *pstSavm, TABLE to, TABLE tn);
|
||||
extern long lCreateSeque(SATvm *pstSavm, char *pszSQName, uint uIncre);
|
||||
|
@ -729,6 +730,7 @@ extern long lTruncate(SATvm *pstSavm, TABLE t);
|
|||
extern long lSelect(SATvm *pstSavm, void *psvOut);
|
||||
extern long lUpdate(SATvm *pstSavm, void *psvUpd);
|
||||
extern long lCount(SATvm *pstSavm, size_t *plCount);
|
||||
extern long lClick(SATvm *pstSavm, ulong *puHits);
|
||||
extern long lExtreme(SATvm *pstSavm, void *psvOut);
|
||||
extern long lGroup(SATvm *pstSavm, size_t *plOut, void **ppsvOut);
|
||||
extern long lQuery(SATvm *pstSavm, size_t *plOut, void **ppsvOut);
|
||||
|
|
12
src/detvm.c
12
src/detvm.c
|
@ -318,10 +318,10 @@ void vGetAction(char *s, long *plAction)
|
|||
*************************************************************************************************/
|
||||
void vPrintFunc(char *s)
|
||||
{
|
||||
fprintf(stdout, "\nUsage:\t%s -[tpu][hugldtui]\n", s);
|
||||
fprintf(stdout, "\nUsage:\t%s -[tpr][hugldtui]\n", s);
|
||||
fprintf(stdout, "\t-t\t\t--table\n");
|
||||
fprintf(stdout, "\t-p[hugldta]\t--debug\n");
|
||||
fprintf(stdout, "\t-u(ui)\t\t--reset lock\n");
|
||||
fprintf(stdout, "\t-r\t\t--reset lock\n");
|
||||
fprintf(stdout, "\n");
|
||||
}
|
||||
|
||||
|
@ -367,7 +367,7 @@ int main(int argc, char *argv[])
|
|||
int iChoose = 0, iAction = 0;
|
||||
|
||||
memset(szCom, 0, sizeof(szCom));
|
||||
while(-1 != (iChoose = getopt(argc, argv, "t:p:u::v?::")))
|
||||
while(-1 != (iChoose = getopt(argc, argv, "t:p:r::v?::")))
|
||||
{
|
||||
switch(iChoose)
|
||||
{
|
||||
|
@ -375,11 +375,7 @@ int main(int argc, char *argv[])
|
|||
iAction |= 1;
|
||||
t = atol(optarg);
|
||||
break;
|
||||
case 'u':
|
||||
if(!optarg)
|
||||
strcpy(szCom, "u");
|
||||
else
|
||||
strcpy(szCom, optarg);
|
||||
case 'r':
|
||||
iAction |= 2;
|
||||
break;
|
||||
case 'p':
|
||||
|
|
128
src/stvm.c
128
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)
|
||||
|
@ -733,10 +733,10 @@ void vCreateStruck(TblDef *pstTde, bool bf)
|
|||
t --table
|
||||
return:
|
||||
*************************************************************************************************/
|
||||
void vTableStruck(TABLE t)
|
||||
void vTableStruck(TABLE t)
|
||||
{
|
||||
RunTime *pstRun = NULL;
|
||||
SATvm *pstSavm = (SATvm *)pGetSATvm();
|
||||
RunTime *pstRun = NULL;
|
||||
SATvm *pstSavm = (SATvm *)pGetSATvm();
|
||||
|
||||
if(NULL == (pstSavm = (SATvm *)pInitSATvm(t)))
|
||||
{
|
||||
|
@ -751,10 +751,10 @@ void vTableStruck(TABLE t)
|
|||
return ;
|
||||
}
|
||||
|
||||
vCreateStruck((TblDef *)pGetTblDef(t), 0);
|
||||
vTblDisconnect(pstSavm, pstSavm->tblName);
|
||||
vCreateStruck((TblDef *)pGetTblDef(t), 0);
|
||||
vTblDisconnect(pstSavm, pstSavm->tblName);
|
||||
|
||||
return ;
|
||||
return ;
|
||||
}
|
||||
|
||||
/*************************************************************************************************
|
||||
|
@ -806,7 +806,7 @@ long lDefineTable(char *pszCreate, char *pszTable)
|
|||
return RC_FAIL;
|
||||
}
|
||||
|
||||
strcpy(pszTable, stTde.m_szTable);
|
||||
strcpy(pszTable, stTde.m_szTable);
|
||||
return RC_SUCC;
|
||||
}
|
||||
|
||||
|
@ -816,22 +816,22 @@ long lDefineTable(char *pszCreate, char *pszTable)
|
|||
return:
|
||||
SQLFld
|
||||
*************************************************************************************************/
|
||||
long lCreateByFile(char *pszFile)
|
||||
long lCreateByFile(char *pszFile)
|
||||
{
|
||||
FILE *fp = NULL;
|
||||
FILE *fp = NULL;
|
||||
struct stat stBuf;
|
||||
SATvm *pstSavm = (SATvm *)pGetSATvm();
|
||||
char *pszCreate = NULL, szTable[MAX_FIELD_LEN];
|
||||
char *pszCreate = NULL, szTable[MAX_FIELD_LEN];
|
||||
|
||||
sltrim(pszFile);
|
||||
srtrim(pszFile);
|
||||
sltrim(pszFile);
|
||||
srtrim(pszFile);
|
||||
fprintf(stdout, "\n------------------------------------------------------SQL Result"
|
||||
"-----------------------------------------------------\n");
|
||||
if(0 == strlen(pszFile))
|
||||
{
|
||||
if(0 == strlen(pszFile))
|
||||
{
|
||||
fprintf(stderr, "create table syntax error\n");
|
||||
return RC_FAIL;
|
||||
}
|
||||
return RC_FAIL;
|
||||
}
|
||||
|
||||
if(0 != access(pszFile, F_OK | R_OK ))
|
||||
{
|
||||
|
@ -840,41 +840,41 @@ long lCreateByFile(char *pszFile)
|
|||
}
|
||||
|
||||
if(0 != stat(pszFile, &stBuf))
|
||||
{
|
||||
{
|
||||
fprintf(stderr, "get %s stat error: %s\n", pszFile, strerror(errno));
|
||||
return RC_FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
if(!(S_IFREG == (S_IFREG & stBuf.st_mode)))
|
||||
{
|
||||
{
|
||||
fprintf(stderr, "file stat error\n");
|
||||
return RC_FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
if(NULL == (pszCreate = (char *)calloc(stBuf.st_size, 1)))
|
||||
{
|
||||
if(NULL == (pszCreate = (char *)calloc(stBuf.st_size, 1)))
|
||||
{
|
||||
fprintf(stderr, "create memory error, %s\n", strerror(errno));
|
||||
return RC_FAIL;
|
||||
}
|
||||
return RC_FAIL;
|
||||
}
|
||||
|
||||
if(NULL == (fp = fopen(pszFile, "r")))
|
||||
{
|
||||
TFree(pszFile);
|
||||
fprintf(stderr, "open file %s error, %s\n", strerror(errno));
|
||||
return RC_FAIL;
|
||||
}
|
||||
if(NULL == (fp = fopen(pszFile, "r")))
|
||||
{
|
||||
TFree(pszFile);
|
||||
fprintf(stderr, "open file %s error, %s\n", pszFile, strerror(errno));
|
||||
return RC_FAIL;
|
||||
}
|
||||
|
||||
fread(pszCreate, stBuf.st_size, 1, fp);
|
||||
fclose(fp);
|
||||
fread(pszCreate, stBuf.st_size, 1, fp);
|
||||
fclose(fp);
|
||||
|
||||
if(RC_SUCC != lDefineTable(pszCreate, szTable))
|
||||
return RC_FAIL;
|
||||
if(RC_SUCC != lDefineTable(pszCreate, szTable))
|
||||
return RC_FAIL;
|
||||
|
||||
fprintf(stdout, "---(%s) was created ---\n", szTable);
|
||||
fprintf(stdout, "---(%s) was created ---\n", szTable);
|
||||
|
||||
|
||||
TFree(pszCreate);
|
||||
return RC_SUCC;
|
||||
TFree(pszCreate);
|
||||
return RC_SUCC;
|
||||
}
|
||||
|
||||
/*************************************************************************************************
|
||||
|
@ -3561,10 +3561,12 @@ void vPrintFunc(char *s)
|
|||
{
|
||||
fprintf(stdout, "\nUsage:\t%s -wspfco[oytd]\n", s);
|
||||
fprintf(stdout, "\t-w[o]\t\t--Startup STVM\n");
|
||||
fprintf(stdout, "\t-s[o]\t\t--Shutdown STVM\n");
|
||||
fprintf(stdout, "\t-s\t\t--Shutdown STVM\n");
|
||||
fprintf(stdout, "\t-p(ytd)\t\t--Output STVM Running information\n");
|
||||
fprintf(stdout, "\t-f\t\t--Display the amount of table\n");
|
||||
fprintf(stdout, "\t-t\t\t--Output the table struck\n");
|
||||
fprintf(stdout, "\t-d\t\t--Dump the table\n");
|
||||
fprintf(stdout, "\t-m\t\t--Mount the table\n");
|
||||
fprintf(stdout, "\t-c[file]\t--Compile the startup config file\n");
|
||||
fprintf(stdout, "\t-o[file]\t--Decompile the startup config\n");
|
||||
fprintf(stdout, "\n");
|
||||
|
@ -3706,19 +3708,19 @@ void vSQLStatement(int argc, char *argv[])
|
|||
continue;
|
||||
}
|
||||
else if(!strncasecmp(pszUser, "create", 6))
|
||||
{
|
||||
if(lRemote > 0)
|
||||
{
|
||||
fprintf(stderr, "could not create table on Remte mode\n");
|
||||
TFree(pszUser);
|
||||
continue;
|
||||
}
|
||||
{
|
||||
if(lRemote > 0)
|
||||
{
|
||||
fprintf(stderr, "could not create table on Remte mode\n");
|
||||
TFree(pszUser);
|
||||
continue;
|
||||
}
|
||||
|
||||
lCreateByFile(pszUser + 6);
|
||||
fprintf(stdout, "\n\n\n");
|
||||
TFree(pszUser);
|
||||
continue;
|
||||
}
|
||||
lCreateByFile(pszUser + 6);
|
||||
fprintf(stdout, "\n\n\n");
|
||||
TFree(pszUser);
|
||||
continue;
|
||||
}
|
||||
|
||||
strimcrlf(pszUser);
|
||||
lRec = lfieldnum(pszUser, ";");
|
||||
|
@ -3821,7 +3823,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 +3870,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 +3882,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 +3890,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);
|
||||
|
||||
|
@ -4097,7 +4099,7 @@ int main(int argc, char *argv[])
|
|||
|
||||
vCheckTvmEnv();
|
||||
memset(szCom, 0, sizeof(szCom));
|
||||
while(-1 != (iChoose = getopt(argc, argv, "w::s::p::f::t:i:c:v?::")))
|
||||
while(-1 != (iChoose = getopt(argc, argv, "w::s::p::f::d:m:t:i:c:v?::")))
|
||||
{
|
||||
switch(iChoose)
|
||||
{
|
||||
|
@ -4109,8 +4111,16 @@ int main(int argc, char *argv[])
|
|||
case 'p':
|
||||
vPrintParam(optarg);
|
||||
return RC_SUCC;
|
||||
case 't':
|
||||
vTableStruck(atol(optarg));
|
||||
case 't':
|
||||
vTableStruck(atol(optarg));
|
||||
return RC_SUCC;
|
||||
case 'd':
|
||||
if(RC_SUCC != lDumpTable(pstSavm, atol(optarg)))
|
||||
fprintf(stderr, "dump table error, %s\n", sGetTError(pstSavm->m_lErrno));
|
||||
return RC_SUCC;
|
||||
case 'm':
|
||||
if(RC_SUCC != lMountTable(pstSavm, optarg))
|
||||
fprintf(stderr, "mount table error, %s\n", sGetTError(pstSavm->m_lErrno));
|
||||
return RC_SUCC;
|
||||
case 'f':
|
||||
vTableAmount();
|
||||
|
|
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;
|
||||
}
|
||||
|
||||
|
|
500
src/tree.c
500
src/tree.c
|
@ -5256,6 +5256,7 @@ long _lSelectTruck(SATvm *pstSavm, void *pvAddr, TABLE t, void *psvOut, size_
|
|||
memcpy(psvOut, pvData, lGetRowSize(pstSavm->tblName));
|
||||
pthread_rwlock_unlock(prwLock);
|
||||
pstTruck->m_lTimes ++;
|
||||
|
||||
return RC_SUCC;
|
||||
}
|
||||
|
||||
|
@ -5799,7 +5800,6 @@ long _lQueryHash(SATvm *pstSavm, void *pvAddr, TABLE t, size_t *plOut, void *
|
|||
continue;
|
||||
}
|
||||
|
||||
pstTruck->m_lTimes ++;
|
||||
lPos = (++ (*plOut)) * lGetRowSize(t);
|
||||
if(NULL == (*ppsvOut = (char *)realloc(*ppsvOut, lPos)))
|
||||
{
|
||||
|
@ -5867,7 +5867,6 @@ long _lQueryGroup(SATvm *pstSavm, void *pvAddr, TABLE t, size_t *plOut, void
|
|||
continue;
|
||||
}
|
||||
|
||||
pstTruck->m_lTimes ++;
|
||||
lPos = (++ (*plOut)) * lGetRowSize(t);
|
||||
if(NULL == (*ppsvOut = (char *)realloc(*ppsvOut, lPos)))
|
||||
{
|
||||
|
@ -7296,6 +7295,7 @@ long _lUpdateIndex(SATvm *pstSavm, void *pvAddr, TABLE t, void *pvUpdate)
|
|||
}
|
||||
|
||||
pstSavm->pstVoid = pvUpdate;
|
||||
pstTruck->m_lTimes ++;
|
||||
SET_DATA_TRUCK(pstTruck, DATA_TRUCK_NULL);
|
||||
if(!memcmp(szIdx, szOld, MAX_INDEX_LEN))
|
||||
{
|
||||
|
@ -9506,6 +9506,502 @@ long lExtreme(SATvm *pstSavm, void *psvOut)
|
|||
return RC_SUCC;
|
||||
}
|
||||
|
||||
/*************************************************************************************************
|
||||
description:Select the table hits according to the Unique index
|
||||
parameters:
|
||||
pstSavm --stvm handle
|
||||
pvAddr --memory address
|
||||
t --table
|
||||
puHits --offset
|
||||
return:
|
||||
RC_SUCC --success
|
||||
RC_FAIL --failure
|
||||
*************************************************************************************************/
|
||||
long _lClickIndex(SATvm *pstSavm, void *pvAddr, TABLE t, ulong *puHits)
|
||||
{
|
||||
SHTree *pstTree = NULL;
|
||||
SHTruck *pstTruck = NULL;
|
||||
char szIdx[MAX_INDEX_LEN];
|
||||
RWLock *prwLock = (RWLock *)pGetRWLock(pvAddr);
|
||||
|
||||
memset(szIdx, 0, sizeof(szIdx));
|
||||
if(NULL == pGetIndex(&pstSavm->stCond, lGetIdxNum(t), pGetTblIdx(t), pstSavm->pstVoid, szIdx))
|
||||
return RC_CONTU;
|
||||
|
||||
if(RC_SUCC != pthread_rwlock_rdlock(prwLock))
|
||||
{
|
||||
pstSavm->m_lErrno = LOCK_DORD_ERR;
|
||||
return RC_FAIL;
|
||||
}
|
||||
|
||||
pstSavm->m_lEType = EXE_PLAN_IDX;
|
||||
if(NULL == (pstTree = (SHTree *)pGetNode(pvAddr, ((TblDef *)pvAddr)->m_lTreeRoot)))
|
||||
{
|
||||
pthread_rwlock_unlock(prwLock);
|
||||
pstSavm->m_lErrno = SVR_EXCEPTION;
|
||||
return RC_FAIL;
|
||||
}
|
||||
|
||||
pstTree = (SHTree *)pSearchTree(pvAddr, pstTree, szIdx, lGetIdxLen(pstSavm->tblName));
|
||||
if(!pstTree)
|
||||
{
|
||||
pthread_rwlock_unlock(prwLock);
|
||||
pstSavm->m_lErrno = NO_DATA_FOUND;
|
||||
return RC_FAIL;
|
||||
}
|
||||
|
||||
pstTruck = (PSHTruck)pGetNode(pvAddr, pstTree->m_lData);
|
||||
if(RC_MISMA == lFeildMatch(&pstSavm->stCond, pstTruck->m_pvData, pstSavm->pstVoid))
|
||||
{
|
||||
pthread_rwlock_unlock(prwLock);
|
||||
pstSavm->m_lErrno = SVR_EXCEPTION;
|
||||
return RC_FAIL;
|
||||
}
|
||||
|
||||
pthread_rwlock_unlock(prwLock);
|
||||
*puHits = pstTruck->m_lTimes;
|
||||
pstSavm->m_lEffect = 1;
|
||||
|
||||
return RC_SUCC;
|
||||
}
|
||||
|
||||
/*************************************************************************************************
|
||||
description:Select the table hits according to the index
|
||||
parameters:
|
||||
pstSavm --stvm handle
|
||||
pvAddr --memory address
|
||||
t --table
|
||||
puHits --offset
|
||||
return:
|
||||
RC_SUCC --success
|
||||
RC_FAIL --failure
|
||||
*************************************************************************************************/
|
||||
long _lClickGroup(SATvm *pstSavm, void *pvAddr, TABLE t, ulong *puHits)
|
||||
{
|
||||
void *pvData = NULL;
|
||||
SHList *pstList = NULL;
|
||||
SHTree *pstTree = NULL;
|
||||
SHTruck *pstTruck = NULL;
|
||||
char szIdx[MAX_INDEX_LEN];
|
||||
RWLock *prwLock = (RWLock *)pGetRWLock(pvAddr);
|
||||
|
||||
memset(szIdx, 0, sizeof(szIdx));
|
||||
if(NULL == pGetIndex(&pstSavm->stCond, lGetGrpNum(t), pGetTblGrp(t), pstSavm->pstVoid, szIdx))
|
||||
return RC_CONTU;
|
||||
|
||||
if(RC_SUCC != pthread_rwlock_rdlock(prwLock))
|
||||
{
|
||||
pstSavm->m_lErrno = LOCK_DORD_ERR;
|
||||
return RC_FAIL;
|
||||
}
|
||||
|
||||
if(NULL == (pstTree = (SHTree *)pGetNode(pvAddr, ((TblDef *)pvAddr)->m_lGroupRoot)))
|
||||
{
|
||||
pthread_rwlock_unlock(prwLock);
|
||||
pstSavm->m_lErrno = SVR_EXCEPTION;
|
||||
return RC_FAIL;
|
||||
}
|
||||
|
||||
if(NULL == (pstList = pSearchGroup(pvAddr, pstTree, szIdx, lGetGrpLen(t))))
|
||||
{
|
||||
pthread_rwlock_unlock(prwLock);
|
||||
pstSavm->m_lErrno = NO_DATA_FOUND;
|
||||
return RC_CONTU;
|
||||
}
|
||||
|
||||
for(pstSavm->m_lEType = EXE_PLAN_GRP; SELF_POS_UNUSE != pstList->m_lPos;
|
||||
pstList = (SHList *)pGetNode(pvAddr, pstList->m_lNext))
|
||||
{
|
||||
pstTruck = (PSHTruck)pGetNode(pvAddr, pstList->m_lData);
|
||||
if(RC_MATCH == lFeildMatch(&pstSavm->stCond, pstTruck->m_pvData, pstSavm->pstVoid))
|
||||
{
|
||||
if(1 < (++ pstSavm->m_lEffect))
|
||||
{
|
||||
pthread_rwlock_unlock(prwLock);
|
||||
pstSavm->m_lErrno = MORE_ROWS_SEL;
|
||||
return RC_FAIL;
|
||||
}
|
||||
|
||||
pvData = pstTruck->m_pvData;
|
||||
if(FIRST_ROW & pstSavm->lFind) break;
|
||||
}
|
||||
|
||||
if(SELF_POS_UNUSE == pstList->m_lNext) break;
|
||||
}
|
||||
|
||||
if(0 == pstSavm->m_lEffect)
|
||||
{
|
||||
pthread_rwlock_unlock(prwLock);
|
||||
pstSavm->m_lErrno = NO_DATA_FOUND;
|
||||
return RC_FAIL;
|
||||
}
|
||||
|
||||
pthread_rwlock_unlock(prwLock);
|
||||
*puHits = pstTruck->m_lTimes;
|
||||
|
||||
return RC_SUCC;
|
||||
}
|
||||
|
||||
/*************************************************************************************************
|
||||
description:Select the table hits according to the hash
|
||||
parameters:
|
||||
pstSavm --stvm handle
|
||||
pvAddr --memory address
|
||||
t --table
|
||||
puHits --offset
|
||||
return:
|
||||
RC_SUCC --success
|
||||
RC_FAIL --failure
|
||||
*************************************************************************************************/
|
||||
long _lClickHash(SATvm *pstSavm, void *pvAddr, TABLE t, ulong *puHits)
|
||||
{
|
||||
size_t lData, lIdx;
|
||||
SHTree *pstTree = NULL;
|
||||
SHList *pstList = NULL;
|
||||
SHTruck *pstTruck = NULL;
|
||||
char szIdx[MAX_INDEX_LEN], *pvData = NULL;
|
||||
RWLock *prwLock = (RWLock *)pGetRWLock(pvAddr);
|
||||
|
||||
memset(szIdx, 0, sizeof(szIdx));
|
||||
if(NULL == pGetIndex(&pstSavm->stCond, lGetGrpNum(t), pGetTblGrp(t), pstSavm->pstVoid, szIdx))
|
||||
return RC_CONTU;
|
||||
|
||||
lIdx = uGetHash(szIdx, lGetGrpLen(t)) % ((TblDef *)pvAddr)->m_lMaxRow;
|
||||
pstTree = pvAddr + ((TblDef *)pvAddr)->m_lGroupRoot + lIdx * sizeof(SHTree);
|
||||
if(NULL == pstTree || SELF_POS_UNUSE == pstTree->m_lData)
|
||||
{
|
||||
pstSavm->m_lErrno = NO_DATA_FOUND;
|
||||
return RC_FAIL;
|
||||
}
|
||||
|
||||
if(RC_SUCC != pthread_rwlock_rdlock(prwLock))
|
||||
{
|
||||
pstSavm->m_lErrno = LOCK_DORD_ERR;
|
||||
return RC_FAIL;
|
||||
}
|
||||
|
||||
pstList = (SHList *)pGetNode(pvAddr, pstTree->m_lData);
|
||||
for(pstSavm->m_lEType = EXE_PLAN_GRP; SELF_POS_UNUSE != pstList->m_lPos;
|
||||
pstList = (SHList *)pGetNode(pvAddr, pstList->m_lNext))
|
||||
{
|
||||
pstTruck = (PSHTruck)pGetNode(pvAddr, pstList->m_lData);
|
||||
if(RC_MATCH == lFeildMatch(&pstSavm->stCond, pstTruck->m_pvData, pstSavm->pstVoid))
|
||||
{
|
||||
if(1 < (++ pstSavm->m_lEffect))
|
||||
{
|
||||
pthread_rwlock_unlock(prwLock);
|
||||
pstSavm->m_lErrno = MORE_ROWS_SEL;
|
||||
return RC_FAIL;
|
||||
}
|
||||
|
||||
pvData = pstTruck->m_pvData;
|
||||
if(FIRST_ROW & pstSavm->lFind) break;
|
||||
}
|
||||
|
||||
if(SELF_POS_UNUSE == pstList->m_lNext) break;
|
||||
}
|
||||
|
||||
if(0 == pstSavm->m_lEffect)
|
||||
{
|
||||
pthread_rwlock_unlock(prwLock);
|
||||
pstSavm->m_lErrno = NO_DATA_FOUND;
|
||||
return RC_FAIL;
|
||||
}
|
||||
|
||||
pthread_rwlock_unlock(prwLock);
|
||||
*puHits = pstTruck->m_lTimes;
|
||||
return RC_SUCC;
|
||||
}
|
||||
|
||||
/*************************************************************************************************
|
||||
description:Select the table hits according to the truck
|
||||
parameters:
|
||||
pstSavm --stvm handle
|
||||
pvAddr --memory address
|
||||
t --table
|
||||
puHits --offset
|
||||
return:
|
||||
RC_SUCC --success
|
||||
RC_FAIL --failure
|
||||
*************************************************************************************************/
|
||||
long _lClickTruck(SATvm *pstSavm, void *pvAddr, TABLE t, ulong *puHits)
|
||||
{
|
||||
void *pvData = NULL;
|
||||
SHTruck *pstTruck = NULL;
|
||||
size_t lRow = 0, lOffset = lGetTblData(t);
|
||||
RWLock *prwLock = (RWLock *)pGetRWLock(pvAddr);
|
||||
|
||||
if(RC_SUCC != pthread_rwlock_rdlock(prwLock))
|
||||
{
|
||||
pstSavm->m_lErrno = LOCK_DORD_ERR;
|
||||
return RC_FAIL;
|
||||
}
|
||||
|
||||
pstSavm->m_lEType = EXE_PLAN_ALL;
|
||||
pstTruck = (PSHTruck)pGetNode(pvAddr, lOffset);
|
||||
for(lRow = 0; (lRow < ((TblDef *)pvAddr)->m_lValid) && (lOffset < lGetTableSize(t));
|
||||
pstTruck = (PSHTruck)pGetNode(pvAddr, lOffset))
|
||||
{
|
||||
if(IS_TRUCK_NULL(pstTruck))
|
||||
{
|
||||
lOffset += lGetRowTruck(t);
|
||||
continue;
|
||||
}
|
||||
|
||||
lRow ++;
|
||||
if(RC_MISMA == lFeildMatch(&pstSavm->stCond, pstTruck->m_pvData, pstSavm->pstVoid))
|
||||
{
|
||||
lOffset += lGetRowTruck(t);
|
||||
continue;
|
||||
}
|
||||
|
||||
if(1 < (++ pstSavm->m_lEffect))
|
||||
{
|
||||
pthread_rwlock_unlock(prwLock);
|
||||
pstSavm->m_lErrno = MORE_ROWS_SEL;
|
||||
return RC_FAIL;
|
||||
}
|
||||
|
||||
lOffset+= lGetRowTruck(t);
|
||||
pvData = pstTruck->m_pvData;
|
||||
if(FIRST_ROW & pstSavm->lFind) break;
|
||||
}
|
||||
|
||||
if(0 == pstSavm->m_lEffect)
|
||||
{
|
||||
pthread_rwlock_unlock(prwLock);
|
||||
pstSavm->m_lErrno = NO_DATA_FOUND;
|
||||
return RC_FAIL;
|
||||
}
|
||||
|
||||
pthread_rwlock_unlock(prwLock);
|
||||
*puHits = pstTruck->m_lTimes;
|
||||
return RC_SUCC;
|
||||
}
|
||||
|
||||
/*************************************************************************************************
|
||||
description:API - lClick
|
||||
parameters:
|
||||
pstSavm --stvm handle
|
||||
puHits --hits
|
||||
return:
|
||||
RC_SUCC --success
|
||||
RC_FAIL --failure
|
||||
*************************************************************************************************/
|
||||
long lClick(SATvm *pstSavm, ulong *puHits)
|
||||
{
|
||||
long lRet;
|
||||
size_t lData = 0;
|
||||
RunTime *pstRun = NULL;
|
||||
|
||||
if(!pstSavm || !pstSavm->pstVoid)
|
||||
{
|
||||
pstSavm->m_lErrno = CONDIT_IS_NIL;
|
||||
return RC_FAIL;
|
||||
}
|
||||
|
||||
if(NULL == (pstRun = (RunTime *)pInitMemTable(pstSavm, pstSavm->tblName)))
|
||||
return RC_FAIL;
|
||||
|
||||
if(RES_REMOT_SID == pstRun->m_lLocal)
|
||||
{
|
||||
pstSavm->m_lErrno = RMT_NOT_SUPPT;
|
||||
return RC_FAIL;
|
||||
// Tremohold(pstSavm, pstRun);
|
||||
// return _lSelectByRt(pstSavm, psvOut);
|
||||
}
|
||||
|
||||
if(HAVE_UNIQ_IDX(pstSavm->tblName))
|
||||
{
|
||||
lRet = _lClickIndex(pstSavm, pstRun->m_pvAddr, pstSavm->tblName, puHits);
|
||||
if(RC_CONTU != lRet) return lRet;
|
||||
}
|
||||
|
||||
if(HAVE_NORL_IDX(pstSavm->tblName))
|
||||
{
|
||||
lRet = _lClickGroup(pstSavm, pstRun->m_pvAddr, pstSavm->tblName, puHits);
|
||||
if(RC_CONTU != lRet) return lRet;
|
||||
}
|
||||
else if(HAVE_HASH_IDX(pstSavm->tblName))
|
||||
{
|
||||
lRet = _lClickHash(pstSavm, pstRun->m_pvAddr, pstSavm->tblName, puHits);
|
||||
if(RC_CONTU != lRet) return lRet;
|
||||
}
|
||||
|
||||
lRet = _lClickTruck(pstSavm, pstRun->m_pvAddr, pstSavm->tblName, puHits);
|
||||
vTblDisconnect(pstSavm, pstSavm->tblName);
|
||||
return lRet;
|
||||
}
|
||||
|
||||
/*************************************************************************************************
|
||||
description:dump the table data
|
||||
parameters:
|
||||
pstSavm --stvm handle
|
||||
t --table
|
||||
return:
|
||||
RC_SUCC --success
|
||||
RC_FAIL --failure
|
||||
*************************************************************************************************/
|
||||
long lDumpTable(SATvm *pstSavm, TABLE t)
|
||||
{
|
||||
FILE *fp = NULL;
|
||||
char szFile[512];
|
||||
RunTime *pstRun = NULL;
|
||||
SHTruck *pstTruck = NULL;
|
||||
long lRow = 0, lOffset;
|
||||
|
||||
if(!pstSavm)
|
||||
{
|
||||
pstSavm->m_lErrno = CONDIT_IS_NIL;
|
||||
return RC_FAIL;
|
||||
}
|
||||
|
||||
memset(szFile, 0, sizeof(szFile));
|
||||
if(RC_SUCC != lInitSATvm(pstSavm, t))
|
||||
return RC_FAIL;
|
||||
|
||||
if(NULL == (pstRun = (RunTime *)pInitHitTest(pstSavm, t)))
|
||||
return RC_FAIL;
|
||||
|
||||
if(RES_REMOT_SID == pstRun->m_lLocal)
|
||||
{
|
||||
pstSavm->m_lErrno = RMT_NOT_SUPPT;
|
||||
return RC_FAIL;
|
||||
}
|
||||
|
||||
snprintf(szFile, sizeof(szFile), "%s/%d.sdb", getenv("TVMDBD"), t);
|
||||
if(NULL == (fp = fopen(szFile, "wb")))
|
||||
{
|
||||
pstSavm->m_lErrno = FILE_NOT_RSET;
|
||||
return RC_FAIL;
|
||||
}
|
||||
fwrite(pGetTblDef(t), sizeof(TblDef), 1, fp);
|
||||
|
||||
lOffset = lGetTblData(t);
|
||||
pstRun->m_lCurLine = 0;
|
||||
pstSavm->lSize = lGetRowSize(t);
|
||||
pstTruck = (PSHTruck)pGetNode(pstRun->m_pvAddr, lOffset);
|
||||
for(lRow = 0; (lRow < ((TblDef *)pstRun->m_pvAddr)->m_lValid) && (lOffset < lGetTableSize(t));
|
||||
pstTruck = (PSHTruck)pGetNode(pstRun->m_pvAddr, lOffset))
|
||||
{
|
||||
if(IS_TRUCK_NULL(pstTruck))
|
||||
{
|
||||
lOffset += lGetRowTruck(t);
|
||||
continue;
|
||||
}
|
||||
|
||||
fwrite(pstTruck->m_pvData, lGetRowSize(t), 1, fp);
|
||||
fwrite((void *)&pstTruck->m_lTimes, sizeof(ulong), 1, fp);
|
||||
|
||||
pstSavm->m_lEffect ++;
|
||||
lOffset += lGetRowTruck(t);
|
||||
}
|
||||
fclose(fp);
|
||||
vTableClose(pstSavm);
|
||||
|
||||
fprintf(stdout, "导出表:%s 有效记录:%ld, completed successfully !!\n", sGetTableName(t),
|
||||
pstSavm->m_lEffect);
|
||||
return RC_SUCC;
|
||||
}
|
||||
|
||||
/*************************************************************************************************
|
||||
description:lMountTable
|
||||
parameters:
|
||||
pstSavm --stvm handle
|
||||
t --table
|
||||
return:
|
||||
RC_SUCC --success
|
||||
RC_FAIL --failure
|
||||
*************************************************************************************************/
|
||||
long lMountTable(SATvm *pstSavm, char *pszFile)
|
||||
{
|
||||
TblDef stTde;
|
||||
FILE *fp = NULL;
|
||||
ulong uTimes = 0;
|
||||
long lEffect = 0;
|
||||
void *pvData = NULL;
|
||||
RunTime *pstRun = NULL;
|
||||
RWLock *prwLock = NULL;
|
||||
|
||||
if(!pszFile || !pstSavm || !strlen(pszFile))
|
||||
{
|
||||
pstSavm->m_lErrno = CONDIT_IS_NIL;
|
||||
return RC_FAIL;
|
||||
}
|
||||
|
||||
if(NULL == (fp = fopen(pszFile, "rb")))
|
||||
{
|
||||
pstSavm->m_lErrno = FIL_NOT_EXIST;
|
||||
return RC_FAIL;
|
||||
}
|
||||
|
||||
fread(&stTde, sizeof(TblDef), 1, fp);
|
||||
if(RC_SUCC != lInitSATvm(pstSavm, stTde.m_table))
|
||||
goto MOUNT_ERROR;
|
||||
|
||||
if(NULL == (pstRun = (RunTime *)pInitHitTest(pstSavm, stTde.m_table)))
|
||||
goto MOUNT_ERROR;
|
||||
|
||||
if(stTde.m_lReSize != lGetRowSize(stTde.m_table))
|
||||
{
|
||||
vTblDisconnect(pstSavm, pstSavm->tblName);
|
||||
pstSavm->m_lErrno = VER_NOT_MATCH;
|
||||
goto MOUNT_ERROR;
|
||||
}
|
||||
|
||||
if(NULL == (pvData = (void *)malloc(stTde.m_lReSize)))
|
||||
{
|
||||
vTblDisconnect(pstSavm, pstSavm->tblName);
|
||||
pstSavm->m_lErrno = MALLC_MEM_ERR;
|
||||
goto MOUNT_ERROR;
|
||||
}
|
||||
|
||||
pstSavm->pstVoid = pvData;
|
||||
pstSavm->lSize = stTde.m_lReSize;
|
||||
prwLock = (RWLock *)pGetRWLock(pstRun->m_pvAddr);
|
||||
if(RC_SUCC != pthread_rwlock_wrlock(prwLock))
|
||||
{
|
||||
vTblDisconnect(pstSavm, pstSavm->tblName);
|
||||
pstSavm->m_lErrno = LOCK_DOWR_ERR;
|
||||
goto MOUNT_ERROR;
|
||||
}
|
||||
|
||||
while(1 == fread(pvData, stTde.m_lReSize, 1, fp))
|
||||
{
|
||||
fread((void *)&uTimes, sizeof(ulong), 1, fp);
|
||||
if(lGetTblRow(stTde.m_table) <= ((TblDef *)pstRun->m_pvAddr)->m_lValid)
|
||||
{
|
||||
pthread_rwlock_unlock(prwLock);
|
||||
vTblDisconnect(pstSavm, pstSavm->tblName);
|
||||
pstSavm->m_lErrno = DATA_SPC_FULL;
|
||||
goto MOUNT_ERROR;
|
||||
}
|
||||
|
||||
lEffect ++;
|
||||
if(RC_SUCC != __lInsert(pstSavm, pstRun->m_pvAddr, pstSavm->tblName, uTimes))
|
||||
{
|
||||
fprintf(stderr, "=>警告, 导入表:%s 第(%ld)条记录错误, %s, 跳过..\n",
|
||||
sGetTableName(stTde.m_table), lEffect, sGetTError(pstSavm->m_lErrno));
|
||||
continue;
|
||||
}
|
||||
|
||||
pstSavm->m_lEffect ++;
|
||||
}
|
||||
fclose(fp);
|
||||
TFree(pvData);
|
||||
pthread_rwlock_unlock(prwLock);
|
||||
vTblDisconnect(pstSavm, pstSavm->tblName);
|
||||
|
||||
fprintf(stdout, "导入表:%s 有效记录:%ld, completed successfully !!\n",
|
||||
sGetTableName(stTde.m_table), lEffect);
|
||||
return RC_SUCC;
|
||||
|
||||
MOUNT_ERROR:
|
||||
fclose(fp);
|
||||
TFree(pvData);
|
||||
return RC_FAIL;
|
||||
}
|
||||
|
||||
/*************************************************************************************************
|
||||
* debug
|
||||
*************************************************************************************************/
|
||||
|
|
Loading…
Reference in New Issue