Add a memory limit in mysql ext

From: Date: Sun, 30 Mar 2008 11:32:58 +0000
Subject: Add a memory limit in mysql ext
Groups: php.internals 
Request: Send a blank email to internals+get-36684@lists.php.net to get a copy of this message
Hello, I often host clients which have "bad" PHP/SQL code ; as for example a "select *" + mysql_row_nums on a 200Mo table just to count lines... So I add a little patch to throw a warning in case the result of mysql_query is larger than a specified limit. I use the setting "mysql.min_stored_data_before_warn" in php.ini, and the result is : [30-Mar-2008 04:39:56] PHP Warning: mysql_query() [<a href='function.mysql-query'>function.mysql-query</a>]: Your query use too much memory (202636 o) in /path/to/script.php on line 8 This patch seem "usefull" for me as PHP does not report the queries's memory consumption. But maybe it should be done in mysqli and PDO extensions to ? I'm not a "C developper", and the patch use the mysql internal struct, so it's not really "clean". Maybe we can do it differently. Thanks Olivier PS : sorry for my limited english.

« previous php.internals (#36684) next »