[Rt-commit] r3477 - in DBIx-SearchBuilder/trunk: . SearchBuilder
jesse at bestpractical.com
jesse at bestpractical.com
Thu Jul 14 20:43:40 EDT 2005
Author: jesse
Date: Thu Jul 14 20:43:40 2005
New Revision: 3477
Modified:
DBIx-SearchBuilder/trunk/ (props changed)
DBIx-SearchBuilder/trunk/SearchBuilder/Record.pm
Log:
r24179 at hualien: jesse | 2005-07-14 20:42:50 -0400
* More fleshing out of how validation is supposed to work
Modified: DBIx-SearchBuilder/trunk/SearchBuilder/Record.pm
==============================================================================
--- DBIx-SearchBuilder/trunk/SearchBuilder/Record.pm (original)
+++ DBIx-SearchBuilder/trunk/SearchBuilder/Record.pm Thu Jul 14 20:43:40 2005
@@ -855,9 +855,60 @@
return ( $ret->return_value );
}
+=head2 _Canonicalize PARAMHASH
+
+This routine massages an input value (VALUE) for FIELD into something that's
+going to be acceptable.
+
+Takes
+
+=over
+
+=item FIELD
+
+=item VALUE
+
+=item FUNCTION
+
+=back
+
+
+Takes:
+
+=over
+
+=item FIELD
+
+=item VALUE
+
+=item FUNCTION
+
+=back
+
+Returns a replacement VALUE.
+
+=cut
+
+sub _Canonicalize {
+ my $self = shift;
+ my $field = shift;
+
+
+
+}
+
+
+=head2 _Validate FIELD VALUE
+
+Validate that VALUE will be an acceptable value for FIELD.
+
+Currently, this routine does nothing whatsoever.
+
+If it succeeds (which is always the case right now), returns true. Otherwise returns false.
+
+=cut
-#TODO: Implement _Validate.
sub _Validate {
@@ -1205,25 +1256,25 @@
my ($key);
foreach $key ( keys %attribs ) {
- my $method = "Validate$key";
- if ( $self->_Accessible( $key, 'record-write') ) {
- $attribs{$key} = $attribs{$key}->id if UNIVERSAL::isa($attribs{$key}, 'DBIx::SearchBuilder::Record');
+ if ( $self->_Accessible( $key, 'record-write' ) ) {
+ $attribs{$key} = $attribs{$key}->id
+ if UNIVERSAL::isa( $attribs{$key},
+ 'DBIx::SearchBuilder::Record' );
}
- #Truncate things that are too long for their datatypes
- $attribs{$key} = $self->TruncateValue ($key => $attribs{$key});
+ #Truncate things that are too long for their datatypes
+ $attribs{$key} = $self->TruncateValue( $key => $attribs{$key} );
- unless ( $self->$method( $attribs{$key} ) ) {
- delete $attribs{$key};
- }
}
unless ( $self->_Handle->KnowsBLOBs ) {
+
# Support for databases which don't deal with LOBs automatically
my $ca = $self->_ClassAccessible();
foreach $key ( keys %attribs ) {
if ( $ca->{$key}->{'type'} =~ /^(text|longtext|clob|blob|lob)$/i ) {
- my $bhash = $self->_Handle->BLOBParams( $key, $ca->{$key}->{'type'} );
+ my $bhash =
+ $self->_Handle->BLOBParams( $key, $ca->{$key}->{'type'} );
$bhash->{'value'} = $attribs{$key};
$attribs{$key} = $bhash;
}
@@ -1233,7 +1284,6 @@
}
-
=head2 Delete
Delete this record from the database. On failure return a Class::ReturnValue with the error. On success, return 1;
More information about the Rt-commit
mailing list