[Plugin] [REL] MySQL Plugin (Now on github!)

So mysql_retrive_row does not fetch data to pawn. So it's a little useless, no?
Reply

It's not, it fetches the next row internally allowing you to use mysql_fetch_field.
Reply

It's basically mysql_next_row, so it moves you to the next row. That way you can use mysql_fetch_field_row (mysql_get_field) without extracting result in pawn using mysql_fetch_row_format when you don't need it.
Reply

Okay. That makes a lot of sense, actually. This plugin rrrrreally needs a documentation...maybe I'll write one.
Reply

How make read and right users info from mysql?
Reply

Learn SQL language.
Reply

Hello,
I have a question if the R4 version is available for Debian.
And I wonder if I could use the R4 a_mysql older plugin R2
Alternatively, if so I would ask to revive the link.

Resolving the problem and then sends the command to print individual row in their own changes

Код:
new field[256],str[256]
mysql_fetch_field_row(field, "NICK");
format(str,256,"Test %s, %d",field,field);
SendClientMessage(playerid,GREY,str);
This example does not work and can not use mysql_retrieve_row () any suggestions?
Thank you very much in advance and sorry for my English but (****** Translate)

Mororo
Reply

Did you save result? Did you fetched the row?

Код:
format(str,256,"Test %s, %d",field,field);
Both are strings, so %s.
Reply

I do not understand what you mean my entire code: Thank you for your advice

Код:
dcmd_loadcar(playerid, params[]){
  #pragma unused params
	if(mysql_stav()){
		new query[256];
		format(query,sizeof(query),"SELECT * FROM `savecar` WHERE NICK='%s' LIMIT 1",Jmeno(playerid));
    mysql_reconnect();
    mysql_query(query);
    mysql_store_result();
		if(mysql_ping()>0){
//----------------------------------------------------------------------------------------
			new field[256],str[256]
			mysql_fetch_field_row(field, "Nick");
                        ... 17 row
			format(str,256,"Test %s, %d",field,field); // %d I just gave the test because of desperation to find out why it does not
//----------------------------------------------------------------------------------------
		}else{
      mysql_free_result();
    	SendClientMessage(playerid,RED,"Chyba : Nemбte v DB auto");
		}
	}else{
    SendClientMessage(playerid,RED,"Chyba : Server neni spuљtěn");
	}
	return 1;
}
Reply

Instead of
Код:
if(mysql_ping()>0)
use
Код:
if(mysql_retrieve_row())
And mysql_free_result() isn0t optional, so post it out of ifs
Reply

Your Problem is in your mysql table. Check your db.
Reply

I'm having a problem with gmx, with a fresh gamemode I'm working on.

I'm just connecting to the database on gamemodeinit and closing it on gamemodeexit. No querys executed at all.

And when I gmx, sometimes the server closes and sometimes it doesn't.

Here's the mysql_log:
Код:
[14:53:04] ---------------------------
[14:53:04] MySQL Debugging activated (09/19/10)
[14:53:04] ---------------------------
[14:53:04]  
[14:53:04] >> mysql_connect( )
[14:53:04] CMySQLHandler::CMySQLHandler() - constructor called.
[14:53:04] CMySQLHandler::CMySQLHandler() - Connecting to "localhost" | DB: "x" | Username: "root" ...
[14:53:04] CMySQLHandler::Connect() - Connection was successful.
[14:53:04] CMySQLHandler::Connect() - Auto-Reconnect has been enabled.
[14:54:47] >> mysql_ping( Connection handle: 1 )
[14:54:47] CMySQLHandler::Ping() - Connection is still alive.
[15:19:30] >> mysql_ping( Connection handle: 1 )
[15:19:30] CMySQLHandler::Ping() - Connection is still alive.
[15:19:30] >> mysql_close( Connection handle: 1 )
[15:19:30] CMySQLHandler::~CMySQLHandler() - deconstructor called.
- CRASH
[15:21:43]  
[15:21:43] ---------------------------
[15:21:43] MySQL Debugging activated (09/19/10)
15:21:43] ---------------------------
[15:21:43]  
[15:21:43] >> mysql_connect( )
[15:21:43] CMySQLHandler::CMySQLHandler() - constructor called.
[15:21:43] CMySQLHandler::CMySQLHandler() - Connecting to "localhost" | DB: "x" | Username: "root" ...
[15:21:43] CMySQLHandler::Connect() - Connection was successful.
[15:21:43] CMySQLHandler::Connect() - Auto-Reconnect has been enabled.
[15:23:41] >> mysql_ping( Connection handle: 1 )
[15:23:41] CMySQLHandler::Ping() - Connection is still alive.
[15:27:56] >> mysql_ping( Connection handle: 1 )
[15:27:56] CMySQLHandler::Ping() - Connection is still alive.
[15:27:56] >> mysql_close( Connection handle: 1 )
[15:27:56] CMySQLHandler::~CMySQLHandler() - deconstructor called.
[15:27:56] CMySQLHandler::FreeResult() - The result is already empty.
[15:27:56] CMySQLHandler::Disconnect() - Connection was closed.
- DIDN'T CRASH
[15:28:08]  
[15:28:08] ---------------------------
[15:28:08] MySQL Debugging activated (09/19/10)
[15:28:08] ---------------------------
[15:28:08]  
[15:28:08] >> mysql_connect( )
[15:28:08] CMySQLHandler::CMySQLHandler() - constructor called.
[15:28:08] CMySQLHandler::CMySQLHandler() - Connecting to "localhost" | DB: "x" | Username: "root" ...
15:28:08] CMySQLHandler::Connect() - Connection was successful.
[15:28:08] CMySQLHandler::Connect() - Auto-Reconnect has been enabled.
[15:29:53] >> mysql_ping( Connection handle: 1 )
[15:29:53] CMySQLHandler::Ping() - Connection is still alive.
[15:29:53] >> mysql_close( Connection handle: 1 )
[15:29:53] CMySQLHandler::~CMySQLHandler() - deconstructor called.
- CRASH

pawn Код:
public OnGameModeExit()
{
    print("* Exiting gamemode...");
   
    if(mysql_ping())
        mysql_close();
    return 1;
}
I changed today to version R5. Didn't experience any problems with the earlier versions.
Reply

It's been "fixed". The server just crashes if the gamemode doesn't execute any querys. Since I wasn't executing any at the time, it was crashing.

Anyway, what exactly is this threaded callback business? Is it something like Hyper-Threading?
Reply

Sometimes query's didn't executed.. In log:
Код:
[01:06:05] CMySQLHandler::Query(UPDATE `players` SET Sex=1,Age=21,Origin=0,DepositDay=0,Level=1,AdminLevel=0,Account=0,Muted=0,Warns=0,ConnectTime=1,Respect=1,Paycheck=281,PayDay=1,Deposit=0,Cash=5000,Bank=2117,SHealth=0.0,Health=76.0,Interior=3,Pos_x=-2025.3,Pos_y=-114.6,Pos_z=1035.1,Virtual=3,Local=255,House=255,Bizz=255,Job=0,Team=3,Member=0,Leader=0,FMember=7,Rank=6,FSkin=0,Model=133,ContractTime=0,DetSkill=0,LawSkill=0,RoadSkill=0,DrugsSkill=0,JackSkill=0,ProfSkill=0,MechSkill=0,GuardSkill=0,GunSkill=0,CarSkill=0,InkasSkill=0,BookmakerSkill=0,TaxiSkill=0,BusSkill=0,CourierSkill=0,TruckSkill=0,FishSkill=0,CookSkill=0,CarLic=11,BikeLic=0,FlyLic=0,BoatLic=0,FishLic=0,GunLic=0,Gun1=0,Ammo1=0,Gun2=0,Ammo2=0,Gun3=0,Ammo3=0,Gun4=0,Ammo4=0,Gun22Skill=0,Gun23Skill=0,Gun24Skill=0,Gun25Skill=0,Gun26Skill=0,Gun27Skill=0,Gun28Skill=0,Gun29Skill=0,Gun30Skill=0,Gun31Skill=0,Gun34Skill=0,HeadValue=0,Wins=0,Loses=0,Kills=0,Deaths=0,Crimes=0,Arrested=0,WantedDeaths=0,Article=0,Part=0,Jailed=0,JailTime=0,JailPrice=0,UpgradePoints=0,AlcoholPerk=0,DrugPerk=0,MiserPerk=0,PainPerk=0,TraderPerk=0,STD=0,Antiradar=0,GPS=0,CDPlayer=0,Dice=0,Drugs=0,Cigars=0,Fishes=0,BiggestFish=0,Fuel=0,LottoNr=0,Materials=0,PhoneNr=0,Phonebook=0,Married=0,MarriedTo='BeSingle',Offline=271,CarTime=0,Tutorial=0,PurposeMurder=0,Referal=0 WHERE Name='Michail_Suvorov') - Successfully executed.
But in table:

Uploaded with ImageShack.us
It's happened with 20 percent of the players.
Reply

Use this ` ! Without ` doesn't work.

Example:

UPDATE `players` SET `money` = '50000', `bank` = '150' WHERE `reg_id` = '1'
Reply

Код:
BikeLic=0,FlyLic=0,BoatLic=0,FishLic=0,GunLic=0,Gun1=0,Ammo1=0,Gun2=0,Ammo2=0,Gun3=0,Ammo3=0,Gun4=0,Ammo4=0,Gun22Skill=0,Gun23Skill=0,Gun24Skill=0,Gun25Skill=0,Gun26Skill=0
It will be defiantly 0, so it did execute
Reply

Quote:
Originally Posted by kurta999
Посмотреть сообщение
Use this ` ! Without ` doesn't work.

Example:

UPDATE `players` SET `money` = '50000', `bank` = '150' WHERE `reg_id` = '1'
You fail. Please learn about MySQL syntax.
Reply

Quote:
Originally Posted by Sergei
Посмотреть сообщение
You fail. Please learn about MySQL syntax.
If you know better then just correct him. Your post was as useful as his.
Reply

Quote:
Originally Posted by toneysix
Посмотреть сообщение
Sometimes query's didn't executed.. In log:
Код:
[01:06:05] CMySQLHandler::Query(UPDATE `players` SET Sex=1,Age=21,Origin=0,DepositDay=0,Level=1,AdminLevel=0,Account=0,Muted=0,Warns=0,ConnectTime=1,Respect=1,Paycheck=281,PayDay=1,Deposit=0,Cash=5000,Bank=2117,SHealth=0.0,Health=76.0,Interior=3,Pos_x=-2025.3,Pos_y=-114.6,Pos_z=1035.1,Virtual=3,Local=255,House=255,Bizz=255,Job=0,Team=3,Member=0,Leader=0,FMember=7,Rank=6,FSkin=0,Model=133,ContractTime=0,DetSkill=0,LawSkill=0,RoadSkill=0,DrugsSkill=0,JackSkill=0,ProfSkill=0,MechSkill=0,GuardSkill=0,GunSkill=0,CarSkill=0,InkasSkill=0,BookmakerSkill=0,TaxiSkill=0,BusSkill=0,CourierSkill=0,TruckSkill=0,FishSkill=0,CookSkill=0,CarLic=11,BikeLic=0,FlyLic=0,BoatLic=0,FishLic=0,GunLic=0,Gun1=0,Ammo1=0,Gun2=0,Ammo2=0,Gun3=0,Ammo3=0,Gun4=0,Ammo4=0,Gun22Skill=0,Gun23Skill=0,Gun24Skill=0,Gun25Skill=0,Gun26Skill=0,Gun27Skill=0,Gun28Skill=0,Gun29Skill=0,Gun30Skill=0,Gun31Skill=0,Gun34Skill=0,HeadValue=0,Wins=0,Loses=0,Kills=0,Deaths=0,Crimes=0,Arrested=0,WantedDeaths=0,Article=0,Part=0,Jailed=0,JailTime=0,JailPrice=0,UpgradePoints=0,AlcoholPerk=0,DrugPerk=0,MiserPerk=0,PainPerk=0,TraderPerk=0,STD=0,Antiradar=0,GPS=0,CDPlayer=0,Dice=0,Drugs=0,Cigars=0,Fishes=0,BiggestFish=0,Fuel=0,LottoNr=0,Materials=0,PhoneNr=0,Phonebook=0,Married=0,MarriedTo='BeSingle',Offline=271,CarTime=0,Tutorial=0,PurposeMurder=0,Referal=0 WHERE Name='Michail_Suvorov') - Successfully executed.
But in table:

Uploaded with ImageShack.us
It's happened with 20 percent of the players.
Maybe your query is too long?

Did you try executing that query before you applied it to your gamemode?
Reply

good Job
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)