2018-03-12 07:01:29 +00:00
|
|
|
|
#include "tvm.h"
|
|
|
|
|
#include "tmain.h"
|
|
|
|
|
|
2018-06-07 13:37:33 +00:00
|
|
|
|
#define TBL_USER_INFO 21
|
2018-03-12 07:01:29 +00:00
|
|
|
|
|
|
|
|
|
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 lInsertUserInfo()
|
|
|
|
|
{
|
|
|
|
|
dbUser stUser;
|
|
|
|
|
SATvm *pstSavm = (SATvm *)pGetSATvm();
|
|
|
|
|
|
|
|
|
|
/* 初始化TBL_USER_INFO表,每张表都需要初始化一次, 对于表重建后,需要重新初始化一次。*/
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
2018-06-05 04:03:18 +00:00
|
|
|
|
conditinit(pstSavm, stUser, TBL_USER_INFO); // 绑定变量
|
|
|
|
|
|
2018-06-01 05:04:49 +00:00
|
|
|
|
// stUser.acct_id = 10021; // 对结构体赋值
|
2018-03-12 07:01:29 +00:00
|
|
|
|
strcpy(stUser.user_no, "20180223"); // 对结构体赋值
|
|
|
|
|
strcpy(stUser.user_type, "1"); // 对结构体赋值
|
|
|
|
|
strcpy(stUser.user_nm, "Savens Liu"); // 对结构体赋值
|
|
|
|
|
strcpy(stUser.user_addr, "China"); // 对结构体赋值
|
|
|
|
|
strcpy(stUser.user_phone, "18672911111"); // 对结构体赋值
|
2018-06-01 05:04:49 +00:00
|
|
|
|
decorate(pstSavm, dbUser, acct_id, FIELD_INCR); // 自增llong型
|
2018-03-12 07:01:29 +00:00
|
|
|
|
|
|
|
|
|
if(RC_SUCC != lInsert(pstSavm)) // 插入记录
|
|
|
|
|
{
|
|
|
|
|
fprintf(stderr, "Insert error:(%d)(%s)\n", pstSavm->m_lErrno, sGetTError(pstSavm->m_lErrno));
|
|
|
|
|
return RC_FAIL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return RC_SUCC;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int main(int argc, char *argv[])
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if(RC_SUCC != lInsertUserInfo())
|
|
|
|
|
return RC_FAIL;
|
|
|
|
|
|
|
|
|
|
fprintf(stdout, "新增记录成功, completed successfully!!!\n");
|
|
|
|
|
fflush(stderr);
|
|
|
|
|
|
|
|
|
|
return RC_SUCC;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|