From 833895f46fdd117b0416acff264041af2ce6f46a Mon Sep 17 00:00:00 2001 From: Aaron Trevena Date: Sun, 16 Jul 2006 21:29:20 +0000 Subject: [PATCH] db_colinfo now works with (my) sqlite, uncommented perldoc for 'undocumented' validate method and labelled it experimental git-svn-id: http://svn.maypole.perl.org/Maypole/trunk@509 48953598-375a-da11-a14b-00016c27c3ee --- lib/Maypole/Model/CDBI/FromCGI.pm | 28 ++++++++++++++++------------ t/db_colinfo.t | 13 +++++++++---- 2 files changed, 25 insertions(+), 16 deletions(-) diff --git a/lib/Maypole/Model/CDBI/FromCGI.pm b/lib/Maypole/Model/CDBI/FromCGI.pm index 8c28c2c..c5ad458 100644 --- a/lib/Maypole/Model/CDBI/FromCGI.pm +++ b/lib/Maypole/Model/CDBI/FromCGI.pm @@ -342,18 +342,22 @@ sub validate_all { } -# validate_inputs undocumented. It is not yet part of the public interface. -#=head2 validate_inputs -# -#$self->validate_inputs($h, $opts); -# -#This is the main validation method to validate inputs for a single class. -#Most of the time you use validate_all. -# -# Returns validated and errors. -# If no errors then undef in that slot. -# -#=cut + +=head2 validate_inputs + +$self->validate_inputs($h, $opts); + +This is the main validation method to validate inputs for a single class. +Most of the time you use validate_all. + +Returns validated and errors. + +If no errors then undef in that slot. + +Note: This method is currently experimental (in 2.11) and may be subject to change +without notice. + +=cut sub validate_inputs { my ($self, $h, $opts) = @_; diff --git a/t/db_colinfo.t b/t/db_colinfo.t index ef2466f..ed526fc 100755 --- a/t/db_colinfo.t +++ b/t/db_colinfo.t @@ -48,7 +48,7 @@ create table $table ( created => 'CURRENT_TIMESTAMP', modified => undef, style => 1, - name => 'noname', + name => 'noname', ); # correct nullables @@ -56,7 +56,7 @@ create table $table ( brewery => 1, modified => 1, style => 0, - name => 0, + name => 0, tasted => 0, ); @@ -66,6 +66,8 @@ create table $table ( sub run_method_tests { ($class, $method, %correct) = @_; for $col (sort keys %correct) { +# warn "class : $class\n"; +# warn "ISA : ", join(', ',@BeerDB::BeerTestmysql::ISA); $val = $class->$method($col); # Hacks for various val types @@ -110,7 +112,7 @@ SKIP: { skip $skip_msg, $skip_howmany if $err; $DB_Class->db_Main->do("drop table if exists $table;"); $DB_Class->db_Main->do($sql); - $DB_Class->table($table); + $DB_Class->table($table); run_method_tests($DB_Class,'column_type', %correct_types); run_method_tests($DB_Class,'column_default', %correct_defaults); run_method_tests($DB_Class,'column_nullable', %correct_nullables); @@ -121,6 +123,7 @@ SKIP: { package BeerDB::BeerTestsqlite; use base Maypole::Model::CDBI; package main; +use Cwd; $DB_Class = 'BeerDB::BeerTestsqlite'; @@ -133,7 +136,9 @@ if ( !-e "t/test.db" ) { } unless ($err) { my $driver = sqlite_driver(); - eval { $DB_Class->connection("dbi:$driver:dbname='t/test.db'");}; + warn "using driver : $driver"; + my $cwd = cwd; + eval { $DB_Class->connection("dbi:$driver:dbname=$cwd/t/test.db");}; $err = $@; } -- 2.39.2