Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

I need a list of values for the DBI statement handle attribute TYPE

by rinceWind (Monsignor)
on Feb 25, 2004 at 01:10 UTC ( #331568=perlquestion: print w/replies, xml ) Need Help??

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

I am trying to use a script I have already published to Perlmonks here. The script was designed to be database generic, and in principle it is. I have just successfully hacked the first few lines to allow my current database to be analysed.

Considering the original post was written with an Oracle database in mind, and I am now using it for Sybase, I am pleased that my original script works. However, I have an issue with the decoding of data types as the DBD layer is returning different values for $sth->{TYPE}. I am getting different 'magic' numbers, but I do not have the complete infomation to decode them. I would like a comprehensive list for the standard values that will occur.

The two references I have seen quoted for this information in the documentation both don't work:

Can anyone please post the current list of values as a reply, or a url which works (preferrably http rather than ftp).

Thanks in anticipation.

rinceWind

--
I'm Not Just Another Perl Hacker

  • Comment on I need a list of values for the DBI statement handle attribute TYPE

Replies are listed 'Best First'.
Re: I need a list of values for the DBI statement handle attribute TYPE
by pfaut (Priest) on Feb 25, 2004 at 02:07 UTC

    Are you looking for this little tidbit buried in the DBI POD?

    Constants representing the values of the SQL standard types can + be imported individually by name, or all together by importing the + special ":sql_types" tag. The names and values of all the defined SQL standard types can +be pro- duced like this: foreach (@{ $DBI::EXPORT_TAGS{sql_types} }) { printf "%s=%d\n", $_, &{"DBI::$_"}; }
    90% of every Perl application is already written.
    dragonchild
      > foreach (@{ $DBI::EXPORT_TAGS{sql_types} }) { > printf "%s=%d\n", $_, &{"DBI::$_"}; > } It fails with "use strict", and I can't see how to define that variable.
Re: I need a list of values for the DBI statement handle attribute TYPE
by iburrell (Chaplain) on Feb 25, 2004 at 20:23 UTC
    It is possible to have DBI return information on the types that it knows about. Look at type_info_all and type_info.
    my $type_info = $dbh->type_info($data_type); print "Name: ", $type_info->{TYPE_NAME}; print "Type: ", $type_info->{DATA_TYPE};

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (2)
As of 2020-12-04 07:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How often do you use taint mode?





    Results (58 votes). Check out past polls.

    Notices?