Skip to Content.
Sympa Menu

freetds - Re: globally defined RETCODE variable

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Brian Bruns <camber AT ais.org>
  • To: TDS Development Group <freetds AT franklin.oit.unc.edu>
  • Subject: Re: globally defined RETCODE variable
  • Date: Fri, 31 Aug 2001 22:46:49 -0400 (EDT)



dblib is littered with badly named globals. If you need to compile
freetds within the same program as DB2 (or other SQL/CLI-like
interfaces) I would strongly recommend using ctlib. For php that is
--with-sybase-ct flag on the configure.

Renaming RETCODE is simply not possible, as it is a feature of the API
defined by Sybase/MS that we are implementing. Change it, and you kill
compatibility with every dblib program out there. Namespace clean up is
one of the big reasons Sybase moved to ctlib.

Brian

On Fri, 31 Aug 2001, Ryan D. Hatch wrote:

> I am using freetds 0.52, php 4.06. I am also using IBM DB2.
>
> When I tried compiling php with the following command
>
> ./configure \
> --with-apxs=/opt/apache_1.3.20/bin/apxs \
> ----with-sybase=/opt/freetds-0.52 \
> --with-ibm-db2=/home/db2inst1/sqllib
>
> It broke on me when compiling giving me a previously declared variable
> error. Here is what it said:
> In file included from /opt/freetds-0.52/include/sybfront.h:23,
> from
> /usr/src/apps/php-4.0.6/ext/sybase/php_sybase_db.h:67,
> from internal_functions.c:46:
> /opt/freetds-0.52/include/sybdb.h:72: conflicting types for
> `RETCODE'
> /home/db2inst1/sqllib/include/sqlcli.h:344: previous declaration
> of `RETCODE'
> make[2]: *** [internal_functions.lo] Error 1
> make[2]: Leaving directory `/usr/src/apps/php-4.0.6/main'
> make[1]: *** [all-recursive] Error 1
> make[1]: Leaving directory `/usr/src/apps/php-4.0.6/main'
> make: *** [all-recursive] Error 1
>
> So, I changed the variable definition to read;
> typedef signed short RETCODE
> (this is how IBM did it in the DB2 include. I assume for Java
> compatibility issues)
>
> and it worked most of the way through the compile. It broke again later
> (saying that the variable hadnt been declared), so I put it back in and
> finished my make. It worked, and now freetds and DB2 both work together
> nicely. I am worried though that if TDS has return codes greater than
> 127, then I could end up with it outputing negative return codes. If the
> codes are larger that 255, then I could end up with buffer overflows.
> Does anybody have any better ways of handling this? Could I just simply
> rename the RETCODE variable throughout the TDS source code? Perhalps a
> patch?
>
> Thanks guys.
>
> Ryan Hatch
>
> ---
> You are currently subscribed to freetds as: [camber AT ais.org]
> To unsubscribe, forward this message to $subst('Email.Unsub')
>





Archive powered by MHonArc 2.6.24.

Top of Page