Skip to content

New attribute for sql bigint and decimal/numeric types to php int and float types #1498

@startork

Description

@startork

Is your feature request related to a problem? Please describe.

We are changing our pdo driver from pdo_dblib to pdo_sqlsrv and have issues with bigints and decimals being cast to strings. We pass these values straight to our frontend which does some small calcs for display (totals etc...). I have read through the issues related to this area such as #291 and absolutely agree that by default these types need to be strings to preserve precision. However, a) bigint is the same size as the php int type on most systems b) as mentioned, to do any sort of operation on these values they must be converted to php floats anyway. There is no built-in way to arithmetically handle decimals as decimals in PHP so I don't see the harm in (optionally) always converting these to floats.

Describe the solution you'd like

One or two attributes added to allow default types of int and float for bigint and decimal/numeric types.

Describe alternatives you've considered

Currently I am using a custom version of pdo_sqlsrv with a modified sql_type_to_php_type method.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions