MonkeyWrench.DB.GetNextStep C# (CSharp) Method

GetNextStep() public method

public GetNextStep ( string lane ) : DBWork
lane string
return DBWork
		public DBWork GetNextStep (string lane)
		{
			DBWork result = null;

			using (IDbCommand cmd = CreateCommand ()) {
				cmd.CommandText = "SELECT * FROM steps WHERE lane = @lane AND (state = 0 OR state = 1) ORDER BY revision DESC, sequence LIMIT 1";
				DB.CreateParameter (cmd, "lane", lane);
				using (IDataReader reader = cmd.ExecuteReader ()) {
					while (reader.Read ()) {
						if (result != null)
							throw new Exception ("Got more than one step");
						result = new DBWork ();
						result.Load (reader);
					}
				}
			}

			return result;
		}