Beispiel #1
0
 public function __construct(AMysql_Statement $stmt)
 {
     $isValidSelectResult = $stmt->result instanceof Mysqli_Result || is_resource($stmt->result);
     if (!$isValidSelectResult) {
         throw new LogicException("Statement is not a SELECT statement. " . "Unable to iterate. Query: " . $stmt->query);
     }
     $count = $stmt->numRows();
     $this->_stmt = $stmt;
     $this->_count = $count;
 }
Beispiel #2
0
 /**
  * Gets the full, bound SQL string ready for use with MySQL.
  * 
  * @param string $prepared      (Optional) Only for parent compatibility.
  * @access public
  * @return string
  */
 public function getSql($prepared = null)
 {
     if (!$prepared) {
         $this->prepared = $this->getUnboundSql();
     }
     $ret = parent::getSql($prepared);
     return $ret;
 }
Beispiel #3
0
 /**
  * If the last mysql query was a SELECT with the SQL_CALC_FOUND_ROWS
  * options, this returns the number of found rows from that last
  * query with LIMIT and OFFSET ignored.
  * 
  * @access public
  * @return int              Number of found rows.
  */
 public function foundRows()
 {
     $stmt = new AMysql_Statement($this);
     $sql = 'SELECT FOUND_ROWS()';
     $stmt->query($sql);
     return $stmt->resultInt();
 }