/// <summary> /// TODO: /// </summary> /// <returns></returns> public string GetCastExpressionFromBinary() { string castingType = Binary2Type[this.Type]; if ((Debugger.Cmp(castingType, "unsigned") == 0) && (!this.Unsigned)) { castingType = "signed"; } if (!_isDecimal) { return(string.Format("{0}", castingType)); } else { return(string.Format(string.Format("{0}", castingType), this.Length, this.Precision)); } }
public static string WrapValue(string Type, object Value) { if (Value == null || Value == DBNull.Value) { return("NULL"); } else if (StoreType.IsString(Type) || StoreType.IsDateTime(Type)) { return(string.Format("'{0}'", Value)); } else if (Debugger.Cmp(Type, "bit") == 0) { return((Convert.ToInt32(Value) == 1) ? "1" : "0"); } else { return(Value.ToString()); } }
internal static bool IsDateTime(string type) { return((Debugger.Cmp(type, "date") == 0) || (Debugger.Cmp(type, "time") == 0) || (Debugger.Cmp(type, "timestamp") == 0) || (Debugger.Cmp(type, "datetime") == 0)); }
internal static bool IsString(string type) { return((Debugger.Cmp(type, "char") == 0) || (Debugger.Cmp(type, "varchar") == 0) || type.EndsWith("text", StringComparison.OrdinalIgnoreCase) || (Debugger.Cmp(type, "binary") == 0) || (Debugger.Cmp(type, "varbinary") == 0)); }