Lines 293-312
sub memcached {
Link Here
|
293 |
} |
293 |
} |
294 |
} |
294 |
} |
295 |
|
295 |
|
296 |
# db_scheme2dbi |
296 |
=head2 db_schema2dbi |
297 |
# Translates the full text name of a database into de appropiate dbi name |
297 |
|
298 |
# |
298 |
my $dbd_driver_name = C4::Context::db_schema2dbi($scheme); |
|
|
299 |
|
300 |
This routines translates a database type to part of the name |
301 |
of the appropriate DBD driver to use when establishing a new |
302 |
database connection. It recognizes 'mysql' and 'Pg'; if any |
303 |
other scheme is supplied it defaults to 'mysql'. |
304 |
|
305 |
=cut |
306 |
|
299 |
sub db_scheme2dbi { |
307 |
sub db_scheme2dbi { |
300 |
my $name = shift; |
308 |
my $scheme = shift // ''; |
301 |
# for instance, we support only mysql, so don't care checking |
309 |
return $scheme eq 'Pg' ? $scheme : 'mysql'; |
302 |
return "mysql"; |
|
|
303 |
for ($name) { |
304 |
# FIXME - Should have other databases. |
305 |
if (/mysql/) { return("mysql"); } |
306 |
if (/Postgres|Pg|PostgresSQL/) { return("Pg"); } |
307 |
if (/oracle/) { return("Oracle"); } |
308 |
} |
309 |
return; # Just in case |
310 |
} |
310 |
} |
311 |
|
311 |
|
312 |
sub import { |
312 |
sub import { |
Lines 794-805
sub _new_dbh
Link Here
|
794 |
|
794 |
|
795 |
## $context |
795 |
## $context |
796 |
## correct name for db_schme |
796 |
## correct name for db_schme |
797 |
my $db_driver; |
797 |
my $db_driver = db_scheme2dbi($context->config("db_scheme")); |
798 |
if ($context->config("db_scheme")){ |
|
|
799 |
$db_driver=db_scheme2dbi($context->config("db_scheme")); |
800 |
}else{ |
801 |
$db_driver="mysql"; |
802 |
} |
803 |
|
798 |
|
804 |
my $db_name = $context->config("database"); |
799 |
my $db_name = $context->config("database"); |
805 |
my $db_host = $context->config("hostname"); |
800 |
my $db_host = $context->config("hostname"); |