This shows you the differences between two versions of the page.

Link to this comparison view

rfc:extended-string-types-for-pdo [2017/02/16 16:13]
adambaratz created
rfc:extended-string-types-for-pdo [2017/09/22 13:28]
Line 1: Line 1:
-====== PHP RFC: Extended String Types For PDO ====== 
-  * Version: 0.1 
-  * Date: 2017-02-16 
-  * Author: Adam Baratz adambaratz@php.net 
-  * Status: Under Discussion 
-  * First Published at: https://wiki.php.net/rfc/extended-string-types-for-pdo 
-===== Introduction ===== 
-[[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]] define special column types for storing Unicode strings. There is a different format for literals of this type. 
-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. By not doing this, queries become more expensive because of an implicit cast. 
-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. 
-===== Proposal ===== 
-Three constants would be added to the pdo extension: 
-  - **PDO::PARAM_STR_UNICODE.** A new type, to be applied as a bitwise-OR to ''PDO::PARAM_STR''. It would indicate that the value should be quoted with the N-prefix. 
-  - **PDO::ATTR_UNICODE_STRINGS.** This bool driver attribute would indicate whether all ''PDO::PARAM_STR'' values should be treated like ''PDO::PARAM_STR | PDO::PARAM_STR_UNICODE'' by default. 
-  - **PDO::PARAM_STR_ASCII.** A new type, to be applied as a bitwise-OR to ''PDO::PARAM_STR''. It would indicate that the value should be quoted without the N-prefix. This would be intended to be used as an exception for when the ''PDO::ATTR_UNICODE_STRINGS'' attribute is set to true. 
-===== Backward Incompatible Changes ===== 
-Since this functionality would be opt-in, existing code would continue to work as it does. The bitmasked values would be ignored by other drivers, or pdo_mysql toggling off prepared statement emulation, so the portability valued for PDO code would be preserved. 
-====== Impact To Existing Extensions ====== 
-Drivers outside of php-src might have to be modified if they make assumptions about the structure of ''enum pdo_param_type''. They would have to be rebuilt since the ''PDO_DRIVER_API'' macro would be updated. 
-===== Proposed PHP Version(s) ===== 
-Next PHP 7.x. 
-===== Proposed Voting Choices ===== 
-This project requires a 50%+1 majority. 
rfc/extended-string-types-for-pdo.txt · Last modified: 2017/09/22 13:28 (external edit)