Beispiel #1
0
        public void ExecuteQuery()
        {
            var   source = GetExecuteSourceQuery();
            Table destination;

            switch (Query.ExecutionMode)
            {
            case ExecutionMode.SingleServer:
                // In single-server mode results are directly written into destination table
                destination = Query.Destination.GetTable();
                break;

            case ExecutionMode.Graywulf:
                // In graywulf mode results are written into a temporary table first
                destination = GetOutputTable();
                TemporaryTables.TryAdd(destination.TableName, destination);

                // Drop destination table, in case it already exists for some reason
                destination.Drop();
                break;

            default:
                throw new NotImplementedException();
            }

            ExecuteSelectInto(source, destination, Query.QueryTimeout);
        }
Beispiel #2
0
        /// <summary>
        /// Copies a table from a remote data source by creating and
        /// executing a table copy task.
        /// </summary>
        /// <param name="table"></param>
        /// <param name="source"></param>
        public void CopyRemoteTable(TableReference table, SourceTableQuery source)
        {
            // Create a target table name
            var temptable = GetTemporaryTable(GetEscapedUniqueName(table));

            TemporaryTables.TryAdd(table.UniqueName, temptable);

            var dest = new DestinationTable(temptable)
            {
                Options = TableInitializationOptions.Drop | TableInitializationOptions.Create
            };

            var tc = CreateTableCopyTask(source, dest, false);

            var guid = Guid.NewGuid();

            RegisterCancelable(guid, tc);

            tc.Execute();

            UnregisterCancelable(guid);
        }