From 7e155af62c922823bdb0ca348272d51c14b4a801 Mon Sep 17 00:00:00 2001 From: deffpuzzl Date: Mon, 11 Jun 2018 16:36:23 +0800 Subject: [PATCH] fix errno --- README.MD | 5 +++-- include/tvm.h | 1 + src/stvm.c | 21 ++++++++++++++++++--- src/tcp.c | 52 +++++++++++++++++++++++++-------------------------- src/tree.c | 1 + 5 files changed, 49 insertions(+), 31 deletions(-) diff --git a/README.MD b/README.MD index fc819e9..a12d770 100644 --- a/README.MD +++ b/README.MD @@ -110,9 +110,10 @@ STVM也提供一个类型sqlpuls类型简单工具。 >* 2、在M-SQL支持查询索引 show index from tablename >* 3、新增用户M-SQL用户体验(TAB补全、查询展示showmode、showsize) -====***更新日期:20180531***==== +====***更新日期:20180610***==== ->* 1、新增queue功能 +>* 1、新增queue网络同步异步接口 +>* 1、新增将表中长时间无用数据导出备份接口 **下本版本:** * 1、新增多机资源共享方式。 diff --git a/include/tvm.h b/include/tvm.h index e4274f1..a097092 100644 --- a/include/tvm.h +++ b/include/tvm.h @@ -310,6 +310,7 @@ typedef long CREATE; #define MQUE_WAIT_ERR 98 // queue waiting for failure #define MQUE_CRTE_BIG 99 // created queue is too big #define NOT_SUPPT_OPT 100 // queue does not support this operation +#define SERV_NOT_CONN 101 // not connect server /************************************************************************************************* 创建表宏函数 diff --git a/src/stvm.c b/src/stvm.c index f9be49a..88d1347 100644 --- a/src/stvm.c +++ b/src/stvm.c @@ -4892,7 +4892,7 @@ int main(int argc, char *argv[]) vCheckTvmEnv(); memset(szCom, 0, sizeof(szCom)); - while(-1 != (iChoose = getopt(argc, argv, "w::s::p::f::d:m:t:i:l:c:v?::"))) + while(-1 != (iChoose = getopt(argc, argv, "w::s::p::f::d:m:t:i:u:l:c:v?::"))) { switch(iChoose) { @@ -4904,9 +4904,13 @@ int main(int argc, char *argv[]) case 'p': vPrintParam(optarg); return RC_SUCC; + case 'u': + lAction |= 2; + break; case 't': - vTableStruck(atol(optarg)); - return RC_SUCC; + lAction |= 1; + table = atol(optarg); + break; case 'd': if(RC_SUCC != lDumpTable(pstSavm, atol(optarg))) fprintf(stderr, "dump table error, %s\n", sGetTError(pstSavm->m_lErrno)); @@ -4942,6 +4946,17 @@ int main(int argc, char *argv[]) break; } } + + if(1 == lAction) + { + vTableStruck(atol(optarg)); + return RC_SUCC; + } + else if(2 == lAction) + { +// vTableStruck(atol(optarg)); + return RC_SUCC; + } vPrintFunc(basename(argv[0])); return RC_SUCC; diff --git a/src/tcp.c b/src/tcp.c index a85ee65..bb82fab 100644 --- a/src/tcp.c +++ b/src/tcp.c @@ -4397,7 +4397,7 @@ long lTvmPopup(SATvm *pstSavm, size_t lExpect, time_t lTime, size_t *plOut, v pstRun = (RunTime *)pGetRunTime(pstSavm, 0); if(!pstRun->pstVoid) { - pstSavm->m_lErrno = DOM_NOT_INITL; + pstSavm->m_lErrno = SERV_NOT_CONN; return RC_FAIL; } @@ -4466,7 +4466,7 @@ long lTvmPop(SATvm *pstSavm, void *pvOut, Uenum eWait) pstRun = (RunTime *)pGetRunTime(pstSavm, 0); if(!pstRun->pstVoid) { - pstSavm->m_lErrno = DOM_NOT_INITL; + pstSavm->m_lErrno = SERV_NOT_CONN; return RC_FAIL; } @@ -4528,7 +4528,7 @@ long lTvmSelect(SATvm *pstSavm, void *pvOut) pstRun = (RunTime *)pGetRunTime(pstSavm, 0); if(!pstRun->pstVoid) { - pstSavm->m_lErrno = DOM_NOT_INITL; + pstSavm->m_lErrno = SERV_NOT_CONN; return RC_FAIL; } @@ -4596,7 +4596,7 @@ long lTvmQuery(SATvm *pstSavm, size_t *plOut, void **ppvOut) pstRun = (RunTime *)pGetRunTime(pstSavm, 0); if(!pstRun->pstVoid) { - pstSavm->m_lErrno = DOM_NOT_INITL; + pstSavm->m_lErrno = SERV_NOT_CONN; return RC_FAIL; } @@ -4670,7 +4670,7 @@ long lAsyDelete(SATvm *pstSavm) pstRun = (RunTime *)pGetRunTime(pstSavm, 0); if(!pstRun->pstVoid) { - pstSavm->m_lErrno = DOM_NOT_INITL; + pstSavm->m_lErrno = SERV_NOT_CONN; return RC_FAIL; } @@ -4720,7 +4720,7 @@ long lAsyUpdate(SATvm *pstSavm, void *pvData) pstRun = (RunTime *)pGetRunTime(pstSavm, 0); if(!pstRun->pstVoid) { - pstSavm->m_lErrno = DOM_NOT_INITL; + pstSavm->m_lErrno = SERV_NOT_CONN; return RC_FAIL; } @@ -4777,7 +4777,7 @@ long lAsyReplace(SATvm *pstSavm, void *pvData) pstRun = (RunTime *)pGetRunTime(pstSavm, 0); if(!pstRun->pstVoid) { - pstSavm->m_lErrno = DOM_NOT_INITL; + pstSavm->m_lErrno = SERV_NOT_CONN; return RC_FAIL; } @@ -4832,7 +4832,7 @@ long lAsyInsert(SATvm *pstSavm) pstRun = (RunTime *)pGetRunTime(pstSavm, 0); if(!pstRun->pstVoid) { - pstSavm->m_lErrno = DOM_NOT_INITL; + pstSavm->m_lErrno = SERV_NOT_CONN; return RC_FAIL; } @@ -4880,7 +4880,7 @@ long lAsyPush(SATvm *pstSavm) pstRun = (RunTime *)pGetRunTime(pstSavm, 0); if(!pstRun->pstVoid) { - pstSavm->m_lErrno = DOM_NOT_INITL; + pstSavm->m_lErrno = SERV_NOT_CONN; return RC_FAIL; } @@ -4928,7 +4928,7 @@ long lTvmPush(SATvm *pstSavm) pstRun = (RunTime *)pGetRunTime(pstSavm, 0); if(!pstRun->pstVoid) { - pstSavm->m_lErrno = DOM_NOT_INITL; + pstSavm->m_lErrno = SERV_NOT_CONN; return RC_FAIL; } @@ -4987,7 +4987,7 @@ long lTvmInsert(SATvm *pstSavm) pstRun = (RunTime *)pGetRunTime(pstSavm, 0); if(!pstRun->pstVoid) { - pstSavm->m_lErrno = DOM_NOT_INITL; + pstSavm->m_lErrno = SERV_NOT_CONN; return RC_FAIL; } @@ -5046,7 +5046,7 @@ long lTvmDelete(SATvm *pstSavm) pstRun = (RunTime *)pGetRunTime(pstSavm, 0); if(!pstRun->pstVoid) { - pstSavm->m_lErrno = DOM_NOT_INITL; + pstSavm->m_lErrno = SERV_NOT_CONN; return RC_FAIL; } @@ -5108,7 +5108,7 @@ long lTvmUpdate(SATvm *pstSavm, void *pvData) pstRun = (RunTime *)pGetRunTime(pstSavm, 0); if(!pstRun->pstVoid) { - pstSavm->m_lErrno = DOM_NOT_INITL; + pstSavm->m_lErrno = SERV_NOT_CONN; return RC_FAIL; } @@ -5177,7 +5177,7 @@ long lTvmReplace(SATvm *pstSavm, void *pvData) pstRun = (RunTime *)pGetRunTime(pstSavm, 0); if(!pstRun->pstVoid) { - pstSavm->m_lErrno = DOM_NOT_INITL; + pstSavm->m_lErrno = SERV_NOT_CONN; return RC_FAIL; } @@ -5244,7 +5244,7 @@ long lTvmTruncate(SATvm *pstSavm, TABLE t) pstRun = (RunTime *)pGetRunTime(pstSavm, 0); if(!pstRun->pstVoid) { - pstSavm->m_lErrno = DOM_NOT_INITL; + pstSavm->m_lErrno = SERV_NOT_CONN; return RC_FAIL; } @@ -5300,7 +5300,7 @@ long lTvmGroup(SATvm *pstSavm, size_t *plOut, void **ppvOut) pstRun = (RunTime *)pGetRunTime(pstSavm, 0); if(!pstRun->pstVoid) { - pstSavm->m_lErrno = DOM_NOT_INITL; + pstSavm->m_lErrno = SERV_NOT_CONN; return RC_FAIL; } @@ -5381,7 +5381,7 @@ long lTvmCount(SATvm *pstSavm, size_t *plCount) pstRun = (RunTime *)pGetRunTime(pstSavm, 0); if(!pstRun->pstVoid) { - pstSavm->m_lErrno = DOM_NOT_INITL; + pstSavm->m_lErrno = SERV_NOT_CONN; return RC_FAIL; } @@ -5443,7 +5443,7 @@ long lTvmExtreme(SATvm *pstSavm, void *pvOut) pstRun = (RunTime *)pGetRunTime(pstSavm, 0); if(!pstRun->pstVoid) { - pstSavm->m_lErrno = DOM_NOT_INITL; + pstSavm->m_lErrno = SERV_NOT_CONN; return RC_FAIL; } @@ -5515,7 +5515,7 @@ long lTvmDropTable(SATvm *pstSavm, TABLE t) pstRun = (RunTime *)pGetRunTime(pstSavm, 0); if(!pstRun->pstVoid) { - pstSavm->m_lErrno = DOM_NOT_INITL; + pstSavm->m_lErrno = SERV_NOT_CONN; return RC_FAIL; } @@ -5569,7 +5569,7 @@ long lTvmRenameTable(SATvm *pstSavm, TABLE to, TABLE tn) pstRun = (RunTime *)pGetRunTime(pstSavm, 0); if(!pstRun->pstVoid) { - pstSavm->m_lErrno = DOM_NOT_INITL; + pstSavm->m_lErrno = SERV_NOT_CONN; return RC_FAIL; } @@ -5624,7 +5624,7 @@ long lTvmClick(SATvm *pstSavm, ulong *pulHits) pstRun = (RunTime *)pGetRunTime(pstSavm, 0); if(!pstRun->pstVoid) { - pstSavm->m_lErrno = DOM_NOT_INITL; + pstSavm->m_lErrno = SERV_NOT_CONN; return RC_FAIL; } @@ -5692,7 +5692,7 @@ long lTvmSelectSeque(SATvm *pstSavm, char *pszSQName, ulong *pulNumber) pstRun = (RunTime *)pGetRunTime(pstSavm, 0); if(!pstRun->pstVoid) { - pstSavm->m_lErrno = DOM_NOT_INITL; + pstSavm->m_lErrno = SERV_NOT_CONN; return RC_FAIL; } @@ -5755,7 +5755,7 @@ long lTvmSetSequence(SATvm *pstSavm, char *pszSQName, ulong uStart) pstRun = (RunTime *)pGetRunTime(pstSavm, 0); if(!pstRun->pstVoid) { - pstSavm->m_lErrno = DOM_NOT_INITL; + pstSavm->m_lErrno = SERV_NOT_CONN; return RC_FAIL; } @@ -5811,7 +5811,7 @@ long lTvmRebuildIndex(SATvm *pstSavm, TABLE t) pstRun = (RunTime *)pGetRunTime(pstSavm, 0); if(!pstRun->pstVoid) { - pstSavm->m_lErrno = DOM_NOT_INITL; + pstSavm->m_lErrno = SERV_NOT_CONN; return RC_FAIL; } @@ -5863,7 +5863,7 @@ long lTvmResetLock(SATvm *pstSavm, TABLE t) pstRun = (RunTime *)pGetRunTime(pstSavm, 0); if(!pstRun->pstVoid) { - pstSavm->m_lErrno = DOM_NOT_INITL; + pstSavm->m_lErrno = SERV_NOT_CONN; return RC_FAIL; } @@ -5915,7 +5915,7 @@ long _lTvmWork(SATvm *pstSavm, Benum eWork) pstRun = (RunTime *)pGetRunTime(pstSavm, 0); if(!pstRun->pstVoid) { - pstSavm->m_lErrno = DOM_NOT_INITL; + pstSavm->m_lErrno = SERV_NOT_CONN; return RC_FAIL; } diff --git a/src/tree.c b/src/tree.c index 7c157c2..e131446 100644 --- a/src/tree.c +++ b/src/tree.c @@ -153,6 +153,7 @@ static char tvmerr[128][MAX_INDEX_LEN] = { "queue waiting for failure", "created queue is too big", "queue does not support this operation", + "not connect to server", "", };