當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。