2018-03-12 07:01:29 +00:00
|
|
|
|
#include "tvm.h"
|
|
|
|
|
#include "tmain.h"
|
|
|
|
|
|
|
|
|
|
#define TBL_USER_INFO 20
|
|
|
|
|
|
|
|
|
|
typedef struct __TBL_USER_INFO
|
|
|
|
|
{
|
|
|
|
|
long acct_id;
|
|
|
|
|
char user_no[21];
|
|
|
|
|
char user_type[2];
|
|
|
|
|
char user_nm[81];
|
|
|
|
|
char user_addr[161];
|
|
|
|
|
char user_phone[31];
|
|
|
|
|
}dbUser;
|
|
|
|
|
|
|
|
|
|
long lSelectUserInfo()
|
|
|
|
|
{
|
|
|
|
|
dbUser stUser;
|
|
|
|
|
int i = 0;
|
|
|
|
|
SATvm *pstSavm = (SATvm *)pGetSATvm();
|
|
|
|
|
|
|
|
|
|
/* 初始化TBL_USER_INFO表,每张表都需要初始化一次, 对于表重建后,需要重新初始化一次。*/
|
2018-06-19 08:30:51 +00:00
|
|
|
|
vHoldConnect(pstSavm); // 让进程始终与STVM 保持链接,可以大大提高效率
|
2018-03-12 07:01:29 +00:00
|
|
|
|
if(RC_SUCC != lInitSATvm(pstSavm, TBL_USER_INFO))
|
|
|
|
|
{
|
|
|
|
|
fprintf(stderr, "init failed, err:(%d)(%s)\n", pstSavm->m_lErrno, sGetTError(pstSavm->m_lErrno));
|
|
|
|
|
return RC_FAIL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
conditinit(pstSavm, stUser, TBL_USER_INFO); // 绑定变量
|
2018-06-14 01:42:35 +00:00
|
|
|
|
conditstr(pstSavm, stUser, user_type, "1"); // 查询条件赋值
|
|
|
|
|
conditstr(pstSavm, stUser, user_no, "20180223"); // 查询条件赋值
|
2018-03-12 07:01:29 +00:00
|
|
|
|
|
|
|
|
|
for(i = 0; i < 2000000; i ++)
|
|
|
|
|
{
|
|
|
|
|
if(RC_SUCC != lSelect(pstSavm, (void *)&stUser))
|
|
|
|
|
{
|
|
|
|
|
fprintf(stderr, "Select error: (%d) (%s)\n", pstSavm->m_lErrno, sGetTError(pstSavm->m_lErrno));
|
2018-06-20 00:52:21 +00:00
|
|
|
|
return RC_FAIL;
|
2018-03-12 07:01:29 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fprintf(stdout, "acct_id:%ld, user_no:%s, user_type:%s, user_nm:%s, user_addr:%s, user_phone:%s\n",
|
|
|
|
|
stUser.acct_id, stUser.user_no, stUser.user_type, stUser.user_nm, stUser.user_addr, stUser.user_phone);
|
|
|
|
|
|
|
|
|
|
vHoldRelease(pstSavm); // 在进程退出时,断开链接
|
|
|
|
|
return RC_SUCC;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int main(int argc, char *argv[])
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if(RC_SUCC != lSelectUserInfo())
|
|
|
|
|
return RC_FAIL;
|
|
|
|
|
|
|
|
|
|
return RC_SUCC;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|