----- Forwarded message from [EMAIL PROTECTED] -----
Delivered-To: [EMAIL PROTECTED]
Date: Mon, 2 Jun 2003 20:12:49 +0800 (CST)
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Subject: metadata
X-SHIP: 219.150.96.110
X-SHMOBILE: 0
X-SHBIND: 0
hi:
can dbd::oracle add support to meta data of column type .Because I have to add the
following code in tie::dbi .
Thanks.
sub _types {
my $self = shift;
return $self->{'types'} if $self->{'types'};
my $sth;
my %types;
if($self->{'driver'} eq 'Oracle')
{
$sth = $self->{'dbh'}->prepare("SELECT column_name,data_type FROM
ALL_TAB_COLUMNS WHERE TABLE_NAME = " . $self->{'dbh'}->quote("$self->{table}"));
$sth->execute()||
croak "_types() failed during execute(SELECT) statement: $DBI::errstr";
while (my ($col_name,$col_type)=$sth->fetchrow())
{
$types{$col_name} = $col_type;
}
}
else
{
$sth = $self->{'dbh'}->prepare("SELECT * FROM $self->{table} WHERE 0=1") ||
croak "_types() failed during prepare(SELECT) statement: $DBI::errstr";
$sth->execute() ||
croak "_types() failed during execute(SELECT) statement: $DBI::errstr";
my $types = $sth->{TYPE};
my $names = $sth->{NAME};
%types = map { shift(@$names) => $_ } @$types;
}
return $self->{'types'} = \%types;
}
----- End forwarded message -----