SA-MP Forums Archive
Mysql input too long.. - 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)
+--- Thread: Mysql input too long.. (/showthread.php?tid=559431)



Mysql input too long.. - Metharon - 23.01.2015

pawn Код:
format(szQuery, 500,"INSERT INTO `business` (ID, Ownable, Titlu, Detinator, Entrance, Interior, Type , Depozit, Price, PickupX, PickupY, PickupZ, EntranceX, EntranceY, EntranceZ, InteriorX, InteriorY, InteriorZ) VALUES ('%d','%d','%s','%s','%d','%d','%d','%d','%d','%f','%f','%f','%f','%f','%f','%f','%f','%f')", BID,Bizz[BID][BOwnable],Bizz[BID][Detinator],Bizz[BID][bEntrance],Bizz[BID][bInt],Bizz[BID][bType],Bizz[BID][BDeposit],Bizz[BID][BPret], Bizz[BID][PickupINT][0],Bizz[BID][PickupINT][1],Bizz[BID][PickupINT][2],Bizz[BID][Ext][0],Bizz[BID][Ext][1],Bizz[BID][Ext][2],Bizz[BID][Int][0],Bizz[BID][Int][1],Bizz[BID][Int][2]);
mysql_tquery(SQL, szQuery, "", "");
I tried strcat but still this error.. how can i make it work ?


AW: Mysql input too long.. - Saize - 23.01.2015

If this is the line where you want to create the biz simply set the defaults in your DB to 0 or w/e

I had the same problem and I fixxed it this way


Re: Mysql input too long.. - Kyance - 23.01.2015

Quote:
Originally Posted by Metharon
Посмотреть сообщение
pawn Код:
format(szQuery, 500,"INSERT INTO `business` (ID, Ownable, Titlu, Detinator, Entrance, Interior, Type , Depozit, Price, PickupX, PickupY, PickupZ, EntranceX, EntranceY, EntranceZ, InteriorX, InteriorY, InteriorZ) VALUES ('%d','%d','%s','%s','%d','%d','%d','%d','%d','%f','%f','%f','%f','%f','%f','%f','%f','%f')", BID,Bizz[BID][BOwnable],Bizz[BID][Detinator],Bizz[BID][bEntrance],Bizz[BID][bInt],Bizz[BID][bType],Bizz[BID][BDeposit],Bizz[BID][BPret], Bizz[BID][PickupINT][0],Bizz[BID][PickupINT][1],Bizz[BID][PickupINT][2],Bizz[BID][Ext][0],Bizz[BID][Ext][1],Bizz[BID][Ext][2],Bizz[BID][Int][0],Bizz[BID][Int][1],Bizz[BID][Int][2]);
mysql_tquery(SQL, szQuery, "", "");
I tried strcat but still this error.. how can i make it work ?
pawn Код:
format(szQuery, 500, "INSERT INTO `business` (ID, Ownable, Titlu, Detinator, Entrance, Interior, Type , Depozit, Price, PickupX, PickupY, PickupZ, EntranceX, EntranceY, EntranceZ, InteriorX, InteriorY, InteriorZ) VALUES ('%d','%d','%s','%s','%d','%d','%d','%d','%d','%f','%f','%f','%f','%f','%f','%f','%f','%f')",
    BID,Bizz[BID][BOwnable],Bizz[BID][Detinator],Bizz[BID][bEntrance],Bizz[BID][bInt],Bizz[BID][bType],Bizz[BID][BDeposit],Bizz[BID][BPret], Bizz[BID][PickupINT][0],Bizz[BID][PickupINT][1],Bizz[BID][PickupINT][2],Bizz[BID][Ext][0],Bizz[BID][Ext][1],Bizz[BID][Ext][2],Bizz[BID][Int][0],Bizz[BID][Int][1],Bizz[BID][Int][2]);
    mysql_tquery(SQL, szQuery, "", "");
Try this.
e: You can also remove the ' for vars(%d), and the ` for tables/w.e (business)


Re: Mysql input too long.. - Metharon - 23.01.2015

Quote:
Originally Posted by Kyance
Посмотреть сообщение
pawn Код:
format(szQuery, 500, "INSERT INTO `business` (ID, Ownable, Titlu, Detinator, Entrance, Interior, Type , Depozit, Price, PickupX, PickupY, PickupZ, EntranceX, EntranceY, EntranceZ, InteriorX, InteriorY, InteriorZ) VALUES ('%d','%d','%s','%s','%d','%d','%d','%d','%d','%f','%f','%f','%f','%f','%f','%f','%f','%f')",
    BID,Bizz[BID][BOwnable],Bizz[BID][Detinator],Bizz[BID][bEntrance],Bizz[BID][bInt],Bizz[BID][bType],Bizz[BID][BDeposit],Bizz[BID][BPret], Bizz[BID][PickupINT][0],Bizz[BID][PickupINT][1],Bizz[BID][PickupINT][2],Bizz[BID][Ext][0],Bizz[BID][Ext][1],Bizz[BID][Ext][2],Bizz[BID][Int][0],Bizz[BID][Int][1],Bizz[BID][Int][2]);
    mysql_tquery(SQL, szQuery, "", "");
Try this.
e: You can also remove the ' for vars(%d), and the ` for tables/w.e (business)

C:\Users\State\Documents\MEGA\Fraggs - Romania\gamemodes\gamemode.pwn(12381 -- 12382) : warning 213: tag mismatch
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase

Header size: 8892 bytes
Code size: 977040 bytes
Data size: 3428392 bytes
Stack/heap size: 28000 bytes; estimated max. usage: unknown, due to recursion
Total requirements: 4442324 bytes

1 Warning.


Re: Mysql input too long.. - Metharon - 23.01.2015

UP ... i need help .. i never tried to create a long query.


Re: Mysql input too long.. - Ironboy - 23.01.2015

pawn Код:
new string[350];
strcat(string, "(ID, Ownable, Titlu, Detinator, Entrance, Interior, Type , Depozit, Price, PickupX, PickupY, PickupZ, EntranceX, EntranceY, EntranceZ, InteriorX, InteriorY, InteriorZ)");
format(szQuery, 500,"INSERT INTO `business` %s VALUES ('%d','%d','%s','%s','%d','%d','%d','%d','%d','%f','%f','%f','%f','%f','%f','%f','%f','%f')",
string, BID,Bizz[BID][BOwnable],Bizz[BID][Detinator],Bizz[BID][bEntrance],Bizz[BID][bInt],Bizz[BID][bType],Bizz[BID][BDeposit],Bizz[BID][BPret], Bizz[BID][PickupINT][0],Bizz[BID][PickupINT][1],
Bizz[BID][PickupINT][2],Bizz[BID][Ext][0],Bizz[BID][Ext][1],Bizz[BID][Ext][2],Bizz[BID][Int][0],Bizz[BID][Int][1],Bizz[BID][Int][2]);

mysql_tquery(SQL, szQuery, "", "");



Re: Mysql input too long.. - Metharon - 23.01.2015

Done , i fixed it.


Re: Mysql input too long.. - Runn3R - 23.01.2015

pawn Код:
format(szQuery, 500,"INSERT INTO `business` (ID, Ownable, Titlu, Detinator, Entrance, Interior, Type , Depozit, Price, PickupX, PickupY, PickupZ, EntranceX, EntranceY, EntranceZ, InteriorX, InteriorY, InteriorZ) VALUES ('%d','%d','%s','%s','%d','%d','%d','%d','%d','%f','%f','%f','%f','%f','%f','%f','%f','%f')",
    BID,Bizz[BID][BOwnable],
    Bizz[BID][Detinator],
    Bizz[BID][bEntrance],
    Bizz[BID][bInt],
    Bizz[BID][bType],
    Bizz[BID][BDeposit],
    Bizz[BID][BPret],
    Bizz[BID][PickupINT][0],
    Bizz[BID][PickupINT][1],
    Bizz[BID][PickupINT][2],
    Bizz[BID][Ext][0],
    Bizz[BID][Ext][1],
    Bizz[BID][Ext][2],
    Bizz[BID][Int][0],
    Bizz[BID][Int][1],
    Bizz[BID][Int][2]);
mysql_tquery(SQL, szQuery, "", "");
Why you don't use mysql_format()
And yeah if you really have some big ass queryes you can split them up. Like half of the data in one query then TQUERY and the rest of after that TQUERY...