WriteString() public method

public WriteString ( string v ) : void
v string
return void
示例#1
0
        public virtual void ExecuteDirect(string sql)
        {
            MySqlPacket p = new MySqlPacket(Encoding);

            p.WriteString(sql);
            SendQuery(p);
            NextResult(0, false);
        }
示例#2
0
        public virtual void ExecuteDirect(string sql)
        {
            MySqlPacket mySqlPacket = new MySqlPacket(this.Encoding);

            mySqlPacket.WriteString(sql);
            this.SendQuery(mySqlPacket);
            this.NextResult(0, false);
        }
示例#3
0
        /// <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);
            }
        }
示例#4
0
 public virtual void ExecuteDirect(string sql)
 {
     MySqlPacket p = new MySqlPacket(Encoding);
     p.WriteString(sql);
     SendQuery(p);
     NextResult(0, false);
 }
示例#5
0
        /// <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);
        }
示例#6
0
    /// <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);
    }