コード例 #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 void SetDbType(DbType db_type)
        {
            dbType = db_type;
            switch (dbType)
            {
            case DbType.Guid:
                mySqlDbType = MySqlDbType.Guid;
                break;

            case DbType.AnsiString:
            case DbType.String:
                mySqlDbType = MySqlDbType.VarChar;
                break;

            case DbType.AnsiStringFixedLength:
            case DbType.StringFixedLength:
                mySqlDbType = MySqlDbType.String;
                break;

            case DbType.Boolean:
            case DbType.Byte:
                mySqlDbType = MySqlDbType.UByte;
                break;

            case DbType.SByte:
                mySqlDbType = MySqlDbType.Byte;
                break;

            case DbType.Date:
                mySqlDbType = MySqlDbType.Date;
                break;

            case DbType.DateTime:
                mySqlDbType = MySqlDbType.DateTime;
                break;

            case DbType.Time:
                mySqlDbType = MySqlDbType.Time;
                break;

            case DbType.Single:
                mySqlDbType = MySqlDbType.Float;
                break;

            case DbType.Double:
                mySqlDbType = MySqlDbType.Double;
                break;

            case DbType.Int16:
                mySqlDbType = MySqlDbType.Int16;
                break;

            case DbType.UInt16:
                mySqlDbType = MySqlDbType.UInt16;
                break;

            case DbType.Int32:
                mySqlDbType = MySqlDbType.Int32;
                break;

            case DbType.UInt32:
                mySqlDbType = MySqlDbType.UInt32;
                break;

            case DbType.Int64:
                mySqlDbType = MySqlDbType.Int64;
                break;

            case DbType.UInt64:
                mySqlDbType = MySqlDbType.UInt64;
                break;

            case DbType.Decimal:
            case DbType.Currency:
                mySqlDbType = MySqlDbType.Decimal;
                break;

            case DbType.Object:
            case DbType.VarNumeric:
            case DbType.Binary:
            default:
                mySqlDbType = MySqlDbType.Blob;
                break;
            }

            if (dbType == DbType.Object)
            {
                var value = this.paramValue as byte[];
                if (value != null && value.Length == GEOMETRY_LENGTH)
                {
                    mySqlDbType = MySqlDbType.Geometry;
                }
            }

            ValueObject = MySqlField.GetIMySqlValue(mySqlDbType);
        }
コード例 #3
0
 private void SetMySqlDbType(MySqlDbType mysql_dbtype)
 {
     mySqlDbType = mysql_dbtype;
     ValueObject = MySqlField.GetIMySqlValue(mySqlDbType);
     SetDbTypeFromMySqlDbType();
 }