[Maypole] beerdb/postgres woes

Markus Spring m.spring@gmx.de
Tue, 05 Oct 2004 12:47:44 +0200


This is a multi-part message in MIME format.
--------------020209070903020003030200
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

-----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-----

--------------020209070903020003030200
Content-Type: text/x-vcard; charset=utf-8;
 name="springm.vcf"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="springm.vcf"

begin:vcard
fn:Markus Spring
n:Spring;Markus
org;quoted-printable:RGU-UW11;Referat f=C3=BCr Gesundheit und Umwelt/Department of Health and Environme=
	nt
adr;quoted-printable:;;Bayerstr. 28a;M=C3=BCnchen;;D-80335;Germany
email;internet:m.spring@gmx.de
title:Baurat
tel;work:+49 89 233 47716
tel;fax:+49 89 233 47705
tel;cell:+49 163 87 51110
x-mozilla-html:FALSE
version:2.1
end:vcard


--------------020209070903020003030200--