PEPPLER.ORG
Michael Peppler
Sybase Consulting
Menu
Home
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
Freeware
Sybperl
Sybase::Simple
DBD::Sybase
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
FAQs
Sybase on Linux FAQ
Sybperl FAQ
Personal
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: "Avis, Ed" <avised at kbcfp dot com>
Subject: RE: Meaning of TYPE_NAME in type_info() output
Date: May 7 2005 6:09PM

Michael Peppler wrote:

>>Currently if I make a user-defined type on Sybase and use it for some
>>column C of a table T, then for 'SELECT C FROM T' DBD::Sybase gives me
>>the name of the user type.

>I just tried it, using a user-defined type mapped to varchar(30), and
>type_info() returns "char" (which is correct).

Hmm, I spoke too soon.  In fact Sybase isn't giving me a user-defined
type of the column, but some other crap.

    my $dbh
      = DBI->connect('dbi:Sybase:server=MY_SERVER;database=mydb',
                     'myuser', 'mypass',
                     { RaiseError => 1, AutoCommit => 0 });
    $dbh->do('create table #foo (c int)');
    my $sth = $dbh->prepare('select c from #foo');
    execute $sth;
    my $data = $sth->fetchall_arrayref;
    print $dbh->type_info($sth->{TYPE}->[0])->{TYPE_NAME}, "\n";

This prints 'event_type_t', although the column was clearly defined as
int.  However with a different database on the same server (eg master),
it prints correctly 'int'.  So there is some weirdness in my database.

-- 
Ed Avis