private MySqlField GetFieldMetaData() { ColumnFlags flags; this.stream.Encoding = base.encoding; if (this.version.isAtLeast(4, 1, 0)) { return(this.GetFieldMetaData41()); } this.stream.OpenPacket(); MySqlField field = new MySqlField(base.connection); field.Encoding = base.encoding; field.TableName = this.stream.ReadLenString(); field.ColumnName = this.stream.ReadLenString(); field.ColumnLength = this.stream.ReadNBytes(); MySqlDbType type = (MySqlDbType)this.stream.ReadNBytes(); this.stream.ReadByte(); if ((this.Flags & ClientFlags.LONG_FLAG) != 0) { flags = (ColumnFlags)this.stream.ReadInteger(2); } else { flags = (ColumnFlags)this.stream.ReadByte(); } field.SetTypeAndFlags(type, flags); field.Scale = (byte)this.stream.ReadByte(); if (!this.version.isAtLeast(3, 0x17, 15) && this.version.isAtLeast(3, 0x17, 0)) { field.Scale = (byte)(field.Scale + 1); } return(field); }
private MySqlField GetFieldMetaData41() { ColumnFlags flags; MySqlField field = new MySqlField(base.connection); this.stream.OpenPacket(); field.Encoding = base.encoding; field.CatalogName = this.stream.ReadLenString(); field.DatabaseName = this.stream.ReadLenString(); field.TableName = this.stream.ReadLenString(); field.RealTableName = this.stream.ReadLenString(); field.ColumnName = this.stream.ReadLenString(); field.OriginalColumnName = this.stream.ReadLenString(); this.stream.ReadByte(); field.CharacterSetIndex = this.stream.ReadInteger(2); field.ColumnLength = this.stream.ReadInteger(4); MySqlDbType type = (MySqlDbType)this.stream.ReadByte(); if ((this.Flags & ClientFlags.LONG_FLAG) != 0) { flags = (ColumnFlags)this.stream.ReadInteger(2); } else { flags = (ColumnFlags)this.stream.ReadByte(); } field.SetTypeAndFlags(type, flags); field.Scale = (byte)this.stream.ReadByte(); if (this.stream.HasMoreData) { this.stream.ReadInteger(2); } if ((base.charSets != null) && (field.CharacterSetIndex != -1)) { CharacterSet chararcterSet = CharSetMap.GetChararcterSet(base.Version, (string)base.charSets[field.CharacterSetIndex]); field.MaxLength = chararcterSet.byteCount; field.Encoding = CharSetMap.GetEncoding(base.version, (string)base.charSets[field.CharacterSetIndex]); } return(field); }
private MySqlField GetFieldMetaData41() { ColumnFlags flags; MySqlField field = new MySqlField(base.connection); this.stream.OpenPacket(); field.Encoding = base.encoding; field.CatalogName = this.stream.ReadLenString(); field.DatabaseName = this.stream.ReadLenString(); field.TableName = this.stream.ReadLenString(); field.RealTableName = this.stream.ReadLenString(); field.ColumnName = this.stream.ReadLenString(); field.OriginalColumnName = this.stream.ReadLenString(); this.stream.ReadByte(); field.CharacterSetIndex = this.stream.ReadInteger(2); field.ColumnLength = this.stream.ReadInteger(4); MySqlDbType type = (MySqlDbType)this.stream.ReadByte(); if ((this.Flags & ClientFlags.LONG_FLAG) != 0) { flags = (ColumnFlags)this.stream.ReadInteger(2); } else { flags = (ColumnFlags)this.stream.ReadByte(); } field.SetTypeAndFlags(type, flags); field.Scale = (byte)this.stream.ReadByte(); if (this.stream.HasMoreData) { this.stream.ReadInteger(2); } if ((base.charSets != null) && (field.CharacterSetIndex != -1)) { CharacterSet chararcterSet = CharSetMap.GetChararcterSet(base.Version, (string)base.charSets[field.CharacterSetIndex]); field.MaxLength = chararcterSet.byteCount; field.Encoding = CharSetMap.GetEncoding(base.version, (string)base.charSets[field.CharacterSetIndex]); } return field; }
private MySqlField GetFieldMetaData() { ColumnFlags flags; this.stream.Encoding = base.encoding; if (this.version.isAtLeast(4, 1, 0)) { return this.GetFieldMetaData41(); } this.stream.OpenPacket(); MySqlField field = new MySqlField(base.connection); field.Encoding = base.encoding; field.TableName = this.stream.ReadLenString(); field.ColumnName = this.stream.ReadLenString(); field.ColumnLength = this.stream.ReadNBytes(); MySqlDbType type = (MySqlDbType)this.stream.ReadNBytes(); this.stream.ReadByte(); if ((this.Flags & ClientFlags.LONG_FLAG) != 0) { flags = (ColumnFlags)this.stream.ReadInteger(2); } else { flags = (ColumnFlags)this.stream.ReadByte(); } field.SetTypeAndFlags(type, flags); field.Scale = (byte)this.stream.ReadByte(); if (!this.version.isAtLeast(3, 0x17, 15) && this.version.isAtLeast(3, 0x17, 0)) { field.Scale = (byte)(field.Scale + 1); } return field; }