15.10.2010, 16:25
I haven't checked the top part, but the second part was just overkill. You're executing a query for every stat item you're saving, there's no need. If you created one large query, that would be the most efficient way to go. Use format and create a large string and bunch your queries in to one large query (or maybe 2), like so:
The reason for using multiple format()'s is because of the compiler input substitution feature which only reads so far through a line, you can use alternatives, but this is probably the easiest way.
Then get out.
pawn Код:
new largeQuery[255]; // This is an extreme size for a string. Queries are usually large, so we need to create a large string. I have a query in a gamemode that I'm scripting that is around 1024 characters, so don't be afraid to increase the string size.
format(largeQuery, sizeof(largeQuery), "UPDATE something SET item1 = 'ya', item2 = 'ya', item3 = 'ya', item4 = 'ya'");
format(largeQuery, sizeof(largeQuery), "%s, item5 = 'ya' WHERE condition = '1'", largeQuery);
Then get out.


i cant understand anything