Raised This Month: $ Target: $400
 0% 

mysql & sqlite combined


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Jack86
Veteran Member
Join Date: Dec 2008
Location: Belgrade, Serbia
Old 07-20-2010 , 08:13   mysql & sqlite combined
Reply With Quote #1

I have a problem with two plugins, first one is cheaterSuspect and second one in simple sql ban logger. The ban logs into mysql db on website and cheatersuspects uses sqlite. Now when both module are loaded only one of these plugins works, didnt tested it thoroughly but it looks like it depends on module or plugin load order. Now the simplest solution is to setup cheatersuspect to uses external db and only mysql module but that for some unknown reason to me causes lag spikes on my server which are repeating every 20 sec, they stop when cheatersuspect is disabled. So what i would like is to somehow force ban logger to uses mysql module and cheatersuspect to uses sqlite module, how can i do this ?
__________________

Jack86 is offline
Jack86
Veteran Member
Join Date: Dec 2008
Location: Belgrade, Serbia
Old 07-21-2010 , 12:02   Re: mysql & sqlite combined
Reply With Quote #2

Can i do something with SQL_SetAffinity command, there arent many stuff about it, i found it mentioned only in 3 threads here, and should i use SQL_SetAffinity("mysql") or SQL_SetAffinity ("sqlx") for plugin that connects to external db ?
__________________

Jack86 is offline
Sylwester
Veteran Member
Join Date: Oct 2006
Location: Poland
Old 07-22-2010 , 04:03   Re: mysql & sqlite combined
Reply With Quote #3

I think it's SQL_SetAffinity("mysql") for mysql and SQL_SetAffinity("sqlite") for sqlite.
If you get lag spikes then maybe your plugin is not using threaded queries.
__________________
Impossible is Nothing
Sylwester is offline
Jack86
Veteran Member
Join Date: Dec 2008
Location: Belgrade, Serbia
Old 07-22-2010 , 04:25   Re: mysql & sqlite combined
Reply With Quote #4

Threaded queries ? cheatersuspect is written with dbi include , and i dont feel like rewriting it, and anyway lag ocurred all the time, not just at execution of commands. I did managed it to work, i found out that plugins use modules by their load order (plugin load order is irrelevant) so all plugins will use first module if not otherwise set by SetAffinity. I used SetAffinity in plugin_init, and i wondered can i use it multiple times through plugin to switch at which db query will be executed, something like

SQL_SetAffinity("mysql")
SQL_Execute(Query)
SQL_SetAffinity("sqlite")
__________________

Jack86 is offline
Sylwester
Veteran Member
Join Date: Oct 2006
Location: Poland
Old 07-22-2010 , 04:59   Re: mysql & sqlite combined
Reply With Quote #5

http://www.amxmodx.org/funcwiki.php?go=func&id=1113
Quote:
Originally Posted by Notes
Note, that using this while you have open handles to another database type will cause problems. I.e., you cannot open a handle, switch affinity, then close the handle with a different driver.
So, basically you can use it multiple times, but you can't execute query for mysql if you prepared it for sqlite. You should try to avoid using sqlite and mysql in the same plugin.
__________________
Impossible is Nothing
Sylwester is offline
Jack86
Veteran Member
Join Date: Dec 2008
Location: Belgrade, Serbia
Old 07-22-2010 , 06:36   Re: mysql & sqlite combined
Reply With Quote #6

Ok tnx, i'll use some workaround ,set cheatersuspect to log its bans to a file and then mysql ban logger to read that file and write to db.
__________________

Jack86 is offline
Reply


Thread Tools
Display Modes

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 07:08.


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