Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
startork opened this issue Jan 18, 2024 · 1 comment

Comments

@startork
Copy link

startork commented Jan 18, 2024

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.

@v-makouz
Copy link
Contributor

If you want to add this option you can submit the PR and we can test it and pull it into the a future version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants