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