int pp_add_inactive_pkg (int pkg_id, int *pkg_inst_id, int *pkg_inst_id_serv, char *start_date) { int track_id; int serv_id; int status; int ret_code; dbfcmd(dbproc1, "exec pp_insert_inactive_pkg @account_no = %d,",gaccount_no); dbfcmd(dbproc1, " @pkg_id = %d, ", pkg_id); dbfcmd(dbproc1, " @active_dt = '%s' ", start_date); if(safe_dbexec(dbproc1,"INSERT_PKG", "insert_pkg")) return(FAILURE); while ((status = safe_dbresults (dbproc1, "INSERT_PKG", "insert_pkg")) != NO_MORE_RESULTS) { if (status == FAIL) return(FAILURE); dbbind (dbproc1, 1, INTBIND, 0, &track_id); dbbind (dbproc1, 2, INTBIND, 0, &serv_id); while ((ret_code = dbnextrow(dbproc1)) != NO_MORE_ROWS) { if(ret_code == FAIL) return(FAILURE); /* process results */ *pkg_inst_id = track_id; *pkg_inst_id_serv = serv_id; } } return (SUCCESS); }
int pp_mark_pkg_active( int pkg_id, int pkg_inst_id, int pkg_inst_id_serv) { int status; RETCODE ret_code; dbcmd (dbproc1, "EXEC pp_mark_pkg_active "); dbfcmd(dbproc1, " @pkg_inst_id = %d, ", pkg_inst_id); dbfcmd(dbproc1, " @pkg_inst_id_serv = %d ", pkg_inst_id_serv); if(safe_dbexec(dbproc1,"MARK_PKG_ACTIVE", "mark_pkg_active")) return(FAILURE); while ((status = safe_dbresults (dbproc1, "MARK_PKG_ACTIVE", "mark_pkg_active")) != NO_MORE_RESULTS) { if (status == FAIL) return(FAILURE); while ((ret_code = dbnextrow(dbproc1)) != NO_MORE_ROWS) { if(ret_code == FAIL) return(FAILURE); /* process results */ } } return (SUCCESS); }
int get_next_bill_date (char *bill_period, char *billing_frequency, char *prev_cutoff_date, char *next_bill_date) { int ret_code; /* Nested select statement -- just one way to do this query */ dbfcmd(dbproc1, "select convert(char(8), min(ppdd_date), %d) ", gdatefmt); dbcmd (dbproc1, "from BILL_CYCLE where ppdd_date in "); dbcmd (dbproc1, "(select ppdd_date from BILL_CYCLE "); if ((bill_period == NULL) || (strlen(bill_period) == 0)) dbcmd (dbproc1, "having bill_period = min(bill_period) "); else dbfcmd(dbproc1, "having bill_period = '%s' ", bill_period); if ((billing_frequency == NULL) || (strlen(billing_frequency) == 0)) dbcmd (dbproc1, "and billing_frequency = min(billing_frequency) "); else dbfcmd(dbproc1, "and billing_frequency = %s ", billing_frequency); if ((prev_cutoff_date == NULL) || (strlen(prev_cutoff_date) == 0)) dbcmd (dbproc1, "and cutoff_date > getdate()) "); else dbfcmd(dbproc1, "and cutoff_date > '%s') ", prev_cutoff_date); br_dbsqlexec(dbproc1); if (Sybase_error) { dbcancel(dbproc1); return(FAILURE); } while ((ret_code = dbresults(dbproc1)) != NO_MORE_RESULTS) { if (ret_code != SUCCEED) { dbcancel(dbproc1); return(FAILURE); } dbbind(dbproc1, 1, NTBSTRINGBIND, 0, next_bill_date); while (dbnextrow(dbproc1) != NO_MORE_ROWS); /* empty */ } if (Sybase_error) { dbcancel(dbproc1); return(FAILURE); } return (SUCCESS); } /* end get_next_bill_date */
int delete_overrides_rc_db() { char *db_string; int i = 0, ret_code; dbcmd(dbproc1," delete OVERRIDES_RC "); dbcmd(dbproc1, " where "); db_string = (char *)convert_to_db_string(overrides_rc_selected.tax_pkg_inst_id); dbfcmd(dbproc1, " (tax_pkg_inst_id = %d", atoi(db_string)); if (atoi(db_string)==0){ dbfcmd(dbproc1, " or tax_pkg_inst_id is NULL) " ); }else{ dbfcmd(dbproc1, ") " ); } free(db_string); dbcmd(dbproc1, " and "); db_string = (char *)convert_to_db_string(overrides_rc_selected.element_id); dbfcmd(dbproc1, " element_id = %d", atoi(db_string)); free(db_string); dbcmd(dbproc1, " and "); db_string = (char *)convert_to_db_string(overrides_rc_selected.geocode); dbfcmd(dbproc1, " geocode = '%s'", db_string); free(db_string); if(safe_dbupdate(dbproc1, "OVERRIDES_RC", "delete_overrides_rc_db")) { return(FAILURE); } while ((ret_code = dbnextrow(dbproc1)) == REG_ROW) { if (ret_code == FAIL) { return(FAILURE); } } if(check_dbresults(dbproc1,ret_code,"OVERRIDES_RC", "delete_overrides_rc_db")) return(FAILURE); return(SUCCESS); }
int verify_type_id_usg(RATE_USAGE_OVERRIDES_STRUCT *struct_ptr, int *count) { int i=0; int ret_code; dbcmd(dbproc1, " select count(*) "); dbcmd(dbproc1, " from USAGE_TYPES "); dbfcmd(dbproc1, " where type_id_usg = %s", struct_ptr->type_id_usg); if (safe_dbselect(dbproc1, "USAGE_TYPES", "verify_type_id_usg")) { return(FAILURE); } dbbind(dbproc1,1,INTBIND,0, count); while (dbnextrow(dbproc1) == REG_ROW) { i++; } /* end of while loop */ if(check_dbresults(dbproc1,ret_code,"USAGE_TYPES", "verify_type_id_usg")) { return(FAILURE); } return (SUCCESS); }
int verify_terminate (int *ok_to_terminate) { RETCODE ret_code; dbfcmd(dbproc1, "EXEC csr_verify_acct_terminate @account_no = %d", gaccount_no); br_dbsqlexec(dbproc1); if (Sybase_error) { dbcancel(dbproc1); return(FAILURE); } while ((ret_code = dbresults(dbproc1)) != NO_MORE_RESULTS) { if (ret_code != SUCCEED) { dbcancel(dbproc1); return(FAILURE); } dbbind(dbproc1, 1, INTBIND, 0, ok_to_terminate); while (dbnextrow(dbproc1) != NO_MORE_ROWS); /* empty */ } if (Sybase_error) { dbcancel(dbproc1); return(FAILURE); } return (SUCCESS); } /* end verify_terminate */
void get_all(char *mitnr_in) { dbfcmd(dbproc,"SELECT m.Name, m.Vorname, m.Ort, m.Gebdat, m.Beruf, m.Telnr, mp.Istvzae, mp.Planvzae, p.Proname FROM Mitarbeiter m, MiPro mp, Projekt p WHERE m.Mitnr = mp.Mitnr AND mp.Pronr = p.Pronr AND m.Mitnr = '%s'", mitnr_in); dbsqlexec(dbproc); while (dbresults(dbproc)!=NO_MORE_RESULTS) { i=0; dbbind(dbproc,1,NTBSTRINGBIND,0,name); dbbind(dbproc,2,NTBSTRINGBIND,0,vorname); dbbind(dbproc,3,NTBSTRINGBIND,0,ort); dbbind(dbproc,4,DATETIMEBIND,0,(BYTE *)&gebdat); dbbind(dbproc,5,NTBSTRINGBIND,0,beruf); dbbind(dbproc,6,NTBSTRINGBIND,0,telnr); dbbind(dbproc,7,FLT8BIND,0,(BYTE *)&istvzae); dbbind(dbproc,8,FLT8BIND,0,(BYTE *)&planvzae); dbbind(dbproc,9,NTBSTRINGBIND,0,proname); while (dbnextrow(dbproc)!=NO_MORE_ROWS) { printf("%d:\t%s,\t%s,\t%s,\t%s,\t%s,\t%s,\t%f,\t%f,\t%s,\n",i, name, vorname, ort, date_to_str(gebdat), beruf, telnr, istvzae, planvzae, proname); i++; } } }
/* verify that the provider class is valid(exist in PROVIDER_CLASS_REF) */ int verify_provider_class(RATE_USAGE_OVERRIDES_STRUCT *struct_ptr, int *count) { int i=0; int ret_code; dbcmd(dbproc1, " select count(*) "); dbcmd(dbproc1, " from PROVIDER_CLASS_REF "); dbfcmd(dbproc1, " where provider_class = %s", struct_ptr->provider_class); if (safe_dbselect(dbproc1, "PROVIDER_CLASS_REF", "verify_provider_class")) { return(FAILURE); } dbbind(dbproc1,1,INTBIND,0, count); while (dbnextrow(dbproc1) == REG_ROW) { i++; } /* end of while loop */ if(check_dbresults(dbproc1,ret_code,"PROVIDER_CLASS_REF", "verify_provider_class")) { return(FAILURE); } return (SUCCESS); }
int delete_col_collector_db() { char *db_string; int i = 0, ret_code; dbcmd(dbproc1," delete COL_COLLECTOR "); dbcmd(dbproc1, " where "); db_string = (char *)convert_to_db_string(col_collector_selected.collector_id); dbfcmd(dbproc1, " collector_id = %d", atoi(db_string)); free(db_string); if(safe_dbupdate(dbproc1, "COL_COLLECTOR", "delete_col_collector_db")) { return(FAILURE); } while ((ret_code = dbnextrow(dbproc1)) == REG_ROW) { if (ret_code == FAIL) { return(FAILURE); } } if(check_dbresults(dbproc1,ret_code,"COL_COLLECTOR", "delete_col_collector_db")) return(FAILURE); return(SUCCESS); }
int pp_add_component (int comp_id, int pkg_id, int pkg_inst_id, int pkg_inst_id_serv, int level, int id_value, int subscr_no_resets, int *comp_inst_id, int *comp_inst_id_serv, char *start_date, int pkg_status) { int track_id; int serv_id; int status; int ret_code; dbcmd (dbproc1, "EXEC pp_add_component_to_pkg "); dbfcmd(dbproc1, " @pkg_id = %d, ", pkg_id); dbfcmd(dbproc1, " @pkg_inst_id = %d, ", pkg_inst_id); dbfcmd(dbproc1, " @pkg_inst_id_serv = %d, ", pkg_inst_id_serv); dbfcmd(dbproc1, " @pkg_status = %d, ",pkg_status ); dbfcmd(dbproc1, " @comp_id = %d, ", comp_id); dbfcmd(dbproc1, " @id_type = %d, ", level); dbfcmd(dbproc1, " @id_value = %d, ", id_value); dbfcmd(dbproc1, " @subscr_no_resets = %d, ", subscr_no_resets); dbfcmd(dbproc1, " @active_dt = '%s' ", start_date); if(safe_dbexec(dbproc1,"INSERT_PKG", "insert_pkg")) return(FAILURE); while ((status = safe_dbresults (dbproc1, "INSERT_PKG", "insert_pkg")) != NO_MORE_RESULTS) { if (status == FAIL) return(FAILURE); dbbind (dbproc1, 1, INTBIND, 0, &track_id); dbbind (dbproc1, 2, INTBIND, 0, &serv_id); while ((ret_code = dbnextrow(dbproc1)) != NO_MORE_ROWS) { if(ret_code == FAIL) return(FAILURE); /* process results */ *comp_inst_id = track_id; *comp_inst_id_serv = serv_id; } } return (SUCCESS); }
static void test0(int n, const char * expected) { DBINT ind, expected_ind; char text_buf[16]; dbfcmd(dbproc, "select c from #null where n = %d", n); dbsqlexec(dbproc); if (dbresults(dbproc) != SUCCEED) { fprintf(stderr, "Was expecting a row.\n"); failed = 1; dbcancel(dbproc); return; } dbbind(dbproc, 1, NTBSTRINGBIND, 0, (BYTE *)text_buf); if (use_nullbind) dbnullbind(dbproc, 1, &ind); memset(text_buf, 'a', sizeof(text_buf)); ind = -5; if (dbnextrow(dbproc) != REG_ROW) { fprintf(stderr, "Was expecting a row.\n"); failed = 1; dbcancel(dbproc); return; } text_buf[sizeof(text_buf) - 1] = 0; printf("ind %d text_buf -%s-\n", (int) ind, text_buf); expected_ind = 0; if (strcmp(expected, "aaaaaaaaaaaaaaa") == 0) expected_ind = -1; /* do not check indicator if not bound */ if (!use_nullbind) ind = expected_ind; if (ind != expected_ind || strcmp(expected, text_buf) != 0) { fprintf(stderr, "expected_ind %d expected -%s-\n", (int) expected_ind, expected); failed = 1; dbcancel(dbproc); return; } if (dbnextrow(dbproc) != NO_MORE_ROWS) { fprintf(stderr, "Only one row expected\n"); dbcancel(dbproc); failed = 1; } while (dbresults(dbproc) == SUCCEED) { /* nop */ } }
int delete_bill_cycle_db() { char *db_string; int i = 0, ret_code; dbcmd(dbproc1," delete BILL_CYCLE "); dbcmd(dbproc1, " where "); db_string = (char *)convert_to_db_string(bill_cycle_selected.bill_period); dbfcmd(dbproc1, " bill_period = '%s'", db_string); free(db_string); db_string = (char *)convert_to_db_string(bill_cycle_selected.billing_frequency); dbfcmd(dbproc1, " and billing_frequency = %d", atoi(db_string)); free(db_string); date_time_to_Arbdate(bill_cycle_selected.next_ppdd_date, bill_cycle_selected.next_ppdd_time, &(bill_cycle_selected.next_ppdd_dt)); dbfcmd(dbproc1, " and next_ppdd_date = %t ", &(bill_cycle_selected.next_ppdd_dt)); if(safe_dbupdate(dbproc1, "BILL_CYCLE", "delete_bill_cycle_db")) { return(FAILURE); } while ((ret_code = dbnextrow(dbproc1)) == REG_ROW) { if (ret_code == FAIL) { return(FAILURE); } } if(check_dbresults(dbproc1,ret_code,"BILL_CYCLE", "delete_bill_cycle_db")) return(FAILURE); return(SUCCESS); }
void eft_get_status_codes() { int db_code; char description[81]; RETCODE ret_code; /* this gets called once and hangs around forever */ description[0] = '\0'; db_code = 0; eft_num_display_statuses = 0; if(eft_sel_shell == NULL) create_eft_sel_shell(eft_shell); dbcmd(dbeftproc,"select integer_value,display_value from GUI_INDICATOR_VALUES where "); dbcmd(dbeftproc,"table_name = 'EFT_TRANS' and field_name = 'trans_status'"); dbfcmd(dbeftproc, " and language_code = %d", gGUIlanguage ); br_dbsqlexec(dbeftproc); if (Sybase_error) { dbcancel(dbeftproc); return; } while((ret_code = dbresults(dbeftproc)) != NO_MORE_RESULTS) { if(ret_code == FAIL) { dbcancel(dbeftproc); return; } dbbind(dbeftproc,1,INTBIND,0,&db_code); dbbind(dbeftproc,2,NTBSTRINGBIND,0,description); while (dbnextrow(dbeftproc) != NO_MORE_ROWS) { /* Found an entry. */ eft_num_display_statuses++; eft_display_statuses = (EFT_DB_POPLIST_TYPE *) realloc (eft_display_statuses,eft_num_display_statuses * sizeof (EFT_DB_POPLIST_TYPE)); eft_display_statuses_list = (XmString *) realloc (eft_display_statuses_list,eft_num_display_statuses * sizeof (XmString)); eft_display_statuses[eft_num_display_statuses - 1].db_code = db_code; strcpy (eft_display_statuses[eft_num_display_statuses - 1].description,description); eft_display_statuses_list[eft_num_display_statuses - 1] = XmStringCreateSimple (description); } } if(Sybase_error) { dbcancel(dbeftproc); return; } }
int delete_rate_usage_or_db() { int i = 0, ret_code; dbcancel(dbproc1); if(begin_tran(dbproc1,"DELETE_RATE_USAGE_OVERRIDES") == FAILURE) return(FAILURE); dbcmd(dbproc1," delete RATE_USAGE_BANDS_OVERRIDES "); dbfcmd(dbproc1," where seqnum = %s ",rate_usage_or_selected.seqnum); if(safe_dbupdate(dbproc1, "RATE_USAGE_BANDS_OVERRIDES", "delete_rate_usage_or_db")) { (void)rollback_tran(dbproc1, "delete_rate_usage_or_db"); dbcancel(dbproc1); return(FAILURE); } dbcmd(dbproc1," delete RATE_USAGE_OVERRIDES "); dbfcmd(dbproc1, " where seqnum = %s ",rate_usage_or_selected.seqnum); if(safe_dbupdate(dbproc1, "RATE_USAGE_OVERRIDES", "delete_rate_usage_or_db")) { (void)rollback_tran(dbproc1, "delete_rate_usage_or_db"); dbcancel(dbproc1); return(FAILURE); } /* ************************ */ (void)commit_tran(dbproc1); /* ** COMMIT TRANSACTION ** */ /* ************************ */ return(SUCCESS); }
/* ******************************************* * insert information ******************************************* */ int ext_kermit_access_save_db(EXT_KERMIT_ACCESS_STRUCT *ext_kermit_access_struct) { int i, ret_code; int status; char *db_string = NULL; /***************************************** Insert into EXT_KERMIT_ACCESS; *****************************************/ dbcmd(dbproc1," insert into EXT_KERMIT_ACCESS "); dbcmd(dbproc1, " (ext_contact_id,local_loginfile_path,local_modem,"); dbcmd(dbproc1, " local_port_path,local_speed,local_work_dir,"); dbcmd(dbproc1, " remote_phone_num)"); dbcmd(dbproc1, " values("); db_string = (char *)convert_to_db_string(ext_kermit_access_struct->ext_contact_id); dbfcmd(dbproc1, " %d,",atoi(db_string)); free(db_string); db_string = (char *)convert_to_db_string(ext_kermit_access_struct->local_loginfile_path); if (!strlen(db_string)) dbcmd(dbproc1, " NULL,"); else dbfcmd(dbproc1, " '%s',",db_string); free(db_string); db_string = (char *)convert_to_db_string(ext_kermit_access_struct->local_modem); dbfcmd(dbproc1, " '%s',",db_string); free(db_string); db_string = (char *)convert_to_db_string(ext_kermit_access_struct->local_port_path); dbfcmd(dbproc1, " '%s',",db_string); free(db_string); db_string = (char *)convert_to_db_string(ext_kermit_access_struct->local_speed); dbfcmd(dbproc1, " %d,",atoi(db_string)); free(db_string); db_string = (char *)convert_to_db_string(ext_kermit_access_struct->local_work_dir); dbfcmd(dbproc1, " '%s',",db_string); free(db_string); db_string = (char *)convert_to_db_string(ext_kermit_access_struct->remote_phone_num); dbfcmd(dbproc1, " '%s')",db_string); free(db_string); if (safe_dbupdate(dbproc1, "EXT_KERMIT_ACCESS", "ext_kermit_access_save_db")) { return(FAILURE); } return(SUCCESS); }
/* ******************************************* * insert information ******************************************* */ int bill_cycle_save_db(BILL_CYCLE_STRUCT *bill_cycle_struct) { int i, ret_code; int status; char *db_string = NULL; /***************************************** Insert into BILL_CYCLE; *****************************************/ dbcmd(dbproc1," insert into BILL_CYCLE "); dbcmd(dbproc1, " (bill_period,billing_frequency,ppdd_date,"); dbcmd(dbproc1, " next_ppdd_date,statement_date,cutoff_date,"); dbcmd(dbproc1, " prep_delay)"); dbcmd(dbproc1, " values("); db_string = (char *)convert_to_db_string(bill_cycle_struct->bill_period); dbfcmd(dbproc1, " '%s',",db_string); free(db_string); db_string = (char *)convert_to_db_string(bill_cycle_struct->billing_frequency); dbfcmd(dbproc1, " %d,",atoi(db_string)); free(db_string); date_time_to_Arbdate(bill_cycle_struct->ppdd_date, bill_cycle_struct->ppdd_time, &(bill_cycle_struct->ppdd_dt)); dbfcmd(dbproc1, " %t,", &(bill_cycle_struct->ppdd_dt)); date_time_to_Arbdate(bill_cycle_struct->next_ppdd_date, bill_cycle_struct->next_ppdd_time, &(bill_cycle_struct->next_ppdd_dt)); dbfcmd(dbproc1, " %t,", &(bill_cycle_struct->next_ppdd_dt)); date_time_to_Arbdate(bill_cycle_struct->statement_date, bill_cycle_struct->statement_time, &(bill_cycle_struct->statement_dt)); dbfcmd(dbproc1, " %t,", &(bill_cycle_struct->statement_dt)); date_time_to_Arbdate(bill_cycle_struct->cutoff_date, bill_cycle_struct->cutoff_time, &(bill_cycle_struct->cutoff_dt)); dbfcmd(dbproc1, " %t,", &(bill_cycle_struct->cutoff_dt)); db_string = (char *)convert_to_db_string(bill_cycle_struct->prep_delay); dbfcmd(dbproc1, " %d)",atoi(db_string)); free(db_string); if (safe_dbupdate(dbproc1, "BILL_CYCLE", "bill_cycle_save_db")) { return(FAILURE); } return(SUCCESS); }
static void test(const char *type, int give_err) { RETCODE ret; query("if object_id('#null') is not NULL drop table #null"); dberrhandle(ignore_err_handler); dbmsghandle(ignore_msg_handler); printf("create table #null (n int, c %s NULL)\n", type); dbfcmd(dbproc, "create table #null (n int, c %s NULL)", type); dbsqlexec(dbproc); ret = dbresults(dbproc); dberrhandle(syb_err_handler); dbmsghandle(syb_msg_handler); if (ret != SUCCEED) { dbcancel(dbproc); if (!give_err) return; fprintf(stdout, "Was expecting a result set.\n"); failed = 1; return; } query("insert into #null values(1, '')"); query("insert into #null values(2, NULL)"); query("insert into #null values(3, ' ')"); query("insert into #null values(4, 'foo')"); use_nullbind = 1; test0(1, ""); test0(2, "aaaaaaaaaaaaaaa"); test0(3, ""); test0(4, "foo"); use_nullbind = 0; test0(1, ""); test0(2, ""); test0(3, ""); test0(4, "foo"); query("drop table #null"); }
/* ******************************************* * insert information ******************************************* */ int ext_socket_access_save_db(EXT_SOCKET_ACCESS_STRUCT *ext_socket_access_struct) { int i, ret_code; int status; char *db_string = NULL; /***************************************** Insert into EXT_SOCKET_ACCESS; *****************************************/ dbcmd(dbproc1," insert into EXT_SOCKET_ACCESS "); dbcmd(dbproc1, " (ext_contact_id,remote_host,ip_address,"); dbcmd(dbproc1, " port,timeout, eof_data)"); dbcmd(dbproc1, " values("); db_string = (char *)convert_to_db_string(ext_socket_access_struct->ext_contact_id); dbfcmd(dbproc1, " %d,",atoi(db_string)); free(db_string); db_string = (char *)convert_to_db_string(ext_socket_access_struct->remote_host); dbfcmd(dbproc1, " '%s',",db_string); free(db_string); db_string = (char *)convert_to_db_string(ext_socket_access_struct->ip_address); dbfcmd(dbproc1, " '%s',",db_string); free(db_string); db_string = (char *)convert_to_db_string(ext_socket_access_struct->port); dbfcmd(dbproc1, " %d,",atoi(db_string)); free(db_string); db_string = (char *)convert_to_db_string(ext_socket_access_struct->timeout); dbfcmd(dbproc1, " %d,",atoi(db_string)); free(db_string); db_string = (char *)convert_to_db_string(ext_socket_access_struct->eof_data); if (strlen(db_string) == 0) dbfcmd(dbproc1, " NULL)",db_string); else dbfcmd(dbproc1, " %s)",db_string); free(db_string); if (safe_dbupdate(dbproc1, "EXT_SOCKET_ACCESS", "ext_socket_access_save_db")) { return(FAILURE); } return(SUCCESS); }
void get_mitarbeiter(char *beruf_in) { dbfcmd(dbproc,"SELECT Mitnr, Name, Vorname FROM Mitarbeiter WHERE Beruf = '%s'", beruf_in); dbsqlexec(dbproc); while (dbresults(dbproc)!=NO_MORE_RESULTS) { i=0; dbbind(dbproc,1,NTBSTRINGBIND,5,mitnr); dbbind(dbproc,2,NTBSTRINGBIND,10,name); dbbind(dbproc,3,NTBSTRINGBIND,10,vorname); while (dbnextrow(dbproc)!=NO_MORE_ROWS) { printf("%d:\t%s,\t%s,\t%s\n",i, mitnr, name, vorname); i++; } } }
int delete_ext_socket_access_db() { char *db_string; int i = 0, ret_code; dbcmd(dbproc1," delete EXT_SOCKET_ACCESS "); dbcmd(dbproc1, " where "); db_string = (char *)convert_to_db_string(ext_socket_access_selected.ext_contact_id); dbfcmd(dbproc1, " ext_contact_id = %d", atoi(db_string)); free(db_string); if(safe_dbupdate(dbproc1, "EXT_SOCKET_ACCESS", "delete_ext_socket_access_db")) { return(FAILURE); } return(SUCCESS); }
int get_num_of_cust(char *from_str, char *search_str, int *num_of_cust, int *last_account_no) { RETCODE ret_code; /* Get the number of accounts that match the find criteria. ** This query will return a count of 1 even if the user is ** finding on subscr_no and there are >1 EMF records with ** the same subscr_no/account_no. A simple "select count(*) ** <from_str> <where_str>" would return >1 and would then ** popup the account selection box. */ /* get count from the catalog db */ dbcancel(dbcatalog); dbcmd (dbcatalog, "select SERVER_LOOKUP.account_no "); dbfcmd(dbcatalog, " %s %s ", from_str, search_str); if (safe_dbselect(dbcatalog, "ARBOR_CATALOG", "get_num_of_cust()")) return FAILURE; dbbind(dbcatalog, 1, INTBIND, 0, last_account_no); *num_of_cust = 0; while ((ret_code = dbnextrow(dbcatalog)) == REG_ROW) (*num_of_cust)++; if (check_dbresults(dbcatalog, ret_code, "ARBOR_CATALOG", "get_num_of_cust()")) return FAILURE; return SUCCESS; } /* end get_num_of_cust */
int get_ext_socket_access_detail_db(int position) { int i = 0, ret_code; char *db_string = NULL; short prefix_flag; char eof_data[41]; dbcmd(dbproc1, " select "); dbcmd(dbproc1, " ext_contact_id,"); dbcmd(dbproc1, " remote_host,"); dbcmd(dbproc1, " ip_address,"); dbcmd(dbproc1, " port,"); dbcmd(dbproc1, " timeout,"); dbcmd(dbproc1, " eof_data"); dbcmd(dbproc1, " from EXT_SOCKET_ACCESS "); dbcmd(dbproc1, " where "); db_string = (char *)convert_to_db_string(ext_socket_access_list[position-1].ext_contact_id); dbfcmd(dbproc1, " ext_contact_id = %d", atoi(db_string)); free(db_string); if (safe_dbselect(dbproc1, "EXT_SOCKET_ACCESS", "get_ext_socket_access_detail_db")) { return(FAILURE); } memset((char *) &ext_socket_access_selected, 0, sizeof(EXT_SOCKET_ACCESS_STRUCT)); dbbind(dbproc1,1,NTBSTRINGBIND,256, ext_socket_access_selected.ext_contact_id); dbbind(dbproc1,2,NTBSTRINGBIND,256, ext_socket_access_selected.remote_host); dbbind(dbproc1,3,NTBSTRINGBIND,256, ext_socket_access_selected.ip_address); dbbind(dbproc1,4,NTBSTRINGBIND,256, ext_socket_access_selected.port); dbbind(dbproc1,5,NTBSTRINGBIND,256, ext_socket_access_selected.timeout); dbbind(dbproc1,6,NTBSTRINGBIND,256, eof_data); while ((ret_code = dbnextrow(dbproc1)) == REG_ROW) { i++; } if(check_dbresults(dbproc1, ret_code, "EXT_SOCKET_ACCESS", "get_ext_socket_access_detail_db")) return(FAILURE); if (i == 1) { XmTextSetString(ext_socket_access_ext_contact_id_text, ext_socket_access_selected.ext_contact_id); XmTextSetString(ext_socket_access_remote_host_text, ext_socket_access_selected.remote_host); XmTextSetString(ext_socket_access_ip_address_text, ext_socket_access_selected.ip_address); XmTextSetString(ext_socket_access_port_text, ext_socket_access_selected.port); XmTextSetString(ext_socket_access_timeout_text, ext_socket_access_selected.timeout); if (strlen(eof_data) != 0) sprintf(ext_socket_access_selected.eof_data, "0x%s", eof_data); else sprintf(ext_socket_access_selected.eof_data, "%s", eof_data); XmTextSetString(ext_socket_access_eof_data_text, ext_socket_access_selected.eof_data); } else if (i > 1) { } return(SUCCESS); }
int update_bill_cycle_db(BILL_CYCLE_STRUCT *bill_cycle_struct) { char *db_string; int ret_code; int first_one = TRUE; if(strcmp(bill_cycle_struct->bill_period, bill_cycle_selected.bill_period) != 0) { db_string = (char *)convert_to_db_string(bill_cycle_struct->bill_period); if(first_one) { dbcmd(dbproc1," update BILL_CYCLE set "); dbfcmd(dbproc1," bill_period = '%s' ",db_string); } else dbfcmd(dbproc1,", bill_period = '%s' ",db_string); free(db_string); first_one = FALSE; } if(strcmp(bill_cycle_struct->billing_frequency, bill_cycle_selected.billing_frequency) != 0) { db_string = (char *)convert_to_db_string(bill_cycle_struct->billing_frequency); if(first_one) { dbcmd(dbproc1," update BILL_CYCLE set "); dbfcmd(dbproc1," billing_frequency = %d ", atoi(db_string)); } else dbfcmd(dbproc1,", billing_frequency = %d ", atoi(db_string)); free(db_string); first_one = FALSE; } if(strcmp(bill_cycle_struct->ppdd_date, bill_cycle_selected.ppdd_date) != 0 || strcmp(bill_cycle_struct->ppdd_time, bill_cycle_selected.ppdd_time) != 0) { date_time_to_Arbdate(bill_cycle_struct->ppdd_date, bill_cycle_struct->ppdd_time, &(bill_cycle_struct->ppdd_dt)); if(first_one) { dbcmd(dbproc1," update BILL_CYCLE set "); dbfcmd(dbproc1," ppdd_date = %t ",&(bill_cycle_struct->ppdd_dt)); } else dbfcmd(dbproc1,", ppdd_date = %t ",&(bill_cycle_struct->ppdd_dt)); first_one = FALSE; } if(strcmp(bill_cycle_struct->next_ppdd_date, bill_cycle_selected.next_ppdd_date) != 0 || strcmp(bill_cycle_struct->next_ppdd_time, bill_cycle_selected.next_ppdd_time) != 0) { date_time_to_Arbdate(bill_cycle_struct->next_ppdd_date, bill_cycle_struct->next_ppdd_time, &(bill_cycle_struct->next_ppdd_dt)); if(first_one) { dbcmd(dbproc1," update BILL_CYCLE set "); dbfcmd(dbproc1," next_ppdd_date = %t ", &(bill_cycle_struct->next_ppdd_dt)); } else dbfcmd(dbproc1,", next_ppdd_date = %t ", &(bill_cycle_struct->next_ppdd_dt)); first_one = FALSE; } if(strcmp(bill_cycle_struct->statement_date, bill_cycle_selected.statement_date) != 0 || strcmp(bill_cycle_struct->statement_time, bill_cycle_selected.statement_time) != 0) { date_time_to_Arbdate(bill_cycle_struct->statement_date, bill_cycle_struct->statement_time, &(bill_cycle_struct->statement_dt)); if(first_one) { dbcmd(dbproc1," update BILL_CYCLE set "); dbfcmd(dbproc1," statement_date = %t ", &(bill_cycle_struct->statement_dt)); } else dbfcmd(dbproc1,", statement_date = %t ", &(bill_cycle_struct->statement_dt)); first_one = FALSE; } if(strcmp(bill_cycle_struct->cutoff_date, bill_cycle_selected.cutoff_date) != 0 || strcmp(bill_cycle_struct->cutoff_time, bill_cycle_selected.cutoff_time) != 0) { date_time_to_Arbdate(bill_cycle_struct->cutoff_date, bill_cycle_struct->cutoff_time, &(bill_cycle_struct->cutoff_dt)); if(first_one) { dbcmd(dbproc1," update BILL_CYCLE set "); dbfcmd(dbproc1," cutoff_date = %t ", &(bill_cycle_struct->cutoff_dt)); } else dbfcmd(dbproc1,", cutoff_date = %t ", &(bill_cycle_struct->cutoff_dt)); first_one = FALSE; } if(strcmp(bill_cycle_struct->prep_delay, bill_cycle_selected.prep_delay) != 0) { db_string = (char *)convert_to_db_string(bill_cycle_struct->prep_delay); if(first_one) { dbcmd(dbproc1," update BILL_CYCLE set "); dbfcmd(dbproc1," prep_delay = %d ", atoi(db_string)); } else dbfcmd(dbproc1,", prep_delay = %d ", atoi(db_string)); free(db_string); first_one = FALSE; } dbcmd(dbproc1, " where "); db_string = (char *)convert_to_db_string(bill_cycle_selected.bill_period); dbfcmd(dbproc1, " bill_period = '%s'", db_string); free(db_string); db_string = (char *)convert_to_db_string(bill_cycle_selected.billing_frequency); dbfcmd(dbproc1, " and billing_frequency = %d", atoi(db_string)); free(db_string); date_time_to_Arbdate(bill_cycle_selected.next_ppdd_date, bill_cycle_selected.next_ppdd_time, &(bill_cycle_selected.next_ppdd_dt)); dbfcmd(dbproc1, " and next_ppdd_date = %t ", &(bill_cycle_selected.next_ppdd_dt)); if(safe_dbupdate(dbproc1, "BILL_CYCLE", "update_bill_cycle_db")) { return(FAILURE); } while ((ret_code = dbnextrow(dbproc1)) == REG_ROW) { if (ret_code == FAIL) { return(FAILURE); } } if(check_dbresults(dbproc1,ret_code,"BILL_CYCLE", "bill_cycle_db")) return(FAILURE); return(SUCCESS); }
int get_bill_cycle_detail_db(int position) { int i = 0, ret_code; char *db_string = NULL; short prefix_flag; dbcmd(dbproc1, " select "); dbcmd(dbproc1, " bill_period,"); dbcmd(dbproc1, " billing_frequency,"); dbcmd(dbproc1, " ppdd_date,"); dbcmd(dbproc1, " next_ppdd_date,"); dbcmd(dbproc1, " statement_date,"); dbcmd(dbproc1, " cutoff_date,"); dbcmd(dbproc1, " prep_delay"); dbcmd(dbproc1, " from BILL_CYCLE "); dbcmd(dbproc1, " where "); db_string = (char *)convert_to_db_string(bill_cycle_list[position-1].bill_period); dbfcmd(dbproc1, " bill_period = '%s'", db_string); free(db_string); db_string = (char *)convert_to_db_string(bill_cycle_list[position-1].billing_frequency); dbfcmd(dbproc1, " and billing_frequency = %d", atoi(db_string)); free(db_string); date_time_to_Arbdate(bill_cycle_list[position-1].next_ppdd_date, bill_cycle_list[position-1].next_ppdd_time, &(bill_cycle_list[position-1].next_ppdd_dt)); dbfcmd(dbproc1, " and next_ppdd_date = %t ", &(bill_cycle_list[position-1].next_ppdd_dt)); if (safe_dbselect(dbproc1, "BILL_CYCLE", "get_bill_cycle_detail_db")) { return(FAILURE); } memset((char *) &bill_cycle_selected, 0, sizeof(BILL_CYCLE_STRUCT)); dbbind(dbproc1,1,NTBSTRINGBIND,256, bill_cycle_selected.bill_period); dbbind(dbproc1,2,NTBSTRINGBIND,256, bill_cycle_selected.billing_frequency); dbbind(dbproc1,3,ARB_TYPE_DATELONG,0, &(bill_cycle_selected.ppdd_dt)); dbbind(dbproc1,4,ARB_TYPE_DATELONG,0, &(bill_cycle_selected.next_ppdd_dt)); dbbind(dbproc1,5,ARB_TYPE_DATELONG,0, &(bill_cycle_selected.statement_dt)); dbbind(dbproc1,6,ARB_TYPE_DATELONG,0, &(bill_cycle_selected.cutoff_dt)); dbbind(dbproc1,7,NTBSTRINGBIND,256, bill_cycle_selected.prep_delay); while ((ret_code = dbnextrow(dbproc1)) == REG_ROW) { i++; Arbdate_to_date_time(&(bill_cycle_selected.ppdd_dt), bill_cycle_selected.ppdd_date, bill_cycle_selected.ppdd_time); Arbdate_to_date_time(&(bill_cycle_selected.next_ppdd_dt), bill_cycle_selected.next_ppdd_date, bill_cycle_selected.next_ppdd_time); Arbdate_to_date_time(&(bill_cycle_selected.statement_dt), bill_cycle_selected.statement_date, bill_cycle_selected.statement_time); Arbdate_to_date_time(&(bill_cycle_selected.cutoff_dt), bill_cycle_selected.cutoff_date, bill_cycle_selected.cutoff_time); } if(check_dbresults(dbproc1, ret_code, "BILL_CYCLE", "get_bill_cycle_detail_db")) return(FAILURE); if (i == 1) { XmTextSetString(bill_cycle_bill_period_text, bill_cycle_selected.bill_period); XmTextSetString(bill_cycle_billing_frequency_text, bill_cycle_selected.billing_frequency); XmTextSetString(bill_cycle_ppdd_date_text, bill_cycle_selected.ppdd_date); XmTextSetString(bill_cycle_ppdd_time_text, bill_cycle_selected.ppdd_time); XmTextSetString(bill_cycle_next_ppdd_date_text, bill_cycle_selected.next_ppdd_date); XmTextSetString(bill_cycle_next_ppdd_time_text, bill_cycle_selected.next_ppdd_time); XmTextSetString(bill_cycle_statement_date_text, bill_cycle_selected.statement_date); XmTextSetString(bill_cycle_statement_time_text, bill_cycle_selected.statement_time); XmTextSetString(bill_cycle_cutoff_date_text, bill_cycle_selected.cutoff_date); XmTextSetString(bill_cycle_cutoff_time_text, bill_cycle_selected.cutoff_time); XmTextSetString(bill_cycle_prep_delay_text, bill_cycle_selected.prep_delay); } else if (i > 1) { } return(SUCCESS); }
static ngx_int_t ngx_dbd_freetds_query(ngx_dbd_t *dbd) { ngx_dbd_freetds_ctx_t *ctx; ngx_log_debug0(NGX_LOG_DEBUG_MYSQL, dbd->log, 0, "dbd freetds query"); ctx = dbd->ctx; #if 0 if (dbrpcinit(ctx->db, ctx->sql, 0) != SUCCEED) { return NGX_ERROR; } /* TODO: dbreginit */ /* dbrpcparam */ if (dbrpcexec(ctx->db) != SUCCEED) { return NGX_ERROR; } if (dbrpcsend(ctx->db) != SUCCEED) { return NGX_ERROR; } /* dbregparam */ /* dbregexec */ ctx->err = dbfcmd(ctx->db, ctx->sql); if (ctx->err != SUCCEED) { return NGX_ERROR; } /* dbbind */ /* dbhasretstat */ /* dbretstatus */ /* dbnumrets */ /* dbretdata */ /* dbrettype */ /* dbretlen */ /* dbretname */ if (dbsqlok(ctx->db) != SUCCEED) { return NGX_ERROR; } #endif ctx->err = dbcmd(ctx->db, (LPCSTR) ctx->sql); if (ctx->err != SUCCEED) { ngx_log_error(NGX_LOG_ALERT, dbd->log, 0, "dbcmd() failed"); return NGX_ERROR; } ctx->err = dbsqlexec(ctx->db); if (ctx->err != SUCCEED) { ngx_log_error(NGX_LOG_ALERT, dbd->log, 0, "dbsqlexec() failed"); return NGX_ERROR; } /* TODO: dbsetopt(DBBUFFER); */ /* dbclropt(ctx->db, DBBUFFER, "100"); */ /* dbisopt; */ #if 0 ctx->err = dbsetopt(ctx->db, DBBUFFER, "100"); #endif ctx->err = dbresults(ctx->db); if (ctx->err != SUCCEED) { ngx_log_error(NGX_LOG_ALERT, dbd->log, 0, "dbresults() failed"); return NGX_ERROR; } ctx->cur_col = 0; ctx->num_fields = (uint64_t) dbnumcols(ctx->db); /* dbnumcompute(ctx->db); */ /* dbnumalts */ return NGX_OK; }
int update_rate_usage_or_db(RATE_USAGE_OVERRIDES_STRUCT *rate_usage_or_entered, RATE_USAGE_BANDS_OVERRIDES_STRUCT *rate_usage_or_bands_entered, int num_of_bands_entered, int seqnum) { int ret_code; char fixed_charge_amt[19]; int i,unit_rate, add_fixed_amt; /* convert money string to money field in proper implied decimal place */ money_str_to_arb_numeric(fixed_charge_amt, rate_usage_or_entered->fixed_charge_amt, (short)atoi(rate_usage_or_entered->currency_code)); if(rate_str_to_int_new(&unit_rate, rate_usage_or_entered->add_unit_rate, (short)atoi(rate_usage_or_entered->currency_code), (short)atoi(rate_usage_or_entered->add_implied_decimal)) == FAILURE) { sprintf(scratch, "Add. Unit Rate: %s would cause an integer overflow", rate_usage_or_entered->add_unit_rate); post_dialog(rate_usage_or_shell,XmDIALOG_MESSAGE, scratch); return FAILURE; } if(rate_str_to_int_new(&add_fixed_amt, rate_usage_or_entered->add_fixed_amt, (short)atoi(rate_usage_or_entered->currency_code), (short)atoi(rate_usage_or_entered->add_implied_decimal)) == FAILURE) { sprintf(scratch, "Add. Fixed Amt: %s would cause an integer overflow", rate_usage_or_entered->add_fixed_amt); post_dialog(rate_usage_or_shell,XmDIALOG_MESSAGE, scratch); return FAILURE; } dbcancel(dbproc1); if(begin_tran(dbproc1,"UPDATE_RATE_USAGE_OVERRIDES") == FAILURE) return(FAILURE); dbcmd(dbproc1," update RATE_USAGE_OVERRIDES "); dbfcmd(dbproc1," set corridor_plan_id = %d, ", atoi(rate_usage_or_entered->corridor_plan_id)); dbfcmd(dbproc1," rate_class = %d, ", atoi(rate_usage_or_entered->rate_class)); dbfcmd(dbproc1," jurisdiction = %d, ", atoi(rate_usage_or_entered->jurisdiction)); dbfcmd(dbproc1," rate_units_type = %d, ", atoi(rate_usage_or_entered->rate_units_type)); dbfcmd(dbproc1," type_id_usg = %d, ", atoi(rate_usage_or_entered->type_id_usg)); dbfcmd(dbproc1," distance_band_id = %d, ", atoi(rate_usage_or_entered->distance_band_id)); dbfcmd(dbproc1," bill_class = %d, ", atoi(rate_usage_or_entered->bill_class)); dbfcmd(dbproc1," element_id = %d, ", atoi(rate_usage_or_entered->element_id)); dbfcmd(dbproc1," equip_type_code = %d, ", atoi(rate_usage_or_entered->equip_type)); dbfcmd(dbproc1," equip_class_code = %d, ", atoi(rate_usage_or_entered->equip_class)); dbfcmd(dbproc1," class_of_service_code = %d, ", atoi(rate_usage_or_entered->equip_class_of_service)); dbfcmd(dbproc1," units_indicator = %d, ", atoi(rate_usage_or_entered->units_indicator)); dbfcmd(dbproc1," provider_class = %d, ", atoi(rate_usage_or_entered->provider_class)); dbfcmd(dbproc1," rate_period = '%s', ", rate_usage_or_entered->rate_period); dbfcmd(dbproc1," currency_code = %d, ", atoi(rate_usage_or_entered->currency_code)); dbfcmd(dbproc1," fixed_charge_amt = %s, ", fixed_charge_amt); dbfcmd(dbproc1," incremental_bands = %s, ", rate_usage_or_entered->incremental_bands); dbfcmd(dbproc1," add_unit_rate = %d, ", unit_rate); dbfcmd(dbproc1," add_fixed_amt = %d, ", add_fixed_amt); dbfcmd(dbproc1," add_implied_decimal = %d, ", atoi(rate_usage_or_entered->add_implied_decimal)); dbfcmd(dbproc1," chg_dt = %s, ", arb_server_getdate()); dbfcmd(dbproc1," chg_who = %s, ", arb_server_username()); date_time_to_Arbdate(rate_usage_or_entered->active_dt, rate_usage_or_entered->active_time, &(rate_usage_or_entered->arb_active_dt)); dbfcmd(dbproc1," active_dt = %t, ", &(rate_usage_or_entered->arb_active_dt)); date_time_to_Arbdate(rate_usage_or_entered->inactive_dt, rate_usage_or_entered->inactive_time, &(rate_usage_or_entered->arb_inactive_dt)); if(Arbdate_is_null(&(rate_usage_or_entered->arb_inactive_dt))) dbcmd(dbproc1," inactive_dt = NULL "); else dbfcmd(dbproc1," inactive_dt = %t ", &(rate_usage_or_entered->arb_inactive_dt)); dbfcmd(dbproc1," where seqnum = %d ",seqnum); if(safe_dbupdate(dbproc1, "RATE_USAGE_OVERRIDES", "update_rate_usage_or_db")) { (void)rollback_tran(dbproc1, "update_rate_usage_or_db"); dbcancel(dbproc1); return(FAILURE); } dbcmd(dbproc1," delete RATE_USAGE_BANDS_OVERRIDES "); dbfcmd(dbproc1," where seqnum = %d ",seqnum); if(safe_dbupdate(dbproc1, "RATE_USAGE_OVERRIDES", "update_rate_usage_or_db")) { (void)rollback_tran(dbproc1, "update_rate_usage_or_db"); dbcancel(dbproc1); return(FAILURE); } for(i = 0; i < num_of_bands_entered; i++) { if(rate_str_to_int_new(&unit_rate, rate_usage_or_bands_entered[i].unit_rate, (short)atoi(rate_usage_or_entered->currency_code), (short)atoi(rate_usage_or_entered->add_implied_decimal)) == FAILURE) { (void)rollback_tran(dbproc1, "rate_usage_or_save_db"); dbcancel(dbproc1); sprintf(scratch, "Band %d Unit Rate: %s would cause an integer overflow", i+1, rate_usage_or_bands_entered[i].unit_rate); post_dialog(rate_usage_or_shell,XmDIALOG_MESSAGE, scratch); return FAILURE; } dbcmd(dbproc1,"insert into RATE_USAGE_BANDS_OVERRIDES(seqnum,rateband,"); dbcmd(dbproc1,"num_units,unit_rate)"); dbfcmd(dbproc1,"values(%d,%d,%s,%d)", seqnum, i + 1, rate_usage_or_bands_entered[i].num_units,unit_rate); if(safe_dbupdate(dbproc1, "RATE_USAGE_OVERRIDES", "update_rate_usage_or_db")) { (void)rollback_tran(dbproc1, "update_rate_usage_or_db"); dbcancel(dbproc1); return(FAILURE); } } /* ************************ */ (void)commit_tran(dbproc1); /* ** COMMIT TRANSACTION ** */ /* ************************ */ /* SUCCESS */ return(SUCCESS); }
int get_rate_usage_or_detail_db(int seqnum, int *num_of_bands) { int i = 0,ret_code; char fixed_charge_amt_db[19]; int add_unit_rate_db; int add_fixed_amt_db; int num_units,unit_rate; char unit_rate_string[13]; tiny rateband; char create_dt[9]; char chg_dt[9]; char chg_who[17]; short k,len,j; dbcmd(dbproc1, " select corridor_plan_id,rate_class, jurisdiction, "); dbcmd(dbproc1, " type_id_usg, distance_band_id,"); dbcmd(dbproc1, " bill_class, rate_units_type,"); dbcmd(dbproc1, " element_id,equip_type_code,equip_class_code,"); dbcmd(dbproc1, " class_of_service_code,"); dbcmd(dbproc1, " units_indicator, provider_class,"); dbcmd(dbproc1, " rate_period,currency_code,fixed_charge_amt,"); dbcmd(dbproc1, " incremental_bands,"); dbcmd(dbproc1, " add_unit_rate,add_fixed_amt,"); dbcmd(dbproc1," create_dt,"); dbcmd(dbproc1," chg_dt,"); dbcmd(dbproc1, " chg_who,"); dbcmd(dbproc1," active_dt,"); dbcmd(dbproc1," inactive_dt,"); dbcmd(dbproc1," add_implied_decimal "); dbcmd(dbproc1, " from RATE_USAGE_OVERRIDES "); dbfcmd(dbproc1, " where seqnum = %d",seqnum); if (safe_dbselect(dbproc1, "RATE_USAGE_OVERRIDES", "get_rate_usage_or_detail_db")) { return(FAILURE); } memset((char *) &rate_usage_or_selected, 0, sizeof(RATE_USAGE_OVERRIDES_STRUCT)); dbbind(dbproc1,1,NTBSTRINGBIND,256, rate_usage_or_selected.corridor_plan_id); dbbind(dbproc1,2,NTBSTRINGBIND,256, rate_usage_or_selected.rate_class); dbbind(dbproc1,3,NTBSTRINGBIND,256, rate_usage_or_selected.jurisdiction); dbbind(dbproc1,4,NTBSTRINGBIND,256, rate_usage_or_selected.type_id_usg); dbbind(dbproc1,5,NTBSTRINGBIND,256, rate_usage_or_selected.distance_band_id); dbbind(dbproc1,6,NTBSTRINGBIND,256, rate_usage_or_selected.bill_class); dbbind(dbproc1,7,NTBSTRINGBIND,256, rate_usage_or_selected.rate_units_type); dbbind(dbproc1,8,NTBSTRINGBIND,256, rate_usage_or_selected.element_id); dbbind(dbproc1,9,NTBSTRINGBIND,256, rate_usage_or_selected.equip_type); dbbind(dbproc1,10,NTBSTRINGBIND,256, rate_usage_or_selected.equip_class); dbbind(dbproc1,11,NTBSTRINGBIND,256, rate_usage_or_selected.equip_class_of_service); dbbind(dbproc1,12,NTBSTRINGBIND,256, rate_usage_or_selected.units_indicator); dbbind(dbproc1,13,NTBSTRINGBIND,256, rate_usage_or_selected.provider_class); dbbind(dbproc1,14,NTBSTRINGBIND,256, rate_usage_or_selected.rate_period); dbbind(dbproc1,15,NTBSTRINGBIND,256, rate_usage_or_selected.currency_code); dbbind(dbproc1,16,NTBSTRINGBIND,256, fixed_charge_amt_db); dbbind(dbproc1,17,NTBSTRINGBIND,256, rate_usage_or_selected.incremental_bands); dbbind(dbproc1,18,INTBIND,0, &add_unit_rate_db); dbbind(dbproc1,19,INTBIND,0, &add_fixed_amt_db); dbbind(dbproc1,20,ARB_TYPE_DATELONG,0, &(rate_usage_or_selected.arb_create_dt)); dbbind(dbproc1,21,ARB_TYPE_DATELONG,0, &(rate_usage_or_selected.arb_chg_dt)); dbbind(dbproc1,22,NTBSTRINGBIND,256, chg_who); dbbind(dbproc1,23,ARB_TYPE_DATELONG,0, &(rate_usage_or_selected.arb_active_dt)); dbbind(dbproc1,24,ARB_TYPE_DATELONG,256, &(rate_usage_or_selected.arb_inactive_dt)); dbbind(dbproc1,25,NTBSTRINGBIND,256, rate_usage_or_selected.add_implied_decimal); while (dbnextrow(dbproc1) == REG_ROW) { Arbdate_to_date_time(&(rate_usage_or_selected.arb_create_dt), rate_usage_or_selected.create_dt, NULL); Arbdate_to_date_time(&(rate_usage_or_selected.arb_chg_dt), rate_usage_or_selected.chg_dt, NULL); Arbdate_to_date_time(&(rate_usage_or_selected.arb_active_dt), rate_usage_or_selected.active_dt, rate_usage_or_selected.active_time); Arbdate_to_date_time(&(rate_usage_or_selected.arb_inactive_dt), rate_usage_or_selected.inactive_dt, rate_usage_or_selected.inactive_time); i++; } /*end of while loop */ if(check_dbresults(dbproc1, ret_code, "RATE_USAGE_OVERRIDES", "get_rate_usage_or_detail_db")) return(FAILURE); if (i == 1) { int_str_to_money_numeric_str_new(rate_usage_or_selected.fixed_charge_amt, fixed_charge_amt_db, (short)atoi(rate_usage_or_selected.currency_code)); rate_to_money_numeric_str_new(rate_usage_or_selected.add_unit_rate, add_unit_rate_db, (short)atoi(rate_usage_or_selected.currency_code), (short)atoi(rate_usage_or_selected.add_implied_decimal)); rate_to_money_numeric_str_new(rate_usage_or_selected.add_fixed_amt, add_fixed_amt_db, (short)atoi(rate_usage_or_selected.currency_code), (short)atoi(rate_usage_or_selected.add_implied_decimal)); XmTextSetString(rate_usage_or_rate_class_text, rate_usage_or_selected.rate_class); XmTextSetString(rate_usage_or_jurisdiction_text, rate_usage_or_selected.jurisdiction); XmTextSetString(rate_usage_or_type_id_usg_text, rate_usage_or_selected.type_id_usg); XmTextSetString(rate_usage_or_distance_band_id_text, rate_usage_or_selected.distance_band_id); XmTextSetString(rate_usage_or_bill_class_text, rate_usage_or_selected.bill_class); XmTextSetString(rate_usage_or_rate_units_type_text, rate_usage_or_selected.rate_units_type); XmTextSetString(rate_usage_or_element_id_text, rate_usage_or_selected.element_id); XmTextSetString(rate_usage_or_equip_type_text, rate_usage_or_selected.equip_type); XmTextSetString(rate_usage_or_equip_class_text, rate_usage_or_selected.equip_class); XmTextSetString(rate_usage_or_equip_class_of_service_text, rate_usage_or_selected.equip_class_of_service); XmTextSetString(rate_usage_or_corridor_plan_id_text, rate_usage_or_selected.corridor_plan_id); XmTextSetString(rate_usage_or_units_indicator_text, rate_usage_or_selected.units_indicator); XmTextSetString(rate_usage_or_provider_class_text, rate_usage_or_selected.provider_class); XmTextSetString(rate_usage_or_rate_period_text, rate_usage_or_selected.rate_period); XmTextSetString(rate_usage_or_currency_code_text, rate_usage_or_selected.currency_code); XmTextSetString(rate_usage_or_fixed_charge_amt_text, rate_usage_or_selected.fixed_charge_amt); XmTextSetString(rate_usage_or_incremental_bands_text, rate_usage_or_selected.incremental_bands); XmTextSetString(rate_usage_or_add_unit_rate_text, rate_usage_or_selected.add_unit_rate); XmTextSetString(rate_usage_or_add_fixed_amt_text, rate_usage_or_selected.add_fixed_amt); XmTextSetString(rate_usage_or_add_implied_decimal_text, rate_usage_or_selected.add_implied_decimal); XmTextSetString(rate_usage_or_active_dt_text, rate_usage_or_selected.active_dt); XmTextSetString(rate_usage_or_inactive_dt_text, rate_usage_or_selected.inactive_dt); XmTextSetString(rate_usage_or_active_time_text, rate_usage_or_selected.active_time); XmTextSetString(rate_usage_or_inactive_time_text, rate_usage_or_selected.inactive_time); XmTextSetString(rate_usage_or_create_dt_text, rate_usage_or_selected.create_dt); XmTextSetString(rate_usage_or_chg_dt_text, rate_usage_or_selected.chg_dt); XmTextSetString(rate_usage_or_chg_who_text,chg_who); sprintf(rate_usage_or_selected.seqnum,"%d",seqnum); } else if (i > 1) { } clear_bands_memory(rate_usage_or_bands_selected); dbcmd(dbproc1, " select rateband,num_units, unit_rate"); dbcmd(dbproc1, " from RATE_USAGE_BANDS_OVERRIDES "); dbfcmd(dbproc1, " where seqnum = %d",seqnum); dbcmd(dbproc1, " order by rateband asc "); if (safe_dbselect(dbproc1, "RATE_USAGE_BANDS_OVERRIDES", "get_rate_usage_or_detail_db")) { return(FAILURE); } i = 0; dbbind(dbproc1,1,TINYBIND,0, &rateband); dbbind(dbproc1,2,INTBIND,0, &num_units); dbbind(dbproc1,3,INTBIND,0, &unit_rate); while (dbnextrow(dbproc1) == REG_ROW) { i++; rate_to_money_numeric_str_new( rate_usage_or_bands_selected[i-1].unit_rate, unit_rate, (short)atoi(rate_usage_or_selected.currency_code), (short)atoi(rate_usage_or_selected.add_implied_decimal)); sprintf(rate_usage_or_bands_selected[i-1].num_units, "%d",num_units); sprintf(rate_usage_or_bands_selected[i-1].rateband,"%d",rateband); } /*end of while loop */ if(check_dbresults(dbproc1, ret_code, "RATE_USAGE_BANDS_OVERRIDES", "get_rate_usage_or_detail_db")) return(FAILURE); (*num_of_bands) = i; XmTextSetString(rate_usage_or_num_units1_text, rate_usage_or_bands_selected[0].num_units); XmTextSetString(rate_usage_or_num_units2_text, rate_usage_or_bands_selected[1].num_units); XmTextSetString(rate_usage_or_num_units3_text, rate_usage_or_bands_selected[2].num_units); XmTextSetString(rate_usage_or_num_units4_text, rate_usage_or_bands_selected[3].num_units); XmTextSetString(rate_usage_or_num_units5_text, rate_usage_or_bands_selected[4].num_units); XmTextSetString(rate_usage_or_num_units6_text, rate_usage_or_bands_selected[5].num_units); XmTextSetString(rate_usage_or_unit_rate1_text, rate_usage_or_bands_selected[0].unit_rate); XmTextSetString(rate_usage_or_unit_rate2_text, rate_usage_or_bands_selected[1].unit_rate); XmTextSetString(rate_usage_or_unit_rate3_text, rate_usage_or_bands_selected[2].unit_rate); XmTextSetString(rate_usage_or_unit_rate4_text, rate_usage_or_bands_selected[3].unit_rate); XmTextSetString(rate_usage_or_unit_rate5_text, rate_usage_or_bands_selected[4].unit_rate); XmTextSetString(rate_usage_or_unit_rate6_text, rate_usage_or_bands_selected[5].unit_rate); return(SUCCESS); }
void populate_emf_external_id_scrolled_list() { XmString temp; RETCODE ret_code; char display_string[300]; int status; int lm; char active_dt[9]; char inactive_dt[9]; char external_id_type[81]; char external_id[50]; char full_active_dt[33]; char full_inactive_dt[33]; int id_type; /*get emf group list from db */ dbcmd(dbproc1, "select external_id,external_id_type,active_date,inactive_date,"); dbfcmd(dbproc1," convert(char(8),active_date,%d),", gdatefmt); dbfcmd(dbproc1," convert(char(8),inactive_date,%d)", gdatefmt); dbcmd(dbproc1," from CUSTOMER_ID_EQUIP_MAP "); dbfcmd(dbproc1,"WHERE subscr_no = %d ",emf_active_subscr_no); dbfcmd(dbproc1," and subscr_no_resets = %d ",emf_active_subscr_no_resets); br_dbsqlexec(dbproc1); if (Sybase_error) { dbcancel(dbproc1); } status = 0; num_active_external_ids = 0; free (active_external_ids); active_external_ids = NULL; XmListDeselectAllItems (emf_external_list); XmListDeleteAllItems (emf_external_list); while((ret_code = dbresults(dbproc1)) != NO_MORE_RESULTS) { if(ret_code == FAIL) { dbcancel(dbproc1); break; } dbbind(dbproc1,1,NTBSTRINGBIND,0,external_id); dbbind(dbproc1,2,INTBIND,0,&id_type); dbbind(dbproc1,3,NTBSTRINGBIND,0,full_active_dt); dbbind(dbproc1,4,NTBSTRINGBIND,0,full_inactive_dt); dbbind(dbproc1,5,NTBSTRINGBIND,0,active_dt); dbbind(dbproc1,6,NTBSTRINGBIND,0,inactive_dt); while (dbnextrow(dbproc1) != NO_MORE_ROWS) { /* Found an entry. */ num_active_external_ids++; active_external_ids = (EXTERNAL_ID_DATA_TYPE *) realloc (active_external_ids,num_active_external_ids * sizeof (EXTERNAL_ID_DATA_TYPE)); strcpy (active_external_ids[num_active_external_ids - 1].external_id,external_id); strcpy (active_external_ids[num_active_external_ids - 1].full_active_dt,full_active_dt); strcpy (active_external_ids[num_active_external_ids - 1].active_dt,active_dt); strcpy (active_external_ids[num_active_external_ids - 1].full_inactive_dt,full_inactive_dt); strcpy (active_external_ids[num_active_external_ids - 1].inactive_dt,inactive_dt); active_external_ids[num_active_external_ids - 1].external_id_type = id_type; if(strlen(external_id) > EXTERNAL_ID_LEN-1) external_id[EXTERNAL_ID_LEN-1] = '\0'; strcpy (external_id_type,""); for (lm = 0; lm < num_cmf_external_id_type_codes; lm++) { if (id_type == cmf_external_id_type_list[lm].db_code) { strcpy (external_id_type,cmf_external_id_type_list[lm].description); break; } } if(strlen(external_id_type) > 20) external_id_type[20] = '\0'; sprintf (display_string,"%-48.48s %-20.20s %-9s %-9s ", external_id,external_id_type,active_dt,inactive_dt); temp = XmStringCreateSimple (display_string); XmListAddItem (emf_external_list, temp, 0); /* Add as last item in list */ XmStringFree (temp); } } if(Sybase_error) { dbcancel(dbproc1); } }
void undo_disc_product_cb(Widget w, XtPointer client_data, XtPointer call_data) { RETCODE ret_code; show_busy_cursor (emfpr_dr_shell,TRUE); /* convert ' in strings to '' before passing to db */ dbcmd(dbproc1,"declare @status int "); dbcmd(dbproc1,"declare @date_rc datetime "); dbcmd(dbproc1,"select @status = 0 "); if (pp_comp_elements[pp_selected_element_row].assoc_type == 0) dbcmd(dbproc1, "select @date_rc = date_rc_billed_through from CMF_PRODUCTS "); else dbcmd(dbproc1, "select @date_rc = date_rc_billed_through from EMF_PRODUCTS "); dbfcmd(dbproc1,"where tracking_id = %d", pp_comp_elements[pp_selected_element_row].tracking_id); dbfcmd(dbproc1," and tracking_id_serv = %d", pp_comp_elements[pp_selected_element_row].tracking_id_serv); dbcmd (dbproc1," if @date_rc = NULL begin select @status = -1 end "); if (pp_comp_elements[pp_selected_element_row].assoc_type == 0) dbcmd(dbproc1,"UPDATE CMF_PRODUCTS set product_status = @status, "); else dbcmd(dbproc1,"UPDATE EMF_PRODUCTS set product_status = @status, "); dbcmd(dbproc1,"disconnect_reason = NULL,product_stop = NULL "); dbfcmd(dbproc1,"where tracking_id = %d", pp_comp_elements[pp_selected_element_row].tracking_id); dbfcmd(dbproc1," and tracking_id_serv = %d", pp_comp_elements[pp_selected_element_row].tracking_id_serv); br_dbsqlexec(dbproc1); if (Sybase_error) { dbcancel(dbproc1); show_busy_cursor (emfpr_dr_shell,FALSE); return; } /* Process the results of the insert op. */ while ((ret_code = dbresults(dbproc1)) != NO_MORE_RESULTS) { if(ret_code == FAIL) { dbcancel(dbproc1); show_busy_cursor (emfpr_dr_shell,FALSE); return; } while (dbnextrow(dbproc1) != NO_MORE_ROWS) { } } if(Sybase_error) { dbcancel(dbproc1); show_busy_cursor (emfpr_dr_shell,FALSE); return; } show_busy_cursor (emfpr_dr_shell,FALSE); refresh_components_elements_list(); XtUnmanageChild(emfpr_dr_main_form); XtPopdown(emfpr_dr_shell); return; }
int update_ext_socket_access_db(EXT_SOCKET_ACCESS_STRUCT *ext_socket_access_struct) { char *db_string; int ret_code; int first_one = TRUE; if(strcmp(ext_socket_access_struct->ext_contact_id, ext_socket_access_selected.ext_contact_id) != 0) { db_string = (char *)convert_to_db_string(ext_socket_access_struct->ext_contact_id); if(first_one) { dbcmd(dbproc1," update EXT_SOCKET_ACCESS set "); dbfcmd(dbproc1," ext_contact_id = %d ", atoi(db_string)); } else dbfcmd(dbproc1,", ext_contact_id = %d ", atoi(db_string)); free(db_string); first_one = FALSE; } if(strcmp(ext_socket_access_struct->remote_host, ext_socket_access_selected.remote_host) != 0) { db_string = (char *)convert_to_db_string(ext_socket_access_struct->remote_host); if(!strlen(db_string)) { if(first_one) { dbcmd(dbproc1," update EXT_SOCKET_ACCESS set "); dbcmd(dbproc1," remote_host = NULL "); } else dbcmd(dbproc1,", remote_host = NULL "); } else { if(first_one) { dbcmd(dbproc1," update EXT_SOCKET_ACCESS set "); dbfcmd(dbproc1," remote_host = '%s' ",db_string); } else dbfcmd(dbproc1,", remote_host = '%s' ",db_string); } free(db_string); first_one = FALSE; } if(strcmp(ext_socket_access_struct->ip_address, ext_socket_access_selected.ip_address) != 0) { db_string = (char *)convert_to_db_string(ext_socket_access_struct->ip_address); if(!strlen(db_string)) { if(first_one) { dbcmd(dbproc1," update EXT_SOCKET_ACCESS set "); dbcmd(dbproc1," ip_address = NULL "); } else dbcmd(dbproc1,", ip_address = NULL "); } else { if(first_one) { dbcmd(dbproc1," update EXT_SOCKET_ACCESS set "); dbfcmd(dbproc1," ip_address = '%s' ",db_string); } else dbfcmd(dbproc1,", ip_address = '%s' ",db_string); } free(db_string); first_one = FALSE; } if(strcmp(ext_socket_access_struct->port, ext_socket_access_selected.port) != 0) { db_string = (char *)convert_to_db_string(ext_socket_access_struct->port); if(first_one) { dbcmd(dbproc1," update EXT_SOCKET_ACCESS set "); dbfcmd(dbproc1," port = %d ", atoi(db_string)); } else dbfcmd(dbproc1,", port = %d ", atoi(db_string)); free(db_string); first_one = FALSE; } if(strcmp(ext_socket_access_struct->timeout, ext_socket_access_selected.timeout) != 0) { db_string = (char *)convert_to_db_string(ext_socket_access_struct->timeout); if(!strlen(db_string)) { if(first_one) { dbcmd(dbproc1," update EXT_SOCKET_ACCESS set "); dbcmd(dbproc1," timeout = NULL "); } else dbcmd(dbproc1,", timeout = NULL "); } else { if(first_one) { dbcmd(dbproc1," update EXT_SOCKET_ACCESS set "); dbfcmd(dbproc1," timeout = %d ", atoi(db_string)); } else dbfcmd(dbproc1,", timeout = %d ", atoi(db_string)); } free(db_string); first_one = FALSE; } if(strcmp(ext_socket_access_struct->eof_data, ext_socket_access_selected.eof_data) != 0) { db_string = (char *)convert_to_db_string(ext_socket_access_struct->eof_data); if(!strlen(db_string)) { if(first_one) { dbcmd(dbproc1," update EXT_SOCKET_ACCESS set "); dbcmd(dbproc1," eof_data = NULL "); } else dbcmd(dbproc1,", eof_data = NULL "); } else { if(first_one) { dbcmd(dbproc1," update EXT_SOCKET_ACCESS set "); dbfcmd(dbproc1," eof_data = %s ",db_string); } else dbfcmd(dbproc1,", eof_data = %s ",db_string); } free(db_string); first_one = FALSE; } dbcmd(dbproc1, " where "); db_string = (char *)convert_to_db_string(ext_socket_access_selected.ext_contact_id); dbfcmd(dbproc1, " ext_contact_id = %d", atoi(db_string)); free(db_string); if(safe_dbupdate(dbproc1, "EXT_SOCKET_ACCESS", "update_ext_socket_access_db")) { return(FAILURE); } return(SUCCESS); }