H2是否支持对单个列进行排序规则定义? [英] Does H2 support a collation defintion for one single column?
本文介绍了H2是否支持对单个列进行排序规则定义?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在H2数据库中创建一个H2列,使其具有其他排序规则(不区分大小写),然后进行其他排序(区分大小写)。
I want to make a single H2 column in a H2 database to have a other collation (case insensitive) then the other columns (that are case sensitive).
在MySQL中,我可以这样做:
In MySQL I would do this:
ALTER TABLE users MODIFY login VARCHAR(255) COLLATE utf8_general_ci
H2中是否有类似功能?
Is there a similar feature in H2?
推荐答案
H2每个数据库仅支持一种排序规则(通过 SET COLLATION
语句)。
H2 only supports one collation per database (via SET COLLATION
statement).
它支持的是不区分大小写的数据类型, VARCHAR_IGNORECASE
。在内部,此数据类型使用 String.compareToIgnoreCase
。对于您的用例,这可能行不通。
What it does support is a case-insensitive data type, VARCHAR_IGNORECASE
. Internally, this data type is using String.compareToIgnoreCase
. This may or may not work for your use case.
这篇关于H2是否支持对单个列进行排序规则定义?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文