Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Datatype of fetch'ed columns using Perl-Sybase

by perl@1983 (Sexton)
on Jul 03, 2012 at 15:12 UTC ( #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
Re: Datatype of fetch'ed columns using Perl-Sybase
by Corion (Pope) 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 (Vicar) 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
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? | Other CB clients
Other Users?
Others chilling in the Monastery: (9)
As of 2014-07-24 06:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (158 votes), past polls