Example #1
0
 /**
  * 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;
 }