DBIx-QuickORM

 view release on metacpan or  search on metacpan

lib/DBIx/QuickORM/Connection.pm  view on Meta::CPAN

sub any      { my $self = shift; $self->handle(@_)->any }
sub first    { my $self = shift; $self->handle(@_)->first }
sub one      { my $self = shift; $self->handle(@_)->one }
sub count    { my $self = shift; $self->handle(@_)->count }
sub delete   { my $self = shift; $self->handle(@_)->delete }

sub by_id   { my $self = shift; my $arg = pop; $self->handle(@_)->by_id($arg) }
sub iterate { my $self = shift; my $arg = pop; $self->handle(@_)->iterate($arg) }
sub insert  { my $self = shift; my $arg = pop; $self->handle(@_)->insert($arg) }
sub vivify  { my $self = shift; my $arg = pop; $self->handle(@_)->vivify($arg) }
sub update  { my $self = shift; my $arg = pop; $self->handle(@_)->update($arg) }

sub update_or_insert { my $self = shift; my $arg = pop; $self->handle(@_)->upsert($arg) }
sub find_or_insert   { my $self = shift; my $arg = pop; my $h = $self->handle(@_); $h->one($arg) // $h->insert($arg) }

=pod

=item $rows_arrayref = $con->by_ids($source, @ids)

Fetch rows in the specified source by their ids.

B<NOTE:> If all the specified rows are already cached, no DB query will occur.

lib/DBIx/QuickORM/Handle.pm  view on Meta::CPAN

        );
    }

    return $sth unless $sync;

    $finish->($sth->dbh, $sth->sth);

    return undef;
}

sub update {
    my $changes;
    my $self = shift->_row_or_hashref(sub {$changes = pop; $_[0]}, @_);

    my $con = $self->{+CONNECTION};
    $con->pid_and_async_check;

    croak "update() with data_only set is not currently supported"        if $self->{+DATA_ONLY};
    croak "update() with a 'limit' clause is not currently supported"     if $self->{+LIMIT};
    croak "update() with an 'order_by' clause is not currently supported" if $self->{+ORDER_BY};

lib/DBIx/QuickORM/Join/Row.pm  view on Meta::CPAN

=item $row = $row->save

=item $row = $row->delete

Apply the operation to every sub-row and return self.

=back

=cut

sub update {
    my $self = shift;
    croak "Not Implemented";
}

sub insert {
    my $self = shift;
    croak "Not Implemented";
}

sub insert_or_save {

lib/DBIx/QuickORM/Row.pm  view on Meta::CPAN


sub delete {
    my $self = shift;

    $self->check_pk;

    croak "This row is not in the database yet" unless $self->is_stored;
    return $self->connection->handle($self)->delete;
}

sub update {
    my $self = shift;

    my $changes;
    if (@_ == 1) {
        ($changes) = @_;
    }
    else {
        $changes = {@_};
    }

lib/DBIx/QuickORM/RowManager.pm  view on Meta::CPAN


    my $state = $self->_state(stored => $fetched, pending => undef);

    $row->{+ROW_DATA}->change_state($state) if $row;

    $row //= $self->_vivify($source, $state);

    return $row;
}

sub update {
    my $self = shift;
    my ($source, $fetched, $old_pk, $new_pk, $row) = $self->parse_params({@_});

    $row = $self->do_update($source, $fetched, $old_pk, $new_pk, $row);
    $self->cache($source, $row, $old_pk, $new_pk);

    return $row;
}

sub do_update {



( run in 2.425 seconds using v1.01-cache-2.11-cpan-99c4e6809bf )