Skip to content

pdo_odbc: allocate sufficient space for retrieving unicode data #15008

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

Open
wants to merge 2 commits into
base: PHP-8.2
Choose a base branch
from

Conversation

jnahmias
Copy link

@jnahmias jnahmias commented Jul 18, 2024

@SakiTakamachi
Copy link
Member

SakiTakamachi commented Jul 18, 2024

@jnahmias
Thank you!

The test file name is gh9498_1.phpt. Are you planning on adding multiple tests? If there is only one, it may be better to remove the _1.

The other changes look good to me, but I'll wait for other people's opinions.

edit:
We need to be able to skip tests somehow. I can't think of a way to do that right now...

@NattyNarwhal
Copy link
Member

FWIW this is kinda similar to what ibm_db2 and friends do with their i5_dbcs_alloc option, except it also does it for non-wchar columns because of the treachery of EBCDIC to UTF-8 conversions (and has to assume all astral plane on the UTF-8 side, so 6 bytes per character). It's a bit of a hack, but doing things "right" would be more complicated last time I looked into it.

https://github.com/php/pecl-database-ibm_db2/blob/master/ibm_db2.c#L1991-L2005

@jnahmias
Copy link
Author

jnahmias commented Jul 18, 2024

The test file name is gh9498_1.phpt. Are you planning on adding multiple tests? If there is only one, it may be better to remove the _1.

@SakiTakamachi: Yes, I have another test planned for the INSERT path; see phpGH-9498 for details; However, from my review it seems to be a deeper issue that is only somewhat related (and probably should be a separate issue) so I have not made it part of this PR. Happy to rename it without the suffix if that's desired.

Work around the fact that Windows does not use UTF-8 by doing
the comparison within the PHP test code.

Also, add a few more tests of plain ASCII strings to make sure those
aren't impacted by this change.

Fixes: e053712
@cmb69
Copy link
Member

cmb69 commented Jul 19, 2024

Hmm, I'm really unsure how to solve this issue, but I think regardless of the exact solution, we should add more common routines for ext/odbc and ext/pdo_odbc to main/php_odbc_utils. Otherwise we likely end up solving similar issues twice.

Comming back to the issue at hand: how does ext/odbc behave in this regard?

@cmb69
Copy link
Member

cmb69 commented Jul 19, 2024

Comming back to the issue at hand: how does ext/odbc behave in this regard?

Yeah, somewhat similar but rather different (see odbc_bindcols()).

Also somewhat related to PR #10809.

@NattyNarwhal
Copy link
Member

Yeah, that old PR did solve some problems I had that were similar, although I was still unsure if it was the right solution, especially as it might have had some performance impact.

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

Successfully merging this pull request may close these issues.

4 participants