Skip to content

Conversation

NattyNarwhal
Copy link
Member

@NattyNarwhal NattyNarwhal commented Sep 15, 2025

  • Merge php_odbc_fetch_into into php_odbc_fetch_hash.
    • The implementation was nearly identical, so refactor into a common implementation with some differences in how the result set array is returned.
    • odbc_fetch_into is kind of weird. I don't know if it'd be better to deprecate it and have a more "symmetrical" API that works like odbc_fetch_array.
  • Converts php_odbc_fetch_hash to use ZPP.
    • Opportunistic since I was there anyways.
  • Convert SQLExtendedFetch calls to SQLFetchScroll
  • Convert result type constants to an enum
  • Merge php_odbc_fetch_row into php_odbc_fetch_hash

@NattyNarwhal NattyNarwhal marked this pull request as ready for review September 15, 2025 20:17
@NattyNarwhal
Copy link
Member Author

ARM failure unrelated.

FWIW, if this misses 8.5, I'll probably continue some further refactoring in this PR.

Now that we can assume fetch_hash exists, there's a lot of redundancy in
these functions. Merge their implementations, and smooth over the
differences in how they handle returning their result set as an array.
These are also doing extremely similar jobs, but with slightly different
behaviours for the return value (in this case, none, as it's tended to
be used with odbc_result). Unify this too.

The $row value deprecation for 0/-1 is only handled for odbc_fetch_row;
it's too late to do so for PHP 8.5. Should probably unify it for PHP 8.6.
Since this is a much more shared fetch function now.
Copy link
Member

@Girgias Girgias left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you remove the deprecation? As that would then be a purely refactory PR.

As for the deprecation you would need RM approval and I don't know how they feel about it being this close to RC1 and might be difficult to convince.

@NattyNarwhal
Copy link
Member Author

NattyNarwhal commented Sep 21, 2025

Can you remove the deprecation? As that would then be a purely refactory PR.

As for the deprecation you would need RM approval and I don't know how they feel about it being this close to RC1 and might be difficult to convince.

I changed the condition in the inner function to only trigger when it's called with the parameters odbc_fetch_row would call it with, so this shouldn't change the deprecation. (That said, for 8.6, we should probably actually get around to deprecating it for the other functions too, but as you say, not now.)

Copy link
Member

@Girgias Girgias left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The commit title "Convert php_odbc_fetch_hash to ZPP" is misleading, as you are not converting the function to ZPP but to fast ZPP as it was already using ZPP to parse and validate arguments.

@NattyNarwhal
Copy link
Member Author

@php/release-managers-85 Your call if it's OK to get this in for RC1.

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.

Replace SQLExtendedFetch with SQLFetchScroll in ext/odbc
2 participants