static int get_field_idx(MYSQL_RES *self, const SQChar *name){ MYSQL_FIELD *fields = dlmysql_fetch_fields(self); unsigned int count = dlmysql_num_fields(self); for(unsigned int i=0; i<count; ++i){ if(scstrcmp(name, fields[i].name) == 0){ return i; } } return -1; }
void SQDbgServer::EndElement(const SQChar *name) { XMLElementState *self = &xmlstate[_xmlcurrentement]; assert(scstrcmp(self->name,name) == 0); if(self->haschildren) { _scratchstring.resize(4+scstrlen(name)); scsprintf(&_scratchstring[0],_SC("</%s>"),name); SendChunk(&_scratchstring[0]); } else { SendChunk(_SC("/>")); } _xmlcurrentement--; }
int Xml_registerCode(HSQUIRRELVM v) { SQ_FUNC_VARS_NO_TOP(v); SQ_GET_STRING(v, 2, decoded); SQ_GET_STRING(v, 3, encoded); size_t i; for(i=0; i<sv_code_size; i+=2) if(scstrcmp(sv_code[i],decoded)==0) return sq_throwerror(v,_SC"SQXml ERROR: code already exists.")); if(sv_code_size+2>sv_code_capacity) { size_t old_capacity = sv_code_capacity; sv_code_capacity*=2; sv_code = (SQChar**)sq_realloc(sv_code, old_capacity*sizeof(SQChar*), sv_code_capacity*sizeof(SQChar*)); } sv_code[sv_code_size]=(SQChar*)sq_malloc((scstrlen(decoded)+1)*sizeof(SQChar*)); strcpy(sv_code[sv_code_size++], decoded); sv_code[sv_code_size]=(SQChar*)sq_malloc((scstrlen(decoded)+1)*sizeof(SQChar*)); strcpy(sv_code[sv_code_size++],encoded); return 0; }