/** * Connects to a MySQL instance. * * @param array $settings The settings from the configuration file. */ protected function connect($settings) { $host = $this->getSetting($settings, true, 'database', 'host'); $user = $this->getSetting($settings, true, 'database', 'user'); $password = $this->getSetting($settings, true, 'database', 'password'); $database = $this->getSetting($settings, true, 'database', 'database'); MetadataDataLayer::setIo($this->io); MetadataDataLayer::connect($host, $user, $password, $database); }
/** * Adds magic constants to replace list. */ private function setMagicConstants() { $real_path = realpath($this->sourceFilename); $this->replace['__FILE__'] = "'" . MetaDataLayer::realEscapeString($real_path) . "'"; $this->replace['__ROUTINE__'] = "'" . $this->routineName . "'"; $this->replace['__DIR__'] = "'" . MetaDataLayer::realEscapeString(dirname($real_path)) . "'"; }
/** * Gets all primary key labels from the MySQL database. */ private function getLabels() { $tables = DataLayer::getLabelTables(); foreach ($tables as $table) { $rows = DataLayer::getLabelsFromTable($table['table_name'], $table['id'], $table['label']); foreach ($rows as $row) { $this->labels[$row['label']] = $row['id']; } } }
/** * Retrieves information about all stored routines in the current schema. */ private function getOldStoredRoutinesInfo() { $this->myRdbmsOldMetadata = []; $routines = DataLayer::getRoutines(); foreach ($routines as $routine) { $this->myRdbmsOldMetadata[$routine['routine_name']] = $routine; } }