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;
( run in 0.320 second using v1.01-cache-2.11-cpan-4d4bc49f3ae )