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

Client Buffered Queries Break FLOAT columns #71

Closed
david-garcia-garcia opened this issue Dec 5, 2015 · 6 comments
Closed

Client Buffered Queries Break FLOAT columns #71

david-garcia-garcia opened this issue Dec 5, 2015 · 6 comments

Comments

@david-garcia-garcia
Copy link

I'm reviving this from issue:

#40

Prefetch statements are returning NULL terminated strings. Indeed, type mapping is messed up to such a point that it is imposible to retrieve a float field from the database when using prefetch.

If you try to retrieve a FLOAT column using client buffered queries, you get a null terminated string, but even worse, there is no way to fix this by calling bindColumn() on the statement.

See sample script:

http://pastebin.com/RUsLBe3J

Disabling CLIENT BUFFERED queries "fixes" the issue. That's like buying an all road car and saying "only using this car in the city fixes the issue" :)

This issue is completely breaking Drupal's locking system when running on MSSQL, basically making it prompt to deadlocks and unusable on high concurrent scenarios. And no, I cannot disable CLIENT BUFFERED queries because it will break the whole integration.

@david-garcia-garcia
Copy link
Author

An update on this. Not only it is returning NULL terminated strings (which could somehow be more or less worked around) but the precission of the result is all messed up, decimal places are being eaten away.

This does not happen when client buffered queries are disabled.

@david-garcia-garcia
Copy link
Author

This issue is still present on the PHP7 version of the driver. Using client buffered queries competely breaks the usage of floats.

This is directly related to #41 (that was closed who knows why).

Can you make type binding behave in the same way wether you use client buffered queries or not?

Thanks.

@meet-bhagdev
Copy link
Contributor

@david-garcia-garcia We believe this issue was fixed with our latest release here: https://github.com/Azure/msphpsql/releases/tag/4.1.0. Please help us validate.

Feel free to open the issue if you need to.

@david-garcia-garcia
Copy link
Author

Works!

Just note that the repro script fatals where before it was not (but I understand that trying to stuff a float inside an int has to crash somewhere). Maybe instead of a fatal an exception will be more developer friendly.

@david-garcia-garcia
Copy link
Author

BTW this is the fatal:

Buffer length must be able to find a long in sqlsrv_buffered_result_set::double_to_long

@yitam
Copy link
Contributor

yitam commented Feb 15, 2017

Hi @david-garcia-garcia : the fatal error can not be reproduced using your sample script. Please confirm with the latest release.

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

No branches or pull requests

4 participants