Ed Avis
2009-07-24 10:40:52 UTC
Hi, I've looked through the list archives for experiences using Sybperl with
FreeTDS and it seems it is possible, but nobody has reported this particular
problem. (Sybperl is the older set of Perl libraries for connecting to Sybase,
providing Sybase::DBlib and Sybase::CTlib packages. I am using the newer
DBD::Sybase with FreeTDS successfully, connecting to an MSSQL server.)
I am using a Fedora 11 x86_64 box with the packaged freetds-0.82. When I try
to build Sybperl it generates a file DBlib.c from a source file DBlib.xs, and
then uses gcc to compile DBlib.c to an object file. The gcc command line is
gcc -c -I/usr/include -D_REENTRANT -D_GNU_SOURCE -DPERL_USE_SAFE_PUTENV
-DDEBUGGING -fno-strict-aliasing -pipe
-I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
-I/usr/include/gdbm -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions
-fstack-protector --param=ssp-buffer-size=4 -m32 -march=i586 -mtune=generic
-fasynchronous-unwind-tables -DVERSION=\"2.18\"
-DXS_VERSION=\"2.18\" -fPIC
"-I/usr/lib/perl5/5.10.0/i386-linux-thread-multi/CORE" -DDBLIBVS=1000
-DSYBPLVER='"2.18"' -DDO_TIE DBlib.c
It fails with errors
DBlib.xs: In function ?XS_Sybase__DBlib__DateTime_crack?:
DBlib.xs:6068: error: ?DBDATEREC? has no member named ?dateyear?
DBlib.xs:6069: error: ?DBDATEREC? has no member named ?datemonth?
DBlib.xs:6070: error: ?DBDATEREC? has no member named ?datedmonth?
Looking at /usr/include/sybdb.h, I see that DBDATEREC is defined as:
typedef struct dbdaterec
{
#ifdef MSDBLIB
DBINT year;
DBINT month;
DBINT day;
DBINT dayofyear;
DBINT weekday;
DBINT hour;
DBINT minute;
DBINT second;
DBINT millisecond;
DBINT tzone;
#else
DBINT dateyear;
DBINT datemonth;
DBINT datedmonth;
DBINT datedyear;
DBINT datedweek;
DBINT datehour;
DBINT dateminute;
DBINT datesecond;
DBINT datemsecond;
DBINT datetzone;
#endif
} DBDATEREC;
So I suppose that MSDBLIB is defined? Although I plan to use the library
to connect to a Microsoft server, I have not done anything special to configure
FreeTDS for 'Microsoft mode'.
Does Sybperl need patching to use the different names for structure members,
or should I do something to unset the MSDBLIB preprocessor symbol, or
something else?
FreeTDS and it seems it is possible, but nobody has reported this particular
problem. (Sybperl is the older set of Perl libraries for connecting to Sybase,
providing Sybase::DBlib and Sybase::CTlib packages. I am using the newer
DBD::Sybase with FreeTDS successfully, connecting to an MSSQL server.)
I am using a Fedora 11 x86_64 box with the packaged freetds-0.82. When I try
to build Sybperl it generates a file DBlib.c from a source file DBlib.xs, and
then uses gcc to compile DBlib.c to an object file. The gcc command line is
gcc -c -I/usr/include -D_REENTRANT -D_GNU_SOURCE -DPERL_USE_SAFE_PUTENV
-DDEBUGGING -fno-strict-aliasing -pipe
-I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
-I/usr/include/gdbm -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions
-fstack-protector --param=ssp-buffer-size=4 -m32 -march=i586 -mtune=generic
-fasynchronous-unwind-tables -DVERSION=\"2.18\"
-DXS_VERSION=\"2.18\" -fPIC
"-I/usr/lib/perl5/5.10.0/i386-linux-thread-multi/CORE" -DDBLIBVS=1000
-DSYBPLVER='"2.18"' -DDO_TIE DBlib.c
It fails with errors
DBlib.xs: In function ?XS_Sybase__DBlib__DateTime_crack?:
DBlib.xs:6068: error: ?DBDATEREC? has no member named ?dateyear?
DBlib.xs:6069: error: ?DBDATEREC? has no member named ?datemonth?
DBlib.xs:6070: error: ?DBDATEREC? has no member named ?datedmonth?
Looking at /usr/include/sybdb.h, I see that DBDATEREC is defined as:
typedef struct dbdaterec
{
#ifdef MSDBLIB
DBINT year;
DBINT month;
DBINT day;
DBINT dayofyear;
DBINT weekday;
DBINT hour;
DBINT minute;
DBINT second;
DBINT millisecond;
DBINT tzone;
#else
DBINT dateyear;
DBINT datemonth;
DBINT datedmonth;
DBINT datedyear;
DBINT datedweek;
DBINT datehour;
DBINT dateminute;
DBINT datesecond;
DBINT datemsecond;
DBINT datetzone;
#endif
} DBDATEREC;
So I suppose that MSDBLIB is defined? Although I plan to use the library
to connect to a Microsoft server, I have not done anything special to configure
FreeTDS for 'Microsoft mode'.
Does Sybperl need patching to use the different names for structure members,
or should I do something to unset the MSDBLIB preprocessor symbol, or
something else?
--
Ed Avis <eda at waniasset.com>
Ed Avis <eda at waniasset.com>