/** * Return an array of table names * * @return array */ public function getTables() { if ($this->_tables == self::AUTO_DETECT_TABLES) { $tables = $this->_db->show('SHOW TABLES', KDatabase::FETCH_FIELD_LIST); $prefix = $this->_db->getTablePrefix() . $this->getIdentifier()->package . '_'; $schemas = array(); foreach ($tables as $table) { if (strpos($table, $prefix) === 0) { $schemas[] = $table; } } } else { $schemas = $this->_tables; settype($schemas, 'array'); $prefix = $this->_db->getTablePrefix(); $schemas = array_map(function ($table) use($prefix) { return $prefix . $table; }, $schemas); } return $schemas; }
/** * Initializes the options for the object * * Called from {@link __construct()} as a first step of object instantiation. * * @param object An optional KConfig object with configuration options. * @return void */ protected function _initialize(KConfig $config) { $config->append(array('options' => array('host' => ini_get('mysqli.default_host'), 'username' => ini_get('mysqli.default_user'), 'password' => ini_get('mysqli.default_pw'), 'database' => '', 'port' => ini_get("mysqli.default_port"), 'socket' => ini_get("mysqli.default_socket")))); parent::_initialize($config); }