[Jifty-commit] r7179 - Jifty-DBI/trunk/lib/Jifty/DBI
Jifty commits
jifty-commit at lists.jifty.org
Thu Jun 4 18:06:14 EDT 2009
Author: sartak
Date: Thu Jun 4 18:06:14 2009
New Revision: 7179
Modified:
Jifty-DBI/trunk/lib/Jifty/DBI/Handle.pm
Log:
Handle->is_available_driver('Pg')
Modified: Jifty-DBI/trunk/lib/Jifty/DBI/Handle.pm
==============================================================================
--- Jifty-DBI/trunk/lib/Jifty/DBI/Handle.pm (original)
+++ Jifty-DBI/trunk/lib/Jifty/DBI/Handle.pm Thu Jun 4 18:06:14 2009
@@ -1352,6 +1352,28 @@
return grep { eval "require DBD::" . $_ } $self->supported_drivers;
}
+=head2 is_available_driver
+
+Returns a boolean indicating whether the provided driver is available.
+
+=cut
+
+do {
+ # lazily memoize
+ my $is_available_driver;
+
+ sub is_available_driver {
+ my $self = shift;
+ my $driver = shift;
+
+ if (!$is_available_driver) {
+ %$is_available_driver = map { $_ => 1 } $self->available_drivers;
+ }
+
+ return $is_available_driver->{$driver};
+ }
+};
+
=head2 DESTROY
When we get rid of the L<Jifty::DBI::Handle>, we need to disconnect
More information about the Jifty-commit
mailing list