Example #1
0
        public override ISQLBuilder Cast(SQLBuilderStringValueKind valueKind, object value, Type type)
        {
            Emit("CAST(");
            switch (valueKind)
            {
            case SQLBuilderStringValueKind.LiteralValue:
                Literal(value);
                break;

            case SQLBuilderStringValueKind.SQLCode:
                Emit(value.ToString());
                break;

            case SQLBuilderStringValueKind.VariableName:
                VariableName(value.ToString());
                break;

            case SQLBuilderStringValueKind.Auto:
                Emit("{0}", value);
                break;

            default:
                throw new SoftwareException("Unsupported SQLBuilderCastValueType {0}", valueKind);
            }
            Emit(" AS ").TypeToSqlType(type).Emit(")");
            return(this);
        }
Example #2
0
 public override ISQLBuilder Cast(SQLBuilderStringValueKind valueKind, object value, Type type)
 {
     try {
         return(base.Cast(valueKind, value, type));
     } finally {
         AddDelimiterIfApplicable();
     }
 }
Example #3
0
 public CastCommand(SQLBuilderStringValueKind valueKind, object value, Type type)
 {
     ValueKind = valueKind;
     Value     = value;
     Type      = type;
 }
Example #4
0
 public static SQLBuilderCommand Cast(SQLBuilderStringValueKind valueKind, object value, Type type)
 {
     return(new CastCommand(valueKind, value, type));
 }
 public virtual ISQLBuilder Cast(SQLBuilderStringValueKind valueKind, object value, Type type)
 {
     _internalBuilder.Cast(valueKind, value, type);
     return(this);
 }