/**
  * "Smart" Escape String
  *
  * Escapes data based on type
  *
  * @param  string $str
  * @return mixed
  */
 public function escape($str)
 {
     if (is_string($str) or is_object($str) && method_exists($str, '__toString')) {
         return pg_escape_literal($this->connID, $str);
     } elseif (is_bool($str)) {
         return $str ? 'TRUE' : 'FALSE';
     }
     return parent::escape($str);
 }
 /**
  * Asserts that the number of rows in the database that match $where
  * is equal to $expected.
  *
  * @param int    $expected
  * @param string $table
  * @param array  $where
  *
  * @return bool
  * @throws \CodeIgniter\DatabaseException
  */
 public function seeNumRecords(int $expected, string $table, array $where)
 {
     $count = $this->db->table($table)->where($where)->countAllResults();
     $this->assertEquals($expected, $count, 'Wrong number of matching rows in database.');
 }