SetValueObject() public method

public SetValueObject ( int i, IMySqlValue valueObject ) : void
i int
valueObject IMySqlValue
return void
コード例 #1
0
        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);
                MySqlParameter parameter = command.Parameters.GetParameterFlexible(fieldName, true);

                IMySqlValue v = MySqlField.GetIMySqlValue(parameter.MySqlDbType);
                if (v is MySqlBit)
                {
                    MySqlBit bit = (MySqlBit)v;
                    bit.ReadAsString = true;
                    resultSet.SetValueObject(i, bit);
                }
                else
                {
                    resultSet.SetValueObject(i, v);
                }
            }
        }
コード例 #2
0
        private MySqlDataReader GetHackedOuputParameters()
        {
            if (outSelect.Length == 0)
            {
                return(null);
            }

            MySqlCommand cmd = new MySqlCommand("SELECT " + outSelect, Connection);

            MySqlDataReader reader = cmd.ExecuteReader();
            // 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
            ResultSet results = reader.ResultSet;

            for (int i = 0; i < reader.FieldCount; i++)
            {
                string fieldName = reader.GetName(i);
                fieldName = fieldName.Remove(0, ParameterPrefix.Length + 1);
                MySqlParameter parameter = Parameters.GetParameterFlexible(fieldName, true);
                results.SetValueObject(i, MySqlField.GetIMySqlValue(parameter.MySqlDbType));
            }
            if (!reader.Read())
            {
                reader.Close();
                return(null);
            }
            return(reader);
        }