static int avpops_init(void) { LM_INFO("initializing...\n"); if (db_table.s) db_table.len = strlen(db_table.s); uuid_col.len = strlen(uuid_col.s); attribute_col.len = strlen(attribute_col.s); value_col.len = strlen(value_col.s); type_col.len = strlen(type_col.s); username_col.len = strlen(username_col.s); domain_col.len = strlen(domain_col.s); /* bind to the DB module */ if (avpops_db_bind()<0) goto error; default_db_url = get_default_db_url(); init_store_avps(db_columns); printbuf = (char*)pkg_malloc((buf_size+1)*sizeof(char)); if(printbuf==NULL) { LM_ERR("no pkg memory left\n"); return -1; } return 0; error: return -1; }
static int avpops_init(void) { LOG(L_INFO,"AVPops - initializing\n"); /* if DB_URL defined -> bind to a DB module */ if (DB_URL!=0) { /* check AVP_TABLE param */ if (DB_TABLE==0) { LOG(L_CRIT,"ERROR:avpops_init: \"AVP_DB\" present but " "\"AVP_TABLE\" found empty\n"); goto error; } /* bind to the DB module */ if (avpops_db_bind(DB_URL)<0) goto error; } init_store_avps( db_columns ); return 0; error: return -1; }
static int avpops_init(void) { if (db_url.s) db_url.len = strlen(db_url.s); if (db_table.s) db_table.len = strlen(db_table.s); uuid_col.len = strlen(uuid_col.s); attribute_col.len = strlen(attribute_col.s); value_col.len = strlen(value_col.s); type_col.len = strlen(type_col.s); username_col.len = strlen(username_col.s); domain_col.len = strlen(domain_col.s); /* if DB_URL defined -> bind to a DB module */ if (db_url.s!=0) { /* check AVP_TABLE param */ if (db_table.s==0) { LM_CRIT("\"AVP_DB\" present but \"AVP_TABLE\" found empty\n"); goto error; } /* bind to the DB module */ if (avpops_db_bind(&db_url)<0) goto error; } init_store_avps(db_columns); return 0; error: return -1; }
static int avpops_init(void) { LM_INFO("initializing...\n"); if (db_table.s) db_table.len = strlen(db_table.s); uuid_col.len = strlen(uuid_col.s); attribute_col.len = strlen(attribute_col.s); value_col.len = strlen(value_col.s); type_col.len = strlen(type_col.s); username_col.len = strlen(username_col.s); domain_col.len = strlen(domain_col.s); default_db_url = get_default_db_url(); if (default_db_url==NULL) { if (db_default_url==NULL) { LM_ERR("no DB URL provision into the module!\n"); return -1; } /* if nothing explicitly set as DB URL, add automatically * the default DB URL */ if (add_db_url(STR_PARAM, db_default_url)!=0) { LM_ERR("failed to use the default DB URL!\n"); return -1; } default_db_url = get_default_db_url(); if (default_db_url==NULL) { LM_BUG("Really ?!\n"); return -1; } } /* bind to the DB module */ if (avpops_db_bind()<0) goto error; init_store_avps(db_columns); printbuf = (char*)pkg_malloc((buf_size+1)*sizeof(char)); if(printbuf==NULL) { LM_ERR("no pkg memory left\n"); return -1; } return 0; error: return -1; }
static int avpops_init(void) { int i; LM_INFO("initializing...\n"); if (db_table.s) db_table.len = strlen(db_table.s); uuid_col.len = strlen(uuid_col.s); attribute_col.len = strlen(attribute_col.s); value_col.len = strlen(value_col.s); type_col.len = strlen(type_col.s); username_col.len = strlen(username_col.s); domain_col.len = strlen(domain_col.s); /* search if any avp_db_* function is used */ for (i=0; cmds[i].name != NULL; i++) { if (strncasecmp(cmds[i].name, AVPDB, sizeof(AVPDB)-1) == 0 && (is_script_func_used(cmds[i].name, cmds[i].param_no))) { need_db=1; } } for (i=0; acmds[i].name != NULL; i++) { if (strncasecmp(acmds[i].name, AVPDB, sizeof(AVPDB)-1) == 0 && (is_script_async_func_used(acmds[i].name, acmds[i].param_no))) { need_db=1; } } if (need_db) { default_db_url = get_default_db_url(); if (default_db_url==NULL) { if (db_default_url==NULL) { LM_ERR("no DB URL provision into the module!\n"); return -1; } /* if nothing explicitly set as DB URL, add automatically * the default DB URL */ if (add_db_url(STR_PARAM, db_default_url)!=0) { LM_ERR("failed to use the default DB URL!\n"); return -1; } default_db_url = get_default_db_url(); if (default_db_url==NULL) { LM_BUG("Really ?!\n"); return -1; } } /* bind to the DB module */ if (avpops_db_bind()<0) goto error; init_store_avps(db_columns); } printbuf = (char*)pkg_malloc((buf_size+1)*sizeof(char)); if(printbuf==NULL) { LM_ERR("no pkg memory left\n"); return -1; } return 0; error: return -1; }