Greetings, 

     I have redhat linux 7.2 running postgresql 7.1.3 and perl 5.6.0 with
many modules installed.  I have a postgresql database with all different
data-type columns in it, when I try to do a simple chart generation using
DBIx::Chart using just integers it works great, but when I specify a field
with a datatype other then integer (time, date, timestamp, varchar) I get
errors about an error:

"DBD::Chart::st execute failed: Non-numeric domain value 01:00:00. at
/usr/bin/perl5/site_perl/5.6.0/DBIx/Chart.pm line 527."

 

In my select statement if I change it to testtbl2 which has a mystamp as
integer and int as integer it works fine.

Here is my code:

########START_CODE#####

#!/usr/bin/perl

 

use strict;

use DBIx::Chart;

use DBI qw(:sql_types);

 

my $dbhtb = DBIx::Chart->connect('dbi:Pg:dbname=AS5400LOGS', 'test', 'test')
or die "Can't connect";

 

#my $buf;

 

sub dump_img

{

    my ($row, $fmt, $fname) = @_;

    open (OUTF, ">t$fname.$fmt");

    binmode  OUTF;

    print OUTF $$row[0];

    close OUTF;

 

}

 

#my $sth = $dbhtb->prepare("SELECT mystamp,int FROM testtbl1 RETURNING
LINEGRAPH(mystamp,int) WHERE #X_AXIS='Modems Available' AND Y_AXIS='Time'
AND SHOWGRID=1 AND SHOWPOINTS=1 AND WIDTH=400 AND #HEIGHT=400 AND
TITLE='Modems Available'AND FORMAT='PNG'", {chart_type_map => [ { NAME =>
'mystamp', #TYPE => SQL_TIME }, { NAME => 'int', TYPE => SQL_INTEGER }]});

    

my $sth = $dbhtb->prepare("SELECT mystamp, int FROM testtbl1

RETURNING LINEGRAPH(*) 

WHERE X_AXIS='Modems Available' 

AND Y_AXIS='Time' 

AND SHOWGRID=1 

AND SHOWPOINTS=1 

AND WIDTH=400 

AND HEIGHT=400 

AND TITLE='Modems Available' 

AND COLOR IN ('red','green') 

AND BACKGROUND='lgray' 

AND FORMAT='PNG'");

 

$sth->execute;

 

my $row = $sth->fetchrow_arrayref;

dump_img($row, 'png', 'testimage1');

 

$sth->finish;

$dbhtb->disconnect;

########ENDCODE#######

Reply via email to