protected void ReportUnknownType(string dt) { using (var ub = new UsageBuilder("warning:unknown_db_type")) { m_conn.FillInfo(ub.Params); ub["data_type"] = dt; ub["analyser"] = GetType().FullName; } Logging.Info("Unknown database type:" + dt); }
public IDatabaseStructure AnalyseDatabase(IPhysicalConnection conn, string dbname, DatabaseStructureMembers members, IProgressInfo progress) { DatabaseAnalyser analyser = CreateAnalyser(); try { return(analyser.Run(this, conn, dbname, members, progress)); } catch (Exception err) { conn.FillInfo(err.Data); err.Data["analyse_dbname"] = dbname; throw; } }
public BedTable LoadTableData(int?start, int?count, string queryInstance) { int skipcount = 0; if (start != null) { skipcount = start.Value; } string sql = queryInstance; if (m_conn.Dialect.DialectCaps.RangeSelect && (skipcount > 0 || count != null)) { sql = m_conn.Dialect.GetRangeSelect(queryInstance, skipcount, count.Value); skipcount = 0; } else if (m_conn.Dialect.DialectCaps.LimitSelect && count != null) { sql = m_conn.Dialect.GetLimitSelect(queryInstance, skipcount + count.Value); } //WantMetadata(); using (DbCommand cmd = m_conn.SystemConnection.CreateCommand()) { try { lock (m_currentCommandLock) m_currentCommand = cmd; cmd.CommandText = sql; CommandBehavior behaviour = CommandBehavior.Default; if (!HasMetaData) { behaviour |= CommandBehavior.KeyInfo; } using (IBedReader reader = m_dda.AdaptReader(cmd.ExecuteReader(behaviour))) { if (!HasMetaData) { m_structure = reader.Structure; } if (m_structure == null) { return(null); } BedTable res = new BedTable(m_structure); while (skipcount > 0) { if (!reader.Read()) { return(res); } skipcount--; } while (count == null || res.Rows.Count < count.Value) { if (!reader.Read()) { return(res); } res.AddRow(reader); } return(res); } } catch (Exception err) { err.Data["sql"] = sql; m_conn.FillInfo(err.Data); throw; } finally { lock (m_currentCommandLock) m_currentCommand = null; } } }