Raised This Month: $ Target: $400
 0% 

Bckup mysql data


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Killer zm
Senior Member
Join Date: Jun 2011
Old 02-11-2013 , 12:36   Bckup mysql data
Reply With Quote #1

I am using zp bank sql for saving amopacks on zombie mod and I am thinking if mysql go down in the midle of the game what can I do so player dont lose his data, because when the map will be changed and mysql is up again then will load the last data that was saved before mysql go down . what can i do for not losing data when mysql is down ...
Killer zm is offline
Torge
Veteran Member
Join Date: Oct 2011
Old 02-11-2013 , 13:13   Re: Bckup mysql data
Reply With Quote #2

If ammo packs will be saved whenever they earn +1 this couldn't happen (I guess)
Torge is offline
Killer zm
Senior Member
Join Date: Jun 2011
Old 02-11-2013 , 13:26   Re: Bckup mysql data
Reply With Quote #3

i dont understand what you say what i want is to get another way of saving ammo packs when mysql is down how i can detect when mysql go down ? i use this http://forums.alliedmods.net/showthread.php?t=121541

and i tried to save with nvault but how can i detect if mysql go down in the midle of the game ?

Last edited by Killer zm; 02-11-2013 at 13:26.
Killer zm is offline
Sylwester
Veteran Member
Join Date: Oct 2006
Location: Poland
Old 02-11-2013 , 14:47   Re: Bckup mysql data
Reply With Quote #4

There is a way but you need to edit code. When mysql goes down, then your queries will fail. You can then use SQL_GetQueryString to get original query string and store it in a file. Once the connection is reestablished you can execute all saved queries.
__________________
Impossible is Nothing
Sylwester is offline
Backstabnoob
Veteran Member
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 02-11-2013 , 15:52   Re: Bckup mysql data
Reply With Quote #5

Quote:
Originally Posted by Torge View Post
If ammo packs will be saved whenever they earn +1 this couldn't happen (I guess)
It can't, but it's a pretty bad idea.
__________________
Currently busy working on a very large scale anime database project.
Backstabnoob is offline
TheDS1337
Veteran Member
Join Date: Jun 2012
Old 02-11-2013 , 15:59   Re: Bckup mysql data
Reply With Quote #6

use plugin_end();
it's hook when map chaned
TheDS1337 is offline
Killer zm
Senior Member
Join Date: Jun 2011
Old 02-12-2013 , 09:31   Re: Bckup mysql data
Reply With Quote #7

in conclusion how i check if mysql goes down, i mean if map is changed then it showing that mysql is down but if is int middle of the game is not showing so i have to check this .. how ?
Killer zm is offline
Sylwester
Veteran Member
Join Date: Oct 2006
Location: Poland
Old 02-12-2013 , 10:07   Re: Bckup mysql data
Reply With Quote #8

Quote:
Originally Posted by Sylwester View Post
When mysql goes down, then your queries will fail.
PHP Code:
public ThreadQuery_handler(FailState,Handle:Query,Error[],Errcode,Data[],DataSize){
    if(
FailState){
        
log_amx("SQL Error: %s"Error)
        
//query failed - in most cases mysql is down, to be sure you can check Errcode
        
return
    }
    
//query did not fail ...

__________________
Impossible is Nothing
Sylwester is offline
Killer zm
Senior Member
Join Date: Jun 2011
Old 02-12-2013 , 10:42   Re: Bckup mysql data
Reply With Quote #9

this check will be made at start game like plugin_init ?

how do i check this with a task in the game

Last edited by Killer zm; 02-12-2013 at 10:43.
Killer zm is offline
Torge
Veteran Member
Join Date: Oct 2011
Old 02-12-2013 , 11:19   Re: Bckup mysql data
Reply With Quote #10

Can be checked with SQL_ThreadQuery();
Torge 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 21:31.


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