private void LoadTableDataProlog(TableDataSetProperties props, out BedAdapter adapter, out string cmdtext) { var per = props.Perspective; WantAdapter(per); adapter = m_adapters[per ?? nullPer]; m_conn.ReconnectIfBroken(); if (m_conn.Dialect.DialectCaps.MultipleDatabase) { m_conn.SystemConnection.SafeChangeDatabase(m_dbname); } cmdtext = GetQuery(props, QueryType.Select); ProgressInfo.Debug(Texts.Get("s_executing$query", "query", cmdtext)); }
public BedTable LoadTableData(TablePageProperties props) { DateTime start = DateTime.Now; var per = props.Perspective; try { BedAdapter adapter; string cmdtext; LoadTableDataProlog(props, out adapter, out cmdtext); using (var canc = Connection.AddOnCancel(adapter.CancelLoading)) { BedTable table = null; try { table = adapter.LoadTableData(props.Start, props.Count, cmdtext); } catch (Exception err) { LoadTableDataPrologHandleError(props, err); } var slen = DateTime.Now - start; double len = slen.TotalSeconds; if (table != null) { ProgressInfo.Debug(Texts.Get("s_readed$rows$cols$len", "rows", table.Rows.Count, "cols", table.Structure.Columns.Count, "len", len.ToString("0.00"))); } m_adapterByTable[table] = adapter; if (per != null) { table.ResultFields = per.Select.Columns; } if (LoadedDataInfo != null) { var ea = new LoadedTableInfoArgs(); ea.Duration = slen; ea.Table = table; LoadedDataInfo(this, ea); } return(table); } } catch (Exception err) { // probably error in command, clear adapter so that it is recreated next time m_adapters.Remove(per ?? nullPer); if (LoadedDataInfo != null) { var ea = new LoadedTableInfoArgs(); ea.Duration = DateTime.Now - start; ea.Error = err; LoadedDataInfo(this, ea); } throw; } }