Add a table to the statement cache.
@param table
@param tableAlias
@return the cache entry
421161
protected StmtTableScan addTableToStmtCache(Table table, String tableAlias) {
        // Create an index into the query Catalog cache
        StmtTableScan tableScan = m_tableAliasMap.get(tableAlias);
        if (tableScan == null) {
            tableScan = new StmtTargetTableScan(table, tableAlias, m_stmtId);
            m_tableAliasMap.put(tableAlias, tableScan);
        }
        return tableScan;
    }
1075993
public void invalidateCache(String table, String key) {
        cache.invalidateCache(new TableCacheKey<>(table, key, x -> null));
    }
28267
final public function traceTableAlias($table)
    {

        if (is_array($table)) {
            foreach ($table as $t) {
                $this->traceTableAlias($t);
            }
            return;
        }
        // Does the string contain a comma?  If so, we need to separate
        // the string into discreet statements
        if (strpos($table, ',') !== FALSE) {
            return $this->traceTableAlias(explode(',', $table));
        }
        // if a table alias is used we can recognize it by a space
        if (strpos($table, " ") !== FALSE) {
            // if the alias is written with the AS keyword, remove it
            $table = preg_replace('/ AS /i', ' ', $table);

            // Grab the alias
            $table = trim(strrchr($table, " "));

            // Store the alias, if it doesn't already exist
            if (!in_array($table, $this->arrayAliasedTables)) {
                $this->arrayAliasedTables[] = $table;
            }
        }
    }
240501
public ConnectedCrud<T, K> table(DataSource dataSource, String table) throws SQLException {
        Connection connection = dataSource.getConnection();
        try {
            return new ConnectedCrud<T, K>(new DataSourceTransactionTemplate(dataSource), table(connection, table));
        } finally {
            connection.close();
        }
    }
1155101
public void add(SchemaTableTree stt, String column, String alias) {
        add(stt.getSchemaTable(), column, stt.getStepDepth(), alias);
    }
905900
public void createTableWithData(String table, Map<String, String> colums, ArrayList<String> pk) {
        String query = this.cassandraqueryUtils.createTable(table, colums, pk);
        LOGGER.debug(query);
        executeQuery(query);
    }
1287207
public function addTable($table)
    {
        if (!$table instanceof Table) {
            $tbl = new Table();
            $tbl->setDatabase($this);
            $tbl->loadMapping($table);

            return $this->addTable($tbl);
        }

        $table->setDatabase($this);

        if (isset($this->tablesByName[$table->getName()])) {
            throw new EngineException(sprintf('Table "%s" declared twice', $table->getName()));
        }

        $this->tables[] = $table;
        $this->tablesByName[$table->getName()] = $table;
        $this->tablesByLowercaseName[strtolower($table->getName())] = $table;
        $this->tablesByPhpName[$table->getPhpName()] = $table;

        $this->computeTableNamespace($table);

        if (null === $table->getPackage()) {
            $table->setPackage($this->getPackage());
        }

        return $table;
    }
1021395
public void addPTable(PTable physicalTable)
    {
        Object strKey = physicalTable.getLookupKey();
        m_htTableList.put(strKey, physicalTable);
        this.getPDatabaseParent().addTableToCache(physicalTable);   // If cache is on
    }
397943
final protected void common_addAlias(Object key, Object[] aliasArray) {
        ValidateUtility.objectNotNull(key, "key", aliasArray, "aliasArray");
        cache.addAlias(
                       key,
                       aliasArray,
                       cache.shouldPull(this.sharingPolicy, key),
                       true);
    }
943834
public function from($table, /*# string */ $alias = '')
    {
        $tbl = $this->fixTable($table, $alias);
        $this->tables = array_merge($this->tables, $tbl);
        return $this;
    }
311192
public void addAlias(String cacheName, Object id, Object[] aliasArray) {
        if (id != null && aliasArray != null) {
            DCache cache = ServerCache.getCache(cacheName);
            if (cache != null) {
                try {
                    cache.addAlias(id, aliasArray, false, false);
                } catch (IllegalArgumentException e) {
                    if (tc.isDebugEnabled()) {
                        Tr.debug(tc, "Adding alias for cache id " + id + " failure: " + e.getMessage());
                    }
                }
            }
        }
    }
849787
private Table findTable(String alias) {
		List<String> names = null;
		if (tableScope == null) {
			// no tables to find
			return null;
		}

		for (ScopeChild child : tableScope.children) {
			if (catalogReader.nameMatcher().matches(child.name, alias)) {
				names = ((SqlIdentifier) child.namespace.getNode()).names;
				break;
			}
		}
		if (names == null || names.size() == 0) {
			return null;
		} else if (names.size() == 1) {
			return findTable(catalogReader.getRootSchema(), names.get(0),
				catalogReader.nameMatcher().isCaseSensitive());
		}

		CalciteSchema.TableEntry entry =
			SqlValidatorUtil.getTableEntry(catalogReader, names);

		return entry == null ? null : entry.getTable();
	}
420554
private function createTable(Table $table)
    {
        if ($this->getSqlStatements) {
            $createFlags = AbstractPlatform::CREATE_INDEXES |
                AbstractPlatform::CREATE_FOREIGNKEYS;
            $this->addSql(
                $this->getPlatform()
                    ->getCreateTableSQL($table, $createFlags)
            );
        } else {
            $this->schemaManager->createTable($table);
        }
    }
1011262
private void registerServerTransactionTable(ComponentRegistry componentRegistry, String cacheName) {
      //skip for global tx table and non-transactional cache
      if (GLOBAL_TX_TABLE_CACHE_NAME.equals(cacheName) ||
            !componentRegistry.getComponent(Configuration.class).transaction().transactionMode().isTransactional()) {
         return;
      }
      EmbeddedCacheManager cacheManager = componentRegistry.getGlobalComponentRegistry()
            .getComponent(EmbeddedCacheManager.class);
      createGlobalTxTable(cacheManager);
      // TODO We need a way for a module to install a factory before the default implementation is instantiated
      BasicComponentRegistry basicComponentRegistry = componentRegistry.getComponent(BasicComponentRegistry.class);
      basicComponentRegistry.replaceComponent(PerCacheTxTable.class.getName(), new PerCacheTxTable(cacheManager.getAddress()), true);
      basicComponentRegistry.replaceComponent(TransactionOriginatorChecker.class.getName(), new ServerTransactionOriginatorChecker(), true);
      basicComponentRegistry.rewire();
   }
311046
private void addRoutedTableIntoContext(TableWrapper table, ShardRouteConfig routeConfig, boolean appendAlias) {
        FrameContext frameContext = this.getStack().peek();
        String scName = table.getSchemaName();
        String tbName = table.getName();
        String tbAliasName = tbName;
        if (table.getAlias() != null && table.getAlias().getName() != null) {
            tbAliasName = table.getAlias().getName();
        } else {
            if (appendAlias) {
                table.setAlias(new Alias(tbName, true));
            }
        }
        String sdKey = DDRStringUtils.toLowerCase(routeConfig.getSdKey());// sdKey可以为null,当为null时需要通过context路由
        if (scName != null) {
            StringBuilder sb = new StringBuilder();
            sb.append(DDRStringUtils.toLowerCase(scName));
            sb.append('.');
            sb.append(DDRStringUtils.toLowerCase(tbAliasName));
            sb.append('.');
            sb.append(sdKey);
            String key = sb.toString();
            putIntoContext(frameContext, key, table);
            putIntoContext(frameContext, key.substring(scName.length() + 1), table);
            putIntoContext(frameContext, key.substring(scName.length() + 2 + tbAliasName.length()), table);
        } else {
            StringBuilder sb = new StringBuilder();
            sb.append(DDRStringUtils.toLowerCase(tbAliasName));
            sb.append('.');
            sb.append(sdKey);
            String key = sb.toString();
            putIntoContext(frameContext, key, table);
            putIntoContext(frameContext, key.substring(tbAliasName.length() + 1), table);
        }
    }
974200
public TableIdx getTableIdx(final String _tableName,
                                final String... _keys)
    {
        TableIdx ret = null;
        final String key = _tableName + "-" + StringUtils.join(_keys, "-");
        final Optional<TableIdx> val = this.tableidxs.stream().filter(t -> t.getKey().equals(key)).findFirst();
        if (val.isPresent()) {
            ret = val.get();
            ret.setCreated(false);
        } else {
            ret = new TableIdx().setCreated(true).setTable(_tableName).setIdx(this.currentIdx++).setKey(key);
            this.tableidxs.add(ret);
        }
        return ret;
    }
56312
protected function _addTable(Table $table)
    {
        $namespaceName = $table->getNamespaceName();
        $tableName     = $table->getFullQualifiedName($this->getName());

        if (isset($this->_tables[$tableName])) {
            throw SchemaException::tableAlreadyExists($tableName);
        }

        if ($namespaceName !== null
            && ! $table->isInDefaultNamespace($this->getName())
            && ! $this->hasNamespace($namespaceName)) {
            $this->createNamespace($namespaceName);
        }

        $this->_tables[$tableName] = $table;
        $table->setSchemaConfig($this->_schemaConfig);
    }