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