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


C# MySqlTokenizer.ReadParenthesis方法代码示例

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


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

示例1: ParseDataType

    /// <summary>
    ///  Parses out the elements of a procedure parameter data type.
    /// </summary>
    private string ParseDataType(DataRow row, MySqlTokenizer tokenizer)
    {
      var dtd = new StringBuilder(
          tokenizer.NextToken().ToUpper(CultureInfo.InvariantCulture));
      row["DATA_TYPE"] = dtd.ToString();
      var type = row["DATA_TYPE"].ToString();

      var token = tokenizer.NextToken();
      if (token == "(")
      {
        token = tokenizer.ReadParenthesis();
        dtd.AppendFormat(CultureInfo.InvariantCulture, "{0}", token);
        if (type != "ENUM" && type != "SET")
          ParseDataTypeSize(row, token);
        token = tokenizer.NextToken();
      }
      else
        dtd.Append(GetDataTypeDefaults(type, row));

      while (token != ")" &&
             token != "," &&
             String.Compare(token, "begin", true) != 0 &&
             String.Compare(token, "return", true) != 0)
      {
        if (String.Compare(token, "CHARACTER", true) == 0 ||
            String.Compare(token, "BINARY", true) == 0)
        { }  // we don't need to do anything with this
        else if (String.Compare(token, "SET", true) == 0 ||
                 String.Compare(token, "CHARSET", true) == 0)
          row["CHARACTER_SET_NAME"] = tokenizer.NextToken();
        else if (String.Compare(token, "ASCII", true) == 0)
          row["CHARACTER_SET_NAME"] = "latin1";
        else if (String.Compare(token, "UNICODE", true) == 0)
          row["CHARACTER_SET_NAME"] = "ucs2";
        else if (String.Compare(token, "COLLATE", true) == 0)
          row["COLLATION_NAME"] = tokenizer.NextToken();
        else
          dtd.AppendFormat(CultureInfo.InvariantCulture, " {0}", token);
        token = tokenizer.NextToken();
      }

      if (dtd.Length > 0)
        row["DTD_IDENTIFIER"] = dtd.ToString();

      // now default the collation if one wasn't given
      if (row["COLLATION_NAME"].ToString().Length == 0 &&
          row["CHARACTER_SET_NAME"].ToString().Length > 0)
        row["COLLATION_NAME"] = CharSetMap.GetDefaultCollation(
            row["CHARACTER_SET_NAME"].ToString(), connection);

      // now set the octet length
      if (row["CHARACTER_MAXIMUM_LENGTH"] != DBNull.Value)
        row["CHARACTER_OCTET_LENGTH"] =
            CharSetMap.GetMaxLength(row["CHARACTER_SET_NAME"].ToString(), connection) *
            (int)row["CHARACTER_MAXIMUM_LENGTH"];

      return token;
    }
开发者ID:RoxyLalonde,项目名称:Phoenix-Realms,代码行数:61,代码来源:ISSchemaProvider.cs


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