コード例 #1
0
 /// <summary>
 /// Gets the mushroom data from the database by name.
 /// </summary>
 /// <param name="name">Name of the mushroom</param>
 /// <returns>The data structure of the mushroom</returns>
 public Mushroom GetMushroomByName(string name)
 {
     Debug.Log("SELECT c." + COL_NAME + ", d." + COL_DESCRIPTION_SPANISH + ", c." + COL_EDIBLE_SPANISH + ", g." + COL_SPECIES + " FROM " + SQL_TABLE_NAME_1 + " c join " + SQL_TABLE_NAME_2 + " d on c.Nombre = d.Nombre join " + SQL_TABLE_NAME_3 + " g on c.IdSeta = g.IdSeta where c." + COL_NAME + " = '" + name + "'");
     //select c.Nombre, d.DescripcionEs, c.ComestibleEs, g.Especie
     //from TablaComestible c
     //join TablaDescripciones d on c.IdSeta = d.IdSeta
     //join TablaGeneros g on c.IdSeta = g.IdSeta
     //where c.Nombre = 'aleuria aurantia'
     RunQuery("SELECT c." + COL_NAME + ", d." + COL_DESCRIPTION_SPANISH + ", c." + COL_EDIBLE_SPANISH + ", g." + COL_SPECIES + " FROM " + SQL_TABLE_NAME_1 + " c join " + SQL_TABLE_NAME_2 + " d on c.Nombre = d.Nombre join " + SQL_TABLE_NAME_3 + " g on c.IdSeta = g.IdSeta where c." + COL_NAME + " = '" + name + "'");
     if (_reader.Read())
     {
         Mushroom mush = new Mushroom(_reader.GetString(0), _reader.GetString(1), _reader.GetString(2), _reader.GetString(3));
         Debug.Log(mush.ToString());
         return(mush);
     }
     Debug.LogWarning("Mushroom " + name + " not found on db!");
     _reader.Close();
     return(null);
 }