private void GetData(Photo photo) { SqliteDataReader reader = Database.Query(new DbCommand("SELECT tag_id, version_id, name " + "FROM photo_tags, photo_versions " + "WHERE photo_tags.photo_id = photo_versions.photo_id " + "AND photo_tags.photo_id = :id", "id", photo.Id)); while (reader.Read()) { if (reader [0] != null) { uint tag_id = Convert.ToUInt32(reader [0]); Tag tag = Core.Database.Tags.Get(tag_id) as Tag; photo.AddTagUnsafely(tag); } if (reader [1] != null) { uint version_id = Convert.ToUInt32(reader [1]); string name = reader[2].ToString(); photo.AddVersionUnsafely(version_id, name); } } reader.Close(); }
private void GetAllTags() { SqliteDataReader reader = Database.Query("SELECT photo_id, tag_id FROM photo_tags"); while (reader.Read()) { uint id = Convert.ToUInt32(reader [0]); Photo photo = LookupInCache(id) as Photo; if (photo == null) { //Console.WriteLine ("Photo {0} not found", id); continue; } if (photo.Loaded) { //Console.WriteLine ("Photo {0} already Loaded", photo.Id); continue; } if (reader [1] != null) { uint tag_id = Convert.ToUInt32(reader [1]); Tag tag = Core.Database.Tags.Get(tag_id) as Tag; photo.AddTagUnsafely(tag); } } reader.Close(); }
private void GetTags(Photo photo) { SqliteDataReader reader = Database.Query(new DbCommand("SELECT tag_id FROM photo_tags WHERE photo_id = :id", photo.Id)); while (reader.Read()) { uint tag_id = Convert.ToUInt32(reader [0]); Tag tag = Core.Database.Tags.Get(tag_id) as Tag; photo.AddTagUnsafely(tag); } reader.Close(); }
private void GetAllData() { SqliteDataReader reader = Database.Query("SELECT photo_tags.photo_id, tag_id, version_id, name " + "FROM photo_tags, photo_versions " + "WHERE photo_tags.photo_id = photo_versions.photo_id"); while (reader.Read()) { uint id = Convert.ToUInt32(reader [0]); Photo photo = LookupInCache(id) as Photo; if (photo == null) { //Console.WriteLine ("Photo {0} not found", id); continue; } if (photo.Loaded) { //Console.WriteLine ("Photo {0} already Loaded", photo); continue; } if (reader [1] != null) { uint tag_id = Convert.ToUInt32(reader [1]); Tag tag = Core.Database.Tags.Get(tag_id) as Tag; photo.AddTagUnsafely(tag); } if (reader [2] != null) { uint version_id = Convert.ToUInt32(reader [2]); string name = reader[3].ToString(); photo.AddVersionUnsafely(version_id, name); } } reader.Close(); }
private void GetTags (Photo photo) { SqliteDataReader reader = Database.Query(new DbCommand("SELECT tag_id FROM photo_tags WHERE photo_id = :id", "id", photo.Id)); while (reader.Read ()) { uint tag_id = Convert.ToUInt32 (reader [0]); Tag tag = Core.Database.Tags.Get (tag_id) as Tag; photo.AddTagUnsafely (tag); } reader.Close(); }
private void GetData (Photo photo) { SqliteDataReader reader = Database.Query(new DbCommand("SELECT tag_id, version_id, name " + "FROM photo_tags, photo_versions " + "WHERE photo_tags.photo_id = photo_versions.photo_id " + "AND photo_tags.photo_id = :id", "id", photo.Id)); while (reader.Read ()) { if (reader [0] != null) { uint tag_id = Convert.ToUInt32 (reader [0]); Tag tag = Core.Database.Tags.Get (tag_id) as Tag; photo.AddTagUnsafely (tag); } if (reader [1] != null) { uint version_id = Convert.ToUInt32 (reader [1]); string name = reader[2].ToString (); photo.AddVersionUnsafely (version_id, name); } } reader.Close(); }