/// <summary> /// Gets a rate by ID /// </summary> /// <param name="output"></param> /// <param name="id"></param> /// <returns></returns> public static bool FetchById(ref Rate output, int id) { SQLiteDataReader reader = DBI.DoPreparedQuery( "SELECT * FROM Rate WHERE id = @id LIMIT 1;", new Tuple <string, object>("@id", id)); if (reader != null && reader.Read()) { output = Rate.Factory(reader); return(true); } return(false); }
/// <summary> /// Gets a rate by name /// </summary> /// <param name="output"></param> /// <param name="name"></param> /// <returns></returns> public static bool FetchByName(ref Rate output, string name) { SQLiteDataReader reader = DBI.DoPreparedQuery( "SELECT * FROM Rate WHERE name = @name LIMIT 1;", new Tuple <string, object>("@name", name)); if (reader != null && reader.Read()) { output = Rate.Factory(reader); return(true); } return(false); }
/// <summary> /// Gets all possible rates /// </summary> /// <param name="output"></param> /// <returns></returns> public static bool FetchAll(ref List <Rate> output) { output = new List <Rate>(); SQLiteDataReader reader = DBI.DoQuery( "SELECT * FROM Rate ORDER BY id ASC;"); while (reader != null && reader.Read()) { output.Add(Rate.Factory(reader)); } return(true); }