2
2
* SPDX-License-Identifier: Apache-2.0
3
3
* Copyright Red Hat Inc. and Hibernate Authors
4
4
*/
5
- package org .hibernate .dialect ;
5
+ package org .hibernate .community . dialect ;
6
6
7
7
import org .hibernate .LockOptions ;
8
+ import org .hibernate .dialect .DatabaseVersion ;
9
+ import org .hibernate .dialect .Dialect ;
10
+ import org .hibernate .dialect .FunctionalDependencyAnalysisSupport ;
11
+ import org .hibernate .dialect .FunctionalDependencyAnalysisSupportImpl ;
12
+ import org .hibernate .dialect .MySQLDialect ;
13
+ import org .hibernate .dialect .MySQLServerConfiguration ;
8
14
import org .hibernate .dialect .aggregate .AggregateSupport ;
9
15
import org .hibernate .dialect .aggregate .MySQLAggregateSupport ;
10
16
import org .hibernate .dialect .sequence .SequenceSupport ;
11
- import org .hibernate .dialect .sequence .TiDBSequenceSupport ;
17
+ import org .hibernate .community . dialect .sequence .TiDBSequenceSupport ;
12
18
import org .hibernate .engine .jdbc .dialect .spi .DialectResolutionInfo ;
13
19
import org .hibernate .engine .spi .SessionFactoryImplementor ;
14
20
import org .hibernate .query .sqm .IntervalType ;
18
24
import org .hibernate .sql .ast .spi .StandardSqlAstTranslatorFactory ;
19
25
import org .hibernate .sql .ast .tree .Statement ;
20
26
import org .hibernate .sql .exec .spi .JdbcOperation ;
21
- import org .hibernate .tool . schema . extract . internal .SequenceInformationExtractorTiDBDatabaseImpl ;
27
+ import org .hibernate .community . dialect . sequence .SequenceInformationExtractorTiDBDatabaseImpl ;
22
28
import org .hibernate .tool .schema .extract .spi .SequenceInformationExtractor ;
23
29
24
30
import jakarta .persistence .TemporalType ;
@@ -43,7 +49,7 @@ public TiDBDialect(DatabaseVersion version) {
43
49
}
44
50
45
51
public TiDBDialect (DialectResolutionInfo info ) {
46
- super ( createVersion ( info ), MySQLServerConfiguration .fromDialectResolutionInfo ( info ) );
52
+ super ( createVersion ( info , MINIMUM_VERSION ), MySQLServerConfiguration .fromDialectResolutionInfo ( info ) );
47
53
registerKeywords ( info );
48
54
}
49
55
@@ -62,19 +68,19 @@ protected DatabaseVersion getMinimumSupportedVersion() {
62
68
protected void registerDefaultKeywords () {
63
69
super .registerDefaultKeywords ();
64
70
// TiDB implemented 'Window Functions' of MySQL 8, so the following keywords are reserved.
65
- registerKeyword ("CUME_DIST" );
66
- registerKeyword ("DENSE_RANK" );
67
- registerKeyword ("EXCEPT" );
68
- registerKeyword ("FIRST_VALUE" );
69
- registerKeyword ("GROUPS" );
70
- registerKeyword ("LAG" );
71
- registerKeyword ("LAST_VALUE" );
72
- registerKeyword ("LEAD" );
73
- registerKeyword ("NTH_VALUE" );
74
- registerKeyword ("NTILE" );
75
- registerKeyword ("PERCENT_RANK" );
76
- registerKeyword ("RANK" );
77
- registerKeyword ("ROW_NUMBER" );
71
+ registerKeyword ( "CUME_DIST" );
72
+ registerKeyword ( "DENSE_RANK" );
73
+ registerKeyword ( "EXCEPT" );
74
+ registerKeyword ( "FIRST_VALUE" );
75
+ registerKeyword ( "GROUPS" );
76
+ registerKeyword ( "LAG" );
77
+ registerKeyword ( "LAST_VALUE" );
78
+ registerKeyword ( "LEAD" );
79
+ registerKeyword ( "NTH_VALUE" );
80
+ registerKeyword ( "NTILE" );
81
+ registerKeyword ( "PERCENT_RANK" );
82
+ registerKeyword ( "RANK" );
83
+ registerKeyword ( "ROW_NUMBER" );
78
84
}
79
85
80
86
@ Override
@@ -134,12 +140,12 @@ public boolean supportsWait() {
134
140
}
135
141
136
142
@ Override
137
- boolean supportsForShare () {
143
+ protected boolean supportsForShare () {
138
144
return false ;
139
145
}
140
146
141
147
@ Override
142
- boolean supportsAliasLocks () {
148
+ protected boolean supportsAliasLocks () {
143
149
return false ;
144
150
}
145
151
@@ -192,12 +198,13 @@ public FunctionalDependencyAnalysisSupport getFunctionalDependencyAnalysisSuppor
192
198
return FunctionalDependencyAnalysisSupportImpl .TABLE_REFERENCE ;
193
199
}
194
200
195
- @ Override @ SuppressWarnings ("deprecation" )
201
+ @ Override
202
+ @ SuppressWarnings ("deprecation" )
196
203
public String timestampaddPattern (TemporalUnit unit , TemporalType temporalType , IntervalType intervalType ) {
197
204
// TiDB doesn't natively support adding fractional seconds
198
205
return unit == TemporalUnit .SECOND && intervalType == null
199
206
? "timestampadd(microsecond,?2*1e6,?3)"
200
- : super .timestampaddPattern (unit , temporalType , intervalType );
207
+ : super .timestampaddPattern ( unit , temporalType , intervalType );
201
208
}
202
209
203
210
@ Override
0 commit comments