Ejemplo n.º 1
0
    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();
    }
Ejemplo n.º 2
0
    private void GetVersions(Photo photo)
    {
        SqliteDataReader reader = Database.Query(
            new DbCommand("SELECT version_id, name, uri, md5_sum, protected " +
                          "FROM photo_versions " +
                          "WHERE photo_id = :id",
                          "id", photo.Id
                          )
            );

        while (reader.Read())
        {
            uint   version_id = Convert.ToUInt32(reader [0]);
            string name       = reader[1].ToString();
#if MONO_2_0
            System.Uri uri = new System.Uri(reader[2].ToString());
#else
            System.Uri uri = new System.Uri(reader[2].ToString(), true);
#endif
            string md5_sum      = reader[3].ToString();
            bool   is_protected = Convert.ToBoolean(reader[4]);
            photo.AddVersionUnsafely(version_id, uri, md5_sum, name, is_protected);
        }
        reader.Close();
    }
Ejemplo n.º 3
0
    private void GetVersions(Photo photo)
    {
        SqliteDataReader reader = Database.Query(new DbCommand("SELECT version_id, name FROM photo_versions WHERE photo_id = :id", photo.Id));

        while (reader.Read())
        {
            uint   version_id = Convert.ToUInt32(reader [0]);
            string name       = reader[1].ToString();
            photo.AddVersionUnsafely(version_id, name);
        }
        reader.Close();
    }
Ejemplo n.º 4
0
    private void GetAllVersions()
    {
        SqliteDataReader reader = Database.Query("SELECT photo_id, version_id, name, uri, md5_sum, protected FROM photo_versions");

        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   version_id = Convert.ToUInt32(reader [1]);
                string name       = reader[2].ToString();
#if MONO_2_0
                System.Uri uri = new System.Uri(reader[3].ToString());
#else
                System.Uri uri = new System.Uri(reader[3].ToString(), true);
#endif
                string md5_sum      = reader[4].ToString();
                bool   is_protected = Convert.ToBoolean(reader[5]);
                photo.AddVersionUnsafely(version_id, uri, md5_sum, name, is_protected);
            }

            /*
             * string directory_path = null;
             * if (reader [3] != null)
             *      directory_path = reader [3].ToString ();
             * System.Console.WriteLine ("directory_path = {0}", directory_path);
             */
        }
        reader.Close();
    }
Ejemplo n.º 5
0
    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();
    }
Ejemplo n.º 6
0
    private void GetAllVersions()
    {
        SqliteDataReader reader = Database.Query("SELECT photo_id, version_id, name FROM photo_versions");

        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   version_id = Convert.ToUInt32(reader [1]);
                string name       = reader[2].ToString();

                photo.AddVersionUnsafely(version_id, name);
            }

            /*
             * string directory_path = null;
             * if (reader [3] != null)
             *      directory_path = reader [3].ToString ();
             * System.Console.WriteLine ("directory_path = {0}", directory_path);
             */
        }
        reader.Close();
    }
Ejemplo n.º 7
0
	private void GetVersions (Photo photo)
	{
		SqliteDataReader reader = Database.Query(
			new DbCommand("SELECT version_id, name, uri, md5_sum, protected " + 
				      "FROM photo_versions " + 
				      "WHERE photo_id = :id", 
				      "id", photo.Id
			)
		);

		while (reader.Read ()) {
			uint version_id = Convert.ToUInt32 (reader [0]);
			string name = reader[1].ToString ();
#if MONO_2_0
			System.Uri uri = new System.Uri (reader[2].ToString ());
#else
			System.Uri uri = new System.Uri (reader[2].ToString (), true);
#endif
			string md5_sum = reader[3].ToString ();
			bool is_protected = Convert.ToBoolean (reader[4]);
			photo.AddVersionUnsafely (version_id, uri, md5_sum, name, is_protected);
		}
		reader.Close();
	}
Ejemplo n.º 8
0
	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();
	}
Ejemplo n.º 9
0
	private void GetVersions (Photo photo)
	{
		SqliteDataReader reader = Database.Query(new DbCommand("SELECT version_id, name FROM photo_versions WHERE photo_id = :id", photo.Id));

		while (reader.Read ()) {
			uint version_id = Convert.ToUInt32 (reader [0]);
			string name = reader[1].ToString ();
			photo.AddVersionUnsafely (version_id, name);
		}
		reader.Close();
	}