Exemple #1
0
 IMySqlValue IMySqlValue.ReadValue(MySqlStream stream, long length, bool nullVal)
 {
     if (nullVal)
     {
         return new MySqlByte(true);
     }
     if (length == -1L)
     {
         return new MySqlByte((sbyte) stream.ReadByte());
     }
     string s = stream.ReadString(length);
     MySqlByte num = new MySqlByte(sbyte.Parse(s, NumberStyles.Any, CultureInfo.InvariantCulture));
     num.TreatAsBoolean = this.TreatAsBoolean;
     return num;
 }
Exemple #2
0
 void IMySqlValue.SkipValue(MySqlStream stream)
 {
     stream.ReadByte();
 }
Exemple #3
0
        IMySqlValue IMySqlValue.ReadValue(MySqlStream stream, long length, bool nullVal)
        {
            if (nullVal)
            {
                return new MySqlTimeSpan(true);
            }
            if (length >= 0L)
            {
                string s = stream.ReadString(length);
                this.ParseMySql(s, stream.Version.isAtLeast(4, 1, 0));
                return this;
            }
            long num = stream.ReadByte();
            int num2 = 0;
            if (num > 0L)
            {
                num2 = stream.ReadByte();
            }
            this.isNull = false;
            switch (num)
            {
                case 0L:
                    this.isNull = true;
                    break;

                case 5L:
                    this.mValue = new TimeSpan(stream.ReadInteger(4), 0, 0, 0);
                    break;

                case 8L:
                    this.mValue = new TimeSpan(stream.ReadInteger(4), stream.ReadByte(), stream.ReadByte(), stream.ReadByte());
                    break;

                default:
                    this.mValue = new TimeSpan(stream.ReadInteger(4), stream.ReadByte(), stream.ReadByte(), stream.ReadByte(), stream.ReadInteger(4) / 0xf4240);
                    break;
            }
            if (num2 == 1)
            {
                this.mValue = this.mValue.Negate();
            }
            return this;
        }
Exemple #4
0
 void IMySqlValue.SkipValue(MySqlStream stream)
 {
     int len = stream.ReadByte();
     stream.SkipBytes(len);
 }
Exemple #5
0
 IMySqlValue IMySqlValue.ReadValue(MySqlStream stream, long length, bool nullVal)
 {
     if (nullVal)
     {
         return new MySqlUByte(true);
     }
     if (length == -1L)
     {
         return new MySqlUByte((byte) stream.ReadByte());
     }
     return new MySqlUByte(byte.Parse(stream.ReadString(length)));
 }
Exemple #6
0
 void IMySqlValue.SkipValue(MySqlStream stream)
 {
     long num = stream.ReadByte();
     stream.SkipBytes((int) num);
 }
Exemple #7
0
 IMySqlValue IMySqlValue.ReadValue(MySqlStream stream, long length, bool nullVal)
 {
     if (nullVal)
     {
         return new MySqlDateTime(this.type, true);
     }
     if (length >= 0L)
     {
         string s = stream.ReadString(length);
         return this.ParseMySql(s, stream.Version.isAtLeast(4, 1, 0));
     }
     long num = stream.ReadByte();
     int year = 0;
     int month = 0;
     int day = 0;
     int hour = 0;
     int minute = 0;
     int second = 0;
     if (num >= 4L)
     {
         year = stream.ReadInteger(2);
         month = stream.ReadByte();
         day = stream.ReadByte();
     }
     if (num > 4L)
     {
         hour = stream.ReadByte();
         minute = stream.ReadByte();
         second = stream.ReadByte();
     }
     if (num > 7L)
     {
         stream.ReadInteger(4);
     }
     return new MySqlDateTime(this.type, year, month, day, hour, minute, second);
 }