Mod aaa-12 修改用户管理-配置参数,目前暂存数据库
RCA: SOL: 修改人:chenling 检视人:
This commit is contained in:
parent
c37bc6e71d
commit
2ec5be8a7a
|
@ -19,52 +19,48 @@ char * mes[]={"mod success", "mod failure", "get success", "get failure"};
|
|||
/*前端type类型只有修改,修改数据库中的内容,返回值为code message——修改成功 修改失败*/
|
||||
void mod_authpara(int port, int timehorizon, int failcount, int locktime, int aging_time, configure_result_t *configure_result)
|
||||
{
|
||||
#if 0
|
||||
authparInit();
|
||||
void * authpara_hdbc;
|
||||
char * ret_sql = NULL;
|
||||
//void * authpara_hdbc;
|
||||
//char * ret_sql = NULL;
|
||||
int ret;
|
||||
int num;
|
||||
int r = -1;
|
||||
#endif
|
||||
|
||||
if (NULL == configure_result)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
#if 0
|
||||
printf("开始连接数据库\n");
|
||||
|
||||
/* 连接数据库 */
|
||||
authpara_hdbc = connect_database(AUTHPARA_DATABASE_ID);
|
||||
if(NULL == authpara_hdbc)
|
||||
auth_hdbc = connect_database(AUTHRECOVER_DATABASE_ID);
|
||||
if(NULL == auth_hdbc)
|
||||
{
|
||||
printf("connetc failure\n");
|
||||
return;
|
||||
}
|
||||
|
||||
/*长整型bigint 浮点型double 字符串character(10)*/
|
||||
printf("authpara_hdbc = %p\n", authpara_hdbc);
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
printf("authpara_hdbc = %p\n", auth_hdbc);
|
||||
|
||||
/*建表*/
|
||||
ret = create_database_table(AUTHRECOVER_DATABASE_ID, auth_hdbc, "authparas", "create table authparas(port bigint, timehorizon bigint, failcount bigint, locktime bigint, aging_time bigint)");
|
||||
printf("%d \n",ret);
|
||||
|
||||
/* 存authpara表 默认值 */
|
||||
char *user1_authpara = "INSERT INTO `authparas` SET port = 8080, timehorizon = 1, failcount = 5, locktime = 10, aging_time = 10";
|
||||
int ret_addauthpara = update_database(AUTHRECOVER_DATABASE_ID, auth_hdbc, DB_OP_INSERT, AUTHPARA_TABLE, user1_authpara, 0);
|
||||
if(0 != ret_addauthpara)
|
||||
{
|
||||
disconnect_database(AUTHRECOVER_DATABASE_ID , auth_hdbc); // ret_release记录日志
|
||||
configure_result->resultcode = 1;
|
||||
configure_result->message = mes[configure_result->resultcode];
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if(ret == 0)
|
||||
{
|
||||
/* 存authpara表 默认值 */
|
||||
char *user1_authpara = "INSERT INTO `authparas` SET port = 8081, timehorizon = 1, failcount = 5, locktime = 10, aging_time = 10";
|
||||
int ret_addauthpara = update_database(AUTHRECOVER_DATABASE_ID, auth_hdbc, DB_OP_INSERT, AUTHPARA_TABLE, user1_authpara, 0);
|
||||
if(0 != ret_addauthpara)
|
||||
{
|
||||
configure_result->resultcode = 1;
|
||||
configure_result->message = mes[configure_result->resultcode];
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
char *user_authpara = "UPDATE `authparas` SET port = ?, timehorizon = ?, failcount = ?, locktime = ?, aging_time = ?";
|
||||
ret = update_database(AUTHRECOVER_DATABASE_ID, auth_hdbc, DB_OP_UPDATE, AUTHPARA_TABLE, user_authpara, 5,
|
||||
DB_DATA_INT_TYPE, sizeof(port), port,
|
||||
|
@ -81,9 +77,6 @@ void mod_authpara(int port, int timehorizon, int failcount, int locktime, int ag
|
|||
return;
|
||||
}
|
||||
|
||||
//disconnect_database(AUTHPARA_DATABASE_ID , authpara_hdbc);
|
||||
#endif
|
||||
|
||||
/*存全局变量*/
|
||||
auth_para->port = port;
|
||||
auth_para->timehorizon = timehorizon;
|
||||
|
|
Loading…
Reference in New Issue