columnize($sequence); } $sqlStr = 'select %s from final table (%s)'; $finalSql = sprintf($sqlStr, $sequenceStr, $sql); $results = $query->getConnection()->select($finalSql, $values); if (is_array($sequence)) { return array_values((array) $results[0]); } else { $result = (array) $results[0]; $id = $result[strtolower($sequenceStr)]; return is_numeric($id) ? (int) $id : $id; } } }