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


C# MySqlTokenizer.NextParameter方法代码示例

本文整理汇总了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;
        }
开发者ID:yalunwang,项目名称:DotnetSpider,代码行数:27,代码来源:PreparableStatement.cs

示例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;
    }
开发者ID:jimmy00784,项目名称:mysql-connector-net,代码行数:34,代码来源:PreparableStatement.cs

示例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);
        }
开发者ID:zibler,项目名称:zibler,代码行数:26,代码来源:Statement.cs


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