Skip to content

Commit

Permalink
reverted: Add ForceIndex function to DB Select.php Shardj#350
Browse files Browse the repository at this point in the history
  • Loading branch information
develart-projects committed Aug 10, 2023
1 parent e41414c commit 1bc6de3
Showing 1 changed file with 1 addition and 30 deletions.
31 changes: 1 addition & 30 deletions library/Zend/Db/Select.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ class Zend_Db_Select
const DISTINCT = 'distinct';
const COLUMNS = 'columns';
const FROM = 'from';
const FORCE_INDEX = 'forceindex';
const UNION = 'union';
const WHERE = 'where';
const GROUP = 'group';
Expand All @@ -74,7 +73,6 @@ class Zend_Db_Select
const SQL_UNION = 'UNION';
const SQL_UNION_ALL = 'UNION ALL';
const SQL_FROM = 'FROM';
const SQL_FORCE_INDEX = 'FORCE INDEX';
const SQL_WHERE = 'WHERE';
const SQL_DISTINCT = 'DISTINCT';
const SQL_GROUP_BY = 'GROUP BY';
Expand Down Expand Up @@ -468,19 +466,6 @@ public function joinNatural($name, $cols = self::SQL_WILDCARD, $schema = null)
{
return $this->_join(self::NATURAL_JOIN, $name, null, $cols, $schema);
}

/**
* Adds an index hint for a given schema.index
* @param $tableIndex
* @throws Zend_Db_Select_Exception
*/
public function forceIndex($tableIndex)
{
list($table,$index) = explode('.',$tableIndex);
if (empty($table) || empty($index)) {
throw new Zend_Db_Select_Exception("Format of forceIndex is table_name.index_name");
}
}

/**
* Adds a WHERE condition to the query by AND.
Expand Down Expand Up @@ -1104,19 +1089,6 @@ protected function _getQuotedTable($tableName, $correlationName = null)
{
return $this->_adapter->quoteTableAs($tableName, $correlationName, true);
}

/**
* Returns force index statement for _renderFrom processing
* @param $tableName
* @return string
*/
protected function _getForceIndexForTable($tableName)
{
if ($this->_parts[self::FORCE_INDEX][$tableName]) {
return ' ' . self::SQL_FORCE_INDEX . ' ('.$this->_parts[self::FORCE_INDEX][$tableName].')';
}
return '';
}

/**
* Render DISTINCT clause
Expand Down Expand Up @@ -1196,7 +1168,6 @@ protected function _renderFrom($sql)

$tmp .= $this->_getQuotedSchema($table['schema']);
$tmp .= $this->_getQuotedTable($table['tableName'], $correlationName);
$tmp .= $this->_getForceIndexForTable($table['tableName']);

// Add join conditions (if applicable)
if (!empty($from) && ! empty($table['joinCondition'])) {
Expand All @@ -1214,7 +1185,7 @@ protected function _renderFrom($sql)

return $sql;
}

/**
* Render UNION query
*
Expand Down

0 comments on commit 1bc6de3

Please sign in to comment.