sub dbh_new {
my ($self) = @_;
my $dbh = $self->SUPER::dbh_new;
- $dbh->do('PRAGMA synchronous = OFF'); # commit_fsync instead
$dbh->do('PRAGMA journal_mode = TRUNCATE');
$dbh->do('PRAGMA cache_size = 80000');
create_tables($dbh);
$dbh;
}
-sub commit_fsync {
- my $fn = $_[0]->{filename};
- if (open my $fh, '+<', $fn) {
- $fh->sync;
- close $fh;
- }
-}
-
sub get_counter ($$) {
my ($dbh, $key) = @_;
my $sth = $dbh->prepare_cached(<<'', undef, 1);
sub add_over {
my ($self, $values) = @_;
- my ($ts, $num, $mids, $refs, $xpath, $ddd) = @$values;
+ my ($ts, $ds, $num, $mids, $refs, $xpath, $ddd) = @$values;
my $old_tid;
my $vivified = 0;
my $sid = $self->sid($xpath);
my $dbh = $self->{dbh};
my $sth = $dbh->prepare_cached(<<'');
-INSERT INTO over (num, tid, sid, ts, ddd)
-VALUES (?,?,?,?,?)
+INSERT INTO over (num, tid, sid, ts, ds, ddd)
+VALUES (?,?,?,?,?,?)
my $n = 0;
- my @v = ($num, $tid, $sid, $ts);
+ my @v = ($num, $tid, $sid, $ts, $ds);
foreach (@v) { $sth->bind_param(++$n, $_) }
$sth->bind_param(++$n, $ddd, SQL_BLOB);
$sth->execute;
tid INTEGER NOT NULL,
sid INTEGER,
ts INTEGER,
+ ds INTEGER,
ddd VARBINARY, /* doc-data-deflated */
UNIQUE (num)
)
$dbh->do('CREATE INDEX IF NOT EXISTS idx_tid ON over (tid)');
$dbh->do('CREATE INDEX IF NOT EXISTS idx_sid ON over (sid)');
$dbh->do('CREATE INDEX IF NOT EXISTS idx_ts ON over (ts)');
+ $dbh->do('CREATE INDEX IF NOT EXISTS idx_ds ON over (ds)');
$dbh->do(<<'');
CREATE TABLE IF NOT EXISTS counter (