Bug 7188: C4::Context::db_scheme2dbi does case-insensitive grep
Checking NYTProf in C4::Context, it appears that the /i flag is highly time-consumming
As we don't support anything outside from mysql, returning directly mysql directly
If in a future version PostgresSQL works, then we will have to update this sub. But if an ORM is introduced, this code will be removed completly anyway
Testing note:
Drops execution time of the line from 300ms to 20 microseconds (in my testing).
(cherry picked from commit 0f8db0c538)
Signed-off-by: Chris Nighswonger <chris.nighswonger@gmail.com>
This commit is contained in:
parent
a6b7a1432a
commit
edcbd0cde0
|
|
@ -237,12 +237,13 @@ sub read_config_file { # Pass argument naming config file to read
|
|||
#
|
||||
sub db_scheme2dbi {
|
||||
my $name = shift;
|
||||
|
||||
# for instance, we support only mysql, so don't care checking
|
||||
return "mysql";
|
||||
for ($name) {
|
||||
# FIXME - Should have other databases.
|
||||
if (/mysql/i) { return("mysql"); }
|
||||
if (/mysql/) { return("mysql"); }
|
||||
if (/Postgres|Pg|PostgresSQL/) { return("Pg"); }
|
||||
if (/oracle/i) { return("Oracle"); }
|
||||
if (/oracle/) { return("Oracle"); }
|
||||
}
|
||||
return undef; # Just in case
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue