Exemplo n.º 1
0
	public function __construct($result, $sql, $as_object = FALSE, array $params = NULL)
	{
		parent::__construct($result, $sql, $as_object, $params);

		// Find the number of rows in the result
		$this->_total_rows = mysql_num_rows($result);
	}
Exemplo n.º 2
0
	public function __construct($result, $sql, $as_object)
	{
		parent::__construct($result, $sql, $as_object);

		// Find the number of rows in the result
		$this->_total_rows = mysql_num_rows($result);
	}
Exemplo n.º 3
0
	public function __construct(array $result, $sql, $as_object = NULL)
	{
		parent::__construct($result, $sql, $as_object);

		// Find the number of rows in the result
		$this->_total_rows = count($result);
	}
Exemplo n.º 4
0
 public function __construct($result, $sql, $as_object = FALSE, $params = NULL, $total_rows = NULL)
 {
     parent::__construct($result, $sql, $as_object, $params);
     if ($as_object === TRUE) {
         $this->_as_object = 'stdClass';
     }
     if ($total_rows !== NULL) {
         $this->_total_rows = $total_rows;
     } else {
         switch (pg_result_status($result)) {
             case PGSQL_TUPLES_OK:
                 $this->_total_rows = pg_num_rows($result);
                 break;
             case PGSQL_COMMAND_OK:
                 $this->_total_rows = pg_affected_rows($result);
                 break;
             case PGSQL_BAD_RESPONSE:
             case PGSQL_NONFATAL_ERROR:
             case PGSQL_FATAL_ERROR:
                 throw new Database_Exception(':error [ :query ]', array(':error' => pg_result_error($result), ':query' => $sql));
             case PGSQL_COPY_OUT:
             case PGSQL_COPY_IN:
                 throw new Database_Exception('PostgreSQL COPY operations not supported [ :query ]', array(':query' => $sql));
             default:
                 $this->_total_rows = 0;
         }
     }
 }
Exemplo n.º 5
0
 public function __construct(array $result, $sql, $as_object = NULL)
 {
     if (count($result) > 0) {
         // Determine if we stored as objects or associative arrays
         $as_object = get_class($result[0]);
     }
     // If there are no results, we don't care how they're returned
     parent::__construct($result, $sql, $as_object);
     // Find the number of rows in the result
     $this->_total_rows = count($result);
 }
Exemplo n.º 6
0
 public function __construct(array $result, $sql, $as_object = NULL)
 {
     parent::__construct($result, $sql, $as_object);
     $this->_total_rows = count($result);
 }
Exemplo n.º 7
0
 public function __construct($result, $sql, $as_object)
 {
     parent::__construct($result, $sql, $as_object);
     $this->_total_rows = mysql_num_rows($result);
 }