Skip to content
This repository was archived by the owner on Sep 7, 2021. It is now read-only.
This repository is currently being migrated. It's locked while the migration is in progress.

Commit 4b0ff8a

Browse files
BetaCat0lunny
authored andcommitted
remove QuoteStr() usage in dialects (#1364)
1 parent 9b08f94 commit 4b0ff8a

File tree

2 files changed

+185
-192
lines changed

2 files changed

+185
-192
lines changed

dialect_mssql.go

Lines changed: 185 additions & 185 deletions
Original file line numberDiff line numberDiff line change
@@ -16,191 +16,191 @@ import (
1616

1717
var (
1818
mssqlReservedWords = map[string]bool{
19-
"ADD": true,
20-
"EXTERNAL": true,
21-
"PROCEDURE": true,
22-
"ALL": true,
23-
"FETCH": true,
24-
"PUBLIC": true,
25-
"ALTER": true,
26-
"FILE": true,
27-
"RAISERROR": true,
28-
"AND": true,
29-
"FILLFACTOR": true,
30-
"READ": true,
31-
"ANY": true,
32-
"FOR": true,
33-
"READTEXT": true,
34-
"AS": true,
35-
"FOREIGN": true,
36-
"RECONFIGURE": true,
37-
"ASC": true,
38-
"FREETEXT": true,
39-
"REFERENCES": true,
40-
"AUTHORIZATION": true,
41-
"FREETEXTTABLE": true,
42-
"REPLICATION": true,
43-
"BACKUP": true,
44-
"FROM": true,
45-
"RESTORE": true,
46-
"BEGIN": true,
47-
"FULL": true,
48-
"RESTRICT": true,
49-
"BETWEEN": true,
50-
"FUNCTION": true,
51-
"RETURN": true,
52-
"BREAK": true,
53-
"GOTO": true,
54-
"REVERT": true,
55-
"BROWSE": true,
56-
"GRANT": true,
57-
"REVOKE": true,
58-
"BULK": true,
59-
"GROUP": true,
60-
"RIGHT": true,
61-
"BY": true,
62-
"HAVING": true,
63-
"ROLLBACK": true,
64-
"CASCADE": true,
65-
"HOLDLOCK": true,
66-
"ROWCOUNT": true,
67-
"CASE": true,
68-
"IDENTITY": true,
69-
"ROWGUIDCOL": true,
70-
"CHECK": true,
71-
"IDENTITY_INSERT": true,
72-
"RULE": true,
73-
"CHECKPOINT": true,
74-
"IDENTITYCOL": true,
75-
"SAVE": true,
76-
"CLOSE": true,
77-
"IF": true,
78-
"SCHEMA": true,
79-
"CLUSTERED": true,
80-
"IN": true,
81-
"SECURITYAUDIT": true,
82-
"COALESCE": true,
83-
"INDEX": true,
84-
"SELECT": true,
85-
"COLLATE": true,
86-
"INNER": true,
87-
"SEMANTICKEYPHRASETABLE": true,
88-
"COLUMN": true,
89-
"INSERT": true,
19+
"ADD": true,
20+
"EXTERNAL": true,
21+
"PROCEDURE": true,
22+
"ALL": true,
23+
"FETCH": true,
24+
"PUBLIC": true,
25+
"ALTER": true,
26+
"FILE": true,
27+
"RAISERROR": true,
28+
"AND": true,
29+
"FILLFACTOR": true,
30+
"READ": true,
31+
"ANY": true,
32+
"FOR": true,
33+
"READTEXT": true,
34+
"AS": true,
35+
"FOREIGN": true,
36+
"RECONFIGURE": true,
37+
"ASC": true,
38+
"FREETEXT": true,
39+
"REFERENCES": true,
40+
"AUTHORIZATION": true,
41+
"FREETEXTTABLE": true,
42+
"REPLICATION": true,
43+
"BACKUP": true,
44+
"FROM": true,
45+
"RESTORE": true,
46+
"BEGIN": true,
47+
"FULL": true,
48+
"RESTRICT": true,
49+
"BETWEEN": true,
50+
"FUNCTION": true,
51+
"RETURN": true,
52+
"BREAK": true,
53+
"GOTO": true,
54+
"REVERT": true,
55+
"BROWSE": true,
56+
"GRANT": true,
57+
"REVOKE": true,
58+
"BULK": true,
59+
"GROUP": true,
60+
"RIGHT": true,
61+
"BY": true,
62+
"HAVING": true,
63+
"ROLLBACK": true,
64+
"CASCADE": true,
65+
"HOLDLOCK": true,
66+
"ROWCOUNT": true,
67+
"CASE": true,
68+
"IDENTITY": true,
69+
"ROWGUIDCOL": true,
70+
"CHECK": true,
71+
"IDENTITY_INSERT": true,
72+
"RULE": true,
73+
"CHECKPOINT": true,
74+
"IDENTITYCOL": true,
75+
"SAVE": true,
76+
"CLOSE": true,
77+
"IF": true,
78+
"SCHEMA": true,
79+
"CLUSTERED": true,
80+
"IN": true,
81+
"SECURITYAUDIT": true,
82+
"COALESCE": true,
83+
"INDEX": true,
84+
"SELECT": true,
85+
"COLLATE": true,
86+
"INNER": true,
87+
"SEMANTICKEYPHRASETABLE": true,
88+
"COLUMN": true,
89+
"INSERT": true,
9090
"SEMANTICSIMILARITYDETAILSTABLE": true,
91-
"COMMIT": true,
92-
"INTERSECT": true,
93-
"SEMANTICSIMILARITYTABLE": true,
94-
"COMPUTE": true,
95-
"INTO": true,
96-
"SESSION_USER": true,
97-
"CONSTRAINT": true,
98-
"IS": true,
99-
"SET": true,
100-
"CONTAINS": true,
101-
"JOIN": true,
102-
"SETUSER": true,
103-
"CONTAINSTABLE": true,
104-
"KEY": true,
105-
"SHUTDOWN": true,
106-
"CONTINUE": true,
107-
"KILL": true,
108-
"SOME": true,
109-
"CONVERT": true,
110-
"LEFT": true,
111-
"STATISTICS": true,
112-
"CREATE": true,
113-
"LIKE": true,
114-
"SYSTEM_USER": true,
115-
"CROSS": true,
116-
"LINENO": true,
117-
"TABLE": true,
118-
"CURRENT": true,
119-
"LOAD": true,
120-
"TABLESAMPLE": true,
121-
"CURRENT_DATE": true,
122-
"MERGE": true,
123-
"TEXTSIZE": true,
124-
"CURRENT_TIME": true,
125-
"NATIONAL": true,
126-
"THEN": true,
127-
"CURRENT_TIMESTAMP": true,
128-
"NOCHECK": true,
129-
"TO": true,
130-
"CURRENT_USER": true,
131-
"NONCLUSTERED": true,
132-
"TOP": true,
133-
"CURSOR": true,
134-
"NOT": true,
135-
"TRAN": true,
136-
"DATABASE": true,
137-
"NULL": true,
138-
"TRANSACTION": true,
139-
"DBCC": true,
140-
"NULLIF": true,
141-
"TRIGGER": true,
142-
"DEALLOCATE": true,
143-
"OF": true,
144-
"TRUNCATE": true,
145-
"DECLARE": true,
146-
"OFF": true,
147-
"TRY_CONVERT": true,
148-
"DEFAULT": true,
149-
"OFFSETS": true,
150-
"TSEQUAL": true,
151-
"DELETE": true,
152-
"ON": true,
153-
"UNION": true,
154-
"DENY": true,
155-
"OPEN": true,
156-
"UNIQUE": true,
157-
"DESC": true,
158-
"OPENDATASOURCE": true,
159-
"UNPIVOT": true,
160-
"DISK": true,
161-
"OPENQUERY": true,
162-
"UPDATE": true,
163-
"DISTINCT": true,
164-
"OPENROWSET": true,
165-
"UPDATETEXT": true,
166-
"DISTRIBUTED": true,
167-
"OPENXML": true,
168-
"USE": true,
169-
"DOUBLE": true,
170-
"OPTION": true,
171-
"USER": true,
172-
"DROP": true,
173-
"OR": true,
174-
"VALUES": true,
175-
"DUMP": true,
176-
"ORDER": true,
177-
"VARYING": true,
178-
"ELSE": true,
179-
"OUTER": true,
180-
"VIEW": true,
181-
"END": true,
182-
"OVER": true,
183-
"WAITFOR": true,
184-
"ERRLVL": true,
185-
"PERCENT": true,
186-
"WHEN": true,
187-
"ESCAPE": true,
188-
"PIVOT": true,
189-
"WHERE": true,
190-
"EXCEPT": true,
191-
"PLAN": true,
192-
"WHILE": true,
193-
"EXEC": true,
194-
"PRECISION": true,
195-
"WITH": true,
196-
"EXECUTE": true,
197-
"PRIMARY": true,
198-
"WITHIN": true,
199-
"EXISTS": true,
200-
"PRINT": true,
201-
"WRITETEXT": true,
202-
"EXIT": true,
203-
"PROC": true,
91+
"COMMIT": true,
92+
"INTERSECT": true,
93+
"SEMANTICSIMILARITYTABLE": true,
94+
"COMPUTE": true,
95+
"INTO": true,
96+
"SESSION_USER": true,
97+
"CONSTRAINT": true,
98+
"IS": true,
99+
"SET": true,
100+
"CONTAINS": true,
101+
"JOIN": true,
102+
"SETUSER": true,
103+
"CONTAINSTABLE": true,
104+
"KEY": true,
105+
"SHUTDOWN": true,
106+
"CONTINUE": true,
107+
"KILL": true,
108+
"SOME": true,
109+
"CONVERT": true,
110+
"LEFT": true,
111+
"STATISTICS": true,
112+
"CREATE": true,
113+
"LIKE": true,
114+
"SYSTEM_USER": true,
115+
"CROSS": true,
116+
"LINENO": true,
117+
"TABLE": true,
118+
"CURRENT": true,
119+
"LOAD": true,
120+
"TABLESAMPLE": true,
121+
"CURRENT_DATE": true,
122+
"MERGE": true,
123+
"TEXTSIZE": true,
124+
"CURRENT_TIME": true,
125+
"NATIONAL": true,
126+
"THEN": true,
127+
"CURRENT_TIMESTAMP": true,
128+
"NOCHECK": true,
129+
"TO": true,
130+
"CURRENT_USER": true,
131+
"NONCLUSTERED": true,
132+
"TOP": true,
133+
"CURSOR": true,
134+
"NOT": true,
135+
"TRAN": true,
136+
"DATABASE": true,
137+
"NULL": true,
138+
"TRANSACTION": true,
139+
"DBCC": true,
140+
"NULLIF": true,
141+
"TRIGGER": true,
142+
"DEALLOCATE": true,
143+
"OF": true,
144+
"TRUNCATE": true,
145+
"DECLARE": true,
146+
"OFF": true,
147+
"TRY_CONVERT": true,
148+
"DEFAULT": true,
149+
"OFFSETS": true,
150+
"TSEQUAL": true,
151+
"DELETE": true,
152+
"ON": true,
153+
"UNION": true,
154+
"DENY": true,
155+
"OPEN": true,
156+
"UNIQUE": true,
157+
"DESC": true,
158+
"OPENDATASOURCE": true,
159+
"UNPIVOT": true,
160+
"DISK": true,
161+
"OPENQUERY": true,
162+
"UPDATE": true,
163+
"DISTINCT": true,
164+
"OPENROWSET": true,
165+
"UPDATETEXT": true,
166+
"DISTRIBUTED": true,
167+
"OPENXML": true,
168+
"USE": true,
169+
"DOUBLE": true,
170+
"OPTION": true,
171+
"USER": true,
172+
"DROP": true,
173+
"OR": true,
174+
"VALUES": true,
175+
"DUMP": true,
176+
"ORDER": true,
177+
"VARYING": true,
178+
"ELSE": true,
179+
"OUTER": true,
180+
"VIEW": true,
181+
"END": true,
182+
"OVER": true,
183+
"WAITFOR": true,
184+
"ERRLVL": true,
185+
"PERCENT": true,
186+
"WHEN": true,
187+
"ESCAPE": true,
188+
"PIVOT": true,
189+
"WHERE": true,
190+
"EXCEPT": true,
191+
"PLAN": true,
192+
"WHILE": true,
193+
"EXEC": true,
194+
"PRECISION": true,
195+
"WITH": true,
196+
"EXECUTE": true,
197+
"PRIMARY": true,
198+
"WITHIN": true,
199+
"EXISTS": true,
200+
"PRINT": true,
201+
"WRITETEXT": true,
202+
"EXIT": true,
203+
"PROC": true,
204204
}
205205
)
206206

@@ -507,7 +507,7 @@ func (db *mssql) CreateTableSql(table *core.Table, tableName, storeEngine, chars
507507

508508
sql = "IF NOT EXISTS (SELECT [name] FROM sys.tables WHERE [name] = '" + tableName + "' ) CREATE TABLE "
509509

510-
sql += db.QuoteStr() + tableName + db.QuoteStr() + " ("
510+
sql += db.Quote(tableName) + " ("
511511

512512
pkList := table.PrimaryKeys
513513

engine.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -175,13 +175,6 @@ func (engine *Engine) SupportInsertMany() bool {
175175
return engine.dialect.SupportInsertMany()
176176
}
177177

178-
// QuoteStr Engine's database use which character as quote.
179-
// mysql, sqlite use ` and postgres use "
180-
// Deprecated, use Quote() instead
181-
func (engine *Engine) QuoteStr() string {
182-
return engine.dialect.QuoteStr()
183-
}
184-
185178
func (engine *Engine) quoteColumns(columnStr string) string {
186179
columns := strings.Split(columnStr, ",")
187180
for i := 0; i < len(columns); i++ {

0 commit comments

Comments
 (0)