private void ImportLink() { using var status = WaitStatus.StartStatic(GetTruncatedDstTableName()); if (_vendor == "mssql") { _notebook.Execute( $"CREATE VIRTUAL TABLE {_dstTableName.DoubleQuote()} USING mssql " + $"('{_connectionString.Replace("'", "''")}', '{_srcTableName.Replace("'", "''")}', " + $"'{_srcSchemaName.Replace("'", "''")}')"); } else { _notebook.Execute( $"CREATE VIRTUAL TABLE {_dstTableName.DoubleQuote()} USING {_vendor} " + $"('{_connectionString.Replace("'", "''")}', '{_srcTableName.Replace("'", "''")}')"); } }
public void OnOpen() { using var simpleDataTable = WaitForm.GoWithCancel(TopLevelControl, "Table", "Reading table...", out var success, cancel => { using var status = WaitStatus.StartStatic(_tableName); cancel.Register(() => _manager.Notebook.BeginUserCancel()); try { return(_manager.Notebook.Query($"SELECT * FROM {_tableName.DoubleQuote()} LIMIT 1000")); } finally { _manager.Notebook.EndUserCancel(); } }); if (!success) { throw new OperationCanceledException(); } _grid.DataSource = simpleDataTable.ToDataTable(); _grid.AutoSizeColumns(this.Scaled(500)); _query = $"SELECT\r\n{string.Join(",\r\n", simpleDataTable.Columns.Select(x => " " + x.DoubleQuote()))}\r\nFROM {_tableName.DoubleQuote()}\r\nLIMIT 1000;\r\n"; }