[PHP-DEV] case folding array string keys
Hi, I have a patch that I'm hoping might be useful to PHP developers, at least those using PostgreSQL. The patch provides case folding of string keys during hash lookups. The need for this comes from ... We're transitioning from MySQL to PostgreSQL, and like many, we use camel casing for naming tables and columns in our db. In PostgreSQL, (unquoted) table and column names are case folded to lower case, so where we currently have $row['someForeignId'], we would need to rewrite the key to 'someforeignid'. Besides being a lesson that we should use _ naming in the future, it was clear there was no quick solution, we'd be forced to modify many lines of code, and possibly end up with less readability. Instead, I added a caseFold flag to the HashTable struct, which is later checked in zend_hash_find() where, if configured, case folding of the key is performed before hash lookup. My question to the list is, can this functionality be added in a way that doesn't adversely effect developers who won't use it, but helps us PostgreSQL users and anyone else who might find it useful? Judging from my searches on the subject, it's not an uncommon impedance for PHP/PostgreSQL users. thanks, Dave
Re: [PHP-DEV] case folding array string keys
Dave Lee wrote: Hi, I have a patch that I'm hoping might be useful to PHP developers, at least those using PostgreSQL. The patch provides case folding of string keys during hash lookups. The need for this comes from ... My question to the list is, can this functionality be added in a way that doesn't adversely effect developers who won't use it, but helps us PostgreSQL users and anyone else who might find it useful? Judging from my searches on the subject, it's not an uncommon impedance for PHP/PostgreSQL users. Oracle columns names are similarly case insensitive - unless the table was created with quoted column names. Users can see similar issues. I think a PHP solution is more likely to need to be handled the way PDO does, see PDO::CASE_. However, what about creating an RFC on the wiki to share what you have done and found. Do you have any benchmarks? Chris -- Christopher Jones, Oracle Email: [EMAIL PROTECTED]Tel: +1 650 506 8630 Blog: http://blogs.oracle.com/opal/ Free PHP Book: http://tinyurl.com/f8jad -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] case folding array string keys
On Mon, Jun 16, 2008 at 2:06 PM, Christopher Jones [EMAIL PROTECTED] wrote: Oracle columns names are similarly case insensitive - unless the table was created with quoted column names. Users can see similar issues. So same needs as as PostgreSQL. However, what about creating an RFC on the wiki to share what you have done and found. Do you have any benchmarks? I haven't benchmarked. I haven't looked, maybe you could tell me, are there standard PHP benchmarks? If not I'll run some basic ones and post the results here. I'm new to the php-dev scene, I'll take a look at the wiki and other RFCs posted. thanks, Dave -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] case folding array string keys
Dave Lee wrote: I haven't benchmarked. I haven't looked, maybe you could tell me, are there standard PHP benchmarks? If not I'll run some basic ones and post the results here. Try the basic test Zend/benchmark.php. Ideally, you'd create some specific tests that stress the changed code. I'm new to the php-dev scene, I'll take a look at the wiki and other RFCs posted. The RFC page is at http://wiki.php.net/rfc Chris -- Christopher Jones, Oracle Email: [EMAIL PROTECTED]Tel: +1 650 506 8630 Blog: http://blogs.oracle.com/opal/ Free PHP Book: http://tinyurl.com/f8jad -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php