Example #1
0
 /**
  * @param string $q
  * @param int $fetchStyle
  * @return PDOStatement|false
  */
 private function query($q, $fetchStyle = PDO::FETCH_ASSOC)
 {
     $this->lastQuery = $q;
     if (!$this->isDebug()) {
         $error = null;
         $stmt = null;
         try {
             $connection = parent::getLink($this->config, $this->schema);
             $stmt = $connection->query($q, $fetchStyle);
             if ($stmt === false) {
                 $error = new PDOException('query failed');
             }
         } catch (PDOException $e) {
             $error = $e;
         }
         $this->error = $error;
         if ($error === null) {
             return $stmt;
         }
     }
     return false;
 }