private void CopyMembers(DestinationTable old) { this.dataset = old.dataset; this.databaseName = old.databaseName; this.schemaName = old.schemaName; this.tableName = old.tableName; this.options = old.options; }
protected void ReadTable(DataFileBase source, DestinationTable destination) { // Import the file by wrapping it into a dummy command using (var cmd = new FileCommand(source)) { ImportTable(cmd, destination); } }
protected void ImportTable(IDbCommand cmd, DestinationTable destination) { var guid = Guid.NewGuid(); var ccmd = new CancelableDbCommand(cmd); RegisterCancelable(guid, ccmd); ccmd.ExecuteReader(dr => { // TODO: Add multiple results logic // TODO: Add table naming logic here, maybe... var table = destination.GetTable(); table.Initialize(dr.GetSchemaTable(), destination.Options); ExecuteBulkCopy(dr, table); }); UnregisterCancelable(guid); }
/// <summary> /// Copies resultset from the output temporary table to the destination database (MYDB) /// </summary> public void CopyResultset() { switch (Query.ExecutionMode) { case ExecutionMode.SingleServer: // Do nothing as execute writes results directly into destination table break; case ExecutionMode.Graywulf: { var source = GetOutputSourceQuery(); var destination = new DestinationTable(Query.Destination) { // Change destination to Append, output table has already been created, // partitions only append to it Options = TableInitializationOptions.Append }; DumpSqlCommand(source.Query); // Create bulk copy task and execute it var tc = CreateTableCopyTask(source, destination, false); var guid = Guid.NewGuid(); RegisterCancelable(guid, tc); tc.Execute(); UnregisterCancelable(guid); } break; default: throw new NotImplementedException(); } }
/// <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); }
private void InitializeMembers() { this.source = null; this.destination = null; }
private void CopyMembers(CopyTable old) { this.source = old.source; this.destination = old.destination; }
private void CopyMembers(ImportTableArchive old) { this.destination = old.destination; }
private DestinationTable CreateDestination(string schemaName, string tableName) { GetUniqueTableName(schemaName, ref tableName); var destination = new DestinationTable( MyDBDataset, MyDBDataset.DatabaseName, schemaName, tableName, Graywulf.Schema.TableInitializationOptions.Create); return destination; }
public DestinationTable(DestinationTable old) { CopyMembers(old); }