Basset

 view release on metacpan or  search on metacpan

lib/Basset/DB/Table.pm  view on Meta::CPAN

$test->is($bindable2{'baker'}, undef, 'baker is not update bindable');
$test->is($bindable2{'charlie'}, undef, 'charlie is not update bindable');
$test->is($bindable2{'delta'}, undef, 'delta is not update bindable');

=end btest

=cut

__PACKAGE__->add_attr('_cached_bindables');

sub update_bindables {
	my $self = shift;
	if (my $bindables = $self->_cached_bindables->{'update'}) {
		return @$bindables;
	} else {
        my @excess = $self->primary_cols;
		my @bindables = grep {$self->is_bindable('U', $_)} ($self->update_columns, @excess);
		$self->_cached_bindables->{'update'} = \@bindables;
		return @bindables;
	};
}

lib/Basset/DB/Table.pm  view on Meta::CPAN

	my $q = "update mytable set " . join(', ', map{$_ . ' = ' . ($_ eq 'able' ? 'lc(?)' : $_ eq 'baker' ? 'uc(?)' : '?')} @update);

	$test->is($o->update_query, $q, "got re-written default update query");

}

=end btest

=cut

sub update_query {
	my $self = shift;

	my @cols = @_;

	if (@cols){
		foreach my $col (@cols){
			return $self->error("Cannot update column not in table : $col", "BDT-06")
				unless $self->is_column($col);
		};
	} else {

lib/Basset/DB/Table/View.pm  view on Meta::CPAN

my $o = __PACKAGE__->new();
$test->ok($o, "got object");
$test->ok(! $o->replace_query, "Cannot call replace_query");
$test->is($o->errcode, "BDTV-02", "proper error code");

=end btest

=cut


sub update_query {
	return shift->error("Views cannot update", "BDTV-03");
}

=pod

=begin btest update_query

my $o = __PACKAGE__->new();
$test->ok($o, "got object");
$test->ok(! $o->update_query, "Cannot call update_query");



( run in 0.316 second using v1.01-cache-2.11-cpan-95122f20152 )