public final class IdentifierProfile extends Object
封装每个数据库厂商的完整标识符配置,包括:
IdentifierProfile.Builder.withObjectRules(ESQLDataObjectType, IdentifierRules)
设计目标:
使用示例:
// 创建 Oracle profile(使用默认 flags)
IdentifierProfile oracleProfile = IdentifierProfile.forVendor(
EDbVendor.dbvoracle,
VendorFlags.defaults()
);
// 创建 MySQL profile(指定 lower_case_table_names)
IdentifierProfile mysqlProfile = IdentifierProfile.forVendor(
EDbVendor.dbvmysql,
new VendorFlags(1, null, false, false) // lower_case_table_names = 1
);
// 查询规则
IdentifierRules tableRules = oracleProfile.getRules(ESQLDataObjectType.dotTable);
| Modifier and Type | Class and Description |
|---|---|
static class |
IdentifierProfile.Builder
Builder for creating customized IdentifierProfile instances.
|
static class |
IdentifierProfile.ObjectGroup
对象组(用于区分不同对象类型的标识符规则)
|
static class |
IdentifierProfile.VendorFlags
Vendor-specific flags(厂商特定配置)
|
| Modifier and Type | Method and Description |
|---|---|
static IdentifierProfile.Builder |
builder(EDbVendor vendor)
Create a builder seeded from default rules for the given vendor
with default VendorFlags.
|
static IdentifierProfile.Builder |
builder(EDbVendor vendor,
IdentifierProfile.VendorFlags flags)
Create a builder seeded from default rules for the given vendor
and the specified VendorFlags.
|
boolean |
equals(Object o)
Value equality over the complete effective strategy — see
hasSameEffectivePolicyAs(gudusoft.gsqlparser.sqlenv.IdentifierProfile). |
static IdentifierProfile |
forVendor(EDbVendor vendor,
IdentifierProfile.VendorFlags flags)
为指定厂商创建标识符配置档案
|
static IdentifierProfile |
forVendorOr(IdentifierProfile configured,
EDbVendor vendor)
configured when it is a configuration for vendor, else that vendor's
default profile. |
long |
getFingerprint()
计算配置指纹(用于 TObjectName 缓存失效)
|
IdentifierProfile.VendorFlags |
getFlags()
获取 vendor flags
|
Map<ESQLDataObjectType,IdentifierRules> |
getObjectRuleOverrides()
The categories this profile configures explicitly, finest granularity first.
|
IdentifierRules |
getRules(ESQLDataObjectType objectType)
获取指定对象类型的标识符规则
|
EDbVendor |
getVendor()
获取数据库厂商
|
IdentifierProfile.ObjectGroup |
groupOf(ESQLDataObjectType objectType)
将对象类型映射到对象组(公开访问器,供
CanonKey 的规则域标识使用) |
int |
hashCode() |
boolean |
hasSameEffectivePolicyAs(IdentifierProfile other)
Whether this profile and
other are the SAME effective strategy: same vendor, same
flags, and the same resolved rule for every object category — regardless of how each was
built (vendor default, group override, category override) or of object identity. |
IdentifierRules |
ruleDomainOf(ESQLDataObjectType objectType)
The effective rule cell of one object category with
SAME_AS_UNQUOTED resolved —
the rule domain a CanonKey of that category belongs to. |
IdentifierProfile.Builder |
toBuilder()
Create a builder pre-populated from this profile's current state.
|
String |
toString() |
public static IdentifierProfile forVendor(EDbVendor vendor, IdentifierProfile.VendorFlags flags)
vendor - 数据库厂商flags - vendor-specific flagspublic static IdentifierProfile forVendorOr(IdentifierProfile configured, EDbVendor vendor)
configured when it is a configuration for vendor, else that vendor's
default profile.
For the places that build an object of a dialect an analysis may or may not be configured
for — a metadata file that declares its own dbVendor, nested SQL in another dialect.
A profile belongs to exactly one vendor, so it is never transplanted onto another: rules
chosen for BigQuery tables say nothing about Oracle's.
configured - the analysis's configuration, or null when there is nonevendor - the vendor the caller actually needs a profile forvendor; never nullpublic static IdentifierProfile.Builder builder(EDbVendor vendor)
vendor - database vendorpublic static IdentifierProfile.Builder builder(EDbVendor vendor, IdentifierProfile.VendorFlags flags)
vendor - database vendorflags - vendor-specific flagspublic IdentifierProfile.Builder toBuilder()
public IdentifierRules getRules(ESQLDataObjectType objectType)
objectType - 对象类型public IdentifierRules ruleDomainOf(ESQLDataObjectType objectType)
SAME_AS_UNQUOTED resolved —
the rule domain a CanonKey of that category belongs to.
Since categories inside one IdentifierProfile.ObjectGroup may now carry different rules, the
group alone no longer identifies the domain a canonical payload was produced in: with
tables insensitive and schemas sensitive, a table keyed as orders and a schema
literally named orders would otherwise produce equal keys. Two categories with the
same effective cell share a domain, which is what keeps a default profile's
table/schema/catalog keys interchangeable exactly as before.
objectType - the object categorypublic boolean hasSameEffectivePolicyAs(IdentifierProfile other)
other are the SAME effective strategy: same vendor, same
flags, and the same resolved rule for every object category — regardless of how each was
built (vendor default, group override, category override) or of object identity.
The fingerprint is a hash: it can accelerate this answer but
must never stand in for it, since distinct strategies can collide in 32 bits.
other - the profile to compare with; null is never the same strategypublic boolean equals(Object o)
hasSameEffectivePolicyAs(gudusoft.gsqlparser.sqlenv.IdentifierProfile). Two profiles that decide every identifier question the
same way ARE the same profile, so an equivalent instance passed at a second entry point
does not read as a conflicting configuration.public Map<ESQLDataObjectType,IdentifierRules> getObjectRuleOverrides()
getRules(gudusoft.gsqlparser.sqlenv.ESQLDataObjectType).public IdentifierProfile.VendorFlags getFlags()
public IdentifierProfile.ObjectGroup groupOf(ESQLDataObjectType objectType)
CanonKey 的规则域标识使用)objectType - 对象类型public long getFingerprint()
当 vendor 或 flags 变化时,指纹会改变,触发缓存失效