DBD-Spanner
view release on metacpan or search on metacpan
t/26execute_array.t view on Meta::CPAN
use DBI;
my $dbh = DBI->connect('dbi:Spanner:projects/p/instances/i/databases/d', '', '');
my $sth = $dbh->prepare('INSERT INTO users (id, val) VALUES (?, ?)');
my @col1 = (10, 20, 30);
my @col2 = ('a', 'b', 'c');
$sth->bind_param_array(1, \@col1);
$sth->bind_param_array(2, \@col2);
my $tuples = $sth->execute_array({ ArrayTupleStatus => [] });
is($tuples, 3, 'execute_array processed 3 tuples');
ok($sth, 'Statement handle active after batch execution');
ok($dbh->ping(), 'Connection alive after batch execution');
t/end-to-end/01-live-connection.t view on Meta::CPAN
}
plan tests => 3;
$ENV{GOOGLE_APPLICATION_CREDENTIALS} = $creds if $creds && -f $creds;
my $dbh = DBI->connect("dbi:Spanner:$db_path", '', '', { RaiseError => 1 });
ok($dbh, 'Connected to live Cloud Spanner instance');
ok($dbh->ping(), 'Live ping succeeded');
my $sth = $dbh->prepare('SELECT 1 AS alive');
$sth->execute();
my $row = $sth->fetchrow_arrayref();
is($row->[0], 1, 'Fetched live SELECT 1 result');
( run in 1.766 second using v1.01-cache-2.11-cpan-14f38c9f855 )