public function __construct() { $db = Database::get(); $this->isSqlite = App::DB_TYPE == 'sqlite'; if ($this->isSqlite) { $query = $db->prepare("select name from sqlite_master where type='table'"); } else { $query = $db->prepare("show tables from " . DB_NAME); } $query->execute(); //$tables = array(); while ($rows = $query->fetch(Database::FETCH_CLASSTYPE)) { if ($this->isSqlite) { $tableQuery = $db->prepare("PRAGMA TABLE_INFO(" . $rows[0] . ");"); } else { $tableQuery = $db->prepare("show columns from " . $rows[0]); } $tableQuery->execute(); $rows['columns'] = array(); while ($tableRows = $tableQuery->fetch(Database::FETCH_OBJ)) { $rows['columns'][] = $tableRows; } $this->genFile($rows); } }
/** * create a new instance of the database helper */ public function __construct() { //connect to PDO here. $this->_db = Database::get(); }