File: 03insert.t

package info (click to toggle)
libdbd-sqlite2-perl 2%3A0.38-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster
  • size: 1,692 kB
  • sloc: ansic: 27,895; perl: 1,730; makefile: 12
file content (15 lines) | stat: -rw-r--r-- 493 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use Test;
BEGIN { plan tests => 9 }
use DBI;
my $dbh = DBI->connect("dbi:SQLite2:dbname=foo", "", "");
ok($dbh);
my $sth = $dbh->prepare("INSERT INTO f VALUES (?, ?, ?)");
ok($sth);
ok(my $rows = $sth->execute("Fred", "Bloggs", "fred\@bloggs.com"));
ok($rows == 1);
ok($dbh->func('last_insert_rowid'));
ok($sth->execute("test", "test", "1"));
ok($sth->execute("test", "test", "2"));
ok($sth->execute("test", "test", "3"));
ok($dbh->do("delete from f where f1='test'") == 3);
$dbh->disconnect;