protected virtual List <FirefoxBookmarkRow> GetBookmarksRows(SQLiteConnection connection)
        {
            var hasLastVisitedColumn = HasColumn(connection, "moz_bookmarks", "last_visit_date");
            var columnsToSelect      = hasLastVisitedColumn ? ColumnsToSelect + ", p.last_visit_date" : ColumnsToSelect;

            var     cmd    = new SQLiteCommand(string.Format(BookmarksSelectStatementTemplate, columnsToSelect), connection);
            dynamic reader = new DynamicReader(cmd.ExecuteReader());
            var     rows   = new List <FirefoxBookmarkRow>();

            while (reader.Read())
            {
                rows.Add(new FirefoxBookmarkRow()
                {
                    Id           = reader.id,
                    Parent       = reader.parent,
                    Type         = reader.type,
                    Position     = reader.position,
                    Title        = reader.title,
                    Url          = reader.url,
                    LastModified = reader.lastmodified,
                    DateAdded    = reader.dateadded,
                    LastVisit    = reader.last_visit_date,
                    VisitCount   = reader.visit_count,
                    Hidden       = reader.hidden > 0,
                });
            }
            return(rows);
        }
        protected virtual IEnumerable <FirefoxBookmarkAttribute> GetBookmarksAttributes(SQLiteConnection connection)
        {
            var     cmd    = new SQLiteCommand(AttributesSelectStatement, connection);
            dynamic reader = new DynamicReader(cmd.ExecuteReader());
            var     attrs  = new List <FirefoxBookmarkAttribute>();

            while (reader.Read())
            {
                attrs.Add(new FirefoxBookmarkAttribute()
                {
                    BookmarkId     = reader.item_id,
                    AttributeName  = reader.name,
                    AttributeValue = reader.content
                });
            }
            return(attrs);
        }
        private void FillDbColumns(SQLiteConnection connection, string tableName)
        {
            var cmd     = new SQLiteCommand(string.Format(TableInfoSelectTemplate, tableName), connection);
            var columns = new HashSet <string>();

            _dbColumnInfo[tableName] = columns;
            dynamic reader = new DynamicReader(cmd.ExecuteReader());

            try
            {
                while (reader.Read())
                {
                    columns.Add(reader.name);
                }
            }
            finally
            {
                reader.Close();
            }
        }
 private void FillBookmarksRoots(SQLiteConnection connection)
 {
     if (!_roots.Any())
     {
         var     cmd    = new SQLiteCommand(BookmarksRootsSelectStatement, connection);
         dynamic reader = new DynamicReader(cmd.ExecuteReader());
         try
         {
             while (reader.Read())
             {
                 string rootName = reader.title.ToLower();
                 if (!_roots.ContainsKey(rootName))
                 {
                     _roots.Add(rootName, (int)reader.id);
                 }
             }
         }
         finally
         {
             reader.Close();
         }
     }
 }
 private void FillDbColumns(SQLiteConnection connection, string tableName)
 {
     var cmd = new SQLiteCommand(string.Format(TableInfoSelectTemplate, tableName), connection);
     var columns = new HashSet<string>();
     _dbColumnInfo[tableName] = columns;
     dynamic reader = new DynamicReader(cmd.ExecuteReader());
     try
     {
         while (reader.Read())
         {
             columns.Add(reader.name);
         }
     }
     finally
     {
         reader.Close();
     }
 }
 private void FillBookmarksRoots(SQLiteConnection connection)
 {
     if (!_roots.Any())
     {
         var cmd = new SQLiteCommand(BookmarksRootsSelectStatement, connection);
         dynamic reader = new DynamicReader(cmd.ExecuteReader());
         try
         {
             while (reader.Read())
             {
                 string rootName = reader.root_name.ToLower();
                 if (!_roots.ContainsKey(rootName))
                 {
                     _roots.Add(rootName, (int)reader.folder_id);
                 }
             }
         }
         finally
         {
             reader.Close();
         }
     }
 }
        protected virtual List<FirefoxBookmarkRow> GetBookmarksRows(SQLiteConnection connection)
        {
            var hasLastVisitedColumn = HasColumn(connection, "moz_bookmarks", "last_visit_date");
            var columnsToSelect = hasLastVisitedColumn ? ColumnsToSelect + ", p.last_visit_date" : ColumnsToSelect;

            var cmd = new SQLiteCommand(string.Format(BookmarksSelectStatementTemplate, columnsToSelect), connection);
            dynamic reader = new DynamicReader(cmd.ExecuteReader());
            var rows = new List<FirefoxBookmarkRow>();
            while (reader.Read())
            {
                rows.Add(new FirefoxBookmarkRow()
                {
                    Id = reader.id,
                    Parent = reader.parent,
                    Type = reader.type,
                    Position = reader.position,
                    Title = reader.title,
                    Url = reader.url,
                    LastModified = reader.lastmodified,
                    DateAdded = reader.dateadded,
                    LastVisit = reader.last_visit_date,
                    VisitCount = reader.visit_count,
                    FaviconUrl = reader.favicon_url,
                    FaviconData = reader.favicon_data,
                    FaviconContentType = reader.favicon_type,
                    Hidden = reader.hidden > 0,
                });
            }
            return rows;
        }
 protected virtual IEnumerable<FirefoxBookmarkAttribute> GetBookmarksAttributes(SQLiteConnection connection)
 {
     var cmd = new SQLiteCommand(AttributesSelectStatement, connection);
     dynamic reader = new DynamicReader(cmd.ExecuteReader());
     var attrs = new List<FirefoxBookmarkAttribute>();
     while (reader.Read())
     {
         attrs.Add(new FirefoxBookmarkAttribute()
         {
             BookmarkId = reader.item_id,
             AttributeName = reader.name,
             AttributeValue = reader.content
         });
     }
     return attrs;
 }