-
Notifications
You must be signed in to change notification settings - Fork 386
Closed
Labels
Description
PHP 7.2 added support for specifying different bind types for unicode and non-unicode string data: https://wiki.php.net/rfc/extended-string-types-for-pdo
This is a major improvement over the default (PDO::PARAM_STR) which binds strings as unicode data. In the past, the inability for PHP to handle this has led to performance problems in certain cases. For example:
$statement = $pdo->prepare(
'SELECT * FROM myTable WHERE myVarcharColumn = :value' -- will bind as N'...'
);
$statement->bindValue(':value', $myVarcharValue);
$statement->execute();
If there's an index on myVarcharColumn SQL won't be able to use the index effectively. More on this problem can be found here: http://blog.sqlgrease.com/are-varchar-or-char-hurting-your-performance-due-to-implicit-conversions/
Does the team have a plan to support this binding in the future?
Reactions are currently unavailable