Exemple #1
0
 /**
  * Fetch a single row by running the provided SQL.  If no matching row is found,
  * null will be returned.
  *
  * @param string|\Dewdrop\Db\Select $sql
  * @param array $bind
  * @return null|Row
  */
 public function fetchRow($sql, array $bind = array())
 {
     $className = $this->rowClass;
     $data = $this->db->fetchRow($sql, $bind, Adapter::ARRAY_A);
     if (null === $data) {
         return null;
     }
     return new $className($this, $data);
 }
Exemple #2
0
 public function testFetchRowWithNoResultsReturnsNull()
 {
     $this->assertNull($this->db->fetchRow('SELECT * FROM dewdrop_test_fruits WHERE dewdrop_test_fruit_id = 10'));
 }