[Maypole] beerdb/postgres woes

From: Markus Spring (m.spring at gmx.de)
Date: Tue Oct 05 2004 - 11:47:44 BST


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi list,

again I have a problem getting Maypole to run with postgres. I suppose it's not
a Maypole problem and beg for pardon wasting bandwidth in this list, but
Maypoles debugging output is as sparse as the complexity of its OO, that I don't
know where the starting point for my problem is.

Using Maypole 1.7 and all supporting modules up-to-date, Maypole refuses to
insert a new record into the beer table in beerdb. Note that inserting a brewery
works fine, but there are no integer columns which can be left empty

The Apache Error log says:

[Tue Oct 5 10:59:51 2004] [error] Can't insert new BeerDB::Beer: DBD::Pg::st
execute failed: ERROR: invalid input syntax for integer: "" [for Statement
"INSERT INTO beer (abv, name, style, score, notes, id, brewery, price)\nVALUES
(?, ?, ?, ?, ?, ?, ?, ?)\n"] at
/usr/local/lib/perl5/site_perl/5.8.4/DBIx/ContextualFetch.pm line 51.\n at
/usr/local/lib/perl5/site_perl/5.8.4/Class/DBI/FromCGI.pm line 246\n

I inserted a debug statement into Class::DBI's sub _insert_row {, which tells me
that the attempted insert is run with the following data:

$VAR1 = {
~ 'abv' => '',
~ 'name' => 'Helles',
~ 'style' => '',
~ 'score' => '',
~ 'notes' => '',
~ 'id' => '3',
~ 'brewery' => '2',
~ 'price' => ''
~ };

This of course is wrong, as style and score are integer columns which refuse to
accept an empty string.

The header information for the request is:

http://beer.local/beer//beer/do_edit/

POST /beer//beer/do_edit/ HTTP/1.1
Content-Type: application/x-www-form-urlencoded
Content-Length: 82
action=create&name=Helles&brewery=2&style=&price=&score=&abv=&notes=&create=create

So at the moment I am stuck: I browsed Class::DBI::FromCGI and CGI::Untaint, but
found no line which could be hold responsible for creating an empty string
instead of undef for missing data.

Kind regards

Markus
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)

iD8DBQFBYnvQxxUzQSse11ARAjCvAJ9GI0Iu+XliBVZX4GyP0R2AgubfDwCffP44
vQxphteFlh90sVNdEk63zJU=
=Rk/l
-----END PGP SIGNATURE-----



_______________________________________________
maypole mailing list
maypole at lists.netthink.co.uk
http://lists.netthink.co.uk/listinfo/maypole



This archive was generated by hypermail 2.1.3 : Thu Feb 24 2005 - 22:25:56 GMT