Multiple Queries - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Multiple Queries (
/showthread.php?tid=170628)
Multiple Queries -
Dj_maryo1993 - 23.08.2010
pawn Код:
public LoadBuget()
{
new query[128];
new Data[1024];
new intBuf[64];
format(query, sizeof(query), "SELECT * FROM `Primaria` WHERE `Nume` = '%s' LIMIT 1", "Primaria");
samp_mysql_query(query);
samp_mysql_store_result();
samp_mysql_fetch_row(Data);
samp_mysql_get_field("Capital", intBuf);
Primaria[Capital] = strval(intBuf);
samp_mysql_get_field("BonusLupta", intBuf);
Primaria[BonusLupta] = strval(intBuf);
printf("Primaria : Capital = %d , BonusLupta = %d",Primaria[Capital],Primaria[BonusLupta]);
return 1;
}
public LoadBizz(bizid)
{
new query[128];
new Data[1024];
new intBuf[64];
format(query, sizeof(query), "SELECT * FROM `Bizzuri` WHERE `id` = '%d' LIMIT 1",bizid);
samp_mysql_query(query);
samp_mysql_store_result();
samp_mysql_fetch_row(Data);
samp_mysql_get_field("Owner", intBuf);
BizzInfo[bizid][Owner] = strval(intBuf);
samp_mysql_get_field("Price", intBuf);
BizzInfo[bizid][Price] = strval(intBuf);
samp_mysql_get_field("Cx", intBuf);
BizzInfo[bizid][Cx] = strval(intBuf);
samp_mysql_get_field("Cy", intBuf);
BizzInfo[bizid][Cy] = strval(intBuf);
samp_mysql_get_field("Cz", intBuf);
BizzInfo[bizid][Cz] = strval(intBuf);
samp_mysql_get_field("Cix", intBuf);
BizzInfo[bizid][Cix] = strval(intBuf);
samp_mysql_get_field("Ciy", intBuf);
BizzInfo[bizid][Ciy] = strval(intBuf);
samp_mysql_get_field("Ciz", intBuf);
BizzInfo[bizid][Ciz] = strval(intBuf);
samp_mysql_get_field("Intid", intBuf);
BizzInfo[bizid][Intid] = strval(intBuf);
samp_mysql_get_field("Fee", intBuf);
BizzInfo[bizid][Fee] = strval(intBuf);
samp_mysql_get_field("Status", intBuf);
BizzInfo[bizid][Status] = strval(intBuf);
printf(">><<<<");
printf("Owner : %s , Status : %d , Cx : %f ",BizzInfo[bizid][Owner],BizzInfo[bizid][Status],BizzInfo[bizid][Cx] );
samp_mysql_free_result();
return 1;
}
I call them like this ( and the loadstuff function is called with an timer)
pawn Код:
public LoadStuff()
{
LoadBuget();
LoadBizz(1);
return 1;
}
The server crashes and the log show something like this
Код:
[20:35:53] MYSQL: Attempting to connect to server...
[20:35:53]
Connection to MySQL database: Successfull !
[20:35:53] MYSQL: Database connection established.
[20:35:53] Number of vehicle models: 0
[20:35:59] Primaria : Capital = 300000000 , BonusLupta = 30
The other way
Код:
[20:34:27] MYSQL: Attempting to connect to server...
[20:34:27]
Connection to MySQL database: Successfull !
[20:34:27] MYSQL: Database connection established.
[20:34:27] Number of vehicle models: 0
[20:34:33] >><<<<
[20:34:33] Owner : , Status : 0 , Cx : 312.000000
Separately works ok
Re: Multiple Queries -
[HiC]TheKiller - 23.08.2010
Try freeing the result on LoadBuget.
Re: Multiple Queries -
Dj_maryo1993 - 23.08.2010
Same problem , server crashes
Re: Multiple Queries -
eXtr1kE - 23.08.2010
OFF : Wazzup maryo :>, here eXtrike, unignore eXtr1ke please
ON :
..
Re: Multiple Queries -
Dj_maryo1993 - 25.08.2010
12h +
BUMP
LE
The sql table
The bizz
And this is how they load
Код:
[20:43:06] Owner : alexo , Status : 0 , Cx : 310.000000
[20:43:06] Cy : 311.000000 , CZ : 312.000000 , INTID : 4
Re: Multiple Queries -
Dj_maryo1993 - 26.08.2010
Bump , there must be someone who loads stuff from mysql
Re: Multiple Queries -
Sergei - 26.08.2010
Use one of modern MySQL plugins, then we can talk further.
Re: Multiple Queries -
Dj_maryo1993 - 26.08.2010
I have problem loading that "modern" mysql plugins , im going to try and make an big function that loads all that stuff (houses , bizz , factions cars etc )