什么MySQL数据类型应该用于xsd:anyURI?

时间:2022-09-08 17:15:22

I have a parameter that i wish to store into my MySQL database.

我有一个参数,我希望存储到我的MySQL数据库中。

Here is the description of the parameter :

以下是参数的说明:

Parameter Name : endUserId

参数名称:endUserId

Type : xsd:anyURI

键入:xsd:anyURI

Max Length : 256

最大长度:256

Description : The format is 'tel:' followed by '+' and followed by the phone number for e.g. tel: +22507588125 , The endUserId in the URL must be the same and URL-escaped, i.e. tel%3A%2B22507588125

说明:格式为'tel:'后跟'+',后跟电话号码,例如:电话:+22507588125,URL中的endUserId必须相同且URL转义,即tel%3A%2B22507588125

so what data type is suitable for the parameter 'endUserId' described above ?

那么什么数据类型适合上面描述的参数'endUserId'?

Thanks

1 个解决方案

#1


0  

A maximum length of 256 is larger than required. I have never seen a phone number with more than, say, 15 digits. Under reasonable constraints, you could store the phone number as a BIGINT. Just store the numeric part, and format the output (append "tel:+") when only you read it.

最大长度256大于所需的长度。我从未见过超过15位数的电话号码。在合理的限制下,您可以将电话号码存储为BIGINT。只需存储数字部分,并在只读取时格式化输出(附加“tel:+”)。

You may also store the international prefix apart, i.e. a phone number would be stored in two numeric columns (one for the international prefix, another for the actual phone number -- I am told no phone number has a 0 after its international prefix).

您还可以将国际前缀分开存储,即电话号码将存储在两个数字列中(一个用于国际前缀,另一个用于实际电话号码 - 我被告知没有电话号码在其国际前缀后有0)。

If the max size of 256 is not negociable, then your only choice is VARCHAR.

如果256的最大大小不是可以消极的,那么你唯一的选择就是VARCHAR。

#1


0  

A maximum length of 256 is larger than required. I have never seen a phone number with more than, say, 15 digits. Under reasonable constraints, you could store the phone number as a BIGINT. Just store the numeric part, and format the output (append "tel:+") when only you read it.

最大长度256大于所需的长度。我从未见过超过15位数的电话号码。在合理的限制下,您可以将电话号码存储为BIGINT。只需存储数字部分,并在只读取时格式化输出(附加“tel:+”)。

You may also store the international prefix apart, i.e. a phone number would be stored in two numeric columns (one for the international prefix, another for the actual phone number -- I am told no phone number has a 0 after its international prefix).

您还可以将国际前缀分开存储,即电话号码将存储在两个数字列中(一个用于国际前缀,另一个用于实际电话号码 - 我被告知没有电话号码在其国际前缀后有0)。

If the max size of 256 is not negociable, then your only choice is VARCHAR.

如果256的最大大小不是可以消极的,那么你唯一的选择就是VARCHAR。