Database-Abstraction

 view release on metacpan or  search on metacpan

lib/Database/Abstraction.pm  view on Meta::CPAN

extracted from the DSN and C<stat()>-ed live on every call, so callers
get a current mtime suitable for cache-invalidation even when the database
was opened via a DSN rather than a C<directory>.

For all other DSN-based connections (PostgreSQL, MySQL, etc.) and for
URL-based backends, returns the Unix timestamp of the most recent
C<new()> call (connection time).

=cut

sub updated {
	my $self = shift;

	if(($self->{'_dialect'} // '') eq 'sqlite') {
		my $dsn = $self->{'dsn'};
		if(defined($dsn) && $dsn =~ /\Adbi:SQLite:(?:dbname=)?(.+)\z/i) {
			my $path = $1;
			my @st = stat($path);
			return $st[9] if @st;
		}
	}



( run in 0.888 second using v1.01-cache-2.11-cpan-7da0f45c409 )