Hi:
Attached are three patches for ext/sybase. The first two fix bugs. The
third adds a function, while at the same time removing a lot of
redundant code. In order:
php5_sybase-fetch_object.diff:
The sybase extension does not currently compile, since
sybase_fetch_object was never converted to ZE2's new object API.
This patch converts sybase_fetch_object, fixes three warnings, and
checks the return value of malloc() in the one place it's used.
Please apply this - ext/sybase is broken in PHP5 without it.
php_sybase-string-termination:
With --enable-debug turned on, both ZE1 and ZE2 emit warnings about
null-termination for each call to sybase_query. These warnings are
caused by php_sybase_get_column_content, which returns a zval whose
internal string is not null-terminated. The original logic which
terminated the string was #ifdef'ed out; this patch replaces it
with a greatly simplified version. Tested with FreeTDS 0.60 against
Microsoft SQL Server 2000; also applies cleanly to PHP4.
php5_sybase-fetch_assoc.diff:
Most of the other PHP database extensions have three ways for rows
to be fetched: fetch_row (numeric keys), fetch_assoc (string keys),
or fetch_array (both numeric and string keys). The ext/sybase
extension currently has no sybase_fetch_assoc function. This patch
adds sybase_fetch_assoc, while at the same time removing the
duplication between sybase_fetch_row and php_sybase_fetch_hash. The
result is a unified php_sybase_fetch_hash capable of fetching in
either of the three modes, and three userland functions which pass
through to it. (Depends: php5_sybase-fetch_object.diff)
If these look okay, please apply. If not, I'll gladly fix and resend -
just let me know.
Thanks a lot,
- Dave
dave@spoonguard.org