using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Sky.Darkness.Commons.Util
{
    public class MyString
    {
        /// <summary>
        /// Default Constructor
        /// </summary>
        public MyString() { }

        /// <summary>
        /// 根据Type类型判断是否需要在commandText两边加上''
        /// </summary>
        /// <param name="commandText"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        public static string GetSqlString(object commandText, Type type)
        {
            string str = commandText.ToString();
            if (type.Equals(Type.GetType("System.DateTime")) ||
                type.Equals(Type.GetType("System.String")))
            {
                if ("0001-1-1 0:00:00".Equals(str))
                    str = "1971-1-1 0:00:00";
                str = "'" + str + "'";
            }

            return str;
        }
    }
}
