Exemplo n.º 1
0
        public virtual object Format(ISelectAlias instance, object source)
        {
            if (source is int)
            {
                return(source.ToString());
            }
            if (source is long)
            {
                return(source.ToString());
            }
            if (source is double)
            {
                return(source.ToString());
            }
            if (source is SelectAlias)
            {
                return(source.ToString());
            }
            if (source is SqlSnippet)
            {
                return(source.ToString());
            }

            if (source is DateTime)
            {
                var result = String.Format("TIMEZONE(TO_TIMESTAMP('{0:yyyy-MM-dd hhh:mm:ss}', 'YYYY-MM-DD HH24:MI:SS'),'America/Toronto','UTC')", source);
                return(result);
            }
            if (source is MethodInfo)
            {
                return(FormatMethodInfo(instance, (MethodInfo)source));
            }

            return("'" + source.ToString() + "'");
        }
Exemplo n.º 2
0
 public virtual object FormatMethodInfo(ISelectAlias instance, MethodInfo mi)
 {
     if (mi.Name == "ToString")
     {
         return(new SqlSnippet("CAST( " + instance.ToString() + " as VARCHAR(10))"));
     }
     throw new Exception("Unsupported method");
 }
Exemplo n.º 3
0
        public override object FormatMethodInfo(ISelectAlias instance, MethodInfo mi)
        {
            if (mi.Name == "ToString")
            {
                return(new SqlSnippet(instance.ToString()));
            }

            return(base.FormatMethodInfo(instance, mi));
        }