sanyisasha Posted October 25, 2015 Share Posted October 25, 2015 Hello. I want to create a function, what save all to my database. That's easy. But i want to use the "multi query". An example: "UPDATE table SET ... WHERE ...; UPDATE table SET ...2 WHERE ...2 [...] My problem: The MTA always say: Syntax error. Like if i use the old php mysql, with query | multi_query. So: It's posible to use mysql in multiquery? So sorry for worst english Link to comment
0 Jusonex Posted October 25, 2015 Share Posted October 25, 2015 No, it has been disabled due to security issues (more possibilities to do bad things using SQL injection). Link to comment
0 sanyisasha Posted October 25, 2015 Author Share Posted October 25, 2015 Eh But the simple query is too lagy with much data for i,v in ipairs(vehs) do dbExec(DB,"UPDATE vehs SET x='"..x.."',y='"..y.."',z='"..z.."',rotx='"..rotx.."',roty='"..roty.."',rotz='"..rotz.."' WHERE id='"..v["id"].."'") end End i want to use like: for i,v in ipairs(vehs) do sql = sql.."UPDATE vehs SET x='"..x.."',y='"..y.."',z='"..z.."',rotx='"..rotx.."',roty='"..roty.."',rotz='"..rotz.."' WHERE id='"..v["id"]..'";" end dbExec(sql) Link to comment
0 myonlake Posted January 27, 2016 Share Posted January 27, 2016 There is no performance drop with that, only a few more calls, that's all. Link to comment
0 Tomas Posted January 28, 2016 Share Posted January 28, 2016 It may help, do not use it when you're saving something that comes from an input or whatever a player can edit _dbExec = dbExec function dbExec(db, query) local query = split(query, ";") or query if ( type(query) == "table" ) then for _, q in ipairs(query) do _dbExec(db, q) end else _dbExec(db, query) end end Link to comment
Question
sanyisasha
Hello. I want to create a function, what save all to my database.
That's easy. But i want to use the "multi query".
An example:
"UPDATE table SET ... WHERE ...; UPDATE table SET ...2 WHERE ...2 [...]
My problem: The MTA always say: Syntax error. Like if i use the old php mysql, with query | multi_query.
So: It's posible to use mysql in multiquery?
So sorry for worst english
Link to comment
3 answers to this question
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now