• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# MySqlClient.MySqlField类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中MySql.Data.MySqlClient.MySqlField的典型用法代码示例。如果您正苦于以下问题:C# MySqlField类的具体用法?C# MySqlField怎么用?C# MySqlField使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



MySqlField类属于MySql.Data.MySqlClient命名空间,在下文中一共展示了MySqlField类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: 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


示例2: PrepareStatement

    public int PrepareStatement(string sql, ref MySqlField[] parameters)
    {
      //TODO: check this
      //ClearFetchedRow();

      packet.Length = sql.Length * 4 + 5;
      byte[] buffer = packet.Buffer;
      int len = Encoding.GetBytes(sql, 0, sql.Length, packet.Buffer, 5);
      packet.Position = len + 5;
      buffer[4] = (byte)DBCmd.PREPARE;
      ExecutePacket(packet);

      packet = stream.ReadPacket();

      int marker = packet.ReadByte();
      if (marker != 0)
        throw new MySqlException("Expected prepared statement marker");

      int statementId = packet.ReadInteger(4);
      int numCols = packet.ReadInteger(2);
      int numParams = packet.ReadInteger(2);
      //TODO: find out what this is needed for
      packet.ReadInteger(3);
      if (numParams > 0)
      {
        parameters = owner.GetColumns(numParams);
        // we set the encoding for each parameter back to our connection encoding
        // since we can't trust what is coming back from the server
        for (int i = 0; i < parameters.Length; i++)
          parameters[i].Encoding = Encoding;
      }

      if (numCols > 0)
      {
        while (numCols-- > 0)
        {
          packet = stream.ReadPacket();
          //TODO: handle streaming packets
        }

        ReadEOF();
      }

      return statementId;
    }
开发者ID:jimmy00784,项目名称:mysql-connector-net,代码行数:45,代码来源:NativeDriver.cs


示例3: ReadColumnValue

    public IMySqlValue ReadColumnValue(int index, MySqlField field, IMySqlValue valObject)
    {
      long length = -1;
      bool isNull;

      if (nullMap != null)
        isNull = nullMap[index + 2];
      else
      {
        length = packet.ReadFieldLength();
        isNull = length == -1;
      }

      packet.Encoding = field.Encoding;
      packet.Version = version;
      return valObject.ReadValue(packet, length, isNull);
    }
开发者ID:jimmy00784,项目名称:mysql-connector-net,代码行数:17,代码来源:NativeDriver.cs


示例4: GetColumnsData

 public void GetColumnsData(MySqlField[] columns)
 {
   for (int i = 0; i < columns.Length; i++)
     GetColumnData(columns[i]);
   ReadEOF();
 }
开发者ID:jimmy00784,项目名称:mysql-connector-net,代码行数:6,代码来源:NativeDriver.cs


示例5: PrepareStatement

 public virtual int PrepareStatement(string sql, ref MySqlField[] parameters)
 {
     return handler.PrepareStatement(sql, ref parameters);
 }
开发者ID:LittlePeng,项目名称:ncuhome,代码行数:4,代码来源:Driver.cs


示例6: ReadColumnValue

 public IMySqlValue ReadColumnValue(int index, MySqlField field, IMySqlValue value)
 {
     return handler.ReadColumnValue(index, field, value);
 }
开发者ID:LittlePeng,项目名称:ncuhome,代码行数:4,代码来源:Driver.cs


示例7: ReadColumnValue

 public abstract IMySqlValue ReadColumnValue(int index, MySqlField field, IMySqlValue value);
开发者ID:rykr,项目名称:connector-net,代码行数:1,代码来源:Driver.cs


示例8: GetColumns

        public MySqlField[] GetColumns(int count)
        {
            MySqlField[] fields = new MySqlField[count];
            for (int i = 0; i < count; i++)
                fields[i] = new MySqlField(this);
            handler.GetColumnsData(fields);

            return fields;
        }
开发者ID:LittlePeng,项目名称:ncuhome,代码行数:9,代码来源:Driver.cs


示例9: PrepareStatement

 public override int PrepareStatement(string sql, ref MySqlField[] parameters)
 {
   int statementId = base.PrepareStatement(sql, ref parameters);
   MySqlTrace.TraceEvent(TraceEventType.Information, MySqlTraceEventType.StatementPrepared,
       Resources.TraceStatementPrepared, driverId, sql, statementId);
   return statementId;
 }
开发者ID:jimmy00784,项目名称:mysql-connector-net,代码行数:7,代码来源:TracingDriver.cs


示例10: PrepareStatement

 public abstract int PrepareStatement(string sql, ref MySqlField[] parameters);
开发者ID:rykr,项目名称:connector-net,代码行数:1,代码来源:Driver.cs


示例11: PrepareStatement

        public override int PrepareStatement(string sql, ref MySqlField[] parameters)
        {
            //TODO: check this
            //ClearFetchedRow();

            byte[] bytes = encoding.GetBytes(sql);
            ExecuteCommand(DBCmd.PREPARE, bytes, bytes.Length);

            stream.OpenPacket();

            int marker = stream.ReadByte();
            if (marker != 0)
                throw new MySqlException("Expected prepared statement marker");

            int statementId = stream.ReadInteger(4);
            int numCols = stream.ReadInteger(2);
            int numParams = stream.ReadInteger(2);
            //TODO: find out what this is needed for
            stream.ReadInteger(3);
            if (numParams > 0)
            {
                parameters = ReadColumnMetadata(numParams);

                // we set the encoding for each parameter back to our connection encoding
                // since we can't trust what is coming back from the server
                for (int i = 0; i < parameters.Length; i++)
                    parameters[i].Encoding = encoding;
            }

            if (numCols > 0)
            {
                while (numCols-- > 0)
                {
                    stream.OpenPacket();
                    stream.SkipPacket();
                }

                ReadEOF();
            }

            return statementId;
        }
开发者ID:maanshancss,项目名称:ClassLibrary,代码行数:42,代码来源:NativeDriver.cs


示例12: 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


示例13: 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


示例14: ReadColumnMetadata

        public override MySqlField[] ReadColumnMetadata(int count)
        {
            MySqlField[] fields = new MySqlField[count];

            for (int i = 0; i < count; i++)
                fields[i] = GetFieldMetaData();

            ReadEOF();
            return fields;
        }
开发者ID:maanshancss,项目名称:ClassLibrary,代码行数:10,代码来源:NativeDriver.cs


示例15: ReadColumnValue

        public override IMySqlValue ReadColumnValue(int index, MySqlField field, IMySqlValue valObject)
        {
            long length = -1;
            bool isNull;

            if (nullMap != null)
                isNull = nullMap[index + 2];
            else
            {
                length = stream.ReadFieldLength();
                isNull = length == -1;
            }

            stream.Encoding = field.Encoding;
            return valObject.ReadValue(stream, length, isNull);
        }
开发者ID:maanshancss,项目名称:ClassLibrary,代码行数:16,代码来源:NativeDriver.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# MySqlClient.MySqlPacket类代码示例发布时间:2022-05-26
下一篇:
C# MySqlClient.MySqlDataReader类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap