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


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.


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); } ... } ```


Postponing. To be not an issue in ZF2.

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

$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.