本文整理汇总了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);
}
示例2: ExecuteDirect
public virtual void ExecuteDirect(string sql)
{
MySqlPacket p = new MySqlPacket(Encoding);
p.WriteString(sql);
SendQuery(p);
NextResult(0, false);
}
示例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);
}