根据表名获取cache版本号

@param string $table

@return mixed
336061
public function getCacheVer($table)
    {
        if (!$this->openCache) {
            return '';
        }

        $version = Model::getInstance()->cache()->get($this->conf['mark'] . '_db_cache_version_' . $table);
        if (!$version) {
            $version = microtime(true);
            Model::getInstance()->cache()->set($this->conf['mark'] . '_db_cache_version_' . $table, $version, $this->conf['cache_expire']);
        }
        return $version;
    }
52533
public function wrapTable($table)
    {
        if ($this->isExpression($table)) {
            return $this->getValue($table);
        }
        return $this->wrap($this->tablePrefix.$table, true);
    }
55935
public function getColumns($table)
    {
        $table = $this->prefixTable($table);

        if (empty($this->queriesResultCache[ 'tableColumns' ][ $table ])) {
            $result = $this->query('PRAGMA TABLE_INFO(' . $this->protectIdentifiers($table, true, null, false) . ')');

            if ($result->count()) {
                foreach ($result as $row) {
                    // Do we know from where to get the column's name?
                    if ( ! isset($key)) {
                        if (isset($row[ 'name' ])) {
                            $key = 'name';
                        }
                    }

                    $this->queriesResultCache[ 'tableColumns' ][ $table ][ $row->offsetGet($key) ] = $row;
                }
            }
        }

        return $this->queriesResultCache[ 'tableColumns' ][ $table ];
    }
374012
public function prefixTable(string $table): string
	{
		// Add the prefix to the table name
		// before quoting it
		if ( ! empty($this->tablePrefix))
		{
			// Split identifier by period, will split into:
			// database.schema.table OR
			// schema.table OR
			// database.table OR
			// table
			$identifiers = explode('.', $table);
			$segments = count($identifiers);

			// Quote the last item, and add the database prefix
			$identifiers[$segments - 1] = $this->_prefix(end($identifiers));

			// Rejoin
			$table = implode('.', $identifiers);
		}

		return $table;
	}
1168082
public function FormatTableName($Table) {

      if (strpos($Table, '.') !== FALSE){
         if(preg_match('/^([^\s]+)\s+(?:as\s+)?`?([^`]+)`?$/', $Table, $Matches)){
            $DatabaseTable = '`' . str_replace('.', '`.`', $Matches[1]) . '`';
            $Table = str_replace($Matches[1], $DatabaseTable, $Table);
         }else
            $Table = '`' . str_replace('.', '`.`', $Table) . '`';
      }
      return $Table;
   }
341537
final public function fetchColumnDefs(string $table) {
        $tableKey = strtolower($table);

        if (!empty($this->tables[$tableKey]['columns'])) {
            $this->tables[$tableKey]['columns'];
        } elseif ($this->tableNames !== null && !isset($this->tableNames[$tableKey])) {
            return null;
        }

        $columnDefs = $this->fetchColumnDefsDb($table);
        if ($columnDefs !== null) {
            $this->tables[$tableKey]['columns'] = $columnDefs;
        }
        return $columnDefs;
    }
307837
public function getAliasNames($table) {
    $names = [];
    if (is_array($this->table) && current($this->table) == $table) {
      $names[] = key($this->table);
    }
    foreach ($this->joins->getJoins() as $join) {
      $joinName = $join['name'];
      if (is_array($joinName) && current($joinName) == $table) {
        $names[] = key($joinName);
      }
    }
    return $names;
  }
1190890
public function getFields($table)
	{
		// 查询
		$result = $this->query('show columns from ' . $this->parseKeyword($table));
		if (false === $result)
		{
			// 失败
			$result = false;
			return $result;
		}
		else
		{
			$fields = array ();
			// 处理数据
			foreach($result as $item)
			{
				$this->parseFieldType($item['Type'], $typeName, $length, $accuracy);
				$fields[$item['Field']] = array(
					'name'			=>	$item['Field'],
					'type'			=>	$typeName,
					'length'		=>	$length,
					'accuracy'		=>	$accuracy,
					'null'			=>	'yes' === strtolower($item['Null']),
					'default'		=>	$item['Default'],
					'pk'			=>	'PRI' === $item['Key'],
					'is_auto_inc'	=>	false !== strpos($item['Extra'], 'auto_increment'),
					'key'			=>	$item['Key'],
					'extra'			=>	$item['Extra']
				);
			}
			// 返回结果
			return $fields;
		}
	}
924909
protected function parseUpdateTable($table)
    {
        $table = $alias = $this->wrapTable($table);

        if (stripos($table, '] as [') !== false) {
            $alias = '['.explode('] as [', $table)[1];
        }

        return [$table, $alias];
    }
252197
public function getTable($table)
    {
        return array_merge(
            $this->cache['tables'][$table],
            [
                'fields'      => $this->cache['fields'][$table] ?? [],
                'constraints' => $this->cache['constraints'][$table] ?? [],
            ]
        );
    }
295649
public function getCachedVersion($key)
    {
        $key = strtolower($key);
        if ('www.' === substr($key, 0, 4)) {
            $key = substr($key, 4);
        }

        if (\array_key_exists($key, $this->cache)) {
            return $this->cache[$key];
        }

        return false;
    }
1314774
public function getHash($table)
    {
        $fields = array();
        if (isset($table['fields'])) {
            $fields = $table['fields'];
        }
        if (isset($table['field'])) {
            $fields = array($table);
        }
        if (isset($table['keys'])) {
            $fields += $table['keys'];
        }
        $list = array_map(array($this, 'encode_hash'), $fields);
        ksort($list);
        return sha1(strtolower(implode('-', array_keys($list)) . implode('-', $list)));
    }
987455
public function getTableInfo($table)
    {
        if (!$this->tableExists($table)) {
            return null;
        }
        
        $rtable = static::buildRealTableName($table, true);
        $key = 'db/tableinfo/' . $rtable;
        $data = static::getCache()->get($key);
        
        if (!$data) {
            $data = ['table_name' => $table];
            $data['fields'] = $this->getColumns($table);
            $pk = [];
            foreach ($data['fields'] as $key => $val) {
                if($val['is_primary']) {
                    $pk[] = $key;
                }
            }
            $data['primary_key'] = $pk ? $pk[0] : null;
            
            static::getCache()->set($key, $data);
        }
        
        return $data;
    }
205835
public function update( $table )
    {
        $table = $this->getIdentifier( $table );
        $table = $this->getPrefixedTableNames($table);
        $this->table = $table;
        return $this;
    }
1219874
public function getPrimaryKey($table)
    {
        $query = $this->getUtilityQuery();
        $results = $this->getColumns($table, "`Key` = 'PRI'");
        return isset($results[0]['Field']) ? $results[0]['Field'] : null;
    }
147083
public function getColumns($table)
    {
        $sql = 'SHOW COLUMNS FROM '. $this->formatKey($table);
        
        $result = $this->query($sql);
        if ($result === false) {
            return array();
        }
        
        $array = array();
        while ($tmp = $result->fetch(\PDO::FETCH_ASSOC)){
            // $tmp['Type'] 格式为 varchar(30), 可解析出 data_type, data_length
            preg_match('/([^\(]+)\(?(\d*)\)?/i', $tmp['Type'], $matches);
            $data_type = $matches[1];
            $data_length = $matches[2];
            $array[$tmp['Field']] = array(
                'name'      => $tmp['Field'],
                'type'      => $data_type,
                'length'    => $data_length,
                'null'      => $tmp['Null'],
                'primary'   => (strtolower($tmp['Key']) == 'pri'),
                'default'   => $tmp['Default'],
                'auto_increment' => (strtolower($tmp['Extra']) == 'auto_increment'),
            );
        }
        
        return $this->formatColumns($array);
    }
1159569
public function getTableKeys($table)
    {
        $this->connect();

        $keys = array();
        $query = $this->getQuery(true);

        $fieldCasing = $this->getOption(PDO::ATTR_CASE);

        $this->setOption(PDO::ATTR_CASE, PDO::CASE_UPPER);

        $table = strtoupper($table);
        $query->setQuery('pragma table_info( ' . $table . ')');

        // $query->bind(':tableName', $table);

        $this->setQuery($query);
        $rows = $this->loadObjectList();

        foreach ($rows as $column)
        {
            if ($column->PK == 1)
            {
                $keys[$column->NAME] = $column;
            }
        }

        $this->setOption(PDO::ATTR_CASE, $fieldCasing);

        return $keys;
    }