note 122967 deleted from pdo.quote by salathe

From: Date: Mon, 21 Sep 2020 14:57:38 +0000
Subject: note 122967 deleted from pdo.quote by salathe
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-215392@lists.php.net to get a copy of this message
Note Submitter: nolife at gmail dot com ---- PDO quote (tested with mysql and mariadb 10.3) is extremely slow. It took me hours of debugging my performance issues until I found that pdo->quote is the problem. This function is far from fast, and it's PHP instead of C code: function escape($value) { $search = array("\\", "\x00", "\n", "\r", "'", '"', "\x1a"); $replace = array("\\\\","\\0","\\n", "\\r", "\'", '\"', "\\Z"); return str_replace($search, $replace, $value); } It is 50 times faster than pdo->quote() (note, it's without quotes just escaping and only used here as an example)

« previous php.notes (#215392) next »