/**
  * @param string $query
  * @param array $sqlValues
  * @return bool|MySqliStatementExtended
  */
 public function prepare($query, $sqlValues = array())
 {
     if (preg_match('#:([a-zA-Z0-9_]+)#', $query)) {
         $prepared = preg_replace('#:([a-zA-Z0-9_]+)#', '?', $query);
     } else {
         $prepared = $query;
     }
     return parent::prepare($prepared) ? new MySqliStatementExtended($this, $prepared, $sqlValues, $query) : false;
 }
 /**
  *
  * @param string $sql
  * @throws Exception\ConnectionException
  * @return array
  */
 protected function readFields($sql)
 {
     if (trim($sql) == '') {
         throw new Exception\EmptyQueryException(__METHOD__ . ": Error cannot handle empty queries");
     }
     $sql = $this->getEmptiedQuery($sql);
     $stmt = $this->mysqli->prepare($sql);
     if (!$stmt) {
         $message = $this->mysqli->error;
         throw new Exception\InvalidQueryException(__METHOD__ . ": Error sql is not correct : {$message}");
     }
     $stmt->execute();
     $result = $stmt->result_metadata();
     $metaFields = $result->fetch_fields();
     $result->close();
     $stmt->close();
     return $metaFields;
 }
 /**
  *
  * @param string $sql
  * @throws Exception\ConnectionException
  */
 protected function readFields($sql)
 {
     if (trim($sql) == '') {
         throw new Exception\EmptyQueryException(__METHOD__ . ": Error cannot handle empty queries");
     }
     $sql = $this->makeQueryEmpty($sql);
     $stmt = $this->mysqli->prepare($sql);
     if (!$stmt) {
         $message = $this->mysqli->error;
         throw new Exception\InvalidQueryException(__METHOD__ . ": Error sql is not correct : {$message}");
     }
     $stmt->execute();
     // to check if query is empty
     /*
        $stmt->store_result();
        var_dump($stmt->num_rows);
        var_dump(
     */
     $result = $stmt->result_metadata();
     $metaFields = $result->fetch_fields();
     $result->close();
     $stmt->close();
     return $metaFields;
 }