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);
        }
Beispiel #2
0
 public override ISQLBuilder Cast(SQLBuilderStringValueKind valueKind, object value, Type type)
 {
     try {
         return(base.Cast(valueKind, value, type));
     } finally {
         AddDelimiterIfApplicable();
     }
 }
 public CastCommand(SQLBuilderStringValueKind valueKind, object value, Type type)
 {
     ValueKind = valueKind;
     Value     = value;
     Type      = type;
 }
 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);
 }