/** * Get a select statement using a filter and sort * * Modified to add the information schema, only possible like this since * the table has no primary key and can not be added using normal joins * * @param array $filter * @param array $sort * @return \Zend_Db_Table_Select */ public function _createSelect(array $filter, array $sort) { $select = parent::_createSelect($filter, $sort); $config = $select->getAdapter()->getConfig(); if (isset($config['dbname'])) { $constraint = $select->getAdapter()->quoteInto(' AND TABLE_SCHEMA=?', $config['dbname']); } else { $constraint = ''; } $select->joinLeft('INFORMATION_SCHEMA.TABLES', "table_name = convert(concat_ws('_','gems__orf_', REPLACE(gof_form_id,'.','_'),gof_form_version) USING utf8)" . $constraint, array('TABLE_ROWS')); return $select; }