Nadroev Nadroev - 6 months ago 63
SQL Question

How to check the current query packet size for MySql?

According to the answer to this question: What is maximum query size for mysql?

The max value is shown in bytes and not characters, so I can't decide when the time to split the query is. Would be even better if I could check that while the query is still a string in php since its length will be flexible.

Answer

You can simply use strlen() to measure the byte size of your query in php.

See manual at http://www.php.net/manual/en/function.strlen.php

Note: strlen() returns the number of bytes rather than the number of characters in a string.