DBD::Chart::st execute failed

------_=_NextPart_001_01C72F3D.76A2891F
Content-Type: text/plain;
charset="windows-1250"
Content-Transfer-Encoding: quoted-printable



Whenever when I try to plot a percentage value, I get these erros.



DBD::Chart::st execute failed: Supplied value not compatible with target =
field at parameter 1. at gv_ind_1_18.pl line 147.

Can't take log of -2e+38 at =
/usr/lib/perl5/site_perl/5.8.0/DBD/Chart/Plot.pm line 1591.



My data type is set to Float



$dbh->do('CREATE CHART tb_serie_1 (HORA CHAR(30), serie_1 FLOAT)');

$sth =3D $dbh->prepare('INSERT INTO tb_serie_1 VALUES( ?, ?)');

$sth->func(1, \ [at] SERIES_CAT, chart_bind_param_array);

$sth->func(2, \ [at] SERIES_VAL_1, chart_bind_param_array);

%stsary =3D ();

$sth->func(\%stsary, chart_bind_param_status);

$sth->execute;

$sth->finish();



Then I tried to change the data type to DECIMAL with no avail.



To solve this problem I have to multiply the SERIES_CAT by 10, but the =
value shown in my graph is not the correct percentage, once the values =
are multiplied by 10.



Any Idea how I can solve this problem?



Thanks in advance.



BR=92s



Thiago






--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.432 / Virus Database: 268.16.3/614 - Release Date: 2/1/2007 =
14:58


------_=_NextPart_001_01C72F3D.76A2891F--
tzago [ Mi, 03 Januar 2007 14:45 ] [ ID #1583942 ]

RE: DBD::Chart::st execute failed

------_=_NextPart_001_01C72F3F.AE7E6D1E
Content-Type: text/plain;
charset="windows-1250"
Content-Transfer-Encoding: quoted-printable



I=92mean multiply SERIES_VAL_1 by 10 and not SERIES_CAT as mentioned =
before.





Tks!



Thiago

_____

From: THIAGO LACERDA ZAGO
Sent: quarta-feira, 3 de janeiro de 2007 11:46
To: 'Dean Arnold'
Cc: dbi-users [at] perl.org
Subject: DBD::Chart::st execute failed





Whenever when I try to plot a percentage value, I get these erros.



DBD::Chart::st execute failed: Supplied value not compatible with target =
field at parameter 1. at gv_ind_1_18.pl line 147.

Can't take log of -2e+38 at =
/usr/lib/perl5/site_perl/5.8.0/DBD/Chart/Plot.pm line 1591.



My data type is set to Float



$dbh->do('CREATE CHART tb_serie_1 (HORA CHAR(30), serie_1 FLOAT)');

$sth =3D $dbh->prepare('INSERT INTO tb_serie_1 VALUES( ?, ?)');

$sth->func(1, \ [at] SERIES_CAT, chart_bind_param_array);

$sth->func(2, \ [at] SERIES_VAL_1, chart_bind_param_array);

%stsary =3D ();

$sth->func(\%stsary, chart_bind_param_status);

$sth->execute;

$sth->finish();



Then I tried to change the data type to DECIMAL with no avail.



To solve this problem I have to multiply the SERIES_CAT by 10, but the =
value shown in my graph is not the correct percentage, once the values =
are multiplied by 10.



Any Idea how I can solve this problem?



Thanks in advance.



BR=92s



Thiago






--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.432 / Virus Database: 268.16.3/614 - Release Date: 2/1/2007 =
14:58



--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.432 / Virus Database: 268.16.3/614 - Release Date: 2/1/2007 =
14:58


------_=_NextPart_001_01C72F3F.AE7E6D1E--
tzago [ Mi, 03 Januar 2007 15:01 ] [ ID #1583943 ]

Re: DBD::Chart::st execute failed

THIAGO LACERDA ZAGO wrote:
>
>
> Whenever when I try to plot a percentage value, I get these erros.
>
> DBD::Chart::st execute failed: Supplied value not compatible with target field at parameter 1.
> at gv_ind_1_18.pl line 147.
>
> Can't take log of -2e+38 at /usr/lib/perl5/site_perl/5.8.0/DBD/Chart/Plot.pm line 1591.
>
>
> My data type is set to Float
>
> $dbh->do('CREATE CHART tb_serie_1 (HORA CHAR(30), serie_1 FLOAT)');
>
> $sth = $dbh->prepare('INSERT INTO tb_serie_1 VALUES( ?, ?)');
>
> $sth->func(1, \ [at] SERIES_CAT, chart_bind_param_array);
>
> $sth->func(2, \ [at] SERIES_VAL_1, chart_bind_param_array);
>
> %stsary = ();
>
> $sth->func(\%stsary, chart_bind_param_status);
>
> $sth->execute;
>
> $sth->finish();
>

What version of DBD::Chart are you using ?

How big are the arrays you're binding ?

Do you know which value is causing the error ?
Can you send the list of values you're trying to
bind ? (Send to me directly, preferably not to the
dbi list)

Regards,
Dean Arnold
Presicient Corp.
darnold [ Mi, 03 Januar 2007 18:53 ] [ ID #1583945 ]

Re: DBD::Chart::st execute failed

THIAGO LACERDA ZAGO wrote:
> Good morning!
>
> Dean,
>
> I'm using DBD::Chart version that I downloaded from I don't remember exactly where, but it is this one: DBD-Chart-0.82.tar.gz.
> I read thoroughly the README.txt file and proceeded exactly as its recommendations.
>
> The array bond is the size of 20 values length.
>

The issue is the use of the comma as the decimal separator.
The regex I borrowed to validate float/decimal values doesn't
support it. I also suspect it will confuse Perl, e.g., run:

perl -e "$x = '0,5'; print 124 * $x, qq/\n/;"

and you'll likely get undesired results. Keep in mind that something
like "1,234,567" might also be interpretted as a float/decimal...but
whether its 1234567 or 1234.567 is a bit nebulous as well.

So you have 2 options:

1. Change your numbers to use a period instead of comma for the decimal point.

2 Hack your copy of Chart.pm at line 1663 to change

($p=~/^[\-\+]?\d+(\.\d+(E[\-\+]?\d+)?)?$/i));

to

($p=~/^[\-\+]?\d+([\.,]\d+(E[\-\+]?\d+)?)?$/i));

However, I can't be certain the latter won't break something
later during evaluation...I'll leave that to you to test.

Dean Arnold
Presicient Corp.
darnold [ Do, 04 Januar 2007 18:38 ] [ ID #1585132 ]

Re: DBD::Chart::st execute failed

THIAGO LACERDA ZAGO wrote:
> Good evening!
>
> Dean,
>
> Actually, the values I sent to you were not from my perl print function,
> it was from the result of my TOAD query.
>

<snip>

>
> As you can see, [at] SERIES_VAL_1 is filled right in the Fetch loop above.
>
> The print result is shown bellow.
>
> serie_1 = 0
> serie_1 = .72
> serie_1 = 0
> serie_1 = 0
> serie_1 = .68
> serie_1 = .98

<snip>

OK, it looks like its the fractionals wo/ leading zero. Which is a bug
in DBD::Chart.

So rather than modifying the regex, here's some patches to replace
it with a better test:

At Chart.pm line 1570, change

use DBI qw(:sql_types);

to

use DBI qw(:sql_types looks_like_number);

At line 1663, change

($p=~/^[\-\+]?\d+(\.\d+(E[\-\+]?\d+)?)?$/i));

to

(looks_like_number($p))[0]);


That seems to fix it for me.

- Dean
darnold [ Do, 04 Januar 2007 19:55 ] [ ID #1585133 ]
Perl » perl.dbi.users » DBD::Chart::st execute failed

Vorheriges Thema: make test DBD::Sybase fails
Nächstes Thema: DBD::Chart copying and pasting...