SA-MP Forums Archive
which is the maximum length of a string? - 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: which is the maximum length of a string? (/showthread.php?tid=674785)



which is the maximum length of a string? - rockys - 27.04.2020

which is the maximum length of a string for a query
like
mysql_format
or format

string[2048] ? or 4096 or bigger?


Re: which is the maximum length of a string? - TopShooter2 - 27.04.2020

https://san-andreas-multiplayer-samp...om/wiki/Limits Although I am not sure why would you need to make such a big string.


Re: which is the maximum length of a string? - PawnFox - 27.04.2020

Why do you need such a big string size ?


Re: which is the maximum length of a string? - rockys - 27.04.2020

i make a optimized save system, save all variables in database after 5 6 minutes on server.
if you save all data always you have a lot of queries, and queries affect the server


Re: which is the maximum length of a string? - Adamoneoone - 28.04.2020

Well actually i think it's completely the opposite. Sending multiple short queries is way more efficient than having a huge query run every 5 - 6 minutes. Imagine having to send a 512 or even 1024 sized query for 100 players at the same time. The server won't really appreciate it.


Re: which is the maximum length of a string? - rockys - 28.04.2020

Quote:
Originally Posted by Adamoneoone
View Post
Well actually i think it's completely the opposite. Sending multiple short queries is way more efficient than having a huge query run every 5 - 6 minutes. Imagine having to send a 512 or even 1024 sized query for 100 players at the same time. The server won't really appreciate it.
i have to update like 230 variables in database, i think one string is better then 230


Re: which is the maximum length of a string? - Adamoneoone - 28.04.2020

It’s even worse imo.. but you do you lel


Re: which is the maximum length of a string? - Markski - 28.04.2020

Having a huge query to save account flags in a single table is fine. It's not ideal, but it's *fine*. Long as you know what you're doing the worst thing that'll happen is it just being annoying to work with.

As for the question, the limit for how long a string can be is so large it should not matter (and if you do reach it, the compiler will let you know). Of course, certain natives which utilize strings will have smaller limits. For those you should check the Limits in the afforementioned Limits wiki link, or in case of a plugin, it's documentation.


Re: which is the maximum length of a string? - rockys - 28.04.2020

So how to do?
1 2 3 query with 230 variables or 230 query?
You have have 100 players you have 23000 queries on 5 minute
Or 100 queries on 5 minute
I think one is good


Re: which is the maximum length of a string? - Banditul18 - 28.04.2020

A better question is, do those variables are changing in same time? Or do they mean same thing? Because you can just update the variable only when it changes. I doubt a player admin level or player level changes so often or needs to be saved every so often