Class-DBI-Frozen-301
view release on metacpan or search on metacpan
- Bug with setting driver defaults [Jay Strauss + Schwern]
- Bug where selecting a column that was only in 'All' group also
attempted to fetch any TEMP columns. [Dominic Mitchell]
Removal of Functionality
- Undocumented ordered_search method has been removed in favour of
order_by option to search.
- Undocumented make_filter method removed in favour of add_constructor
- add_constructor no longer does (undocumented) %s substitutions
- (undocumented) single_value_select() method no longer takes raw
SQL fragments.
0.92 Sat Apr 12 2003
New Functionality
- classes named after reserved SQL words can now supply a
table_alias either directly, or as a second argument to table().
Deprecations
- hasa() now calls has_a() with a warning. It will disappear
completely in a forthcoming release.
Makefile.PL view on Meta::CPAN
0.95 - Breaking the encapsulation of an object (e.g. assuming that
the value for the 'title' column will be stored internally in
$object->{'title'} will stop working in a forthcoming release.
Relying on this behaviour is a Bad Thing, and you should fix it
now! (This also applies to before_create triggers, where
previously it was the supported approach.)
0.93 - Undocumented ordered_search() method no longer exists
- Undocumented make_filter() method no longer exists
- Undocumented option for add_constructor to do %s subitutions removed
- single_value_select() no longer takes raw SQL fragments
0.91 - on_setting() trigger point replaced by new individual column
triggers (see documentation on constraints)
- runtime database errors now throw exceptions
- all errors standardised so on_failed_create no longer needed
- objects now overload in string or boolean context
0.90 - hasa is now deprecated in favour of has_a. Therefore
has_many no longer creates reciprocal hasa relationship.
lib/Class/DBI/Frozen/301.pm view on Meta::CPAN
my (@cols, @vals);
my $search_opts = @args % 2 ? pop @args : {};
while (my ($col, $val) = splice @args, 0, 2) {
my $column = $class->find_column($col)
|| (List::Util::first { $_->accessor eq $col } $class->columns)
|| $class->_croak("$col is not a column of $class");
push @cols, $column;
push @vals, $class->_deflated_column($column, $val);
}
my $frag = join " AND ",
map defined($vals[$_]) ? "$cols[$_] $search_type ?" : "$cols[$_] IS NULL",
0 .. $#cols;
$frag .= " ORDER BY $search_opts->{order_by}"
if $search_opts->{order_by};
return $class->sth_to_objects($class->sql_Retrieve($frag),
[ grep defined, @vals ]);
}
#----------------------------------------------------------------------
# CONSTRUCTORS
#----------------------------------------------------------------------
sub add_constructor {
my ($class, $method, $fragment) = @_;
return $class->_croak("constructors needs a name") unless $method;
no strict 'refs';
my $meth = "$class\::$method";
return $class->_carp("$method already exists in $class")
if *$meth{CODE};
*$meth = sub {
my $self = shift;
$self->sth_to_objects($self->sql_Retrieve($fragment), \@_);
};
}
sub sth_to_objects {
my ($class, $sth, $args) = @_;
$class->_croak("sth_to_objects needs a statement handle") unless $sth;
unless (UNIVERSAL::isa($sth => "DBI::st")) {
my $meth = "sql_$sth";
$sth = $class->$meth();
}
( run in 2.193 seconds using v1.01-cache-2.11-cpan-364913b4093 )