client/proc
create_query(mob/mob)
var/qr="INSERT INTO `[sql_table]` ("
for(var/x=1 to mob.vars.len)
if(isclient(mob.vars[mob.vars[x]]))continue
if(ignored_vars.Find(mob.vars[x]))continue
if(x==mob.vars.len)
qr += "`[mob.vars[x]]`"
else //making the initial part of the query
qr += "`[mob.vars[x]]`"
qr += ","
qr += ") VALUES ("
var/list/VARIABLES=mob.vars
//giant mess of stuff below
for(var/x=1 to VARIABLES.len)
world.log << "[VARIABLES[x]] ([isnull(VARIABLES[VARIABLES[x]]) ? "null" : "[VARIABLES[VARIABLES[x]]]"]) = [x]/[VARIABLES.len]"
if(x==(VARIABLES.len))
if(isclient(VARIABLES[VARIABLES[x]]))continue
if(ignored_vars.Find(VARIABLES[x]))continue
if( islist(VARIABLES[VARIABLES[x]]))
qr += "'[implodetext(VARIABLES[VARIABLES[x]],"|")]'"
continue
if( istext(VARIABLES[VARIABLES[x]]) || isdatum(VARIABLES[VARIABLES[x]]) || ispath(VARIABLES[VARIABLES[x]]))
qr += "\"[VARIABLES[VARIABLES[x]]]\""
continue
if( isnum(VARIABLES[VARIABLES[x]]) )
qr += "[VARIABLES[VARIABLES[x]]]"
continue
if( isnull(VARIABLES[VARIABLES[x]]))
qr += "null"
continue
else qr += "'BROKEN'"
else
if(isclient(VARIABLES[VARIABLES[x]]))continue
if(ignored_vars.Find(VARIABLES[x]))continue
if( istext(VARIABLES[VARIABLES[x]]) || isdatum(VARIABLES[VARIABLES[x]]) || ispath(VARIABLES[VARIABLES[x]]))
qr += "'[VARIABLES[VARIABLES[x]]]',"
continue
if( isnum(VARIABLES[VARIABLES[x]]) )
qr += "[VARIABLES[VARIABLES[x]]],"
continue
if( islist(VARIABLES[VARIABLES[x]]))
qr += "'[implodetext(VARIABLES[VARIABLES[x]],"|")]',"
continue
if( isnull(VARIABLES[VARIABLES[x]]))
qr += "null"
qr += ","
continue
else
qr += "'BROKEN',"
qr += ");"
world.log << qr
return qr
Problem description:
Help?