Both sides previous revisionPrevious revisionNext revision | Previous revision |
rfc:extended-string-types-for-pdo [2017/03/03 15:44] – incorporate feedback from internals discussion adambaratz | rfc:extended-string-types-for-pdo [2017/09/22 13:28] (current) – external edit 127.0.0.1 |
---|
====== PHP RFC: Extended String Types For PDO ====== | ====== PHP RFC: Extended String Types For PDO ====== |
* Version: 0.2 | * Version: 0.3 |
* Date: 2017-02-16 | * Date: 2017-02-16 |
* Author: Adam Baratz adambaratz@php.net | * Author: Adam Baratz adambaratz@php.net |
* Status: Under Discussion | * Status: Accepted |
* First Published at: https://wiki.php.net/rfc/extended-string-types-for-pdo | * First Published at: https://wiki.php.net/rfc/extended-string-types-for-pdo |
| |
The "national character" type was introduced in [[http://www.contrib.andrew.cmu.edu/~shadow/sql/sql1992.txt|SQL-92]] (section 4.2.1). It's an open-ended type. The spec indicates that its meaning is defined by the implementation. [[https://dev.mysql.com/doc/refman/5.7/en/charset-national.html|MySQL]] and [[https://msdn.microsoft.com/en-GB/library/ms186939.aspx|Microsoft SQL Server]] use it to store Unicode data. | The "national character" type was introduced in [[http://www.contrib.andrew.cmu.edu/~shadow/sql/sql1992.txt|SQL-92]] (section 4.2.1). It's an open-ended type. The spec indicates that its meaning is defined by the implementation. [[https://dev.mysql.com/doc/refman/5.7/en/charset-national.html|MySQL]] and [[https://msdn.microsoft.com/en-GB/library/ms186939.aspx|Microsoft SQL Server]] use it to store Unicode data. |
| |
There is a different format for literals of this type. Instead of simply surrounding strings with quotes, an N is added as a prefix (e.g., N'string' instead of 'string'). When using emulated prepared statements -- the default behavior for pdo_mysql, the only one for pdo_dblib -- it's not possible to quote parameters using this format. This means that queries involving these columns will trigger implicit casts, which makes them more expensive. | There is a different format for literals of this type. Instead of simply surrounding strings with quotes, an N is added as a prefix (e.g., N'string' instead of 'string'). When using emulated prepared statements -- the default behavior for pdo_mysql, the only one for pdo_dblib -- it's not possible to quote parameters using this format. This means that queries involving these columns will trigger implicit casts, which makes them more expensive. This issue affects [[https://www.sqlskills.com/blogs/jonathan/implicit-conversions-that-cause-index-scans/|MySQL]] and [[http://code.openark.org/blog/mysql/beware-of-implicit-casting|MSSQL]]. |
| |
There aren't many pdo_dblib users who comment regularly on the internals list, but the presence of a [[https://bugs.php.net/bug.php?id=60818|feature request]] and a [[https://github.com/php/php-src/pull/2017|pull request]] suggests that this is an impactful omission. | There aren't many pdo_dblib users who comment regularly on the internals list, but the presence of a [[https://bugs.php.net/bug.php?id=60818|feature request]] and a [[https://github.com/php/php-src/pull/2017|pull request]] suggests that this is an impactful omission. |
| |
===== Proposed Voting Choices ===== | ===== Proposed Voting Choices ===== |
This project requires a 50%+1 majority. | Voting opened on 8 March 2017. It will close on the 17th at 0:00 UTC. This project requires a 50%+1 majority. |
| |
| <doodle title="extended-string-types-for-pdo" auth="adambaratz" voteType="single" closed="true"> |
| * Yes |
| * No |
| </doodle> |
| |
| ===== Implementation ===== |
| This feature was implemented in PHP 7.2 ([[https://github.com/php/php-src/commit/4afce8ec8c6660ebd9f9eb174d2614361d1c6129|4afce8ec8c6660ebd9f9eb174d2614361d1c6129]]). |