Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

Using 64 bit DBD with Sybase 15

by tecmbg (Initiate)
on Feb 05, 2013 at 14:50 UTC ( #1017196=perlquestion: print w/replies, xml ) Need Help??

tecmbg has asked for the wisdom of the Perl Monks concerning the following question:

Has anyone had the chance to use the 64 bit versions of DBD Sybase using dates/times? I'm pulling out a date from Sybase 15, with the latest version of ctlib, and getting weird results. This same function works fine on the 32 bit side. It does work properly if a "convert(char(20, date)" is used in the query, but we don't want to change the code if possible. Without the convert, it is just pulling the date from a date column is chopping off the time when it is midnight. Also, if the date is 1/1/1900, its only outputting the time, without the date at all. We've tried multiple versions of DBD, still no luck. Any suggestions?

Replies are listed 'Best First'.
Re: Using 64 bit DBD with Sybase 15
by afoken (Canon) on Feb 05, 2013 at 18:39 UTC

    DBD::Sybase is now two years old. Perhaps it was never tested on 64 bit Systems?

    (Update: According to the CHANGES file, DBD::Sybase runs on several 64 bit systems.)

    From the symptoms, it looks like the DBD::Sybase code, when compiled for 64 bit, assumes a wrong size and leaves a part of a buffer untouched (zeroed).

    I think you should post your question on the DBI-Users mailing list. Include a link to your thread here.


    Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)
      Here are the versions we are using: DBD::Sybase is 1.115 (10/2/2011), DBI is version 1.622, ctlib: Sybase Client-Library/15.5/P-EBF18235 ESD #7/DRV.15.5.1/Linux x86_64/Linux 2.6.9-55.ELsmp x86_64/BUILD1550-009/64bit/OPT/Fri Aug 27 01:52:15 2010
Re: Using 64 bit DBD with Sybase 15
by mpeppler (Vicar) on Feb 05, 2013 at 18:24 UTC
    Did "make test" work correctly?

    If so, what do you mean by "weird" results?


      Yes, the make test did work properly. By weird, I mean the date field (defined as date in the database), returns "Jan 4 2013 12:00am" as "Jan 4 2013". A field (defined as time in the database), returns "Jan 1 1900 5:00pm" as "5:00pm". In 32 bit, the dates return as "Jan 4 2013 12:00am" and "Jan 1 1900 5:00pm" respectively.
        Is this with the exact same version of OpenClient, with just the 32/64 bit difference?

        Because the 64bit data you get is more correct - and is also what I get with a 32bit 15.7 client:

        use strict; use DBI; my $dbh = DBI->connect('dbi:Sybase:server=foo', 'user, '***'); my $sth = $dbh->prepare("select convert(date, getdate()), convert(time +, getdate())"); $sth->execute; while(my $r = $sth->fetch) { print "@$r\n"; }
        which outputs:
        $ perl /tmp/ Feb 7 2013 3:06PM
        And to me that's as it should be - you're asking for just the date, so no time portion is displayed, or just the time, and no date portion is displayed.

        This is with DBD::Sybase 1.14, btw.


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1017196]
Approved by Corion
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (3)
As of 2020-10-21 13:52 GMT
Find Nodes?
    Voting Booth?
    My favourite web site is:

    Results (217 votes). Check out past polls.