コード例 #1
0
        private IExportTable GetTableExportTask(string path, bool remote)
        {
            var source = new SourceTableQuery()
            {
                Dataset = new Jhu.Graywulf.Schema.SqlServer.SqlServerDataset(Jhu.Graywulf.Test.Constants.TestDatasetName, Jhu.Graywulf.Test.AppSettings.IOTestConnectionString),
                Query   = "SELECT * FROM SampleData"
            };

            var destination = new DelimitedTextDataFile()
            {
                Uri = Util.UriConverter.FromFilePath(path)
            };

            IExportTable te = null;

            if (remote)
            {
                te = RemoteServiceHelper.CreateObject <IExportTable>(Test.Constants.Localhost);
            }
            else
            {
                te = new ExportTable();
            }

            te.Source      = source;
            te.Destination = destination;

            return(te);
        }
コード例 #2
0
ファイル: TableExportTest.cs プロジェクト: skyquery/graywulf
        private IExportTable GetTableExportTask(string path, bool remote)
        {
            var source = new SourceTableQuery()
            {
                Dataset = new Jhu.Graywulf.Schema.SqlServer.SqlServerDataset(Jhu.Graywulf.Test.Constants.TestDatasetName, Jhu.Graywulf.Test.AppSettings.IOTestConnectionString),
                Query = "SELECT * FROM SampleData"
            };

            var destination = new DelimitedTextDataFile()
            {
                Uri = Util.UriConverter.FromFilePath(path)
            };

            IExportTable te = null;
            if (remote)
            {
                te = RemoteServiceHelper.CreateObject<IExportTable>(Test.Constants.Localhost);
            }
            else
            {
                te = new ExportTable();
            }

            te.Source = source;
            te.Destination = destination;

            return te;
        }
コード例 #3
0
        protected void WriteTable(SourceTableQuery source, DataFileBase destination)
        {
            // Create command that reads the table
            using (var cmd = source.CreateCommand())
            {
                using (var cn = source.OpenConnection())
                {
                    using (var tn = cn.BeginTransaction(IsolationLevel.ReadUncommitted))
                    {
                        cmd.Connection     = cn;
                        cmd.Transaction    = tn;
                        cmd.CommandTimeout = Timeout;

                        WriteTable(cmd, destination);
                    }
                }
            }
        }
コード例 #4
0
        private ICopyTable GetTableCopy(string tableName, bool remote)
        {
            ICopyTable q = null;

            if (remote)
            {
                q = RemoteServiceHelper.CreateObject <ICopyTable>(Test.Constants.Localhost);
            }
            else
            {
                q = new CopyTable();
            }

            var ds = new Jhu.Graywulf.Schema.SqlServer.SqlServerDataset(Jhu.Graywulf.Test.Constants.TestDatasetName, Jhu.Graywulf.Test.AppSettings.IOTestConnectionString)
            {
                IsMutable = true
            };

            var source = new SourceTableQuery()
            {
                Dataset = ds,
                Query   = "SELECT 1 AS one, 2 AS two, 3 AS three"
            };

            q.Source = new SourceTableQuery[] { source };


            var destination = new Jhu.Graywulf.Schema.Table()
            {
                Dataset    = ds,
                SchemaName = "dbo",
                TableName  = tableName
            };

            q.Destination = new Schema.Table[] { destination };

            q.Options = TableInitializationOptions.Create;

            return(q);
        }
コード例 #5
0
ファイル: TableCopyTest.cs プロジェクト: skyquery/graywulf
        private ICopyTable GetTableCopy(string tableName, bool remote)
        {
            ICopyTable q = null;
            if (remote)
            {
                q = RemoteServiceHelper.CreateObject<ICopyTable>(Test.Constants.Localhost);
            }
            else
            {
                q = new CopyTable();
            }

            var ds = new Jhu.Graywulf.Schema.SqlServer.SqlServerDataset(Jhu.Graywulf.Test.Constants.TestDatasetName, Jhu.Graywulf.Test.AppSettings.IOTestConnectionString)
            {
                IsMutable = true
            };

            var source = new SourceTableQuery()
            {
                Dataset = ds,
                Query = "SELECT 1 AS one, 2 AS two, 3 AS three"
            };

            q.Source = new SourceTableQuery[] { source };

            var destination = new Jhu.Graywulf.Schema.Table()
            {
                Dataset = ds,
                SchemaName = "dbo",
                TableName = tableName
            };

            q.Destination = new Schema.Table[] { destination };

            q.Options = TableInitializationOptions.Create;

            return q;
        }
コード例 #6
0
ファイル: CopyTable.cs プロジェクト: theresadower/graywulf
 private void CopyMembers(CopyTable old)
 {
     this.source      = old.source;
     this.destination = old.destination;
 }
コード例 #7
0
ファイル: CopyTable.cs プロジェクト: theresadower/graywulf
 private void InitializeMembers()
 {
     this.source      = null;
     this.destination = null;
 }
コード例 #8
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);
        }
コード例 #9
0
ファイル: ExportTables.cs プロジェクト: skyquery/graywulf
        public IExportTableArchive GetInitializedTableExportTask()
        {
            // Determine server name from connection string
            // This is required, because bulk copy can go into databases that are only known
            // by their connection string
            // Get server name from data source name (requires trimming the sql server instance name)
            string host = ((Jhu.Graywulf.Schema.SqlServer.SqlServerDataset)sources[0].Dataset).Host;

            var ss = new SourceTableQuery[sources.Length];
            for (int i = 0; i < sources.Length; i++)
            {
                ss[i] = new SourceTableQuery()
                {
                    Dataset = sources[i].Dataset,
                    Query = String.Format("SELECT t.* FROM [{0}].[{1}] AS t", sources[i].SchemaName, sources[i].ObjectName)
                };
            }

            // Create bulk operation
            var te = RemoteServiceHelper.CreateObject<IExportTableArchive>(host);

            te.Sources = ss;
            te.Destinations = destinations;
            te.Uri = uri;
            te.FileFormatFactoryType = fileFormatFactoryType;
            te.StreamFactoryType = streamFactoryType;
            te.Timeout = timeout;

            return te;
        }
コード例 #10
0
ファイル: CopyTable.cs プロジェクト: skyquery/graywulf
 private void InitializeMembers()
 {
     this.source = null;
     this.destination = null;
 }
コード例 #11
0
ファイル: SourceTableQuery.cs プロジェクト: skyquery/graywulf
 private void CopyMembers(SourceTableQuery old)
 {
     this.dataset = Util.DeepCloner.CloneObject(old.dataset);
     this.query = old.query;
 }
コード例 #12
0
ファイル: SourceTableQuery.cs プロジェクト: skyquery/graywulf
 public SourceTableQuery(SourceTableQuery old)
 {
     CopyMembers(old);
 }
コード例 #13
0
ファイル: CopyTableBase.cs プロジェクト: skyquery/graywulf
        protected void WriteTable(SourceTableQuery source, DataFileBase destination)
        {
            // Create command that reads the table
            using (var cmd = source.CreateCommand())
            {
                using (var cn = source.OpenConnection())
                {
                    using (var tn = cn.BeginTransaction(IsolationLevel.ReadUncommitted))
                    {
                        cmd.Connection = cn;
                        cmd.Transaction = tn;
                        cmd.CommandTimeout = Timeout;

                        WriteTable(cmd, destination);
                    }
                }
            }
        }
コード例 #14
0
 public SourceTableQuery(SourceTableQuery old)
 {
     CopyMembers(old);
 }
コード例 #15
0
ファイル: CopyTable.cs プロジェクト: skyquery/graywulf
 private void CopyMembers(CopyTable old)
 {
     this.source = old.source;
     this.destination = old.destination;
 }
コード例 #16
0
 private void CopyMembers(SourceTableQuery old)
 {
     this.dataset = Util.DeepCloner.CloneObject(old.dataset);
     this.query   = old.query;
 }
コード例 #17
0
ファイル: CopyRemoteTable.cs プロジェクト: skyquery/graywulf
 private void OnAsyncExecute(Guid workflowInstanceGuid, string activityInstanceId, QueryPartitionBase querypartition, TableReference remotetable, SourceTableQuery source)
 {
     RegisterCancelable(workflowInstanceGuid, activityInstanceId, querypartition);
     querypartition.CopyRemoteTable(remotetable, source);
     UnregisterCancelable(workflowInstanceGuid, activityInstanceId, querypartition);
 }