From: Michael N. <uu...@rz...> - 2003-01-25 11:36:51
|
Paul DuBois wrote: > There is some code in dbi.rb that attempts to make driver-loading > work in case-insensitive fashion. That is, it allows the driver > name to be given in any lettercase, so that DSNs such as these > are synonymous: > > dbi:Mysql:test:localhost > dbi:mysql:test:localhost > > Ironically, this code works *except* on filesystems that are not > case sensitive. :-) For example, the code does not work on HFS+ > filesystems on Mac OS X. > > Cause: Suppose you give a DSN of dbi:mysql:test:localhost. > load_driver attempts to require 'DBD/mysql/mysql', which *works* > on a non-case-sensitive file system. load_driver then assumes > that DBI::DBD.const_get(mysql) can be used to get the appropriate > module constant for generating the driver handle. That fails because > the constant has to be Mysql. > > Solution: If const_get fails, look through all the available constants > to see which one matches the given driver name in a caseless match. > That gives you the constant with the proper capitalization. > > > The patch below fixes the problem. It can be improved, I'm sure, > but it does work for non-case-sensitive filesystems while preserving > existing behavior for case-sensitive filesystems. Thanks. But I think, to allow case-insensitive DBD names was a big mistake. And possibly it will get depreciated in the next major version. Regards, Michael |