Hi people,
Having a problem with a script 
that  connects to a mysql db and generates a png graph. 
When i run it i get the desired result but i also get the following error

Name "DBIx::Chart" used only once: possible typo at gp line 8.
DBI handle has uncleared implementors data at gp line 16.
dbih_clearcom (sth 0x851aa5c 0x85489d0, com 0x8548ae0, imp DBD::mysql::st):
FLAGS 0x113: COMSET IMPSET Warn PrintError 
PARENT DBIx::Chart::db=HASH(0x85420c4)
KIDS 0 (0 Active)
IMP_DATA undef
NUM_OF_FIELDS 3
NUM_OF_PARAMS 0


SCHEMA
+-----------+-------------+------+-----+------------+-------+
| Field     | Type        | Null | Key | Default    | Extra |
+-----------+-------------+------+-----+------------+-------+
| ip        | varchar(20) |      | PRI |            |       |
| interface | varchar(25) |      | PRI |            |       |
| ndate     | date        |      | PRI | 0000-00-00 |       |
| ntime     | time        |      | PRI | 00:00:00   |       |
| bin       | int(11)     | YES  |     | NULL       |       |
| bout      | int(11)     | YES  |     | NULL       |       |
+-----------+-------------+------+-----+------------+-------+

DATA
       ip        int          ndate   ntime     bin     bout
 10.151.1.254    fe0/1    2004-03-20  04:30:00   0   0 
10.151.1.254   s0/1   2004-03-20      04:30:00  33  44
138.198.1.254 fe0/0    2004-03-20  04:30:00  455 455      

#! /usr/bin/perl

use strict;
use warnings;
use DBIx::Chart;

my $db = "DBI:mysql:ndb";
my $dbh = DBIx::Chart->connect($db,'esm','esm') or die "Can't connect 
+to database: $DBIx::Chart->errstr!";
my $ip= $dbh->quote('xxx.xxx.xxx.xxx');
my $int = $dbh->quote('s0/0');
my $dt = $dbh->quote('2004-03-21');

my $sth = $dbh->selectrow_arrayref("SELECT ntime,bin,bout from bw_dail
+y where ndate=".$dt." and ip=".$ip." and interface=".$int." RETURNING
+ LINEGRAPH(ntime,bin,bout) WHERE width=500 and height=250 and title='
+weekly bandwidth utilization graph' and colors in ('red','blue') and 
+background = 'lgray' and x-axis='time' and y-axis='bandwidth' and sig
+nature='[EMAIL PROTECTED]' "); 
#$sth->bind_param(1,$dt);
#$sth->execute;
open(FI, ">gp1.png");
binmode FI;
print FI $$sth[0];
close FI;
$dbh->disconnect;
exit 0;


1 .Do i need to explicitly close the statement handle? how do i get rid of the error 
2. Code review? Can i use placeholders in selectrow_arrayref with RETURNING LINEGRAPH? 
Thanks. 
Regards, 
chimni 

Reply via email to