本文整理汇总了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;
}