File: 03insert.t

package info (click to toggle)
libdbd-sqlite3-perl 1.08-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 1,984 kB
  • ctags: 2,870
  • sloc: ansic: 33,006; perl: 1,731; makefile: 44
file content (18 lines) | stat: -rw-r--r-- 657 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use Test;
use DBI;
BEGIN { plan tests => 10 }
my $dbh = DBI->connect("dbi:SQLite: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'));
my $unless_min_dbi =
    $DBI::VERSION < 1.43 ? 'last_insert_id requires DBI v1.43' : '';
skip($unless_min_dbi, $dbh->last_insert_id(undef, undef, undef, undef) );
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;