简体   繁体   English

[cs] 在 MariaDb 的 DDL 中是什么意思

[英]What does [cs] means in DDL for MariaDb

I have a DDL for a table我有一个表的 DDL

create table AIRPORT (
    AIRP_CODE varchar(10)[cs] not null,
    AIRP_NAME nvarchar(60)[cs] not null,
    GEOR_ID_LOCATED integer not null,
    PRCC_CONST integer,
    AIRP_TIME_ZONE char(5),
    AIRP_TRANSLATION mediumtext,
    LCOUNT integer default 0
);

I am trying to figure out what does [cs] mean in it.我想弄清楚 [cs] 在其中的含义。 I think its for collation but I am not sure how it works.我认为它用于整理,但我不确定它是如何工作的。 Table DDL isn't written by me and I can't figure it out.表 DDL 不是我写的,我无法弄清楚。

In that position would be CHARACTER SET and/or COLLATION .在那个位置将是CHARACTER SET和/或COLLATION

An "airport code" would best be CHARACTER SET ascii . “机场代码”最好是CHARACTER SET ascii Depending on whether you want to allow case folding, you could use COLLATION ascii_bin (disallow folding) or COLLATION ascii_ci (allow folding).根据您是否希望允许大小写折叠,您可以使用COLLATION ascii_bin (禁止折叠)或COLLATION ascii_ci (允许折叠)。

For the airport name, it would probably be best to use UTF-8 :对于机场名称,最好使用UTF-8

AIRP_NAME varchar(60) CHARACTER SET utf8mb4 COLLATION utf8mb4_unicode_520_ci not null

Note: NVARCHAR is a notation from non-MySQL vendors;注意: NVARCHAR是来自非 MySQL 供应商的符号; for MySQL the sharset is important.对于 MySQL,sharset 很重要。

Perhaps you also want to specify a charset for AIRP_TRANSLATION ?也许您还想为AIRP_TRANSLATION指定一个字符集? Again, utf8mb4 is probably appropriate.同样,utf8mb4 可能是合适的。

(I have never seen "[cs]"; my advice is aimed at what should be specified in that context.) (我从未见过“[cs]”;我的建议是针对在这种情况下应该指定的内容。)

That SQL code is invalid, period.该 SQL 代码无效,句号。

You must be missing information.你肯定缺少信息。 Wherever you got the code from, there's possibly some documentation that explains what it is and how to use it.无论您从何处获得代码,都可能有一些文档解释了它是什么以及如何使用它。 If it was handed to you by some other person, he didn't consider sharing the information with you.如果是其他人交给你的,他不会考虑与你分享信息。

Judging from column names and types, I suspect the code comes from the README file of an airport database available for download, perhaps in CSV format, and it's just a recommended table structure you are meant to take as starting point and adapt to your own system.从列名和类型来看,我怀疑代码来自可供下载的机场数据库的 README 文件,可能是 CSV 格式,它只是一个推荐的表结构,您打算以此为起点并适应您自己的系统. My educated guess about [cs] is that it's an annotation to imply that those fields are case sensitive, meaning that you application should use eg MAD and not mad .我对[cs]有根据的猜测是,它是暗示这些字段区分大小写的注释,这意味着您的应用程序应该使用例如MAD而不是mad

In any case, having no further context it's impossible to tell.无论如何,没有进一步的背景是不可能说出来的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM