/** * show table listing * * @throws DatabaseException * * @return array: */ public function showTableList() { try { if (!$this->db) { throw new DatabaseException(__METHOD__ . 'No Database Object has been given', MySQL::ERR_NO_CREDENTIALS, MySQL::SEVERITY_LOG, __FILE__, __LINE__); } $sql = (string) "SELECT * FROM `information_schema`.`tables`"; $res = $this->db->query($sql); if (empty($res)) { return []; } return $this->db->fetchObjectList($res); } catch (DatabaseException $e) { throw $e; } }
/** * fetch a direct query * * @param $sql * @param $param array of bind parameters * * @return $this */ public function query($sql, $param = null) { $this->__init_database(); // direct wrapper for fetch $stmt = $this->db->prepare($sql); for ($i = 0, $c = count($param); $i < $c; $i++) { $stmt->bindParam($param[$i][0], $param[$i][1]); } $this->last_sql = $sql; if (!$stmt->execute()) { return $this; } $this->result = $stmt->fetchAll(MySQL::FETCH_OBJ); return $this; }