Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Datatype of fetch'ed columns using Perl-Sybase

by perl@1983 (Sexton)
on Jul 03, 2012 at 15:12 UTC ( [id://979731]=perlquestion: print w/replies, xml ) Need Help??

perl@1983 has asked for the wisdom of the Perl Monks concerning the following question:

Hello Monks, I am generating an HTML page from a (Sybase) resultset of a select query (using latest versions of DBI and DBD::Sybase). In that, I am printing the column names, but along with column names, I also wanted to print the datatype and size of respective columns. Can someone please guide with regards to how can I get the datatypes and size of each column? I've gone through the DBI and DBD::Sybase + some online articles, but couldn't figure it out. Any pointers would be appreciated. Thanks in advance.
  • Comment on Datatype of fetch'ed columns using Perl-Sybase

Replies are listed 'Best First'.
Re: Datatype of fetch'ed columns using Perl-Sybase
by Corion (Patriarch) on Jul 03, 2012 at 15:18 UTC

    Have a look at the "catalog" functions of DBI. They return the database type of columns for a given query.

      Thanks for the quick reply Corion! I went through those functions and if I understood correctly, they would return the datatype as a number representing their ISO counerpart. Is it possible to see the actual Sybase datatype (instead of number)?

        You could certainly translate them yourself:

        First, create your translation table (ficticious data, of course):

        my %translation_table = ( 1=>"bool", 27=>"char", 13=>"dec", 34=>"nul", 55=>"etc...", );

        Then, using the value from catalog functions, select and then print (or say) the appropriate data-type-word to your output.

Re: Datatype of fetch'ed columns using Perl-Sybase
by erix (Prior) on Jul 03, 2012 at 16:37 UTC
Re: Datatype of fetch'ed columns using Perl-Sybase
by mpeppler (Vicar) on Jul 27, 2012 at 14:51 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://979731]
Approved by herveus
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (6)
As of 2024-04-23 14:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found