Ejemplo n.º 1
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.º 2
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.º 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;
		}
Ejemplo n.º 4
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);
		}