function testFieldNamesAreLowercase() { $result = $this->_db->query('SELECT * FROM ' . self::TableName . ' WHERE date_created > :placeholder', array('placeholder' => '2006-01-01')); // use the PDOStatement $result to fetch all rows as an array $row = $result->fetch(); $this->assertEquals(5, count($row)); // correct number of fields $this->assertEquals('1', $row['id']); // correct data $this->assertTrue(array_key_exists('subtitle', $row)); // "subTitle" is now "subtitle" $this->assertFalse(array_key_exists('subTitle', $row)); // "subTitle" is not a key }
/** * Execute a SQL statement and return the result * * Use $params to use a prepared statement. * * @param string $statement The statement to execute * @param array $params The params to bind * * @return mixed */ public function query($statement, $params = array()) { if ($this->zendConn !== null) { return $this->zendConn->query($statement, $params); } if (empty($params)) { return $this->pdoConn->query($statement); } $stmt = $this->pdoConn->prepare($statement); $stmt->execute($params); return $stmt; }