本文整理汇总了C#中MySql.Data.MySqlClient.MySqlField.SetTypeAndFlags方法的典型用法代码示例。如果您正苦于以下问题:C# MySqlField.SetTypeAndFlags方法的具体用法?C# MySqlField.SetTypeAndFlags怎么用?C# MySqlField.SetTypeAndFlags使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MySql.Data.MySqlClient.MySqlField
的用法示例。
在下文中一共展示了MySqlField.SetTypeAndFlags方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetFieldMetaData41
private MySqlField GetFieldMetaData41()
{
MySqlField field = new MySqlField(connection);
stream.OpenPacket();
field.Encoding = encoding;
field.CatalogName = stream.ReadLenString();
field.DatabaseName = stream.ReadLenString();
field.TableName = stream.ReadLenString();
field.RealTableName = stream.ReadLenString();
field.ColumnName = stream.ReadLenString();
field.OriginalColumnName = stream.ReadLenString();
stream.ReadByte();
field.CharacterSetIndex = stream.ReadInteger(2);
field.ColumnLength = stream.ReadInteger(4);
MySqlDbType type = (MySqlDbType) stream.ReadByte();
ColumnFlags colFlags;
if ((Flags & ClientFlags.LONG_FLAG) != 0)
colFlags = (ColumnFlags) stream.ReadInteger(2);
else
colFlags = (ColumnFlags) stream.ReadByte();
field.SetTypeAndFlags(type, colFlags);
field.Scale = (byte) stream.ReadByte();
if (stream.HasMoreData)
{
stream.ReadInteger(2); // reserved
}
if (charSets != null && field.CharacterSetIndex != -1)
{
CharacterSet cs = CharSetMap.GetChararcterSet(Version, (string) charSets[field.CharacterSetIndex]);
field.MaxLength = cs.byteCount;
field.Encoding = CharSetMap.GetEncoding(version, (string) charSets[field.CharacterSetIndex]);
}
return field;
}
示例2: GetColumnData
private void GetColumnData(MySqlField field)
{
stream.Encoding = Encoding;
packet = stream.ReadPacket();
field.Encoding = Encoding;
field.CatalogName = packet.ReadLenString();
field.DatabaseName = packet.ReadLenString();
field.TableName = packet.ReadLenString();
field.RealTableName = packet.ReadLenString();
field.ColumnName = packet.ReadLenString();
field.OriginalColumnName = packet.ReadLenString();
packet.ReadByte();
field.CharacterSetIndex = packet.ReadInteger(2);
field.ColumnLength = packet.ReadInteger(4);
MySqlDbType type = (MySqlDbType)packet.ReadByte();
ColumnFlags colFlags;
if ((connectionFlags & ClientFlags.LONG_FLAG) != 0)
colFlags = (ColumnFlags)packet.ReadInteger(2);
else
colFlags = (ColumnFlags)packet.ReadByte();
field.Scale = (byte)packet.ReadByte();
if (packet.HasMoreData)
{
packet.ReadInteger(2); // reserved
}
if (type == MySqlDbType.Decimal || type == MySqlDbType.NewDecimal)
{
field.Precision = (byte)(field.ColumnLength - 2);
if ((colFlags & ColumnFlags.UNSIGNED) != 0)
field.Precision++;
}
field.SetTypeAndFlags(type, colFlags);
}
示例3: GetFieldMetaData
private MySqlField GetFieldMetaData()
{
MySqlField field;
if (version.isAtLeast(4, 1, 0))
field = GetFieldMetaData41();
else
{
stream.OpenPacket();
field = new MySqlField(connection);
field.Encoding = encoding;
field.TableName = stream.ReadLenString();
field.ColumnName = stream.ReadLenString();
field.ColumnLength = stream.ReadNBytes();
MySqlDbType type = (MySqlDbType) stream.ReadNBytes();
stream.ReadByte();
ColumnFlags colFlags;
if ((Flags & ClientFlags.LONG_FLAG) != 0)
colFlags = (ColumnFlags) stream.ReadInteger(2);
else
colFlags = (ColumnFlags) stream.ReadByte();
field.SetTypeAndFlags(type, colFlags);
field.Scale = (byte) stream.ReadByte();
if (!version.isAtLeast(3, 23, 15) && version.isAtLeast(3, 23, 0))
field.Scale++;
}
return field;
}