Size of a query
#1

Hi,

I wanted to know, how to determine the size of a query.
Is it like a string ?

For example for those queries:

"SELECT * FROM `maisons`" is the size 24 ?

"mysql_format(mysql, query, sizeof(query), "UPDATE `joueurs` SET `Bannis`=%d, `RaisonBan`='%s', `BannisPar`='%s' WHERE `ID`=%d", pInfo[id][Bannis], pInfo[id][RaisonBan], joueuremetteur, pInfo[id][ID]);"

Is the size 248 ?


Is there any tool that can calculate it automatically ?


Thank you !
Reply
#2

Size of a string.. well, each index holds one, so that makes it the.. ermm.. size?

pawn Код:
new _st[3] = "aaa";
You don't need to calculate the size of every string to perfectly optimise it, because it's not the 80s, but you need to be sensible about it too - using 128 string size for a 24 char player name OR 512 for a 128 client message, is stupidity. For the query you mentioned, the first size that popped to my head, SAFELY, was 40.
Reply
#3

Here you go, this tool calculates the string length for you.
Reply
#4

Okay, thank you guys.
Gonna check this
Reply
#5

Quote:
Originally Posted by Conradus
Посмотреть сообщение
Here you go, this tool calculates the string length for you.
Except that it doesn't at all account for placeholders like %d and %s. The output as represented by that "tool" will - when used straight up as an array's size - produce a load of errors at runtime.
Reply
#6

Vince is right.

%s took 2 characters, whereas the string which is represented by the %s takes generally more than 2 characters.
My way to proceed is to create a 1024 chars string that I use for the queries, for sending mails, for sending client messages, for formatted gametexts...for whatever I want.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)