Hi all!

Thanks for the quick (and helpful) responses last time!

I have anohter problem with DBD:Sybase. I've got a simple program that pulls 
the metadata for a column:

sub GetMetaData
{
### Routine to get MetaData on a specific column
my $connection  = shift;
my $username    = shift;
my $password    = shift;
my $source      = shift;
my $table       = shift;
my $column      = shift;
my $ctype � = "";
my $cprec � = "";
my $cscale � = "";
my $cnull � = "";

### Load DBI module
use DBI;
### Connect to the database
my $dbh = DBI->connect($connection,$username,$password)
       or  die "Can't connect to MS SQL Server database: $DBI::errstr\n";
### Set finisher
$dbh->{syb_flush_finish} = 1;

### Prepare SQL
my $sth = $dbh->prepare( "SELECT $column from $source" );
### Execute SQL
$sth->execute();
print "Pulling MetaDeta on $column from $table...";
for ( my $i = 1 ; $i <= $sth->{NUM_OF_FIELDS} ; $i++ )
{
   $ctype = $sth->{TYPE}->[$i-1];
   SWITCH:
   {
       $ctype = "VarChar", last SWITCH if($ctype == 1);
       $ctype = "Numeric", last SWITCH if($ctype == 2);
       $ctype = "Numeric", last SWITCH if($ctype == 3);
       $ctype = "Integer", last SWITCH if($ctype == 4);
       $ctype = "Integer", last SWITCH if($ctype == 5);
       $ctype = "Float",   last SWITCH if($ctype == 6);
       $ctype = "Real",    last SWITCH if($ctype == 7);
       $ctype = "Double",  last SWITCH if($ctype == 8);
       $ctype = "VarChar", last SWITCH if($ctype == 12);
   }
   $cprec = $sth->{PRECISION}->[$i-1];
   $cscale = $sth->{SCALE}->[$i-1];
   $cnull = $sth->{NULLABLE}->[$i-1];
   if ($cnull != 0)
   {
       $cnull = "Null";
   }
   else
   {
       $cnull = "Not Null";
   }
}
print "done!\n";
$sth->finish or die "I can't finish this for some reason!\n";
$dbh->disconnect;
return $ctype, $cprec, $cscale, $cnull;
}


When done using DBD:ODBC through the proxy, it works fine. But with 
DBD:Sybase, the metadata returned for items of type Float are a problem. 
They always come back with a Pecision of 8 and a Scale that is empty (null). 
Any ideas?

Thanks!

David Sevier
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com

Reply via email to