[Mysql]Too Long Query (Idea Please)
#1

My Query Code:
Код:
            format(Query, sizeof(Query), "INSERT INTO `members` (`id`, `playername`, `password`, `email`, `adminlevel`, `viplevel`, `viptime`, `score`, `onlinetime`, `faction`, `staticfaction`, `lastloginevent`, `lastlogineventtime`, `lastwinevent`, `lastwineventtime`, `totaleventcount`,`jailtime`, `deathcount`, `killcount`, `moneycount`, `bankmoneycount`, `nicknamecolor`,`weapon1`, `weapon2`, `weapon3`, `weapon4`, `ammo1`, `ammo2`, `ammo3`, `ammo4`, `skin`, `ingame`, `ip`, `spawnposx`, `spawnposy`, `spawnposz`, `crashx`, `crashy`, `crashz`, `fightstyle`, `homeno`, `stuntpoint`, `eventpoint`,`security`, `old1`, `old2`, `old3`, `old4`, `warningpoint`, `inevent`, `coupon1`, `coupon2`) VALUES (mysql_insert_id()NULL, '%s', '%s', 'yourmail@hotmail.com','0', '0', '0', '0', '1', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '5000', '5000', '0xFFFFFFFF', '0', '0', '0', '0', '0', '0', '0', '0', '0', '1', '%s', '2034.1202', '1007.9800', '10.8203', '2034.1202', '1007.9800', '10.8203','FIGHT_STYLE_NORMAL', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0')", escpname, escpass, PIP);
Because Of:
Код:
"error 075: input line too long (after substitutions)"
I tried a few methods, but it did not work.Thank you in advance..
Reply
#2

Split the query into multiple queries.
Reply
#3

Quote:
Originally Posted by xxmitsu
Посмотреть сообщение
Split the query into multiple queries.
What he said.

I'm looking at your code and i assume you want to do this when the player is registering?
Then why are you inserting so many variables? you only update like 3.
Reply
#4

Damn girl. Split it up into several queries.

Edit: Too slow.

But if this is when you register, try setting standars in MySQL.
Reply
#5

You Say: ??
Код:
           format(Query, sizeof(Query), "INSERT INTO `members` (`id`, `playername`, `password`, `email`, `adminlevel`, `viplevel`, `viptime`, `score`, `onlinetime`, `faction`, `staticfaction`, `lastloginevent`, `lastlogineventtime`, `lastwinevent`, `lastwineventtime`, `totaleventcount`)", escpname, escpass, PIP),
			format(Query, sizeof(Query), "`jailtime`, `deathcount`, `killcount`, `moneycount`, `bankmoneycount`, `nicknamecolor`,`weapon1`, `weapon2`, `weapon3`, `weapon4`, `ammo1`, `ammo2`, `ammo3`, `ammo4`, `skin`, `ingame`, `ip`, `spawnposx`, `spawnposy`, `spawnposz`, `crashx`, `crashy`, `crashz`, `fightstyle`, `homeno`, `stuntpoint`, `eventpoint`)", escpname, escpass, PIP),
		 	format(Query, sizeof(Query), "`security`, `old1`, `old2`, `old3`, `old4`, `warningpoint`, `inevent`, `coupon1`, `coupon2`) VALUES (mysql_insert_id()NULL, '%s', '%s', 'yourmail@hotmail.com')", escpname, escpass, PIP),
 			format(Query, sizeof(Query), "'0', '0', '0', '0', '1', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '5000', '5000', '0xFFFFFFFF', '0', '0', '0', '0', '0', '0', '0', '0', '0', '1', '%s', '2034.1202', '1007.9800', '10.8203', '2034.1202', '1007.9800', '10.8203')", escpname, escpass, PIP);
			format(Query, sizeof(Query), "'FIGHT_STYLE_NORMAL', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0')", escpname, escpass, PIP);
Reply
#6

Instead of saving all this data to MySQL, you can set a cell standar.

This is my register query:
pawn Код:
format(query, sizeof(query), "INSERT INTO `players` (name, password, ip) VALUES ('%s', md5('%s'), '%s')", name, pw, ip);
Reply
#7

Quote:
Originally Posted by DVDK
Посмотреть сообщение
What he said.

I'm looking at your code and i assume you want to do this when the player is registering?
Then why are you inserting so many variables? you only update like 3.
Advanced Register System :P
Reply
#8

For example, I've made a query from the first 24 columns and the second query from the other ones.


Part 1:
Код:
format(Query, sizeof(Query), "INSERT INTO `members` (`id`, `playername`, `password`, `email`, `adminlevel`, `viplevel`, `viptime`, `score`, `onlinetime`, `faction`, `staticfaction`, `lastloginevent`, `lastlogineventtime`, `lastwinevent`, `lastwineventtime`, `totaleventcount`,`jailtime`, `deathcount`, `killcount`, `moneycount`, `bankmoneycount`, `nicknamecolor`,`weapon1`, `weapon2`) VALUES (mysql_insert_id()NULL, '%s', '%s', 'yourmail@hotmail.com','0', '0', '0', '0', '1', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '5000', '5000', '0xFFFFFFFF', '0', '0');
Part 2:
Код:
format(Query, sizeof(Query), "INSERT INTO `members` (`weapon3`, `weapon4`, `ammo1`, `ammo2`, `ammo3`, `ammo4`, `skin`, `ingame`, `ip`, `spawnposx`, `spawnposy`, `spawnposz`, `crashx`, `crashy`, `crashz`, `fightstyle`, `homeno`, `stuntpoint`, `eventpoint`,`security`, `old1`, `old2`, `old3`, `old4`, `warningpoint`, `inevent`, `coupon1`, `coupon2`) VALUES ('0', '0', '0', '0', '0', '0', '0', '1', '%s', '2034.1202', '1007.9800', '10.8203', '2034.1202', '1007.9800', '10.8203','FIGHT_STYLE_NORMAL', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0')", escpname, escpass, PIP);
PS: perhaps I haven't counted the number of columns right but you got the point..
Reply
#9

Quote:
Originally Posted by xxmitsu
Посмотреть сообщение
For example, I've made a query from the first 24 columns and the second query from the other ones.


Part 1:
Код:
format(Query, sizeof(Query), "INSERT INTO `members` (`id`, `playername`, `password`, `email`, `adminlevel`, `viplevel`, `viptime`, `score`, `onlinetime`, `faction`, `staticfaction`, `lastloginevent`, `lastlogineventtime`, `lastwinevent`, `lastwineventtime`, `totaleventcount`,`jailtime`, `deathcount`, `killcount`, `moneycount`, `bankmoneycount`, `nicknamecolor`,`weapon1`, `weapon2`) VALUES (mysql_insert_id()NULL, '%s', '%s', 'yourmail@hotmail.com','0', '0', '0', '0', '1', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '5000', '5000', '0xFFFFFFFF', '0', '0');
Part 2:
Код:
format(Query, sizeof(Query), "INSERT INTO `members` (`weapon3`, `weapon4`, `ammo1`, `ammo2`, `ammo3`, `ammo4`, `skin`, `ingame`, `ip`, `spawnposx`, `spawnposy`, `spawnposz`, `crashx`, `crashy`, `crashz`, `fightstyle`, `homeno`, `stuntpoint`, `eventpoint`,`security`, `old1`, `old2`, `old3`, `old4`, `warningpoint`, `inevent`, `coupon1`, `coupon2`) VALUES ('0', '0', '0', '0', '0', '0', '0', '1', '%s', '2034.1202', '1007.9800', '10.8203', '2034.1202', '1007.9800', '10.8203','FIGHT_STYLE_NORMAL', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0')", escpname, escpass, PIP);
PS: perhaps I haven't counted the number of columns right but you got the point..
I try..


Quote:
Originally Posted by ******
Посмотреть сообщение
If you are setting values for all the columns you don't need to specify them, just write them all in the correct order.
I have a new membership database, enter the value. If these values do not live down to the problem? Are you sure?
Reply
#10

And if this is the registration query, you could set the default values for some columns(ID=autoincrement, HP, starting money, level, etc) and only insert that ones that are particular as: playername, password, etc.

And you'll only have to do

Код:
format(Query, sizeof(Query), "INSERT INTO `members` (`playername`, `password`, `email`) VALUES ( '%s', '%s', '%s'",name,pass, email);
This way, the colomns that you don't specify, are automatically filled with the default values.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)