using System;
using System.Collections;
using System.Data;
using System.Data.SqlClient;

namespace edu.jhu.Cas.Util {
    public abstract class SqlJob : Hashtable {
        public const string VERSION = "$Revision: 1.3 $";
        public void addParameterValues(SqlCommand command) {
            foreach (SqlParameter param in command.Parameters) {
                JobInfo ji = (JobInfo)base[param.ParameterName];
                param.Value = ji.Value;
            }
        }

        public void addParameters(SqlCommand command) {
            foreach (Object o in base.Keys) {
                JobInfo value = (JobInfo)base[o];
                command.Parameters.Add(o.ToString(), value.Type, value.Length);
            }
        }

        public void SetValue(Object key, Object value) {
            JobInfo ji = (JobInfo)base[key];
            ji.Value = value;
        }
    }
    public class JobInfo {
        public SqlDbType Type;
        public int Length;
        public Object Value;
        public JobInfo(SqlDbType type, int length, Object value) {
            Type = type;
            Length = length;
            Value = value;
        }
    }

}
