Skip to Content.
Sympa Menu

freetds - PHP: Conversions working, but error handling broken

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: <lbayuk AT mindspring.com>
  • To: freetds AT franklin.oit.unc.edu
  • Subject: PHP: Conversions working, but error handling broken
  • Date: Mon, 26 Aug 2002 21:38:14 -0400 (EDT)


James K. Lowden wrote:
>...
> Many changes went into the conversion code. Please try it out if you can.
> We don't have a complete any-to-any conversion matrix test program yet,
> so your feedback is especially valuable. There are three recent threads
> on that subject that I think are unfixed:
>
> 1. "VAR or not VAR?", needs close examination
> 2. "Issue with IMAGE type in latest build", may need "0x" prepended to
> output in some cases (definitely not dbconvert(), though).
> 3. "Convert seems totally broken now", may be refined in #1.
> ...

Using PHP-4.2.2, sybase_ct extension, and latest FreeTDS from CVS.

Conversion of data types to strings works fine for me now. So item #3
is fixed. Thank you.

But I'm having a problem with error handling: PHP's sybase_query() is not
properly returning FALSE on a failed query. The error message gets reported
(unless suppressed as @sybase_query()), but the TRUE return leaves the
calling script thinking the query worked, when in fact it failed.

The same test works on PHP built with sybase_ct and Sybase OpenClient
library: sybase_query returns FALSE on an error. Worse news: The same test
works with FreeTDS-0.53, and with earlier CVS versions. So please consider
this a regression issue, when considering the future 0.60 release.

I think I can see the problem: The error condition is set in
tds_process_msg(), but cleared by the error handler which ctlib installs.
Back in tds_process_result_tokens(), it sees the cleared priv_msg_type flag
and decides there really wasn't an error after all.

Browsing CVS, I see a change to ctlib/ctutil.c CVS version 1.5 on
2002-07-16 by brianb to add a call to tds_reset_msg_info() from
the ctlib error handler ctlib_handle_err_message(). This might have
been where the problem started. Needless to say, my attempts at a quick
fix - change it back - failed horribly. Help...




Archive powered by MHonArc 2.6.24.

Top of Page