[Rt-commit] r4113 - in Jifty-DBI/trunk: . lib/Jifty/DBI
alexmv at bestpractical.com
alexmv at bestpractical.com
Thu Nov 17 16:30:47 EST 2005
Author: alexmv
Date: Thu Nov 17 16:30:46 2005
New Revision: 4113
Modified:
Jifty-DBI/trunk/ (props changed)
Jifty-DBI/trunk/Changes
Jifty-DBI/trunk/META.yml
Jifty-DBI/trunk/lib/Jifty/DBI/Column.pm
Jifty-DBI/trunk/lib/Jifty/DBI/Record.pm
Jifty-DBI/trunk/lib/Jifty/DBI/Schema.pm
Jifty-DBI/trunk/lib/Jifty/DBI/SchemaGenerator.pm
Log:
r7247 at zoq-fot-pik: chmrr | 2005-11-17 16:30:02 -0500
* mandatory replaces not_null
* 'is' now works with subroutine refs, for instance
* Validators are always called in list context
Modified: Jifty-DBI/trunk/Changes
==============================================================================
--- Jifty-DBI/trunk/Changes (original)
+++ Jifty-DBI/trunk/Changes Thu Nov 17 16:30:46 2005
@@ -1,5 +1,7 @@
Revision history for Perl extension Jifty::DBI.
+* not_null has been replaced with mandatory
+
0.05_01 Tue Nov 8 16:29:02 EST 2005
* Initial release
Modified: Jifty-DBI/trunk/META.yml
==============================================================================
--- Jifty-DBI/trunk/META.yml (original)
+++ Jifty-DBI/trunk/META.yml Thu Nov 17 16:30:46 2005
@@ -1,5 +1,5 @@
name: Jifty-DBI
-version: 0.02
+version: 0.05_01
license: perl
distribution_type: module
build_requires:
@@ -12,7 +12,9 @@
UNIVERSAL::require: 0
Lingua::EN::Inflect: 0
Class::ReturnValue: 0.4
+ Class::Accessor: 0
Cache::Simple::TimedExpiry: 0.21
+ Data::Page: 0
DateTime: 0
DateTime::Format::Strptime: 0
no_index:
Modified: Jifty-DBI/trunk/lib/Jifty/DBI/Column.pm
==============================================================================
--- Jifty-DBI/trunk/lib/Jifty/DBI/Column.pm (original)
+++ Jifty-DBI/trunk/lib/Jifty/DBI/Column.pm Thu Nov 17 16:30:46 2005
@@ -14,7 +14,7 @@
validator
readable writable
length
- null
+ mandatory
refers_to by
alias_for_column
since until
Modified: Jifty-DBI/trunk/lib/Jifty/DBI/Record.pm
==============================================================================
--- Jifty-DBI/trunk/lib/Jifty/DBI/Record.pm (original)
+++ Jifty-DBI/trunk/lib/Jifty/DBI/Record.pm Thu Nov 17 16:30:46 2005
@@ -261,7 +261,7 @@
$column->writable(0);
$column->readable(1);
$column->type('serial');
- $column->null(0);
+ $column->mandatory(1);
}
}
@@ -511,7 +511,8 @@
}
my $method = "validate_" . $column->name;
- unless ( $self->$method( $args{'value'} ) ) {
+ my ($ok, $msg) = $self->$method( $args{'value'} );
+ unless ( $ok ) {
$ret->as_array( 0, 'Illegal value for ' . $column->name );
$ret->as_error(
errno => 3,
Modified: Jifty-DBI/trunk/lib/Jifty/DBI/Schema.pm
==============================================================================
--- Jifty-DBI/trunk/lib/Jifty/DBI/Schema.pm (original)
+++ Jifty-DBI/trunk/lib/Jifty/DBI/Schema.pm Thu Nov 17 16:30:46 2005
@@ -1,7 +1,7 @@
package Jifty::DBI::Schema;
use Exporter::Lite;
our @EXPORT
- = qw(column type default validator immutable unreadable length not_null valid_values label hints render_as since input_filters output_filters mandatory is by are on);
+ = qw(column type default validator immutable unreadable length mandatory valid_values label hints render_as since input_filters output_filters is by are on);
our $SCHEMA;
@@ -16,7 +16,6 @@
name => $name,
readable => 1,
writable => 1,
- null => 1,
@_,
);
my @original = @args;
@@ -77,8 +76,8 @@
return ( length => shift );
}
-sub not_null () {
- return ( [ null => 0 ] );
+sub mandatory () {
+ return ( [ mandatory => 1 ] );
}
sub input_filters ($) {
@@ -93,10 +92,6 @@
return ( since => shift );
}
-sub mandatory () {
- return ( [ mandatory => 1 ] );
-}
-
sub valid_values ($) {
return ( valid_values => shift );
}
@@ -115,7 +110,7 @@
sub is ($) {
my $thing = shift;
- return ref $thing ? @{$thing} : $thing;
+ return ref $thing eq "ARRAY" ? @{$thing} : $thing;
}
sub by ($) {
Modified: Jifty-DBI/trunk/lib/Jifty/DBI/SchemaGenerator.pm
==============================================================================
--- Jifty-DBI/trunk/lib/Jifty/DBI/SchemaGenerator.pm (original)
+++ Jifty-DBI/trunk/lib/Jifty/DBI/SchemaGenerator.pm Thu Nov 17 16:30:46 2005
@@ -201,7 +201,7 @@
DBIx::DBSchema::Column->new(
{ name => $column->name,
type => $column->type,
- null => $column->null,
+ null => $column->mandatory ? 0 : 1,
default => $column->default,
}
);
More information about the Rt-commit
mailing list