Class::DBI::Cascade::None(3pm) User Contributed Perl Documentation Class::DBI::Cascade::None(3pm)NAME
Class::DBI::Cascade::None - Do nothing upon deletion
DESCRIPTION
This is a Cascading Delete strategy that will do nothing, leaving orphaned records behind.
It is the base class for most ofther Cascade strategies, and so provides several important methods:
CONSTRUCTOR
new
my $strategy = Cascade::Class->new($Relationship);
This must be instantiated with a Class::DBI::Relationship object.
METHODS
foreign_for
my $iterator = $strategy->foreign_for($obj);
This will return all the objects which are foreign to $obj across the relationship. It's a normal Class::DBI search you can get the results
either as a list or as an iterator.
cascade
$strategy->cascade($obj);
Cascade across the related objects to $obj.
WRITING NEW STRATEGIES
Creating a Cascade strategy should be fairly simple. You usually just need to inherit from here, and then supply a cascade() method that
does the required thing with the results from foreign_for().
So, for example, Cascade::Delete is implemented simply as:
package Class::DBI::Cascade::Delete;
use base 'Class::DBI::Cascade::None';
sub cascade {
my ($self, $obj) = @_;
$self->foreign_for($obj)->delete_all;
}
perl v5.12.4 2005-09-14 Class::DBI::Cascade::None(3pm)
Check Out this Related Man Page
Class::DBI::Search::Basic(3pm) User Contributed Perl Documentation Class::DBI::Search::Basic(3pm)NAME
Class::DBI::Search::Basic - Simple Class::DBI search
SYNOPSIS
my $searcher = Class::DBI::Search::Basic->new(
$cdbi_class, @search_args
);
my @results = $searcher->run_search;
# Over in your Class::DBI subclass:
__PACKAGE__->add_searcher(
search => "Class::DBI::Search::Basic",
isearch => "Class::DBI::Search::Plugin::CaseInsensitive",
);
DESCRIPTION
This is the start of a pluggable Search infrastructure for Class::DBI.
At the minute Class::DBI::Search::Basic doubles up as both the default search within Class::DBI as well as the search base class. We will
probably need to tease this apart more later and create an abstract base class for search plugins.
METHODS
new
my $searcher = Class::DBI::Search::Basic->new(
$cdbi_class, @search_args
);
A Searcher is created with the class to which the results will belong, and the arguments passed to the search call by the user.
opt
if (my $order = $self->opt('order_by')) { ... }
The arguments passed to search may contain an options hash. This will return the value of a given option.
run_search
my @results = $searcher->run_search;
my $iterator = $searcher->run_search;
Actually run the search.
SUBCLASSING
sql / bind / fragment
The actual mechanics of generating the SQL and executing it split up into a variety of methods for you to override.
run_search() is implemented as:
return $cdbi->sth_to_objects($self->sql, $self->bind);
Where sql() is
$cdbi->sql_Retrieve($self->fragment);
There are also a variety of private methods underneath this that could be overridden in a pinch, but if you need to do this I'd rather you
let me know so that I can make them public, or at least so that I don't remove them from under your feet.
perl v5.12.4 2011-08-10 Class::DBI::Search::Basic(3pm)
Hi there, I wonder if somebody could help me out, i have a written a DBI perl snippet using fetchall_arrayref() that i want to use to populate a simple standard array with the results of a query
#!/usr/bin/perl -w
use DBI;
my $dbh =... (3 Replies)
Hi Guys,
I wonder if possible to execute a Db2 commands within a perl scripts without installing or invoking the DBI modules. I have a script that is written in kron shell and it looks like :
DB=`db2 list db directory | egrep "Database alias|Directory entry type"|awk '{printf $0 ;... (0 Replies)
Hi All,
I installed DBI module in a non INC location and using it in my script via "use lib".
But it throw the below error at the "use DBI" step.
Please help
Usage: DBI::_install_method(dbi_class, meth_name, file, attribs=Nullsv) at /xx/xxx/xxxxx/xxxxx/oracle/lib/DBI.pm/oracle/lib/DBI.pm line... (2 Replies)
I have PERL code to connect to Oracle database using DBI.
e.g.
$PERL -e "use DBI; DBI->connect(qw(DBI:Oracle:db111 testu testpass));"
by using DBI , if remote DB added to tnsnames.ora , I can connect using DBI . is there a way to restrict not to connect to remote DB using DBI ?
... (1 Reply)