CallBackery

 view release on metacpan or  search on metacpan

lib/CallBackery/Database.pm  view on Meta::CPAN

    return $id;
}

=item $id = $self->C<updateOrInsertData(table,data,match?)>

Insert the given data into the table. If a match map is given, try an update first
with the given match only insert when update has 0 hits.

=cut

sub updateOrInsertData {
    my $self = shift;
    my $table = shift;
    my $data = shift;
    my $match = shift;
    my $db = $self->mojoSqlDb;
    my ($colNames,$colValues) = $self->map2sql($table,$data);
    my $sqlTable = $db->dbh->quote_identifier($table);
    my $sqlIdCol = $db->dbh->quote_identifier($table."_id");
    my $sqlColumns = join ', ', @$colNames;
    my $sqlSet = join ', ', map { "$_ = ?" } @$colNames;

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 0.518 second using v1.00-cache-2.02-grep-82fe00e-cpan-4673cadbf75 )