当前位置: 首页>>代码示例>>C#>>正文


C# MySqlField.SetTypeAndFlags方法代码示例

本文整理汇总了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;
        }
开发者ID:maanshancss,项目名称:ClassLibrary,代码行数:41,代码来源:NativeDriver.cs

示例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);
    }
开发者ID:jimmy00784,项目名称:mysql-connector-net,代码行数:36,代码来源:NativeDriver.cs

示例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;
        }
开发者ID:maanshancss,项目名称:ClassLibrary,代码行数:31,代码来源:NativeDriver.cs


注:本文中的MySql.Data.MySqlClient.MySqlField.SetTypeAndFlags方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。