public object RawGetValueOrDefaultFromMapIndex(int mapIndex) { //this check plan //get data from reader at original field //lets do proper conv technique MySqlFieldMap mapField = mapFields[mapIndex]; object value = reader.GetValue(mapField.OriginalFieldIndex); #if DEBUG Type srcType = value.GetType(); #endif switch (mapField.ConvTechnique) { case MySqlDataConversionTechnique.Direct: return(value); case MySqlDataConversionTechnique.GenString: //gen to string return(value.ToString()); case MySqlDataConversionTechnique.GenDateTime: return(DateTime.Parse(value.ToString())); case MySqlDataConversionTechnique.BlobToString: // return(value.ToString()); case MySqlDataConversionTechnique.StringToString: // if (stringConverter != null) { //use string converter to convert again return(stringConverter.Conv((string)value)); } else { return(value.ToString()); } case MySqlDataConversionTechnique.DecimalToDecimal: { return((decimal)value); } case MySqlDataConversionTechnique.DecimalToDouble: { return(Convert.ToDouble((decimal)value)); } case MySqlDataConversionTechnique.DecimalToFloat: { return((float)Convert.ToDouble(value)); } default: throw new NotSupportedException(); } }
public static string ReadString(this BufferReader reader, uint length, IStringConverter strConverter) { return(strConverter.Conv(reader.ReadBytes((int)length))); }
public static string ReadString(this BufferReader reader, uint length, IStringConverter strConverter) { return strConverter.Conv(reader.ReadBytes((int)length)); }