This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

Question on SQL_ThreadQuery


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Cv3
Junior Member
Join Date: Sep 2014
Old 12-11-2014 , 17:31   Question on SQL_ThreadQuery
Reply With Quote #1

I am roaming around couple of plugins using mysql just to figure out how to fix and optimize mine. What I saw is questionable on logical and useful point of view..

When I use SQL_ThreadQuery I'd prefer to keep it optimized and clean, but I do not insist on 'clean'.

What I noticed is that some authors use couple of queries (SQL_ThreadQuery) to get info from 2 tables for example. Like this one ..

PHP Code:
        formatex(g_Cachecharsmax(g_Cache), "UPDATE bf2ranks SET badge1=%i, badge2=%i, badge3=%i, badge4=%i, badge5=%i, badge6=%i, knife=%i, pistol=%i, sniper=%i, support=%i, kills=%i, defuses=%i, plants=%i, explosions=%i WHERE playerid=^"%s^"",
        
g_PlayerBadges[id][BADGE_KNIFE], g_PlayerBadges[id][BADGE_PISTOL], g_PlayerBadges[id][BADGE_ASSAULT], g_PlayerBadges[id][BADGE_SNIPER], g_PlayerBadges[id][BADGE_SUPPORT], g_PlayerBadges[id][BADGE_EXPLOSIVES], knifekills[id], pistolkills[id], sniperkills[id], parakills[id], totalkills[id], defuses[id], plants[id], explosions[id], tempSaveKey);
        
SQL_ThreadQuery(g_SqlTuple"QueryHandle"g_Cache);

        
formatex(g_Cachecharsmax(g_Cache), "UPDATE bf2ranks2 SET badge7=%i, badge8=%i, shotgun=%i, smg=%i, rifle=%i, grenade=%i, gold=%i, silver=%i, bronze=%i WHERE playerid=^"%s^""g_PlayerBadges[id][BADGE_SHOTGUN], g_PlayerBadges[id][BADGE_SMG], shotgunkills[id], smgkills[id], riflekills[id], grenadekills[id], gold[id], silver[id], bronze[id], tempSaveKey);
        
SQL_ThreadQuery(g_SqlTuple"QueryHandle"g_Cache); 
My questions is: Is this the right way to do it or you can just combine both SQL_ThreadQuery and run the 2 queries divided by ';' like

PHP Code:
formatex(g_Cachecharsmax(g_Cache), "UPDATE bf2ranks SET badge1 ... ; UPDATE bf2ranks SET badge1 ..); 
And by 'right way' I mean the faster one..
Cv3 is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 12-11-2014 , 17:34   Re: Question on SQL_ThreadQuery
Reply With Quote #2

I do not believe SQLx supports multiple queries within a single call. Have you tried it yet?
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
Cv3
Junior Member
Join Date: Sep 2014
Old 12-11-2014 , 17:44   Re: Question on SQL_ThreadQuery
Reply With Quote #3

Not yet, there is a lot to rewrite to make it single call that's why I wanted to ask if it's worth the try.
But I found a plugin doing it. Running it through my mind it seems logical to make multiple queries with one call.
Cv3 is offline
Lycode
Junior Member
Join Date: Aug 2014
Old 12-12-2014 , 11:40   Re: Question on SQL_ThreadQuery
Reply With Quote #4

Quote:
Originally Posted by Cv3 View Post
Not yet, there is a lot to rewrite to make it single call that's why I wanted to ask if it's worth the try.
But I found a plugin doing it. Running it through my mind it seems logical to make multiple queries with one call.
I tried making multiple queries with one call and it worked. Not through a plugin, but it shouldn't make a difference.

Also, can you post useful information you came across? As far as optimization goes?
__________________
-This too shall pass
Lycode is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 12:46.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode