本文整理汇总了C#中MySql.Data.MySqlClient.MySqlTokenizer.NextParameter方法的典型用法代码示例。如果您正苦于以下问题:C# MySqlTokenizer.NextParameter方法的具体用法?C# MySqlTokenizer.NextParameter怎么用?C# MySqlTokenizer.NextParameter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MySql.Data.MySqlClient.MySqlTokenizer
的用法示例。
在下文中一共展示了MySqlTokenizer.NextParameter方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PrepareCommandText
/// <summary>
/// Prepares CommandText for use with the Prepare method
/// </summary>
/// <returns>Command text stripped of all paramter names</returns>
/// <remarks>
/// Takes the output of TokenizeSql and creates a single string of SQL
/// that only contains '?' markers for each parameter. It also creates
/// the parameterMap array list that includes all the paramter names in the
/// order they appeared in the SQL
/// </remarks>
private List<string> PrepareCommandText(out string stripped_sql)
{
StringBuilder newSQL = new StringBuilder();
List<string> parameterMap = new List<string>();
int startPos = 0;
string sql = ResolvedCommandText;
MySqlTokenizer tokenizer = new MySqlTokenizer(sql);
string parameter = tokenizer.NextParameter();
while (parameter != null)
{
parameter = tokenizer.NextParameter();
}
newSQL.Append(sql.Substring(startPos));
stripped_sql = newSQL.ToString();
return parameterMap;
}
示例2: PrepareCommandText
/// <summary>
/// Prepares CommandText for use with the Prepare method
/// </summary>
/// <returns>Command text stripped of all paramter names</returns>
/// <remarks>
/// Takes the output of TokenizeSql and creates a single string of SQL
/// that only contains '?' markers for each parameter. It also creates
/// the parameterMap array list that includes all the paramter names in the
/// order they appeared in the SQL
/// </remarks>
private List<string> PrepareCommandText(out string stripped_sql)
{
StringBuilder newSQL = new StringBuilder();
List<string> parameterMap = new List<string>();
int startPos = 0;
string sql = ResolvedCommandText;
MySqlTokenizer tokenizer = new MySqlTokenizer(sql);
string parameter = tokenizer.NextParameter();
while (parameter != null)
{
if (parameter.IndexOf(StoredProcedure.ParameterPrefix) == -1)
{
newSQL.Append(sql.Substring(startPos, tokenizer.StartIndex - startPos));
newSQL.Append("?");
parameterMap.Add(parameter);
startPos = tokenizer.StopIndex;
}
parameter = tokenizer.NextParameter();
}
newSQL.Append(sql.Substring(startPos));
stripped_sql = newSQL.ToString();
return parameterMap;
}
示例3: InternalBindParameters
private void InternalBindParameters(string sql, MySqlParameterCollection parameters,
MySqlPacket packet)
{
if (packet == null)
{
packet = new MySqlPacket(Driver.Encoding);
packet.Version = Driver.Version;
packet.WriteByte(0);
}
int startPos = 0;
MySqlTokenizer tokenizer = new MySqlTokenizer(sql);
tokenizer.ReturnComments = true;
string parameter = tokenizer.NextParameter();
while (parameter != null)
{
packet.WriteStringNoNull(sql.Substring(startPos, tokenizer.StartIndex - startPos));
bool serialized = SerializeParameter(parameters, packet, parameter);
startPos = tokenizer.StopIndex;
if (!serialized)
startPos = tokenizer.StartIndex;
parameter = tokenizer.NextParameter();
}
packet.WriteStringNoNull(sql.Substring(startPos));
buffers.Add(packet);
}