public static CharacterSet GetChararcterSet(DBVersion version, string CharSetName) { CharacterSet set = mapping[CharSetName]; if (set == null) { throw new MySqlException("Character set '" + CharSetName + "' is not supported"); } return(set); }
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); }