这篇教程C++ DB_GET_PAYLOAD函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中DB_GET_PAYLOAD函数的典型用法代码示例。如果您正苦于以下问题:C++ DB_GET_PAYLOAD函数的具体用法?C++ DB_GET_PAYLOAD怎么用?C++ DB_GET_PAYLOAD使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了DB_GET_PAYLOAD函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: bdb_cmd_execint bdb_cmd_exec(db_res_t *res, db_cmd_t *cmd){ db_con_t *con; bdb_cmd_t *bcmd; bdb_con_t *bcon; /* First things first: retrieve connection info from the currently active * connection and also mysql payload from the database command */ con = cmd->ctx->con[db_payload_idx]; bcmd = DB_GET_PAYLOAD(cmd); bcon = DB_GET_PAYLOAD(con); if((bcon->flags & BDB_CONNECTED) == 0) { ERR("bdb: not connected/n"); return -1; } bcmd->next_flag = -1; switch(cmd->type) { case DB_DEL: case DB_PUT: case DB_UPD: /* no result expected - cleanup */ DBG("bdb: query with no result./n"); break; case DB_GET: return bdb_query(cmd, bcmd); break; default: /* result expected - no cleanup */ DBG("bdb: query with result./n"); } return 0;}
开发者ID:adubovikov,项目名称:kamailio,代码行数:35,
示例2: my_con_connectint my_con_connect(db_con_t* con){ struct my_con* mcon; struct my_uri* muri; mcon = DB_GET_PAYLOAD(con); muri = DB_GET_PAYLOAD(con->uri); /* Do not reconnect already connected connections */ if (mcon->flags & MY_CONNECTED) return 0; DBG("mysql: Connecting to %.*s:%.*s/n", con->uri->scheme.len, ZSW(con->uri->scheme.s), con->uri->body.len, ZSW(con->uri->body.s)); if (my_connect_to) { if (mysql_options(mcon->con, MYSQL_OPT_CONNECT_TIMEOUT, (char*)&my_connect_to)) WARN("mysql: failed to set MYSQL_OPT_CONNECT_TIMEOUT/n"); }#if MYSQL_VERSION_ID >= 40101 if ((my_client_ver >= 50025) || ((my_client_ver >= 40122) && (my_client_ver < 50000))) { if (my_send_to) { if (mysql_options(mcon->con, MYSQL_OPT_WRITE_TIMEOUT , (char*)&my_send_to)) WARN("mysql: failed to set MYSQL_OPT_WRITE_TIMEOUT/n"); } if (my_recv_to){ if (mysql_options(mcon->con, MYSQL_OPT_READ_TIMEOUT , (char*)&my_recv_to)) WARN("mysql: failed to set MYSQL_OPT_READ_TIMEOUT/n"); } }#endif if (!mysql_real_connect(mcon->con, muri->host, muri->username, muri->password, muri->database, muri->port, 0, 0)) { LOG(L_ERR, "mysql: %s/n", mysql_error(mcon->con)); return -1; } DBG("mysql: Connection type is %s/n", mysql_get_host_info(mcon->con)); DBG("mysql: Protocol version is %d/n", mysql_get_proto_info(mcon->con)); DBG("mysql: Server version is %s/n", mysql_get_server_info(mcon->con)); mcon->flags |= MY_CONNECTED; /* Increase the variable that keeps track of number of connects performed * on this connection. The mysql module uses the variable to determine * when a pre-compiled command needs to be uploaded to the server again. * If the number in the my_con structure is large than the number kept * in my_cmd then it means that we have to upload the command to the server * again because the connection was reconnected meanwhile. */ mcon->resets++; return 0;}
开发者ID:BackupTheBerlios,项目名称:ser,代码行数:60,
示例3: bdb_con_connectint bdb_con_connect(db_con_t* con){ bdb_con_t *bcon; bdb_uri_t *buri; bcon = DB_GET_PAYLOAD(con); buri = DB_GET_PAYLOAD(con->uri); /* Do not reconnect already connected connections */ if (bcon->flags & BDB_CONNECTED) return 0; DBG("bdb: Connecting to %s/n", buri->uri); /* create BDB environment */ bcon->dbp = bdblib_get_db(&buri->path); if(bcon->dbp == NULL) { ERR("bdb: error binding to DB %s/n", buri->uri); return -1; } DBG("bdb: Successfully bound to %s/n", buri->uri); bcon->flags |= BDB_CONNECTED; return 0;}
开发者ID:4N7HR4X,项目名称:kamailio,代码行数:26,
示例4: my_con_connectint my_con_connect(db_con_t* con){ struct my_con* mcon; struct my_uri* muri; mcon = DB_GET_PAYLOAD(con); muri = DB_GET_PAYLOAD(con->uri); /* Do not reconnect already connected connections */ if (mcon->flags & MY_CONNECTED) return 0; DBG("mysql: Connecting to %.*s:%.*s/n", con->uri->scheme.len, ZSW(con->uri->scheme.s), con->uri->body.len, ZSW(con->uri->body.s)); if (my_connect_to) { if (mysql_options(mcon->con, MYSQL_OPT_CONNECT_TIMEOUT, (char*)&my_connect_to)) WARN("mysql: failed to set MYSQL_OPT_CONNECT_TIMEOUT/n"); }#if MYSQL_VERSION_ID >= 40101 if ((my_client_ver >= 50025) || ((my_client_ver >= 40122) && (my_client_ver < 50000))) { if (my_send_to) { if (mysql_options(mcon->con, MYSQL_OPT_WRITE_TIMEOUT , (char*)&my_send_to)) WARN("mysql: failed to set MYSQL_OPT_WRITE_TIMEOUT/n"); } if (my_recv_to){ if (mysql_options(mcon->con, MYSQL_OPT_READ_TIMEOUT , (char*)&my_recv_to)) WARN("mysql: failed to set MYSQL_OPT_READ_TIMEOUT/n"); } }#endif if (!mysql_real_connect(mcon->con, muri->host, muri->username, muri->password, muri->database, muri->port, 0, 0)) { LOG(L_ERR, "mysql: %s/n", mysql_error(mcon->con)); return -1; } DBG("mysql: Connection type is %s/n", mysql_get_host_info(mcon->con)); DBG("mysql: Protocol version is %d/n", mysql_get_proto_info(mcon->con)); DBG("mysql: Server version is %s/n", mysql_get_server_info(mcon->con)); mcon->flags |= MY_CONNECTED; return 0;}
开发者ID:4N7HR4X,项目名称:kamailio,代码行数:51,
示例5: check_types/** Verify field type compatibility. * This function verifies the types of all parameters of a database command * with the types of corresponding fields on the server to make sure that they * can be converted. * @param cmd A command structure whose parameters are to be checked. * @retval 0 on success. * @retval A negative number if at least one field type does not match. * @todo Store oid and length as part of pg_fld, instead of the arrays used * as parameters to PQ functions */static int check_types(db_cmd_t* cmd) { struct pg_cmd* pcmd; struct pg_con* pcon; pcmd = DB_GET_PAYLOAD(cmd); /* FIXME: The function should take the connection as one of parameters */ pcon = DB_GET_PAYLOAD(cmd->ctx->con[db_payload_idx]); if (pg_check_fld2pg(cmd->match, pcon->oid)) return -1; if (pg_check_fld2pg(cmd->vals, pcon->oid)) return -1; if (pg_check_pg2fld(cmd->result, pcon->oid)) return -1; return 0;}
开发者ID:billyyh,项目名称:kamailio,代码行数:24,
示例6: ld_uri_cmp/** Compares two LDAP connection URIs. * This function is called whenever the database abstraction layer in * SER needs to compare to URIs with the ldap scheme. The function * compares hosts and port numbers of both URIs (host part comparison * is case insensitive). The URI comparison is mainly used to * by the connection pool to determine if a connection to a given * server already exists. **/static unsigned char ld_uri_cmp(db_uri_t* uri1, db_uri_t* uri2){ struct ld_uri* luri1, *luri2; if (!uri1 || !uri2) return 0; luri1 = DB_GET_PAYLOAD(uri1); luri2 = DB_GET_PAYLOAD(uri2); if (luri1->ldap_url->lud_port != luri2->ldap_url->lud_port) return 0; if (cmpstr(luri1->ldap_url->lud_host, luri2->ldap_url->lud_host, strcasecmp)) return 0; return 1;}
开发者ID:BackupTheBerlios,项目名称:ser,代码行数:23,
示例7: create_pg_params/** Creates parameter data structures for PQexecPrepared. * This function creates auxiliary data structures that will be used to pass * parameter value and types to PQexecPrepared. The function only allocates * memory buffers and determines oids of parameters, actual values will be * assigned by another function at runtime. * @param cmd A command where the data strctures will be created. * @retval 0 on success. * @retval A negative number on error. */static int create_pg_params(db_cmd_t* cmd){ int num; struct pg_cmd* pcmd; pcmd = DB_GET_PAYLOAD(cmd); num = cmd->match_count + cmd->vals_count; if (num == 0) return 0; pcmd->params.val = (const char**)pkg_malloc(sizeof(const char*) * num); pcmd->params.len = (int*)pkg_malloc(sizeof(int) * num); pcmd->params.fmt = (int*)pkg_malloc(sizeof(int) * num); if (!pcmd->params.val || !pcmd->params.len || !pcmd->params.fmt) { ERR("postgres: No memory left/n"); goto error; } memset(pcmd->params.val, '/0', sizeof(const char*) * num); memset(pcmd->params.len, '/0', sizeof(int) * num); memset(pcmd->params.fmt, '/0', sizeof(int) * num); pcmd->params.n = num; return 0; error: free_pg_params(&pcmd->params); return -1;}
开发者ID:billyyh,项目名称:kamailio,代码行数:39,
示例8: my_getoptint my_getopt(db_cmd_t* cmd, char* optname, va_list ap){ struct my_cmd* mcmd; long long* id; int* val; mcmd = (struct my_cmd*)DB_GET_PAYLOAD(cmd); if (!strcasecmp("last_id", optname)) { id = va_arg(ap, long long*); if (id == NULL) { BUG("mysql: NULL pointer passed to 'last_id' option/n"); goto error; } if (mcmd->st->last_errno != 0) { BUG("mysql: Option 'last_id' called but previous command failed, " "check your code/n"); return -1; } *id = mysql_stmt_insert_id(mcmd->st); if ((*id) == 0) { BUG("mysql: Option 'last_id' called but there is no auto-increment" " column in table, SQL command: %.*s/n", STR_FMT(&mcmd->sql_cmd)); return -1; } } else if (!strcasecmp("fetch_all", optname)) {
开发者ID:aphistic,项目名称:kamailio,代码行数:28,
示例9: pg_uri_cmp/** Compare two connection URIs */static unsigned char pg_uri_cmp(db_uri_t* uri1, db_uri_t* uri2){ struct pg_uri* puri1, *puri2; if (!uri1 || !uri2) return 0; puri1 = DB_GET_PAYLOAD(uri1); puri2 = DB_GET_PAYLOAD(uri2); if (puri1->port != puri2->port) return 0; if (cmpstr(puri1->username, puri2->username, strcmp)) return 0; if (cmpstr(puri1->password, puri2->password, strcmp)) return 0; if (cmpstr(puri1->host, puri2->host, strcasecmp)) return 0; if (cmpstr(puri1->database, puri2->database, strcmp)) return 0; return 1;}
开发者ID:4N7HR4X,项目名称:kamailio,代码行数:17,
示例10: build_result_arraystatic int build_result_array(char*** res, db_cmd_t* cmd){ struct ld_fld* lfld; char** t; int i; if (cmd->result_count == 0) { *res = NULL; return 0; } t = (char**)pkg_malloc(sizeof(char*) * (cmd->result_count + 1)); if (t == NULL) { ERR("ldap: No memory left/n"); return -1; } t[cmd->result_count] = NULL; for(i = 0; i < cmd->result_count; i++) { lfld = DB_GET_PAYLOAD(cmd->result + i); /* Attribute names are always zero terminated */ t[i] = lfld->attr.s; } *res = t; return 0;}
开发者ID:2pac,项目名称:kamailio,代码行数:26,
示例11: my_uri_cmp/* * Compare two connection identifiers */static unsigned char my_uri_cmp(db_uri_t* uri1, db_uri_t* uri2){ struct my_uri* muri1, *muri2; if (!uri1 || !uri2) return 0; muri1 = DB_GET_PAYLOAD(uri1); muri2 = DB_GET_PAYLOAD(uri2); if (muri1->port != muri2->port) return 0; if (cmpstr(muri1->username, muri2->username, strcmp)) return 0; if (cmpstr(muri1->password, muri2->password, strcmp)) return 0; if (cmpstr(muri1->host, muri2->host, strcasecmp)) return 0; if (cmpstr(muri1->database, muri2->database, strcmp)) return 0; return 1;}
开发者ID:SipSeb,项目名称:kamailio,代码行数:19,
示例12: my_cmd_execint my_cmd_exec(db_res_t* res, db_cmd_t* cmd){ struct my_cmd* mcmd; mcmd = DB_GET_PAYLOAD(cmd); mcmd->next_flag = -1; return exec_cmd_safe(cmd);}
开发者ID:aphistic,项目名称:kamailio,代码行数:9,
示例13: get_typesstatic int get_types(db_cmd_t* cmd){ struct pg_cmd* pcmd; struct pg_con* pcon; pcmd = DB_GET_PAYLOAD(cmd); /* FIXME */ pcon = DB_GET_PAYLOAD(cmd->ctx->con[db_payload_idx]); pcmd->types = PQdescribePrepared(pcon->con, pcmd->name); if (PQresultStatus(pcmd->types) != PGRES_COMMAND_OK) { ERR("postgres: Error while obtaining description of prepared statement/n"); return -1; } return 0;}
开发者ID:billyyh,项目名称:kamailio,代码行数:18,
示例14: bdb_cmd_nextint bdb_cmd_next(db_res_t* res){ bdb_cmd_t *bcmd; DBT key, data; int ret; static char dbuf[MAX_ROW_SIZE]; bcmd = DB_GET_PAYLOAD(res->cmd); if (bcmd->next_flag == 2 || bcmd->next_flag == -2) return 1; memset(&key, 0, sizeof(DBT)); memset(&data, 0, sizeof(DBT)); memset(dbuf, 0, MAX_ROW_SIZE); data.data = dbuf; data.ulen = MAX_ROW_SIZE; data.flags = DB_DBT_USERMEM; ret = 0; if(bcmd->skey.len==0) { while((ret = bcmd->dbcp->c_get(bcmd->dbcp, &key, &data, DB_NEXT))==0) { if(!strncasecmp((char*)key.data,"METADATA",8)) continue; break; } if(ret!=0) { bcmd->next_flag = bcmd->next_flag<0?-2:2; return 1; } } else { key.data = bcmd->skey.s; key.ulen = bcmd->skey_size; key.flags = DB_DBT_USERMEM; key.size = bcmd->skey.len; ret = bcmd->dbcp->c_get(bcmd->dbcp, &key, &data, DB_NEXT); if(ret!=0) { bcmd->next_flag = bcmd->next_flag<0?-2:2; return 1; } } if (bcmd->next_flag <= 0) { bcmd->next_flag++; } if (bdb_update_result(res->cmd, &data) < 0) { return -1; } res->cur_rec->fld = res->cmd->result; return 0;}
开发者ID:AlessioCasco,项目名称:kamailio,代码行数:57,
示例15: my_conint my_con(db_con_t* con){ struct my_con* ptr; struct my_uri* uri; /* First try to lookup the connection in the connection pool and * re-use it if a match is found */ ptr = (struct my_con*)db_pool_get(con->uri); if (ptr) { DBG("mysql: Connection to %.*s:%.*s found in connection pool/n", con->uri->scheme.len, ZSW(con->uri->scheme.s), con->uri->body.len, ZSW(con->uri->body.s)); goto found; } ptr = (struct my_con*)pkg_malloc(sizeof(struct my_con)); if (!ptr) { LOG(L_ERR, "mysql: No memory left/n"); goto error; } memset(ptr, '/0', sizeof(struct my_con)); if (db_pool_entry_init(&ptr->gen, my_con_free, con->uri) < 0) goto error; ptr->con = (MYSQL*)pkg_malloc(sizeof(MYSQL)); if (!ptr->con) { LOG(L_ERR, "mysql: No enough memory/n"); goto error; } mysql_init(ptr->con); uri = DB_GET_PAYLOAD(con->uri); DBG("mysql: Creating new connection to: %.*s:%.*s/n", con->uri->scheme.len, ZSW(con->uri->scheme.s), con->uri->body.len, ZSW(con->uri->body.s)); /* Put the newly created mysql connection into the pool */ db_pool_put((struct db_pool_entry*)ptr); DBG("mysql: Connection stored in connection pool/n"); found: /* Attach driver payload to the db_con structure and set connect and * disconnect functions */ DB_SET_PAYLOAD(con, ptr); con->connect = my_con_connect; con->disconnect = my_con_disconnect; return 0; error: if (ptr) { db_pool_entry_free(&ptr->gen); if (ptr->con) pkg_free(ptr->con); pkg_free(ptr); } return 0;}
开发者ID:BackupTheBerlios,项目名称:ser,代码行数:57,
示例16: search_entry/* Iterate to the next search result in the linked list * of messages returned by the LDAP server and convert * the field values. */static int search_entry(db_res_t* res, int init){ db_con_t* con; struct ld_res* lres; struct ld_con* lcon; int r; lres = DB_GET_PAYLOAD(res); /* FIXME */ con = res->cmd->ctx->con[db_payload_idx]; lcon = DB_GET_PAYLOAD(con); if (init || !lres->current || ldap_msgtype(lres->current) != LDAP_RES_SEARCH_ENTRY /* there is no more value combination result left */ || ld_incindex(res->cmd->result)) { do { if (init) { lres->current = ldap_first_message(lcon->con, lres->msg); init = 0; } else lres->current = ldap_next_message(lcon->con, lres->current); while(lres->current) { if (ldap_msgtype(lres->current) == LDAP_RES_SEARCH_ENTRY) { break; } lres->current = ldap_next_message(lcon->con, lres->current); } if (lres->current == NULL) return 1; r = ld_ldap2fldinit(res->cmd->result, lcon->con, lres->current); } while (r > 0); if (r < 0) return -1; } else { if (ld_ldap2fld(res->cmd->result, lcon->con, lres->current) < 0) return -1; } res->cur_rec->fld = res->cmd->result; return 0;}
开发者ID:2pac,项目名称:kamailio,代码行数:46,
示例17: bdb_conint bdb_con(db_con_t* con){ bdb_con_t* bcon; bdb_uri_t* buri; buri = DB_GET_PAYLOAD(con->uri); /* First try to lookup the connection in the connection pool and * re-use it if a match is found */ bcon = (bdb_con_t*)db_pool_get(con->uri); if (bcon) { DBG("bdb: Connection to %s found in connection pool/n", buri->uri); goto found; } bcon = (bdb_con_t*)pkg_malloc(sizeof(bdb_con_t)); if (!bcon) { ERR("bdb: No memory left/n"); goto error; } memset(bcon, '/0', sizeof(bdb_con_t)); if (db_pool_entry_init(&bcon->gen, bdb_con_free, con->uri) < 0) goto error; DBG("bdb: Preparing new connection to %s/n", buri->uri); if(bdb_is_database(buri->path.s)!=0) { ERR("bdb: database [%.*s] does not exists!/n", buri->path.len, buri->path.s); goto error; } /* Put the newly created BDB connection into the pool */ db_pool_put((struct db_pool_entry*)bcon); DBG("bdb: Connection stored in connection pool/n");found: /* Attach driver payload to the db_con structure and set connect and * disconnect functions */ DB_SET_PAYLOAD(con, bcon); con->connect = bdb_con_connect; con->disconnect = bdb_con_disconnect; return 0;error: if (bcon) { db_pool_entry_free(&bcon->gen); pkg_free(bcon); } return -1;}
开发者ID:4N7HR4X,项目名称:kamailio,代码行数:53,
示例18: bdb_con_disconnectvoid bdb_con_disconnect(db_con_t* con){ bdb_con_t *bcon; bdb_uri_t *buri; bcon = DB_GET_PAYLOAD(con); buri = DB_GET_PAYLOAD(con->uri); if ((bcon->flags & BDB_CONNECTED) == 0) return; DBG("bdb: Unbinding from %s/n", buri->uri); if(bcon->dbp==NULL) { bcon->flags &= ~BDB_CONNECTED; return; } bdblib_close(bcon->dbp, &buri->path); bcon->dbp = 0; bcon->flags &= ~BDB_CONNECTED;}
开发者ID:4N7HR4X,项目名称:kamailio,代码行数:22,
示例19: my_res_freevoid my_res_free(db_res_t* res, struct my_res* payload){ struct my_cmd* mcmd; mcmd = DB_GET_PAYLOAD(res->cmd); if (mcmd->st && mysql_stmt_free_result(mcmd->st)) { ERR("mysql: Error while freeing MySQL result: %d, %s/n", mysql_stmt_errno(mcmd->st), mysql_stmt_error(mcmd->st)); } db_drv_free(&payload->gen); pkg_free(payload);}
开发者ID:GreenfieldTech,项目名称:kamailio,代码行数:14,
示例20: bdb_cmdint bdb_cmd(db_cmd_t *cmd){ bdb_cmd_t *bcmd; db_con_t *con; bdb_con_t *bcon; bcmd = (bdb_cmd_t *)pkg_malloc(sizeof(bdb_cmd_t)); if(bcmd == NULL) { ERR("bdb: No memory left/n"); goto error; } memset(bcmd, '/0', sizeof(bdb_cmd_t)); if(db_drv_init(&bcmd->gen, bdb_cmd_free) < 0) goto error; con = cmd->ctx->con[db_payload_idx]; bcon = DB_GET_PAYLOAD(con); bcmd->bcon = bcon; switch(cmd->type) { case DB_PUT: case DB_DEL: case DB_UPD: ERR("bdb: The driver does not support DB modifications yet./n"); goto error; break; case DB_GET: if(bdb_prepare_query(cmd, bcmd) != 0) { ERR("bdb: error preparing query./n"); goto error; } break; case DB_SQL: ERR("bdb: The driver does not support raw queries yet./n"); goto error; } DB_SET_PAYLOAD(cmd, bcmd); return 0;error: if(bcmd) { DB_SET_PAYLOAD(cmd, NULL); db_drv_free(&bcmd->gen); pkg_free(bcmd); } return -1;}
开发者ID:adubovikov,项目名称:kamailio,代码行数:50,
示例21: set_field/** * Set MYSQL_BIND item. * @param bind destination * @param fld source */static void set_field(MYSQL_BIND *bind, db_fld_t* fld){ struct my_fld* f; f = DB_GET_PAYLOAD(fld); bind->is_null = &f->is_null; /* We can do it for all the types here, mysql will ignore it * for fixed-size types such as MYSQL_TYPE_LONG */ bind->length = &f->length; switch(fld->type) { case DB_INT: case DB_BITMAP: bind->buffer_type = MYSQL_TYPE_LONG; bind->buffer = &fld->v.int4; break; case DB_FLOAT: bind->buffer_type = MYSQL_TYPE_FLOAT; bind->buffer = &fld->v.flt; break; case DB_DOUBLE: bind->buffer_type = MYSQL_TYPE_DOUBLE; bind->buffer = &fld->v.dbl; break; case DB_DATETIME: bind->buffer_type = MYSQL_TYPE_DATETIME; bind->buffer = &f->time; break; case DB_STR: case DB_CSTR: bind->buffer_type = MYSQL_TYPE_VAR_STRING; bind->buffer = ""; /* Updated on runtime */ break; case DB_BLOB: bind->buffer_type = MYSQL_TYPE_BLOB; bind->buffer = ""; /* Updated on runtime */ break; case DB_NONE: /* Eliminates gcc warning */ break; }}
开发者ID:aphistic,项目名称:kamailio,代码行数:54,
示例22: my_cmd_nextint my_cmd_next(db_res_t* res){ int ret; struct my_cmd* mcmd; mcmd = DB_GET_PAYLOAD(res->cmd); if (mcmd->next_flag == 2 || mcmd->next_flag == -2) return 1; if (mcmd->st == NULL) { ERR("mysql: Prepared statement not found/n"); return -1; } ret = mysql_stmt_fetch(mcmd->st); if (ret == MYSQL_NO_DATA) { mcmd->next_flag = mcmd->next_flag<0?-2:2; return 1; } /* MYSQL_DATA_TRUNCATED is only defined in mysql >= 5.0 */#if defined MYSQL_DATA_TRUNCATED if (ret == MYSQL_DATA_TRUNCATED) { int i; ERR("mysql: mysql_stmt_fetch, data truncated, fields: %d/n", res->cmd->result_count); for (i = 0; i < res->cmd->result_count; i++) { if (mcmd->st->bind[i].error /*&& mcmd->st->bind[i].buffer_length*/) { ERR("mysql: truncation, bind %d, length: %lu, buffer_length: %lu/n", i, *(mcmd->st->bind[i].length), mcmd->st->bind[i].buffer_length); } } ret = 0; }#endif if (mcmd->next_flag <= 0) { mcmd->next_flag++; } if (ret != 0) { ERR("mysql: Error in mysql_stmt_fetch (ret=%d): %s/n", ret, mysql_stmt_error(mcmd->st)); return -1; } if (update_result(res->cmd->result, mcmd->st) < 0) { mysql_stmt_free_result(mcmd->st); return -1; } res->cur_rec->fld = res->cmd->result; return 0;}
开发者ID:aphistic,项目名称:kamailio,代码行数:49,
示例23: ld_con_disconnectvoid ld_con_disconnect(db_con_t* con){ struct ld_con* lcon; struct ld_uri* luri; int ret; lcon = DB_GET_PAYLOAD(con); luri = DB_GET_PAYLOAD(con->uri); if ((lcon->flags & LD_CONNECTED) == 0) return; DBG("ldap: Unbinding from %s/n", luri->uri); if (lcon->con) { ret = ldap_unbind_ext_s(lcon->con, NULL, NULL); if (ret) { ERR("ldap: Error while unbinding from %s: %s/n", luri->uri, ldap_err2string(ret)); } } lcon->con = NULL; lcon->flags &= ~LD_CONNECTED;}
开发者ID:2pac,项目名称:kamailio,代码行数:24,
示例24: ld_resolve_fldint ld_resolve_fld(db_fld_t* fld, struct ld_cfg* cfg){ int i; struct ld_fld* lfld; if (fld == NULL || cfg == NULL) return 0; for(i = 0; !DB_FLD_EMPTY(fld) && !DB_FLD_LAST(fld[i]); i++) { lfld = DB_GET_PAYLOAD(fld + i); lfld->attr.s = ld_find_attr_name(&lfld->syntax, cfg, fld[i].name); if (lfld->attr.s == NULL) lfld->attr.s = fld[i].name; if (lfld->attr.s) lfld->attr.len = strlen(lfld->attr.s); } return 0;}
开发者ID:adubovikov,项目名称:kamailio,代码行数:15,
示例25: my_con_disconnectvoid my_con_disconnect(db_con_t* con){ struct my_con* mcon; mcon = DB_GET_PAYLOAD(con); if ((mcon->flags & MY_CONNECTED) == 0) return; DBG("mysql: Disconnecting from %.*s:%.*s/n", con->uri->scheme.len, ZSW(con->uri->scheme.s), con->uri->body.len, ZSW(con->uri->body.s)); mysql_close(mcon->con); mcon->flags &= ~MY_CONNECTED;}
开发者ID:BackupTheBerlios,项目名称:ser,代码行数:15,
示例26: pg_getoptint pg_getopt(db_cmd_t* cmd, char* optname, va_list ap){ struct pg_cmd* pcmd; long long* id; pcmd = (struct pg_cmd*)DB_GET_PAYLOAD(cmd); if (!strcasecmp("last_id", optname)) { id = va_arg(ap, long long*); if (id == NULL) { BUG("postgres: NULL pointer passed to 'last_id' option/n"); goto error; } return -1; } else {
开发者ID:billyyh,项目名称:kamailio,代码行数:15,
示例27: bdb_res_freevoid bdb_res_free(db_res_t* res, bdb_res_t *payload){ bdb_cmd_t *bcmd; bcmd = DB_GET_PAYLOAD(res->cmd); /* free bdb result */ if(bcmd->dbcp!=NULL) { bcmd->dbcp->CLOSE_CURSOR(bcmd->dbcp); bcmd->dbcp = NULL; } db_drv_free(&payload->gen); pkg_free(payload);}
开发者ID:GreenfieldTech,项目名称:kamailio,代码行数:16,
示例28: pg_con_disconnectvoid pg_con_disconnect(db_con_t *con){ struct pg_con *pcon; pcon = DB_GET_PAYLOAD(con); if((pcon->flags & PG_CONNECTED) == 0) return; DBG("postgres: Disconnecting from %.*s:%.*s/n", con->uri->scheme.len, ZSW(con->uri->scheme.s), con->uri->body.len, ZSW(con->uri->body.s)); PQfinish(pcon->con); pcon->con = NULL; pcon->flags &= ~PG_CONNECTED; pcon->flags &= ~PG_INT8_TIMESTAMP;}
开发者ID:GreenfieldTech,项目名称:kamailio,代码行数:16,
示例29: ld_conint ld_con(db_con_t* con){ struct ld_con* lcon; struct ld_uri* luri; luri = DB_GET_PAYLOAD(con->uri); /* First try to lookup the connection in the connection pool and * re-use it if a match is found */ lcon = (struct ld_con*)db_pool_get(con->uri); if (lcon) { DBG("ldap: Connection to %s found in connection pool/n", luri->uri); goto found; } lcon = (struct ld_con*)pkg_malloc(sizeof(struct ld_con)); if (!lcon) { ERR("ldap: No memory left/n"); goto error; } memset(lcon, '/0', sizeof(struct ld_con)); if (db_pool_entry_init(&lcon->gen, ld_con_free, con->uri) < 0) goto error; DBG("ldap: Preparing new connection to %s/n", luri->uri); /* Put the newly created LDAP connection into the pool */ db_pool_put((struct db_pool_entry*)lcon); DBG("ldap: Connection stored in connection pool/n"); found: /* Attach driver payload to the db_con structure and set connect and * disconnect functions */ DB_SET_PAYLOAD(con, lcon); con->connect = ld_con_connect; con->disconnect = ld_con_disconnect; return 0; error: if (lcon) { db_pool_entry_free(&lcon->gen); pkg_free(lcon); } return -1;}
开发者ID:2pac,项目名称:kamailio,代码行数:47,
示例30: my_cmd_firstint my_cmd_first(db_res_t* res) { struct my_cmd* mcmd; mcmd = DB_GET_PAYLOAD(res->cmd); switch (mcmd->next_flag) { case -2: /* table is empty */ return 1; case 0: /* cursor position is 0 */ return 0; case 1: /* next row */ case 2: /* EOF */ ERR("mysql: Unbuffered queries do not support cursor reset./n"); return -1; default: return my_cmd_next(res); }}
开发者ID:aphistic,项目名称:kamailio,代码行数:17,
注:本文中的DB_GET_PAYLOAD函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ DB_t_tif_tradeserial_add函数代码示例 C++ DB_ERROR函数代码示例 |