cloudfoundry/cloud_controller_ng — pull request #41 by youngm (2013-04-25 21:47:26+00:00)
Title: Support for the use of the "lower()" function as an option for ci support

This pull request makes significant changes to the case insensitivity functionality of cloud controller in preparation for support for Oracle as a datasource. This request as it stands isn't necessarily meant to be merged. I'm more looking for feedback but it could be merged. The pull request does the following:

* Fixes the disabled case insensitivity test for sqlite. I banged my head on the wall for quite a while trying to figure out why that sqlite test was failing. I finally decided that sqlite's ci support is buggy and decided to make sqlite my test database for achieving ci through the use of the lower() function. This pull request disables the sqlite ci column support that was in there before and replaces it with using "lower()" functions. Mysql and postgresql are untouched and continue to use their ci column types without lower(). Sqlite doesn't support function based indexes. So using lower() to achieve case insensitivity with sqlite could cause performance problems. Don't know if that is an important consideration for Sqlite or not. Oracle supports function based indexes.

* Makes model objects declare which fields should be handled in case insensitive ways. This allows features like Query and unique_validation to automatically identify which fields should be case insensitive and handle them in a database appropriate way.

* Enhances test fixtures to support testing for case insensitivity in models and apis in a declarative way. In the process I greatly improved CC's case insensitive test coverage.

* This patch does not provide support for creating "lower()" function indexes, since sqlite doesn't support function based indexes. Support for that will be added as part of my actual Oracle patch.

* I still need to add some tests for the case_insensitive Sequel plugin and figure out what to do with the case_insensitive_string_monkeypatch tests.

Please review the patch and let me know if I'm on the right track for adding lower based case insensitivity to the Cloud Controller which will be necessary to support Oracle. For reference you can use this discussion on the google group:

https://groups.google.com/a/cloudfoundry.org/forum/?fromgroups=#!topic/vcap-dev/1hKCkItFQmo