Skip to content

Instantly share code, notes, and snippets.

@schwern

schwern/test.pl Secret

Last active November 14, 2018 16:57
Show Gist options
  • Save schwern/4cd618e7233aa71324dd84d878e31048 to your computer and use it in GitHub Desktop.
Save schwern/4cd618e7233aa71324dd84d878e31048 to your computer and use it in GitHub Desktop.
#!/usr/bin/env perl
use strict;
use warnings;
use v5.10;
use DBI;
unlink "test.sqlite";
my $dbh = DBI->connect(
"dbi:SQLite:dbname=test.sqlite", undef, undef, { RaiseError => 1, AutoCommit => 0 }
);
$dbh->do(<<SQL);
create table foo (id int, name text)
SQL
for my $num ( 1..1_000_000 ) {
$dbh->do(qq{
insert into foo
values ($num, $num)
});
}
$dbh->commit;
my $rows = $dbh->selectall_arrayref(<<SQL);
select * from foo limit 10000
SQL
#$dbh->sqlite_backup_to_file("test.sqlite");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment