Skip to content

Commit 8a41bfa

Browse files
顾鲍尔顾鲍尔
authored andcommitted
# Compatible with Java specification
1 parent f43a881 commit 8a41bfa

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

src/main/java/com/boylegu/springboot_vue/config/SQLiteDialect.java

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,34 +9,60 @@
99
import org.hibernate.type.StringType;
1010

1111
public class SQLiteDialect extends Dialect {
12+
1213
public SQLiteDialect() {
14+
1315
registerColumnType(Types.BIT, "integer");
16+
1417
registerColumnType(Types.TINYINT, "tinyint");
18+
1519
registerColumnType(Types.SMALLINT, "smallint");
20+
1621
registerColumnType(Types.INTEGER, "integer");
22+
1723
registerColumnType(Types.BIGINT, "bigint");
24+
1825
registerColumnType(Types.FLOAT, "float");
26+
1927
registerColumnType(Types.REAL, "real");
28+
2029
registerColumnType(Types.DOUBLE, "double");
30+
2131
registerColumnType(Types.NUMERIC, "numeric");
32+
2233
registerColumnType(Types.DECIMAL, "decimal");
34+
2335
registerColumnType(Types.CHAR, "char");
36+
2437
registerColumnType(Types.VARCHAR, "varchar");
38+
2539
registerColumnType(Types.LONGVARCHAR, "longvarchar");
40+
2641
registerColumnType(Types.DATE, "date");
42+
2743
registerColumnType(Types.TIME, "time");
44+
2845
registerColumnType(Types.TIMESTAMP, "timestamp");
46+
2947
registerColumnType(Types.BINARY, "blob");
48+
3049
registerColumnType(Types.VARBINARY, "blob");
50+
3151
registerColumnType(Types.LONGVARBINARY, "blob");
52+
3253
// registerColumnType(Types.NULL, "null");
3354
registerColumnType(Types.BLOB, "blob");
55+
3456
registerColumnType(Types.CLOB, "clob");
57+
3558
registerColumnType(Types.BOOLEAN, "integer");
3659

3760
registerFunction("concat", new VarArgsSQLFunction(StringType.INSTANCE, "", "||", ""));
61+
3862
registerFunction("mod", new SQLFunctionTemplate(StringType.INSTANCE, "?1 % ?2"));
63+
3964
registerFunction("substr", new StandardSQLFunction("substr", StringType.INSTANCE));
65+
4066
registerFunction("substring", new StandardSQLFunction("substr", StringType.INSTANCE));
4167
}
4268

@@ -77,6 +103,7 @@ public boolean supportsLimit() {
77103
}
78104

79105
protected String getLimitString(String query, boolean hasOffset) {
106+
80107
return new StringBuffer(query.length() + 20).
81108
append(query).
82109
append(hasOffset ? " limit ? offset ?" : " limit ?").
@@ -132,7 +159,9 @@ public boolean supportsOuterJoinForUpdate() {
132159
}
133160

134161
public String getDropForeignKeyString() {
162+
135163
throw new UnsupportedOperationException("No drop foreign key syntax supported by SQLiteDialect");
164+
136165
}
137166

138167
public String getAddForeignKeyConstraintString(String constraintName,
@@ -142,7 +171,9 @@ public String getAddForeignKeyConstraintString(String constraintName,
142171
}
143172

144173
public String getAddPrimaryKeyConstraintString(String constraintName) {
174+
145175
throw new UnsupportedOperationException("No add primary key syntax supported by SQLiteDialect");
176+
146177
}
147178

148179
public boolean supportsIfExistsBeforeTableName() {

0 commit comments

Comments
 (0)