ZF-10605: allow use of database.schema.table in Zend_Db_Select

Issue Type: Improvement Created: 2010-10-27T12:04:59.000+0000 Last Updated: 2012-01-29T04:44:47.000+0000 Status: Postponed Fix version(s): Reporter: Scott Morken (ss10sb) Assignee: Ralph Schindler (ralph) Tags: - Zend_Db_Select

Related issues: Attachments:


Using database.schema.table (often needed in MSSQL) results in the SQL string outputting "database"."schema". It doesn't recognize the 3 part name. In this case, it seems to be an easy fix, just limit the explode to 2 parts. I'm probably missing the 'correct' way to do this, but I didn't see anything for the select statement builder relating to this.

<pre class="highlight">`

protected function _join($type, $name, $cond, $cols, $schema = null) { ... // Schema from table name overrides schema argument if (!is_object($tableName) && false !== strpos($tableName, '.')) { - list($schema, $tableName) = explode('.', $tableName); + list($schema, $tableName) = explode('.', $tableName, 2); } ... } ```


Posted by Ralph Schindler (ralph) on 2011-04-01T19:19:05.000+0000

Postponing. To be not an issue in ZF2.

Posted by Andrew Keller (akeller) on 2012-01-29T04:44:47.000+0000

I had this problem as well and used the $schema parameter to work around it.

<pre class="highlight">
$select = $db->select()
             ->from(array('t' => 'table'), '*', 'database.schema')
             ->joinLeft(array('t2' => 'jointable'), ' =', '*', 'database.schema');

This is working for me on version 1.11.11 of the Zend Framework. But I agree it would be great for Zend_Db_Select to accept the database.schema.table syntax in the first parameter.

Have you found an issue?

See the Overview section for more details.


© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.