original_string: public function limit($sql, $count, $offset = 0)
      {
          $count = intval($count);
          if ($count < 0) {
              /** @see Zend_Db_Adapter_Exception */
              // require_once 'Zend/Db/Adapter/Exception.php';
              throw new Zend_Db_Adapter_Exception("LIMIT argument count=$count is not valid");
          } else if ($count == 0) {
                $limit_sql = str_ireplace("SELECT", "SELECT * FROM (SELECT", $sql);
                $limit_sql .= ") WHERE 0 = 1";
          } else {
              $offset = intval($offset);
              if ($offset < 0) {
                  /** @see Zend_Db_Adapter_Exception */
                  // require_once 'Zend/Db/Adapter/Exception.php';
                  throw new Zend_Db_Adapter_Exception("LIMIT argument offset=$offset is not valid");
              }
              if ($offset == 0) {
                  $limit_sql = str_ireplace("SELECT", "SELECT FIRST $count", $sql);
              } else {
                  $limit_sql = str_ireplace("SELECT", "SELECT SKIP $offset LIMIT $count", $sql);
              }
          }
          return $limit_sql;
      }
code: public function limit($sql, $count, $offset = 0)
      {
          $count = intval($count);
          if ($count < 0) {
              /** @see Zend_Db_Adapter_Exception */
              // require_once 'Zend/Db/Adapter/Exception.php';
              throw new Zend_Db_Adapter_Exception("LIMIT argument count=$count is not valid");
          } else if ($count == 0) {
                $limit_sql = str_ireplace("SELECT", "SELECT * FROM (SELECT", $sql);
                $limit_sql .= ") WHERE 0 = 1";
          } else {
              $offset = intval($offset);
              if ($offset < 0) {
                  /** @see Zend_Db_Adapter_Exception */
                  // require_once 'Zend/Db/Adapter/Exception.php';
                  throw new Zend_Db_Adapter_Exception("LIMIT argument offset=$offset is not valid");
              }
              if ($offset == 0) {
                  $limit_sql = str_ireplace("SELECT", "SELECT FIRST $count", $sql);
              } else {
                  $limit_sql = str_ireplace("SELECT", "SELECT SKIP $offset LIMIT $count", $sql);
              }
          }
          return $limit_sql;
      }
code_tokens: public function limit ( $ sql , $ count , $ offset = 0 ) { $ count = intval ( $ count ) ; if ( $ count < 0 ) { /** @see Zend_Db_Adapter_Exception */ // require_once 'Zend/Db/Adapter/Exception.php'; throw new Zend_Db_Adapter_Exception ( "LIMIT argument count=$count is not valid" ) ; } else if ( $ count == 0 ) { $ limit_sql = str_ireplace ( "SELECT" , "SELECT * FROM (SELECT" , $ sql ) ; $ limit_sql .= ") WHERE 0 = 1" ; } else { $ offset = intval ( $ offset ) ; if ( $ offset < 0 ) { /** @see Zend_Db_Adapter_Exception */ // require_once 'Zend/Db/Adapter/Exception.php'; throw new Zend_Db_Adapter_Exception ( "LIMIT argument offset=$offset is not valid" ) ; } if ( $ offset == 0 ) { $ limit_sql = str_ireplace ( "SELECT" , "SELECT FIRST $count" , $ sql ) ; } else { $ limit_sql = str_ireplace ( "SELECT" , "SELECT SKIP $offset LIMIT $count" , $ sql ) ; } } return $ limit_sql ; }
docstring: Adds an IDS-specific LIMIT clause to the SELECT statement.
  
  @param string $sql
  @param integer $count
  @param integer $offset OPTIONAL
  @throws Zend_Db_Adapter_Exception
  @return string
docstring_tokens: Adds an IDS - specific LIMIT clause to the SELECT statement .