aboutsummaryrefslogtreecommitdiffstats
path: root/lib/LXRng/Index/Pg.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/LXRng/Index/Pg.pm')
-rw-r--r--lib/LXRng/Index/Pg.pm20
1 files changed, 17 insertions, 3 deletions
diff --git a/lib/LXRng/Index/Pg.pm b/lib/LXRng/Index/Pg.pm
index 1b905c0..a385767 100644
--- a/lib/LXRng/Index/Pg.pm
+++ b/lib/LXRng/Index/Pg.pm
@@ -154,9 +154,9 @@ sub init_db {
$dbh->do(qq{
create table ${pre}usage
(
- id_rfile int references ${pre}revisions(id) deferrable,
- id_symbol int references ${pre}symbols(id) deferrable,
- line int
+ id_rfile int,
+ id_symbol int,
+ lines int[]
)
}) or die($dbh->errstr);
@@ -407,6 +407,20 @@ sub _add_ident {
return $id;
}
+sub _add_usage {
+ my ($self, $file_id, $symbol_id, $lines) = @_;
+
+ my $dbh = $self->dbh;
+ my $pre = $self->prefix;
+ my $sth = $$self{'sth'}{'_add_usage'} ||=
+ $dbh->prepare(qq{insert into ${pre}usage(id_rfile, id_symbol, lines)
+ values (?, ?, ?)});
+ $sth->execute($file_id, $symbol_id, '{'.join(',', @$lines).'}');
+
+ return 1;
+}
+
+
sub DESTROY {
my ($self) = @_;