コード例 #1
0
ファイル: QueryObject.cs プロジェクト: theresadower/graywulf
        /// <summary>
        /// Substitutes names of remote tables with name of temporary tables
        /// holding a cached version of remote tables.
        /// </summary>
        /// <remarks></remarks>
        // TODO: This function call must be synchronized! ??
        protected virtual void SubstituteRemoteTableNames(DatasetBase temporaryDataset, string temporarySchemaName)
        {
            switch (ExecutionMode)
            {
            case ExecutionMode.SingleServer:
                // No remote table support

                // Replace remote table references with temp table references
                foreach (TableReference tr in SelectStatement.EnumerateSourceTableReferences(true))
                {
                    if (!tr.IsSubquery && TemporaryTables.ContainsKey(tr.UniqueName))
                    {
                        throw new NotImplementedException();
                    }
                }
                break;

            case ExecutionMode.Graywulf:
                var sm = GetSchemaManager(false);

                // Replace remote table references with temp table references
                foreach (TableReference tr in SelectStatement.EnumerateSourceTableReferences(true))
                {
                    SubstituteRemoteTableName(sm, tr, temporaryDataset, temporarySchemaName);
                }
                break;

            default:
                throw new NotImplementedException();
            }
        }
コード例 #2
0
ファイル: QueryObject.cs プロジェクト: theresadower/graywulf
        /// <summary>
        /// Substitutes the name of a remote tables with name of the temporary table
        /// holding a cached version of the remote data.
        /// </summary>
        /// <param name="sm"></param>
        /// <param name="tr"></param>
        /// <param name="temporaryDataset"></param>
        /// <param name="temporarySchemaName"></param>
        private void SubstituteRemoteTableName(SchemaManager sm, TableReference tr, DatasetBase temporaryDataset, string temporarySchemaName)
        {
            // Save unique name because it will change as names are substituted
            var un = tr.UniqueName;

            // TODO: write function to determine if a table is to be copied
            // ie. the condition in the if clause of the following line
            if (tr.IsCachable && TemporaryTables.ContainsKey(tr.UniqueName) &&
                IsRemoteDataset(sm.Datasets[tr.DatasetName]))
            {
                tr.DatabaseName       = temporaryDataset.DatabaseName;
                tr.SchemaName         = temporarySchemaName;
                tr.DatabaseObjectName = TemporaryTables[un].TableName;
                tr.DatabaseObject     = null;
            }
        }