Register a table override

@param oldTable table to override
@param newTable override
@return previous override value

@deprecated Use {@link #setDynamicNameMapping(NameMapping)} instead.
540993
@Deprecated
    public String registerTableOverride(String oldTable, String newTable) {
        return internalNameMapping.registerTableOverride(oldTable, newTable);
    }
384534
@Override
    public void registerTable(EntityMetadata m, SparkClient sparkClient)
    {
        String conn = getConnectionString(m);

        Map<String, String> options = new HashMap<String, String>();
        options.put("url", conn);
        options.put("dbtable", m.getTableName());

        sparkClient.sqlContext.load("jdbc", options).registerTempTable(m.getTableName());
    }
106683
public String getUpdateNamesPrepareSQL(T bean) {
        if (this.tableStrategy == null) return updateNamesPrepareSQL;
        return updateNamesPrepareSQL.replace("${newtable}", getTable(bean));
    }
497712
protected void registerSuperClassMultipleJoinedTables(ClassDescriptor cld)
    {
        /*
        arminw: Sadly, we can't map to sub class-descriptor, because it's not guaranteed
        that they exist when this method is called. Thus we map the class instance instead
        of the class-descriptor.
        */
        if(cld.getBaseClass() != null)
        {
            try
            {
                Class superClass = ClassHelper.getClass(cld.getBaseClass());
                Class currentClass = cld.getClassOfObject();
                synchronized(descriptorTable)
                {
                    List subClasses = (List) superClassMultipleJoinedTablesMap.get(superClass);
                    if(subClasses == null)
                    {
                        subClasses = new ArrayList();
                        superClassMultipleJoinedTablesMap.put(superClass,  subClasses);
                    }
                    if(!subClasses.contains(currentClass))
                    {
                        if(log.isDebugEnabled())
                        {
                            log.debug("(MultipleJoinedTables): Register sub-class '" + currentClass
                                    + "' for class '" + superClass);
                        }
                        subClasses.add(currentClass);
                    }
                }
            }
            catch(Exception e)
            {
                throw new MetadataException("Can't register super class '" + cld.getBaseClass()
                        + "' for class-descriptor: " + cld, e);
            }
        }
    }
545022
public boolean setTableType(Session session, int newType) {

        int currentType = table.getTableType();

        if (currentType == newType) {
            return false;
        }

        switch (newType) {

            case TableBase.CACHED_TABLE :
                break;

            case TableBase.MEMORY_TABLE :
                break;

            default :
                return false;
        }

        Table tn;

        try {
            tn = table.moveDefinition(session, newType, null, null, null, -1,
                                      0, emptySet, emptySet);

            tn.moveData(session, table, -1, 0);
            updateConstraints(tn, emptySet);
        } catch (HsqlException e) {
            return false;
        }

        setNewTableInSchema(tn);
        database.persistentStoreCollection.releaseStore(table);

        table = tn;

        database.schemaManager.recompileDependentObjects(table);

        return true;
    }
842753
public static boolean isTableExportOnly(org.voltdb.catalog.Database database,
                                            org.voltdb.catalog.Table table) {
        int type = table.getTabletype();
        if (TableType.isInvalidType(type)) {
            // This implementation uses connectors instead of just looking at the tableType
            // because snapshots or catalogs from pre-9.0 versions (DR) will not have this new tableType field.
            for (Connector connector : database.getConnectors()) {
                // iterate the connector tableinfo list looking for tableIndex
                // tableInfo has a reference to a table - can compare the reference
                // to the desired table by looking at the relative index. ick.
                for (ConnectorTableInfo tableInfo : connector.getTableinfo()) {
                    if (tableInfo.getTable().getRelativeIndex() == table.getRelativeIndex()) {
                        return true;
                    }
                }
            }
            // Found no connectors
            return false;
        } else {
            return TableType.isStream(type);
        }
    }
254128
public void setTable(final Table table) {
        if (table != _tableRef.get()) {
            _tableRef.set(table);

            if (table == null) {
                _comboBox.setEmptyModel();
            } else {
                _comboBox.setModel(table);
            }
        }
    }
521929
public Table defineLocalTable(HsqlName tableName, HsqlName[] colNames, Type[] colTypes) {
        // I'm not sure the table type, here TableBase.CACHED_TABLE, matters
        // all that much.
    	assert(localTables != null);
        Table newTable = TableUtil.newTable(database, TableBase.CACHED_TABLE, tableName);
        TableUtil.setColumnsInSchemaTable(newTable, colNames, colTypes);
        newTable.createPrimaryKey(new int[0]);
        localTables.put(tableName.name, newTable);
        return newTable;
    }
836722
public function replaceTable($oldTable, $newTable) {
		$this->where = $this->replaceTableInConditions($this->where, $oldTable, $newTable);
		$this->joins = $this->replaceTableInConditions($this->joins, $oldTable, $newTable);
		#using regex to replace table names not preceded by one of the following character
		if($this->groupBy)
			$this->groupBy[0] = preg_replace('/(?<![a-zA-Z0-9_])'.$oldTable.'\./', $newTable.'.', $this->groupBy[0]);
	}
747515
public NodeSchema resetTableName(String tbName, String tbAlias) {
       m_columns.forEach(sc ->
             sc.reset(tbName, tbAlias, sc.getColumnName(), sc.getColumnAlias()));
       m_columnsMapHelper.forEach((k, v) ->
             k.reset(tbName, tbAlias, k.getColumnName(), k.getColumnAlias()));
       return this;
    }
308879
private function getDroppedPrimaryKey(Table $oldTable, Table $newTable)
    {
        if (($oldTable->hasPrimaryKey() && !$newTable->hasPrimaryKey())
            || ($oldTable->hasPrimaryKey() && $newTable->hasPrimaryKey()
            && $this->comparePrimaryKeys($oldTable->getPrimaryKey(), $newTable->getPrimaryKey()))) {
            return $oldTable->getPrimaryKey();
        }
    }
1139807
public static Table getTable(DatabaseMetaData metadata, String tableName) throws Exception {
        return new Table(
            tableName,
            getPrimaryKey(metadata, tableName),
            getForeignKeys(metadata, tableName),
            getExportedKeys(metadata, tableName),
            getColumns(metadata, tableName)
        );
    }
1258227
public void updateMetadata(String tableName, String metadata){
		try {
			updateStatement.setString(1, metadata);
			updateStatement.setLong(2, tableName.hashCode());
			updateStatement.executeUpdate();
		} catch (SQLException e) {
			throw new BackendException("Could not update metadata for table '" + tableName + "'", e);
		}
	}
261468
public boolean renameTable(String tableName, String newTableName) throws DBException
    {
        try {
            if (DBConstants.TRUE.equals((String)this.getDatabase().getProperties().get(SQLParams.NO_PREPARED_STATEMENTS_ON_CREATE)))
                this.setStatement(null, DBConstants.SQL_CREATE_TYPE);
            if (this.getStatement(DBConstants.SQL_CREATE_TYPE) == null)
            	this.setStatement(((JdbcDatabase)this.getDatabase()).getJDBCConnection().createStatement(), DBConstants.SQL_CREATE_TYPE);

            String sql = "RENAME TABLE " + tableName + " TO " + newTableName;
            this.getStatement(DBConstants.SQL_CREATE_TYPE).execute(sql);
            
            if (DBConstants.TRUE.equals((String)this.getDatabase().getProperties().get(SQLParams.NO_PREPARED_STATEMENTS_ON_CREATE)))
                this.setStatement(null, DBConstants.SQL_CREATE_TYPE);
        } catch (SQLException e) {
            throw this.getDatabase().convertError(e);
        }
        return true;
    }
598524
public function modifyTable()
    {
        $table = $this->getTable();
        $database = $table->getDatabase();
        $delegates = explode(',', $this->parameters['to']);
        foreach ($delegates as $delegate) {
            $delegate = $database->getTablePrefix() . trim($delegate);
            if (!$database->hasTable($delegate)) {
                throw new InvalidArgumentException(sprintf('No delegate table "%s" found for table "%s"', $delegate, $table->getName()));
            }
            if (in_array($delegate, $table->getForeignTableNames())) {
                // existing many-to-one relationship
                $type = self::MANY_TO_ONE;
            } else {
                // one_to_one relationship
                $delegateTable = $this->getDelegateTable($delegate);
                if (in_array($table->getName(), $delegateTable->getForeignTableNames())) {
                    // existing one-to-one relationship
                    $fks = $delegateTable->getForeignKeysReferencingTable($this->getTable()->getName());
                    $fk = $fks[0];
                    if (!$fk->isLocalPrimaryKey()) {
                        throw new InvalidArgumentException(sprintf('Delegate table "%s" has a relationship with table "%s", but it\'s a one-to-many relationship. The `delegate` behavior only supports one-to-one relationships in this case.', $delegate, $table->getName()));
                    }
                } else {
                    // no relationship yet: must be created
                    $this->relateDelegateToMainTable($this->getDelegateTable($delegate), $table);
                }
                $type = self::ONE_TO_ONE;
            }
            $this->delegates[$delegate] = $type;
        }
    }
425898
public static void register(IRegisterable<?> registerable)
	{
		ResourceLocation name = registerable.getName();
		if (name == null)
			throw new IllegalArgumentException("No name specified for registration for " + registerable.getClass().getName());
		if (!(registerable instanceof Block || registerable instanceof Item))
			throw new IllegalArgumentException("Cannot register " + registerable.getClass().getName() + " (" + name
					+ ") because it's neither a block or an item.");

		if (registerable instanceof Block)
		{
			Block block = (Block) registerable;
			ForgeRegistries.BLOCKS.register(block);
			Item item = registerable.getItem(block);
			if (item != null)
				ForgeRegistries.ITEMS.register(item);

			//register the mapper for the block and the model for the item
			if (MalisisCore.isClient())
			{
				ModelLoader.setCustomStateMapper(block, b -> ImmutableMap.of());
				if (item != null)
					EmptyModelLoader.register(item);
			}

			ClientNotificationManager.discover(block);
		}
		else if (registerable instanceof Item)
		{
			Item item = (Item) registerable;
			ForgeRegistries.ITEMS.register(item);
			if (MalisisCore.isClient())
				EmptyModelLoader.register(item);
		}
	}
282247
public void renamedType(String oldName, Class<?> currentValue) {
        if (oldName == null) {
            throw new IllegalArgumentException("oldName must not be null");
        }
        if (currentValue == null) {
            throw new IllegalArgumentException("currentValue must not be null");
        }
        if (oldName.startsWith("java.") || oldName.startsWith("javax.") || oldName.startsWith("org.joda.")) {
            throw new IllegalArgumentException("oldName must not be a java.*, javax.* or org.joda.* type");
        }
        checkNotLocked();
        typeRenames.put(oldName, currentValue);
    }