Beispiel #1
0
        private IEnumerable <Entry> GetEntries(int offset, int length, SQLiteStatement query, int bindOffset)
        {
            query.Bind(bindOffset + 1, length);
            query.Bind(bindOffset + 2, offset);

            while (query.Step())
            {
                var id           = query.ColumnInt(0);
                var type         = (EntryType)query.ColumnInt(1);
                var connectionId = query.ColumnInt(2);
                var database     = query.ColumnText(3);
                var start        = query.ColumnText(4);
                var end          = query.ColumnText(5);
                var text         = query.ColumnText(6);
                var plan         = query.ColumnText(7);
                var results      = query.ColumnText(8);

                var startDate = DateTime.Parse(start, null, DateTimeStyles.RoundtripKind);
                var endDate   = DateTime.Parse(end, null, DateTimeStyles.RoundtripKind);

                var resultsTable = JsonConvert.DeserializeObject <DataTable>(results);

                yield return(new Entry
                {
                    Id = id,
                    Parent = this,
                    Type = type,
                    Connection = connectionId,
                    Database = database,
                    Start = startDate,
                    End = endDate,
                    Text = text,
                    Plan = plan,
                    Results = resultsTable,
                });
            }

            query.Reset();
        }