Exemple #1
0
		public static string ParseToString(object o, Dialect.DbDialect dd)
		{
            if (o == null)
            {
                return "NULL";
            }
			var ot = o.GetType();
			if ( typeof(bool) == ot )
			{
				return Convert.ToInt32(o).ToString();
			}
		    if	( typeof(string) == ot )
		    {
		        string s = o.ToString();
		        s = s.Replace("'", "''");
		        return string.Format("N'{0}'", s);
		    }
		    if ( typeof(DateTime) == ot || typeof(Date) == ot || typeof(Time) == ot )
		    {
		        return dd.QuoteDateTimeValue(o.ToString());
		    }
		    if (ot.IsEnum)
		    {
		        return Convert.ToInt32(o).ToString();
		    }
		    if (typeof(byte[]) == ot)
		    {
		        throw new ApplicationException("Sql without Parameter can not support blob, please using Parameter mode.");
		    }
            return o.ToString();
        }