rsim/oracle-enhanced — pull request #375 by aledovsky (2013-11-28 00:10:32+00:00)
Title: Change OracleEnhancedOCIConnection#describe logic

I would kindly ask you to review this patch, and backport it to 1.4.x branch.

Background:

Some time ago, while running migrations and test schema preparations on one of internal Oracle setups, job wallclock times increased dramatically (in order of 10x). After some investigation it became apparent that problem was in `OracleEnhancedSchemaStatements::create_table` method - it took 40+ seconds to execute `OracleEnhancedAdapter::table_exists?` which itself is wrapper for `OracleEnhancedOCIConnection::describe` Though most probably, the time increase isn't directly related to ruby-oci8 or oracle-enhanced, as same problem was replicated in SQL Developer (which internally also translates `DESC[RIBE]`to UNIONed SELECT), and likely stems from DB configuration changes/patches/size increases, current gem code can be improved a bit; patch provides solution for this isolated performance drop.

Proposal:

When using OCI8 interface and calling `#describe` on non-existant table (as is probably the most frequent case in
test DB preparations and migrations), oracle-enhanced should not retry describe via SELECT-based `super` when no db link is specified and `OCIException` code is 4043 (object does not exist)

Signed-off-by: Aleksandrs Ļedovskis