Esempio n. 1
0
        public IMySqlValue ReadColumnValue(int index, MySqlField field, IMySqlValue valObject)
        {
            long length = -1;
            bool isNull;

            if (nullMap != null)
            {
                isNull = nullMap[index + 2];
            }
            else
            {
                length = packet.ReadFieldLength();
                isNull = length == -1;
            }

            packet.Encoding = field.Encoding;
            packet.Version  = version;
            var val = valObject.ReadValue(packet, length, isNull);

            if (val is MySqlDateTime d)
            {
                d.TimezoneOffset = field.driver.timeZoneOffset;
                return(d);
            }

            return(val);
        }
Esempio n. 2
0
        public override IMySqlValue ReadColumnValue(int index, MySqlField field, IMySqlValue valObject)
        {
            bool flag;
            long length = -1L;

            if (this.nullMap != null)
            {
                flag = this.nullMap[index + 2];
            }
            else
            {
                length = this.stream.ReadFieldLength();
                flag   = length == -1L;
            }
            this.stream.Encoding = field.Encoding;
            return(valObject.ReadValue(this.stream, length, flag));
        }
Esempio n. 3
0
        public IMySqlValue ReadColumnValue(int index, MySqlField field, IMySqlValue valObject)
        {
            long num = -1L;
            bool isNull;

            if (this.nullMap != null)
            {
                isNull = this.nullMap[index + 2];
            }
            else
            {
                num    = this.packet.ReadFieldLength();
                isNull = (num == -1L);
            }
            this.packet.Encoding = field.Encoding;
            this.packet.Version  = this.version;
            return(valObject.ReadValue(this.packet, num, isNull));
        }
Esempio n. 4
0
        public override IMySqlValue ReadColumnValue(int index, MySqlField field, IMySqlValue valObject)
        {
            long length = -1;
            bool isNull;

            if (nullMap != null)
            {
                isNull = nullMap[index + 2];
            }
            else
            {
                length = stream.ReadFieldLength();
                isNull = length == -1;
            }

            stream.Encoding = field.Encoding;
            return(valObject.ReadValue(stream, length, isNull));
        }
Esempio n. 5
0
        public IMySqlValue ReadColumnValue(int index, MySqlField field, IMySqlValue valObject)
        {
            long length = -1;
            bool isNull;

            if (nullMap != null)
            {
                isNull = nullMap[index + 2];
            }
            else
            {
                length = packet.ReadFieldLength();
                isNull = length == -1;
            }

            packet.Encoding = field.Encoding;
            packet.Version  = version;
            return(valObject.ReadValue(packet, length, isNull));
        }
Esempio n. 6
0
        public IMySqlValue ReadColumnValue(int index, MySqlField field, IMySqlValue valObject)
        {
            long  length = -1;
            bool  isNull;
            Regex regex = new Regex(@"(?i)^[0-9A-F]{8}[-](?:[0-9A-F]{4}[-]){3}[0-9A-F]{12}$"); // check for GUID format

            if (nullMap != null)
            {
                isNull = nullMap[index + 2];
                if (!MySqlField.GetIMySqlValue(field.Type).GetType().Equals(valObject.GetType()) && !field.IsUnsigned)
                {
                    length = packet.ReadFieldLength();
                }
            }
            else
            {
                length = packet.ReadFieldLength();
                isNull = length == -1;
            }

            if ((valObject.MySqlDbType is MySqlDbType.Guid && !Settings.OldGuids) &&
                !regex.IsMatch(Encoding.GetString(packet.Buffer, packet.Position, (int)length)))
            {
                field.Type = MySqlDbType.String;
                valObject  = field.GetValueObject();
            }

            packet.Encoding = field.Encoding;
            packet.Version  = version;
            var val = valObject.ReadValue(packet, length, isNull);

            if (val is MySqlDateTime d)
            {
                d.TimezoneOffset = field.driver.timeZoneOffset;
                return(d);
            }

            return(val);
        }
    public IMySqlValue ReadColumnValue(int index, MySqlField field, IMySqlValue valObject)
    {
      long length = -1;
      bool isNull;

      if (nullMap != null)
        isNull = nullMap[index + 2];
      else
      {
        length = packet.ReadFieldLength();
        isNull = length == -1;
      }

      packet.Encoding = field.Encoding;
      packet.Version = version;
      return valObject.ReadValue(packet, length, isNull);
    }
Esempio n. 8
0
 public override IMySqlValue ReadColumnValue(int index, MySqlField field, IMySqlValue valObject)
 {
     bool flag;
     long length = -1L;
     if (this.nullMap != null)
     {
         flag = this.nullMap[index + 2];
     }
     else
     {
         length = this.stream.ReadFieldLength();
         flag = length == -1L;
     }
     this.stream.Encoding = field.Encoding;
     return valObject.ReadValue(this.stream, length, flag);
 }
Esempio n. 9
0
        public override IMySqlValue ReadColumnValue(int index, MySqlField field, IMySqlValue valObject)
        {
            long length = -1;
            bool isNull;

            if (nullMap != null)
                isNull = nullMap[index + 2];
            else
            {
                length = stream.ReadFieldLength();
                isNull = length == -1;
            }

            stream.Encoding = field.Encoding;
            return valObject.ReadValue(stream, length, isNull);
        }
Esempio n. 10
0
        public IMySqlValue ReadColumnValue(int index, MySqlField field, IMySqlValue valObject)
        {
            packet.Encoding = field.Encoding;
            packet.Version = version;

            if (nullMap != null)
            {
                return valObject.ReadValue(packet, -1, nullMap[index + 2]);
            }
            else
            {
                long length = packet.ReadFieldLength();
                return valObject.ReadValue(packet, length, length == -1);
            }
        }