这篇教程C++ DB_CAPABILITY函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中DB_CAPABILITY函数的典型用法代码示例。如果您正苦于以下问题:C++ DB_CAPABILITY函数的具体用法?C++ DB_CAPABILITY怎么用?C++ DB_CAPABILITY使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了DB_CAPABILITY函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: id2db_urlstatic int id2db_url(int id, int require_raw_query, int is_async, struct db_url** url){ *url = get_db_url((unsigned int)id); if (*url==NULL) { LM_ERR("no db_url with id <%d>/n", id); return E_CFG; } /* * Since mod_init() is run before function fixups, all DB structs * are initialized and all DB capabilities are populated */ if (require_raw_query && !DB_CAPABILITY((*url)->dbf, DB_CAP_RAW_QUERY)) { LM_ERR("driver for DB URL [%u] does not support raw queries/n", (unsigned int)id); return -1; } if (is_async && !DB_CAPABILITY((*url)->dbf, DB_CAP_ASYNC_RAW_QUERY)) LM_WARN("async() calls for DB URL [%u] will work " "in normal mode due to driver limitations/n", (unsigned int)id); return 0;}
开发者ID:Parantido,项目名称:opensips,代码行数:27,
示例2: mod_initstatic int mod_init(void){ LM_DBG("initializing/n"); init_db_url( db_url , 0 /*cannot be null*/); user_column.len = strlen(user_column.s); domain_column.len = strlen(domain_column.s); sd_user_column.len = strlen(sd_user_column.s); sd_domain_column.len = strlen(sd_domain_column.s); new_uri_column.len = strlen(new_uri_column.s); if (domain_prefix.s) domain_prefix.len = strlen(domain_prefix.s); /* Find a database module */ if (db_bind_mod(&db_url, &db_funcs)) { LM_ERR("failed to bind database module/n"); return -1; } if (!DB_CAPABILITY(db_funcs, DB_CAP_QUERY)) { LM_ERR("Database modules does not " "provide all functions needed by SPEEDDIAL module/n"); return -1; } if (domain_prefix.s && domain_prefix.len > 0) { dstrip_s.s = domain_prefix.s; dstrip_s.len = domain_prefix.len; } return 0;}
开发者ID:asitm9,项目名称:opensips,代码行数:32,
示例3: acc_db_init/* binds to the corresponding database module * returns 0 on success, -1 on error */int acc_db_init(const str* db_url){ if (db_bind_mod(db_url, &acc_dbf)<0){ LM_ERR("bind_db failed/n"); return -1; } /* Check database capabilities */ if (!DB_CAPABILITY(acc_dbf, DB_CAP_INSERT)) { LM_ERR("database module does not implement insert function/n"); return -1; } db_handle=acc_dbf.init(db_url); if (db_handle==0){ LM_ERR("unable to connect to the database/n"); return -1; } if (db_check_table_version(&acc_dbf, db_handle, &db_table_acc, TABLE_VERSION) < 0) { LM_ERR("error during table version check/n"); return -1; } acc_db_close(); acc_db_init_keys(); return 0;}
开发者ID:iamroger,项目名称:voip,代码行数:34,
示例4: mod_initstatic int mod_init(void){ db_url.len = strlen(db_url.s); user_column.len = strlen(user_column.s); domain_column.len = strlen(domain_column.s); alias_domain_column.len = strlen(alias_domain_column.s); alias_user_column.len = strlen(alias_user_column.s); if (domain_prefix.s) domain_prefix.len = strlen(domain_prefix.s); /* Find a database module */ if (db_bind_mod(&db_url, &adbf)) { LM_ERR("unable to bind database module/n"); return -1; } if (!DB_CAPABILITY(adbf, DB_CAP_QUERY)) { LM_CRIT("database modules does not " "provide all functions needed by avpops module/n"); return -1; } return 0;}
开发者ID:gbour,项目名称:kamailio,代码行数:25,
示例5: verify_dbstatic int verify_db(void){ /* binding to mysql module */ if (db_bind_mod(&db_url, &pxml_dbf)) { LM_ERR("Database module not found/n"); return -1; } if (!DB_CAPABILITY(pxml_dbf, DB_CAP_ALL)) { LM_ERR("Database module does not implement all functions" " needed by the module/n"); return -1; } pxml_db = pxml_dbf.init(&db_url); if (!pxml_db) { LM_ERR("while connecting to database/n"); return -1; } /* pxml_db is free'd by caller later, not sure if safe to do now */ return 0;}
开发者ID:Distrotech,项目名称:opensips,代码行数:25,
示例6: mod_initstatic int mod_init(void){ LM_DBG("Initializing/n"); init_db_url( db_url , 0 /*cannot be null*/); user_column.len = strlen(user_column.s); domain_column.len = strlen(domain_column.s); cd_user_column.len = strlen(cd_user_column.s); cd_domain_column.len = strlen(cd_domain_column.s); group_id_column.len = strlen(group_id_column.s); new_uri_column.len = strlen(new_uri_column.s); /* Find a database module */ if (db_bind_mod(&db_url, &db_functions) == -1) { LM_ERR("Failed to bind database module/n"); return -1; } if (!DB_CAPABILITY(db_functions, DB_CAP_QUERY)) { LM_ERR("Database modules does not " "provide all functions needed by closeddial module./n"); return -1; } return 0;}
开发者ID:zhangzheyuk,项目名称:opensips,代码行数:26,
示例7: mod_initstatic int mod_init(void){ bind_sl_t bind_sl; DBG("speeddial module - initializing/n"); /* Find a database module */ if (bind_dbmod(db_url, &db_funcs)) { LOG(L_ERR, "sd:mod_init: Unable to bind database module/n"); return -1; } if (!DB_CAPABILITY(db_funcs, DB_CAP_QUERY)) { LOG(L_ERR, "sd:mod_init: Database modules does not " "provide all functions needed by SPEEDDIAL module/n"); return -1; } /** * We will need sl_send_reply from stateless * module for sending replies */ bind_sl = (bind_sl_t)find_export("bind_sl", 0, 0); if (!bind_sl) { ERR("This module requires sl module/n"); return -1; } if (bind_sl(&sl) < 0) return -1; return 0;}
开发者ID:Gaoithe,项目名称:openimscore_ims,代码行数:32,
示例8: sql_connectint sql_connect(void){ sql_con_t *sc; sc = _sql_con_root; while(sc) { if (db_bind_mod(&sc->db_url, &sc->dbf)) { LM_DBG("database module not found for [%.*s]/n", sc->name.len, sc->name.s); return -1; } if (!DB_CAPABILITY(sc->dbf, DB_CAP_RAW_QUERY)) { LM_ERR("database module does not have DB_CAP_ALL [%.*s]/n", sc->name.len, sc->name.s); return -1; } sc->dbh = sc->dbf.init(&sc->db_url); if (sc->dbh==NULL) { LM_ERR("failed to connect to the database [%.*s]/n", sc->name.len, sc->name.s); return -1; } sc = sc->next; } return 0;}
开发者ID:SipCoSystems,项目名称:hush,代码行数:29,
示例9: init_dbstatic int init_db (void){/*********** o bind to DB* o check capabilities* o init DB**********/str *pdb_url = &pmod_data->pcfg->db_url;if (db_bind_mod (pdb_url, pmod_data->pdb)) { LM_ERR ("Unable to bind DB API using %s", pdb_url->s); return 0; }db_func_t *pdb = pmod_data->pdb;if (!DB_CAPABILITY ((*pdb), DB_CAP_ALL)) { LM_ERR ("Selected database %s lacks required capabilities", pdb_url->s); return 0; }db1_con_t *pconn = mohq_dbconnect ();if (!pconn) { return 0; }/*********** o check schema* o remove all call recs* o load queue list**********/if (db_check_table_version (pdb, pconn, &pmod_data->pcfg->db_ctable, MOHQ_CTABLE_VERSION) < 0) { LM_ERR ("%s table in DB %s not at version %d", pmod_data->pcfg->db_ctable.s, pdb_url->s, MOHQ_CTABLE_VERSION); goto dberr; }if (db_check_table_version (pdb, pconn, &pmod_data->pcfg->db_qtable, MOHQ_QTABLE_VERSION) < 0) { LM_ERR ("%s table in DB %s not at version %d", pmod_data->pcfg->db_qtable.s, pdb_url->s, MOHQ_QTABLE_VERSION); goto dberr; }clear_calls (pconn);update_mohq_lst (pconn);pmod_data->mohq_update = time (0);mohq_dbdisconnect (pconn);return -1;/*********** close DB**********/dberr:pdb->close (pconn);return 0;}
开发者ID:apogrebennyk,项目名称:kamailio,代码行数:59,
示例10: mod_init/** * init module function */static int mod_init(void){ bind_xcap_t bind_xcap; xcap_api_t xcap_api; /* load XCAP API */ bind_xcap = (bind_xcap_t)find_export("bind_xcap", 1, 0); if (!bind_xcap) { LM_ERR("Can't bind xcap/n"); return -1; } if (bind_xcap(&xcap_api) < 0) { LM_ERR("Can't bind xcap/n"); return -1; } xcap_db_url = xcap_api.db_url; xcap_db_table = xcap_api.xcap_table; /* binding to mysql module */ if (db_bind_mod(&xcap_db_url, &xcap_dbf)) { LM_ERR("Database module not found/n"); return -1; } if (!DB_CAPABILITY(xcap_dbf, DB_CAP_ALL)) { LM_ERR("Database module does not implement all functions" " needed by the module/n"); return -1; } xcap_db = xcap_dbf.init(&xcap_db_url); if (!xcap_db) { LM_ERR("while connecting to database/n"); return -1; } curl_global_init(CURL_GLOBAL_ALL); if(periodical_query) { register_timer("xcapc-update", query_xcap_update, 0, query_period, TIMER_FLAG_DELAY_ON_DELAY); } if(xcap_db) xcap_dbf.close(xcap_db); xcap_db = NULL; return 0;}
开发者ID:alias-neo,项目名称:opensips,代码行数:58,
示例11: push_check_dbint push_check_db(PushServer* apns, const char* push_db, const char* push_table){ str db_url = {0, 0}; str table = {0, 0}; if (apns == NULL) { return 0; } if (push_db == NULL) { return 0; } db_url.s = (char*)push_db; db_url.len = strlen(db_url.s); table.s = (char*)push_table; table.len = strlen(push_table); if ((apns->dbf.init == 0) && (db_bind_mod(&db_url, &apns->dbf))) { LM_ERR("Database module not found/n"); return -1; } if (!DB_CAPABILITY(apns->dbf, DB_CAP_ALL)) { LM_ERR("Database module does not implement all functions" " needed by push module/n"); return -1; } /* should be done prior init in each child...*/ apns->db = apns->dbf.init(&db_url); if (!apns->db) { LM_ERR("Connection to database failed/n"); return -1; } if (db_check_table_version(&apns->dbf, apns->db, &table, PUSH_TABLE_VERSION) < 0) { LM_ERR("wrong table version for %s/n", table.s); return -1; } apns->dbf.close(apns->db); apns->db = NULL; return 1;}
开发者ID:kritlivesync,项目名称:push,代码行数:53,
示例12: mod_initstatic int mod_init(void){ if (bind_dbmod(db_url, &db) < 0) { LOG(L_ERR, "avp_db:mod_init: Unable to bind a database driver/n"); return -1; } if (!DB_CAPABILITY(db, DB_CAP_QUERY)) { LOG(L_ERR, "avp_db:mod_init: Selected database driver does not suppor the query capability/n"); return -1; } return 0;}
开发者ID:Gaoithe,项目名称:openimscore_ims,代码行数:14,
示例13: group_db_bind/*! * /brief Bind the DB connection * /param db_url database URL * /return 0 on success, -1 on failure */int group_db_bind(const str* db_url){ if (db_bind_mod(db_url, &group_dbf)<0){ LM_ERR("unable to bind to the database module/n"); return -1; } if (!DB_CAPABILITY(group_dbf, DB_CAP_QUERY)) { LM_ERR("database module does not implement 'query' function/n"); return -1; } return 0;}
开发者ID:AndreyRybkin,项目名称:kamailio,代码行数:19,
示例14: fixup_db_urlstatic int fixup_db_url(void ** param, int require_raw_query, int is_async){ struct db_url* url; unsigned int ui; str s; s.s = (char*)*param; s.len = strlen(s.s); if(str2int(&s, &ui)!=0) { LM_ERR("bad db_url number <%s>/n", (char *)(*param)); return E_CFG; } url = get_db_url(ui); if (url==NULL) { LM_ERR("no db_url with id <%s>/n", (char *)(*param)); return E_CFG; } /* * Since mod_init() is run before function fixups, all DB structs * are initialized and all DB capabilities are populated */ if (require_raw_query && !DB_CAPABILITY(url->dbf, DB_CAP_RAW_QUERY)) { LM_ERR("driver for DB URL [%u] does not support raw queries/n", ui); return -1; } if (is_async && !DB_CAPABILITY(url->dbf, DB_CAP_ASYNC_RAW_QUERY)) LM_WARN("async() calls for DB URL [%u] will work " "in normal mode due to driver limitations/n", ui); pkg_free(*param); *param=(void *)url; return 0;}
开发者ID:WuKongQC,项目名称:opensips,代码行数:37,
示例15: acc_db_bind/* binds to the corresponding database module * returns 0 on success, -1 on error */int acc_db_bind(char* db_url){ acc_db_url=db_url; if (bind_dbmod(acc_db_url, &acc_dbf)<0){ LOG(L_ERR, "ERROR: acc_db_init: bind_db failed/n"); return -1; } /* Check database capabilities */ if (!DB_CAPABILITY(acc_dbf, DB_CAP_INSERT)) { LOG(L_ERR, "ERROR: acc_db_init: Database module does not implement insert function/n"); return -1; } return 0;}
开发者ID:OPSF,项目名称:uClinux,代码行数:18,
示例16: sca_bind_srdb1 static intsca_bind_srdb1( sca_mod *scam, db_func_t *db_api ){ db1_con_t *db_con = NULL; int rc = -1; if ( db_bind_mod( scam->cfg->db_url, db_api ) != 0 ) { LM_ERR( "Failed to initialize required DB API" ); goto done; } scam->db_api = db_api; if ( !DB_CAPABILITY( (*db_api), DB_CAP_ALL )) { LM_ERR( "Selected database %.*s lacks required capabilities", STR_FMT( scam->cfg->db_url )); goto done; } /* ensure database exists and table schemas are correct */ db_con = db_api->init( scam->cfg->db_url ); if ( db_con == NULL ) { LM_ERR( "sca_bind_srdb1: failed to connect to DB %.*s", STR_FMT( scam->cfg->db_url )); goto done; } if ( db_check_table_version( db_api, db_con, scam->cfg->subs_table, SCA_DB_SUBSCRIPTIONS_TABLE_VERSION ) < 0 ) { LM_ERR( "Version check of %.*s table in DB %.*s failed", STR_FMT( scam->cfg->subs_table ), STR_FMT( scam->cfg->db_url )); LM_ERR( "%.*s table version %d required", STR_FMT( scam->cfg->subs_table ), SCA_DB_SUBSCRIPTIONS_TABLE_VERSION ); goto done; } /* DB and tables are OK, close DB handle. reopen in each child. */ rc = 0;done: if ( db_con != NULL ) { db_api->close( db_con ); db_con = NULL; } return( rc );}
开发者ID:AlessioCasco,项目名称:kamailio,代码行数:47,
示例17: ht_db_init_con/** * initialize database connection */int ht_db_init_con(void){ /* binding to DB module */ if(db_bind_mod(&ht_db_url, &ht_dbf)) { LM_ERR("database module not found/n"); return -1; } if (!DB_CAPABILITY(ht_dbf, DB_CAP_ALL)) { LM_ERR("database module does not " "implement all functions needed by the module/n"); return -1; } return 0;}
开发者ID:kiryu,项目名称:kamailio,代码行数:20,
示例18: acc_db_init/* binds to the corresponding database module * returns 0 on success, -1 on error */int acc_db_init(const str* db_url){ if (db_bind_mod(db_url, &acc_dbf)<0){ LM_ERR("bind_db failed/n"); return -1; } /* Check database capabilities */ if (!DB_CAPABILITY(acc_dbf, DB_CAP_INSERT)) { LM_ERR("database module does not implement insert function/n"); return -1; } acc_db_init_keys(); return 0;}
开发者ID:Jared-Prime,项目名称:kamailio,代码行数:19,
示例19: db_fetch_query_internalstatic int db_fetch_query_internal(db_func_t *dbf, int frows, db1_con_t* _h, const db_key_t* _k, const db_op_t* _op, const db_val_t* _v, const db_key_t* _c, const int _n, const int _nc, const db_key_t _o, db1_res_t** _r, db_query_f _query){ int ret; if (!_query) { LM_ERR("bad query function pointer/n"); goto error; } ret = 0; *_r = NULL; if (DB_CAPABILITY(*dbf, DB_CAP_FETCH)) { if(_query(_h, _k, _op, _v, _c, _n, _nc, _o, 0) < 0) { LM_ERR("unable to query db for fetch/n"); goto error; } if(dbf->fetch_result(_h, _r, frows)<0) { LM_ERR("unable to fetch the db result/n"); goto error; } ret = 1; } else { if(_query(_h, _k, _op, _v, _c, _n, _nc, _o, _r) < 0) { LM_ERR("unable to do full db querry/n"); goto error; } } return ret;error: if(*_r) { dbf->free_result(_h, *_r); *_r = NULL; } return -1;}
开发者ID:GreenfieldTech,项目名称:kamailio,代码行数:46,
示例20: mod_init/** * init module function */static int mod_init(void){ str _s; int ver; xcap_db_url.len = xcap_db_url.s ? strlen(xcap_db_url.s) : 0; /* binding to mysql module */ if (bind_dbmod(xcap_db_url.s, &xcap_dbf)) { LM_ERR("Database module not found/n"); return -1; } if (!DB_CAPABILITY(xcap_dbf, DB_CAP_ALL)) { LM_ERR("Database module does not implement all functions" " needed by the module/n"); return -1; } xcap_db = xcap_dbf.init(xcap_db_url.s); if (!xcap_db) { LM_ERR("while connecting to database/n"); return -1; } _s.s = xcap_db_table; _s.len = strlen(xcap_db_table); ver = table_version(&xcap_dbf, xcap_db, &_s); if(ver!=XCAP_TABLE_VERSION) { LM_ERR("Wrong version v%d for table <%s>, need v%d/n", ver, _s.s, XCAP_TABLE_VERSION); return -1; } curl_global_init(CURL_GLOBAL_ALL); if(periodical_query) { register_timer(query_xcap_update, 0, query_period); } return 0;}
开发者ID:Drooids,项目名称:openser-xmlrpc,代码行数:48,
示例21: mod_init/** * init module function */static int mod_init(void){ if(xcap_client_init_rpc()<0) { LM_ERR("failed to register RPC commands/n"); return -1; } /* binding to mysql module */ if (db_bind_mod(&xcap_db_url, &xcap_dbf)) { LM_ERR("Database module not found/n"); return -1; } if (!DB_CAPABILITY(xcap_dbf, DB_CAP_ALL)) { LM_ERR("Database module does not implement all functions" " needed by the module/n"); return -1; } xcap_db = xcap_dbf.init(&xcap_db_url); if (!xcap_db) { LM_ERR("while connecting to database/n"); return -1; } if(db_check_table_version(&xcap_dbf, xcap_db, &xcap_db_table, XCAP_TABLE_VERSION) < 0) { LM_ERR("error during table version check./n"); return -1; } xcap_dbf.close(xcap_db); xcap_db = NULL; curl_global_init(CURL_GLOBAL_ALL); if(periodical_query) { register_timer(query_xcap_update, 0, query_period); } return 0;}
开发者ID:TheGrandWazoo,项目名称:kamailio,代码行数:47,
示例22: mod_initstatic int mod_init(void){ load_tm_f load_tm; /* import the TM auto-loading function */ if ( !(load_tm = (load_tm_f)find_export("load_tm", NO_SCRIPT, 0))) { LOG(L_ERR, "ERROR:acc:mod_init: can't import load_tm/n"); return -1; } /* let the auto-loading function load all TM stuff */ if (load_tm( &tmb )==-1) return -1; if (verify_fmt(log_fmt)==-1) return -1; /* register callbacks*/ /* listen for all incoming requests */ if (tmb.register_tmcb( 0, 0, TMCB_REQUEST_IN, on_req, 0 ) <= 0) { LOG(L_ERR,"ERROR:acc:mod_init: cannot register TMCB_REQUEST_IN " "callback/n"); return -1; } if (bind_dbmod(db_url.s, &acc_dbf) < 0) { LOG(L_ERR, "ERROR:acc:mod_init: bind_db failed/n"); return -1; } /* Check database capabilities */ if (!DB_CAPABILITY(acc_dbf, DB_CAP_INSERT)) { LOG(L_ERR, "ERROR:acc:mod_init: Database module does not implement insert function/n"); return -1; } init_data(log_fmt); if (parse_attrs(&avps, &avps_n, attrs) < 0) { ERR("Error while parsing 'attrs' module parameter/n"); return -1; } return 0;}
开发者ID:BackupTheBerlios,项目名称:openimscore-svn,代码行数:41,
示例23: mod_init/** * init module function */static int mod_init(void){ /* Find a database module */ if (db_bind_mod(&_tps_db_url, &_tpsdbf)) { LM_ERR("unable to bind database module/n"); return -1; } if (!DB_CAPABILITY(_tpsdbf, DB_CAP_ALL)) { LM_CRIT("database modules does not " "provide all functions needed/n"); return -1; } if(_tps_sanity_checks!=0) { if(sanity_load_api(&scb)<0) { LM_ERR("cannot bind to sanity module/n"); goto error; } } if(tps_storage_lock_set_init()<0) { LM_ERR("failed to initialize locks set/n"); return -1; } if(sruid_init(&_tps_sruid, '-', "tpsh", SRUID_INC)<0) return -1; sr_event_register_cb(SREV_NET_DATA_IN, tps_msg_received); sr_event_register_cb(SREV_NET_DATA_OUT, tps_msg_sent);#ifdef USE_TCP tcp_set_clone_rcvbuf(1);#endif if(sr_wtimer_add(tps_storage_clean, NULL, _tps_clean_interval)<0) return -1; return 0;error: return -1;}
开发者ID:fsantulli,项目名称:kamailio,代码行数:44,
示例24: mod_initstatic int mod_init(void){ /* Find a database module */ if (db_bind_mod(&db_url, &db_funcs)) { LM_ERR("failed to bind database module/n"); return -1; } if (!DB_CAPABILITY(db_funcs, DB_CAP_QUERY)) { LM_ERR("Database modules does not " "provide all functions needed by SPEEDDIAL module/n"); return -1; } if (domain_prefix.s && domain_prefix.len > 0) { dstrip_s.s = domain_prefix.s; dstrip_s.len = domain_prefix.len; } return 0;}
开发者ID:TheGrandWazoo,项目名称:kamailio,代码行数:21,
示例25: select_entire_dialog_tablestatic int select_entire_dialog_table(db_res_t ** res, int *no_rows){ db_key_t query_cols[DIALOG_TABLE_TOTAL_COL_NO] = { &h_entry_column, &h_id_column, &call_id_column, &from_uri_column, &from_tag_column, &to_uri_column, &to_tag_column, &start_time_column, &state_column, &timeout_column, &from_cseq_column, &to_cseq_column, &from_route_column, &to_route_column, &from_contact_column, &to_contact_column, &from_sock_column, &to_sock_column, &vars_column, &profiles_column, &sflags_column, &from_ping_cseq_column, &to_ping_cseq_column,&flags_column, &mangled_fu_column,&mangled_tu_column}; if(use_dialog_table() != 0){ return -1; } /* select the whole tabel and all the columns */ if (DB_CAPABILITY(dialog_dbf, DB_CAP_FETCH)) { if(dialog_dbf.query(dialog_db_handle,0,0,0,query_cols, 0, DIALOG_TABLE_TOTAL_COL_NO, 0, 0) < 0) { LM_ERR("Error while querying (fetch) database/n"); return -1; } *no_rows = estimate_available_rows( 4+4+128+64+32+54+32+4+4+4+16+16 +256+256+64+64+32+32+256+256+4+4+4+4,DIALOG_TABLE_TOTAL_COL_NO ); if (*no_rows==0) *no_rows = 10; if(dialog_dbf.fetch_result(dialog_db_handle,res,*no_rows)<0){ LM_ERR("fetching rows failed/n"); return -1; } } else { if(dialog_dbf.query(dialog_db_handle,0,0,0,query_cols, 0, DIALOG_TABLE_TOTAL_COL_NO, 0, res) < 0) { LM_ERR("Error while querying database/n"); return -1; } } return 0;}
开发者ID:bluemutedwisdom,项目名称:OpenSIPS,代码行数:40,
示例26: init_dbint init_db(const str *db_url, int db_update_period, int fetch_num_rows){ /* Find a database module */ if (db_bind_mod(db_url, &ul_dbf) < 0){ LM_ERR("Unable to bind to a database driver/n"); return -1; } if (connect_db(db_url)!=0){ LM_ERR("unable to connect to the database/n"); return -1; } if (!DB_CAPABILITY(ul_dbf, DB_CAP_ALL)) { LM_ERR("database module does not implement all functions needed by the module/n"); return -1; } ul_dbf.close(ul_dbh); ul_dbh = 0; return 0;}
开发者ID:AlessioCasco,项目名称:kamailio,代码行数:23,
示例27: pv_get_sqlrowsint pv_get_sqlrows(struct sip_msg *msg, pv_param_t *param, pv_value_t *res){ sql_con_t *con; str* sc; sc = ¶m->pvn.u.isname.name.s; con = sql_get_connection(sc); if(con==NULL) { LM_ERR("invalid connection [%.*s]/n", sc->len, sc->s); return -1; } if (!DB_CAPABILITY(con->dbf, DB_CAP_AFFECTED_ROWS)) { LM_ERR("con: %p database module does not have DB_CAP_AFFECTED_ROWS [%.*s]/n", con, sc->len, sc->s); return -1; } return pv_get_sintval(msg, param, res, con->dbf.affected_rows(con->dbh));}
开发者ID:SipCoSystems,项目名称:hush,代码行数:23,
示例28: db_fetch_next/** * wrapper around db fetch to handle fetch capability * return: -1 error; 0 ok with no fetch capability; 1 ok with fetch capability */int db_fetch_next(db_func_t *dbf, int frows, db1_con_t* _h, db1_res_t** _r){ int ret; ret = 0; if (DB_CAPABILITY(*dbf, DB_CAP_FETCH)) { if(dbf->fetch_result(_h, _r, frows)<0) { LM_ERR("unable to fetch next rows/n"); goto error; } ret = 1; } return ret;error: if(*_r) { dbf->free_result(_h, *_r); *_r = NULL; } return -1;}
开发者ID:GreenfieldTech,项目名称:kamailio,代码行数:28,
注:本文中的DB_CAPABILITY函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ DB_DEBUG函数代码示例 C++ DBWriteContactSettingString函数代码示例 |