Ejemplo n.º 1
0
		IMySqlValue IMySqlValue.ReadValue(MySqlStream stream, long length, bool nullVal) {
			if (nullVal) {
				return new MySqlUInt64(true);
			}
			if (length == -1L) {
				return new MySqlUInt64(stream.ReadLong(8));
			}
			return new MySqlUInt64(ulong.Parse(stream.ReadString(length)));
		}
Ejemplo n.º 2
0
		IMySqlValue IMySqlValue.ReadValue(MySqlStream stream, long length, bool nullVal) {
			if (nullVal) {
				return new MySqlInt16(true);
			}
			if (length == -1L) {
				return new MySqlInt16((short)stream.ReadInteger(2));
			}
			return new MySqlInt16(short.Parse(stream.ReadString(length)));
		}
Ejemplo n.º 3
0
		IMySqlValue IMySqlValue.ReadValue(MySqlStream stream, long length, bool nullVal) {
			if (nullVal) {
				return new MySqlInt32(((IMySqlValue)this).MySqlDbType, true);
			}
			if (length == -1L) {
				return new MySqlInt32(((IMySqlValue)this).MySqlDbType, stream.ReadInteger(4));
			}
			return new MySqlInt32(((IMySqlValue)this).MySqlDbType, int.Parse(stream.ReadString(length), CultureInfo.InvariantCulture));
		}
Ejemplo n.º 4
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)));
		}
Ejemplo n.º 5
0
		IMySqlValue IMySqlValue.ReadValue(MySqlStream stream, long length, bool nullVal) {
			if (nullVal) {
				return new MySqlDecimal(true);
			}
			if (length == -1L) {
				return new MySqlDecimal(decimal.Parse(stream.ReadLenString(), CultureInfo.InvariantCulture));
			}
			return new MySqlDecimal(decimal.Parse(stream.ReadString(length), CultureInfo.InvariantCulture));
		}
Ejemplo n.º 6
0
		IMySqlValue IMySqlValue.ReadValue(MySqlStream stream, long length, bool nullVal) {
			if (nullVal) {
				return new MySqlDouble(true);
			}
			if (length == -1L) {
				byte[] buffer = new byte[8];
				stream.Read(buffer, 0, 8);
				return new MySqlDouble(BitConverter.ToDouble(buffer, 0));
			}
			return new MySqlDouble(double.Parse(stream.ReadString(length), CultureInfo.InvariantCulture));
		}
Ejemplo n.º 7
0
		IMySqlValue IMySqlValue.ReadValue(MySqlStream stream, long length, bool nullVal) {
			if (nullVal) {
				return new MySqlString(this.type, true);
			}
			string val = string.Empty;
			if (length == -1L) {
				val = stream.ReadLenString();
			} else {
				val = stream.ReadString(length);
			}
			return new MySqlString(this.type, val);
		}
Ejemplo n.º 8
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;
		}
Ejemplo n.º 9
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);
		}