Skip to content

UTF-16 Support In Prepared Statements and Model Column Annotations #7315

@jmarchiano85

Description

@jmarchiano85

Feature Request

What

I would like to see support for bindings regarding UTF-16 strings in both parameterization for prepared statements and annotations for model columns.

Why

Currently there is no support, in Doctrine, for this kind of thing, and some strings used in applications contain characters used in the UTF-16 realm, such as CJK and emojis.

How

PDO offers a parameter type called \PDO::PARAM_STR_NATL

A const can be added in the \Doctrine\DBAL\ParameterType class called STRING_NATL

This can be mapped to the \PDO::PARAM_STR_NATL value so that it can be available for prepared statements that do not go through raw PDO

A const STRING_NATL would need to be added to the \Doctrine\DBAL\Types\Types class with the value of string_natl. A custom class type, \Doctrine\DBAL\Types\StringNatlType can be created as an extension of the \Doctrine\DBAL\Types\StringType class. This would just need to return \Doctrine\DBAL\Types\Types::STRING_NATL from the getName method and the getBindingType method would just need to return \Doctrine\DBAL\ParameterType::STRING_NATL.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions