ZF-5169: QSYS2.SYSCOLUMNS not limiting search by SCHEMA in Zend_Db_Adapter_Db2::describeTable()
The $schemaName variable passed to Zend_Db_Adapter_Db2::describeTable() is not being set to the schema name defined in the default adapter. This is causing the function to scan the entire QSYS2 table when it should only be looking for matches for the schema named in the adapter. Our QSYS2 table contains over 1,000,000 records. This causes a tremendous slowdown since the table is scanned once for each query; some screens querying over a dozen tables.
A check is performed in the describeTable() method to see if $schemaName is set. In every case it is not. The adapter has a variable which is set containing the schema name ($this->_config['schema']). I modified my version of the adapter to check for $this->_config['schema'] rather than the passed $schemaName variable and use its value and it's now running much faster.
I did notice that if I explicitly set the schema name for a given model the queries work as expected (i.e. the query only checks the schema indicated). Must this be done? It seems to defeat the purpose of setting the schema in the adapter to have set it again for each model; all of which use the same adapter. Shouldn't the adapter pass the schema name on if it's not set in the model?
Please forgive me if this post is a duplicate.
I am running a copy of the DB2 adapter found here: http://framework.zend.com/code/changelog/…
You will find information about my system settings in the following thread: ZF-4501