bool CACHE_SESSION::save() { bool ret = false; unsigned int binlen, sqllen; char *sqlbuff; char *binbuff; binlen = this->serialize_bin(NULL); // obtient la taille maximum n�cessaire if(binbuff = (char *)EMALLOC(binlen)) { binlen = this->serialize_bin((long *)binbuff); // obtient la taille r�elle et s�rialise sqllen = epublisher->escape_string(binbuff, binlen, NULL); // obtient la taille maximum n�cessaire if(sqlbuff = (char *)EMALLOC(sqllen)) { char *sql; int l; sqllen = epublisher->escape_string(binbuff, binlen, sqlbuff); // escape et obtient la taille r�elle l = sizeof("UPDATE cache SET session='' WHERE session_id=???????????") + sqllen; if(sql = (char *)EMALLOC(l)) { sprintf(sql, "UPDATE cache SET session='%s' WHERE session_id=%li", sqlbuff, this->session_id); if(epublisher->query(sql)) { if(epublisher->affected_rows() == 1) ret = true; } EFREE(sql); } EFREE(sqlbuff); } EFREE(binbuff); } return(ret); }
CACHE_COLL::~CACHE_COLL() { if(this->name) { EFREE(this->name); this->name = NULL; } #if GETPREFS if(this->prefs) { EFREE(this->prefs); this->prefs = NULL; } #endif return; }
bool CACHE_SESSION::save() { bool ret = false; MYSQL_STMT *stmt; MYSQL_BIND bind[2]; char *query = (char *)("UPDATE cache SET session=? WHERE session_id=?"); char *binbuff; unsigned long binlen; int session_id = this->session_id; MYSQL *mysql = (MYSQL *)epublisher->get_native_conn(); //zend_printf("LINE %i <br/>\n", __LINE__); if( (stmt = mysql_stmt_init(mysql)) ) { //zend_printf("LINE %i <br/>\n", __LINE__); if( (mysql_stmt_prepare(stmt, query, strlen(query))) == 0 ) { //zend_printf("LINE %i <br/>\n", __LINE__); binlen = this->get_binsize(); // obtient la taille maximum n�cessaire if(binbuff = (char *)EMALLOC(binlen)) { //zend_printf("LINE %i <br/>\n", __LINE__); binlen = this->serialize_bin((long *)binbuff); // s�rialise et obtient la taille r�elle //zend_printf("LINE %i binlen=%li <br/>\n", __LINE__, binlen); bind[0].buffer_type = MYSQL_TYPE_VAR_STRING; bind[0].buffer = binbuff; bind[0].buffer_length = binlen; bind[0].is_null= 0; bind[0].length= &binlen; bind[1].buffer_type= MYSQL_TYPE_LONG; bind[1].buffer= (char *)&session_id; bind[1].is_null= 0; bind[1].length= 0; if (mysql_stmt_bind_param(stmt, bind) == 0) { //zend_printf("LINE %i <br/>\n", __LINE__); if (mysql_stmt_execute(stmt) == 0) { //zend_printf("LINE %i <br/>\n", __LINE__); if(mysql_stmt_affected_rows(stmt) == 1) { //zend_printf("LINE %i <br/>\n", __LINE__); ret = true; } } } EFREE(binbuff); } } mysql_stmt_close(stmt); } return(ret); }
CACHE_COLL::~CACHE_COLL() { // zend_printf("DELETE COLL\n"); if(this->name) { // zend_printf("lib�ration de name=%s\n", this->name); EFREE(this->name); this->name = NULL; } #if GETPREFS if(this->prefs) { // zend_printf("lib�ration de name=%s\n", this->name); EFREE(this->prefs); this->prefs = NULL; } #endif return; }
SQLCONN::~SQLCONN() { // ftrace("%s [%d] %s(%s) \n", __FILE__, __LINE__, __FUNCTION__, this->dbname); // if(this->ukey) // EFREE(this->ukey); // if(this->connok) // mysql_close(&(this->mysql_conn)); this->close(); if(this->ukey) EFREE(this->ukey); }
CACHE_BASE::~CACHE_BASE() { // zend_printf("DELETE BASE\n"); CACHE_COLL *cc; if(this->viewname) EFREE(this->viewname); if(this->host) EFREE(this->host); if(this->dbname) EFREE(this->dbname); if(this->user) EFREE(this->user); if(this->passwd) EFREE(this->passwd); if(this->xmlstruct) EFREE(this->xmlstruct); if(this->conn) delete(this->conn); while(this->firstcoll) { cc = this->firstcoll->nextcoll; delete this->firstcoll; this->firstcoll = cc; } }
bool CACHE_SESSION::save() { bool ret = false; MYSQL_STMT *stmt; MYSQL_BIND bind[2]; char *query = (char *)("UPDATE cache SET session=? WHERE session_id=?"); char *binbuff; unsigned long binlen; int session_id = this->session_id; MYSQL *mysql = (MYSQL *)epublisher->get_native_conn(); if( (stmt = mysql_stmt_init(mysql)) ) { if( (mysql_stmt_prepare(stmt, query, strlen(query))) == 0 ) { binlen = this->get_binsize(); // get size needed if(binbuff = (char *)EMALLOC(binlen)) { memset(binbuff, 0, binlen); binlen = this->serialize_bin((long *)binbuff); // serialize and get the real size memset(bind, 0, sizeof(bind)); bind[0].buffer_type = MYSQL_TYPE_VAR_STRING; bind[0].buffer = binbuff; bind[0].buffer_length = binlen; bind[0].is_null= 0; bind[0].length= &binlen; bind[1].buffer_type= MYSQL_TYPE_LONG; bind[1].buffer= (char *)&session_id; bind[1].is_null= 0; bind[1].length= 0; if (mysql_stmt_bind_param(stmt, bind) == 0) { if (mysql_stmt_execute(stmt) == 0) { if(mysql_stmt_affected_rows(stmt) == 1) { ret = true; } } } EFREE(binbuff); } } mysql_stmt_close(stmt); } return(ret); }
void io_com_dump(MPI_Comm comm, const Coords *coords, const char *name, long id, int n, const int *ii, const float3 *rr) { char fname[FILENAME_MAX] = {0}, *data; long nchar = 0; EMALLOC(MAX_CHAR_PER_LINE * n, &data); if (m::is_master(comm)) UC(os_mkdir(BASE)); gen_fname(name, id, fname); UC(nchar = swrite(coords, n, ii, rr, /**/ data)); write_mpi(comm, fname, nchar, data); EFREE(data); }
SQLCONN::~SQLCONN() { // if(this->ukey) // EFREE(this->ukey); // if(this->connok) // mysql_close(&(this->mysql_conn)); this->close(); if(this->ukey) EFREE(this->ukey); // if(this->thesaurus_buffer) // EFREE(this->thesaurus_buffer); // if(this->stmt_th) // mysql_stmt_close(this->stmt_th); // if(this->XPathCtx_thesaurus) // xmlXPathFreeContext(this->XPathCtx_thesaurus); // if(this->DOMThesaurus) // xmlFreeDoc(this->DOMThesaurus); }
static void main0(const char *cell, Out *out) { int nv, nm; MeshVertArea *vert_area; Vectors *pos; double *vert_areas; UC(mesh_read_ini_off(cell, /**/ &out->mesh)); UC(mesh_vert_area_ini(out->mesh, &vert_area)); nv = mesh_read_get_nv(out->mesh); UC(vectors_float_ini(nv, mesh_read_get_vert(out->mesh), /**/ &pos)); nm = 1; EMALLOC(nv, &vert_areas); mesh_vert_area_apply(vert_area, nm, pos, /**/ vert_areas); dump(nv, nm, vert_areas, pos, out); mesh_vert_area_fin(vert_area); UC(vectors_fin(pos)); UC(mesh_read_fin(out->mesh)); EFREE(vert_areas); }
void rbc_params_fin(RbcParams *p) { EFREE(p); }