[Bast-commits] r4027 - in trunk/DBIx-Class-HTMLWidget: .
lib/DBIx/Class
omega at dev.catalyst.perl.org
omega at dev.catalyst.perl.org
Tue Feb 5 09:53:40 GMT 2008
Author: omega
Date: 2008-02-05 09:53:39 +0000 (Tue, 05 Feb 2008)
New Revision: 4027
Modified:
trunk/DBIx-Class-HTMLWidget/Changes
trunk/DBIx-Class-HTMLWidget/lib/DBIx/Class/HTMLWidget.pm
Log:
0.12: Fix a problem with not null and undef checkboxes
Modified: trunk/DBIx-Class-HTMLWidget/Changes
===================================================================
--- trunk/DBIx-Class-HTMLWidget/Changes 2008-02-05 08:55:39 UTC (rev 4026)
+++ trunk/DBIx-Class-HTMLWidget/Changes 2008-02-05 09:53:39 UTC (rev 4027)
@@ -1,4 +1,7 @@
Revision history for DBIx-Class-HTMLWidget
+0.12 2008-02-05
+ - Special case columns data_type => boolean, is_nullable => 0 for postgres, as they
+ can't handle undef as value, they need 0.
0.11
- Backwards incompatible change: If an element has a value when fill_form is run, it
will not be overwritten with a new value.
Modified: trunk/DBIx-Class-HTMLWidget/lib/DBIx/Class/HTMLWidget.pm
===================================================================
--- trunk/DBIx-Class-HTMLWidget/lib/DBIx/Class/HTMLWidget.pm 2008-02-05 08:55:39 UTC (rev 4026)
+++ trunk/DBIx-Class-HTMLWidget/lib/DBIx/Class/HTMLWidget.pm 2008-02-05 09:53:39 UTC (rev 4027)
@@ -2,8 +2,9 @@
use strict;
use warnings;
use Carp;
+use Data::Dump qw(dump);
-our $VERSION = '0.11';
+our $VERSION = '0.12';
# pod after __END__
sub fill_widget {
@@ -53,6 +54,13 @@
$dbic->$col(undef);
$value = undef;
}
+ if ($col_info->{data_type} and $col_info->{data_type} =~ m/boolean/i
+ && exists $col_info->{is_nullable} && !$col_info->{is_nullable}
+ && exists $cb{$col} && !defined($value)
+ && $dbic->result_source->schema->storage->sqlt_type eq 'PostgreSQL') {
+ # We need to set the value to 0 if it is postgres
+ $value = 0;
+ }
$dbic->$col($value)
if defined $value || exists $cb{$col};
}
@@ -169,6 +177,17 @@
Create or update a DBIx::Class row from a HTML::Widget::Result object
+=head1 CAEVATS / POSSIBLE PROBLEMS
+
+=head2 PostgreSQL
+
+=head3 ERROR: null value in column "private" violates not-null constraint
+
+This is a result of we trying to set a value to undef that should not be. This is typicaly
+a problem when you have a colum such ass "private boolean not null". We have a special-case
+for this, and if you set data_type => boolean, is_nullable => 0 in your ResultSource definition,
+we update the value to 0 before attempting to insert or update
+
=head1 AUTHORS
Thomas Klausner, <domm at cpan.org>, http://domm.zsi.at
More information about the Bast-commits
mailing list