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


C# MySqlPacket.WriteString方法代码示例

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


在下文中一共展示了MySqlPacket.WriteString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AuthenticateNew

        /// <summary>
        /// Perform an authentication against a 4.1.1 server
        /// </summary>
        private void AuthenticateNew()
        {
            if ((connectionFlags & ClientFlags.SECURE_CONNECTION) == 0)
                AuthenticateOld();

            packet.Write(Crypt.Get411Password(Settings.Password, encryptionSeed));
            if ((connectionFlags & ClientFlags.CONNECT_WITH_DB) != 0 && Settings.Database != null)
                packet.WriteString(Settings.Database);
            else
                packet.WriteString(""); // Add a null termination to the string.

            stream.SendPacket(packet);

            // this result means the server wants us to send the password using
            // old encryption
            packet = stream.ReadPacket();
            if (packet.IsLastPacket)
            {
                packet.Clear();
                packet.WriteString(Crypt.EncryptPassword(
                                       Settings.Password, encryptionSeed.Substring(0, 8), true));
                stream.SendPacket(packet);
                ReadOk(true);
            }
            else
                ReadOk(false);
        }
开发者ID:LittlePeng,项目名称:ncuhome,代码行数:30,代码来源:NativeDriver.cs

示例2: ExecuteDirect

 public virtual void ExecuteDirect(string sql)
 {
     MySqlPacket p = new MySqlPacket(Encoding);
     p.WriteString(sql);
     SendQuery(p);
     NextResult(0, false);
 }
开发者ID:LittlePeng,项目名称:ncuhome,代码行数:7,代码来源:Driver.cs

示例3: AuthenticateNew

    /// <summary>
    /// Perform an authentication against a 4.1.1 server
    /// <param name="reset">
    /// True, if this function is called as part of CHANGE_USER request
    /// (connection reset)
    /// False, for first-time logon
    /// </param>
    /// </summary>
    private void AuthenticateNew(bool reset)
    {
      if ((connectionFlags & ClientFlags.SECURE_CONNECTION) == 0)
        AuthenticateOld();

      packet.Write(Crypt.Get411Password(Settings.Password, encryptionSeed));
      if ((connectionFlags & ClientFlags.CONNECT_WITH_DB) != 0 && Settings.Database != null)
        packet.WriteString(Settings.Database);
      else
        packet.WriteString(""); // Add a null termination to the string.


      if (Settings.IntegratedSecurity)
      {
        // Append authentication method after the database name in the 
        // handshake authentication packet.If we're sending CHANGE_USER
        // also write charset number after database name prior to plugin name
        if (reset)
        {
          packet.WriteInteger(8, 2); // Charset number
        }
        packet.WriteString(AuthenticationWindowsPlugin);
        stream.SendPacket(packet);
        AuthenticateSSPI();
        return;
      }
      else
      {
        stream.SendPacket(packet);
      }

      // this result means the server wants us to send the password using
      // old encryption
      packet = stream.ReadPacket();
      if (packet.IsLastPacket)
      {
        packet.Clear();
        packet.WriteString(Crypt.EncryptPassword(
                               Settings.Password, encryptionSeed.Substring(0, 8), true));
        stream.SendPacket(packet);
        ReadOk(true);
      }
      else
        ReadOk(false);
    }
开发者ID:Top-Cat,项目名称:SteamBot,代码行数:53,代码来源:NativeDriver.cs


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