Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
51 lines (33 sloc) 967 Bytes
#!/usr/bin/perl
use strict;
use warnings;
use 5.010;
use Test::Most;
use testlib;
use DBI;
use DBD::Pg;
use Path::Class qw(file dir);
use Time::HiRes qw(time);
testlib->check_pg_9_5;
my $tsv = testlib->tsv;
my $dbh = testlib->dbh;
cmp_ok(testlib->truncate_all(), '==', 0, 'table truncate');
testlib->insert_or_update_row(\&insert_or_update);
testlib->test_table_dump;
done_testing();
sub insert_or_update {
my ($row_data) = @_;
return unless $row_data;
my @bind_params = @$row_data{qw(title num meta ident)};
state $sth_i =
$dbh->prepare('INSERT INTO pg_n_pl_bulking (title,num,meta,ident) VALUES (?,?,?,?)'
. ' ON CONFLICT (ident) DO'
. ' UPDATE SET title=EXCLUDED.title, num=EXCLUDED.num, meta=EXCLUDED.meta');
$sth_i->execute(@bind_params);
}
__END__
=head1 NAME
03_insert-data_standard.t - do basic update and inserts statements
=head1 SYNOPSIS
prove -l -v t/03_insert-data_standard.t
=cut
You can’t perform that action at this time.