<commit_before><?php

namespace mako\database\query\compiler;

/**
* Compiles Oracle queries.
*
* @author     <NAME>
* @copyright  (c) 2008-2012 <NAME>
* @license    http://www.makoframework.com/license
*/

class Oracle extends \mako\database\query\Compiler
{
	//---------------------------------------------
	// Class variables
	//---------------------------------------------

	// Nothing here

	//---------------------------------------------
	// Class constructor, destructor etc ...
	//---------------------------------------------

	// Nothing here

	//---------------------------------------------
	// Class methods
	//---------------------------------------------

	/**
	* Compiles a SELECT query.
	*
	* @access  public
	* @return  string
	*/

	public function select()
	{
		// See http://stackoverflow.com/questions/595123/is-there-an-ansi-sql-alternative-to-the-mysql-limit-keyword
	}
}

/** -------------------- End of file --------------------**/<commit_msg>Added support for limit, offset in oracle query compiler<commit_after><?php

namespace mako\database\query\compiler;

/**
* Compiles Oracle queries.
*
* @author     <NAME>
* @copyright  (c) 2008-2012 <NAME>
* @license    http://www.makoframework.com/license
*/

class Oracle extends \mako\database\query\Compiler
{
	//---------------------------------------------
	// Class variables
	//---------------------------------------------

	// Nothing here

	//---------------------------------------------
	// Class constructor, destructor etc ...
	//---------------------------------------------

	// Nothing here

	//---------------------------------------------
	// Class methods
	//---------------------------------------------

	/**
	* Compiles LIMIT clauses.
	*
	* @access  protected
	* @return  string
	*/

	protected function limit($limit)
	{
		return '';
	}

	/**
	* Compiles OFFSET clause.
	*
	* @access  protected
	* @return  string
	*/

	protected function offset($offset)
	{
		return '';
	}

	/**
	* Compiles a SELECT query.
	*
	* @access  public
	* @return  string
	*/

	public function select()
	{
		if(empty($this->query->limit) && empty($this->query->offset))
		{
			return parent::select();
		}
		else
		{
			// This solution is based on the implementation found in the Zend Framework (http://framework.zend.com/)

			$query = parent::select();

			$limit  = $this->query->limit;
			$offset = empty($this->query->offset) ? 0 : $this->query->offset;

			$sql = 'SELECT m2.* FROM (SELECT m1.*, ROWNUM AS "mako_rownum" FROM (' . $query['sql'] . ') m1) m2 WHERE m2."mako_rownum" BETWEEN ' . ($offset + 1) . ' AND ' . ($offset + $limit);

			exit($sql);return array('sql' => $sql, 'params', $query['params']);
		}
	}
}

/** -------------------- End of file --------------------**/
{'fraction_non_alphanumeric': 0.359680928208847, 'fraction_numerical': 0.010514865844815084, 'mean_word_length': 1.3184873949579832, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 18, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6953835', 'n_tokens_mistral': 825, 'n_tokens_neox': 757, 'n_words': 172}