}
my $db=ID3FS::DB->new($me, $dbpath, $basedir, $ARGV[0]);
+$db->last_update(time());
while(my $path=shift)
{
$self->{dbh}->do("CREATE INDEX $index ON " . $indexes{$index});
}
}
- $self->cmd("INSERT INTO id3fs (schema_version) VALUES (?)", $SCHEMA_VERSION);
+ $self->cmd("INSERT INTO id3fs (schema_version, last_update) VALUES (?, ?)",
+ $SCHEMA_VERSION, time());
}
sub checkschema
}
}
+sub last_update
+{
+ my($self, $newval)=@_;
+ if(defined($newval))
+ {
+ $self->cmd("UPDATE id3fs SET last_update=?", $newval);
+ }
+ else
+ {
+ ($newval)=$self->cmd_onerow("SELECT last_update from id3fs");
+ }
+ return $newval;
+}
+
sub cmd_sth
{
my($self, $sql, @params)=@_;
__DATA__
CREATE TABLE id3fs (
- schema_version INTEGER
+ schema_version INTEGER,
+ last_update
);
CREATE TABLE files (
my($self, $filename)=@_;
print "**GETATTR: $filename\n";
my $path=ID3FS::Path->new($self->{db}, $filename);
+ my $last_update=$self->{db}->last_update();
return(-ENOENT()) unless($path->isvalid());
my($dev,$ino,$nlink)=(0,0,1);
my $uid=$<;
my $gid=(split(/ /, $( ))[0];
my($rdev,$size)=(0,1);
- my($atime,$mtime,$ctime)=(0,0,0);
+ my($atime,$mtime,$ctime)=($last_update) x 3;
my($blksize,$blocks)=(512,1);
my $mode=$self->mode( $path->isdir() ? $TYPE_DIR : $TYPE_SYMLINK );
return($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,