private void AdjustOutputTypes() { // since MySQL likes to return user variables as strings // we reset the types of the readers internal value objects // this will allow those value objects to parse the string based // return values for (int i = 0; i < FieldCount; i++) { string fieldName = GetName(i); fieldName = fieldName.Remove(0, StoredProcedure.ParameterPrefix.Length + 1); MyCatParameter parameter = command.Parameters.GetParameterFlexible(fieldName, true); IMyCatValue v = MyCatField.GetIMyCatValue(parameter.MyCatDbType); if (v is MyCatBit) { MyCatBit bit = (MyCatBit)v; bit.ReadAsString = true; resultSet.SetValueObject(i, bit); } else { resultSet.SetValueObject(i, v); } } }
private void SetDbType(DbType db_type) { dbType = db_type; switch (dbType) { case DbType.Guid: mySqlDbType = MyCatDbType.Guid; break; case DbType.AnsiString: case DbType.String: mySqlDbType = MyCatDbType.VarChar; break; case DbType.AnsiStringFixedLength: case DbType.StringFixedLength: mySqlDbType = MyCatDbType.String; break; case DbType.Boolean: case DbType.Byte: mySqlDbType = MyCatDbType.UByte; break; case DbType.SByte: mySqlDbType = MyCatDbType.Byte; break; case DbType.Date: mySqlDbType = MyCatDbType.Date; break; case DbType.DateTime: mySqlDbType = MyCatDbType.DateTime; break; case DbType.Time: mySqlDbType = MyCatDbType.Time; break; case DbType.Single: mySqlDbType = MyCatDbType.Float; break; case DbType.Double: mySqlDbType = MyCatDbType.Double; break; case DbType.Int16: mySqlDbType = MyCatDbType.Int16; break; case DbType.UInt16: mySqlDbType = MyCatDbType.UInt16; break; case DbType.Int32: mySqlDbType = MyCatDbType.Int32; break; case DbType.UInt32: mySqlDbType = MyCatDbType.UInt32; break; case DbType.Int64: mySqlDbType = MyCatDbType.Int64; break; case DbType.UInt64: mySqlDbType = MyCatDbType.UInt64; break; case DbType.Decimal: case DbType.Currency: mySqlDbType = MyCatDbType.Decimal; break; case DbType.Object: case DbType.VarNumeric: case DbType.Binary: default: mySqlDbType = MyCatDbType.Blob; break; } if (dbType == DbType.Object) { var value = this.paramValue as byte[]; if (value != null && value.Length == GEOMETRY_LENGTH) { mySqlDbType = MyCatDbType.Geometry; } } ValueObject = MyCatField.GetIMyCatValue(mySqlDbType); }
private void SetMyCatDbType(MyCatDbType mysql_dbtype) { mySqlDbType = mysql_dbtype; ValueObject = MyCatField.GetIMyCatValue(mySqlDbType); SetDbTypeFromMyCatDbType(); }