Example #1
0
        public ResultItem(ThreadSql sql)
        {
            Key = sql.Key;
            if (sql.Finished)
            {
                Success = sql.Exception == null;
                if (sql.Exception != null)
                {
                    ErrorMessage = sql.CommandText+" " +System.Environment.NewLine
                        + sql.ConnectionString + " " + System.Environment.NewLine
                        + sql.Exception.Message;
                    ErrorStack = string.Format("{0}:\n{1}", sql.Exception.GetType().FullName, sql.Exception.StackTrace);
                }
                else
                {
                    ErrorMessage = string.Empty;
                    ErrorStack = string.Empty;
                }
            }
            else
            {
                Success = false;
                ErrorMessage = "Not Finished";
                ErrorStack = string.Empty;

            }
            RunTime = Convert.ToInt32(sql.RunTime);
            Output = sql.Output;
        }
Example #2
0
 /// <summary>
 /// Adds sql to be executed in parallel
 /// </summary>
 /// <param name="key"></param>
 /// <param name="sql"></param>
 public void Add(string key, string sql,IList<SqlParameter> parameters)
 {
     //foreach (ThreadSql thread in _threads)
     //{
     //    if (thread.Key == key)
     //        throw new Exception(string.Format("Duplicate key '{0}'", key));
     //}
     ThreadSql threadSql = new ThreadSql(key, _connectionString, sql, parameters);
     _threads.Add(threadSql);
 }