Bläddra i källkod

remove QuoteStr() usage in dialects

xormplus 6 år sedan
förälder
incheckning
2b5a282cc0
3 ändrade filer med 186 tillägg och 193 borttagningar
  1. 185 185
      dialect_mssql.go
  2. 0 7
      engine.go
  3. 1 1
      xorm.go

+ 185 - 185
dialect_mssql.go

@@ -16,191 +16,191 @@ import (
 
 var (
 	mssqlReservedWords = map[string]bool{
-		"ADD":                    true,
-		"EXTERNAL":               true,
-		"PROCEDURE":              true,
-		"ALL":                    true,
-		"FETCH":                  true,
-		"PUBLIC":                 true,
-		"ALTER":                  true,
-		"FILE":                   true,
-		"RAISERROR":              true,
-		"AND":                    true,
-		"FILLFACTOR":             true,
-		"READ":                   true,
-		"ANY":                    true,
-		"FOR":                    true,
-		"READTEXT":               true,
-		"AS":                     true,
-		"FOREIGN":                true,
-		"RECONFIGURE":            true,
-		"ASC":                    true,
-		"FREETEXT":               true,
-		"REFERENCES":             true,
-		"AUTHORIZATION":          true,
-		"FREETEXTTABLE":          true,
-		"REPLICATION":            true,
-		"BACKUP":                 true,
-		"FROM":                   true,
-		"RESTORE":                true,
-		"BEGIN":                  true,
-		"FULL":                   true,
-		"RESTRICT":               true,
-		"BETWEEN":                true,
-		"FUNCTION":               true,
-		"RETURN":                 true,
-		"BREAK":                  true,
-		"GOTO":                   true,
-		"REVERT":                 true,
-		"BROWSE":                 true,
-		"GRANT":                  true,
-		"REVOKE":                 true,
-		"BULK":                   true,
-		"GROUP":                  true,
-		"RIGHT":                  true,
-		"BY":                     true,
-		"HAVING":                 true,
-		"ROLLBACK":               true,
-		"CASCADE":                true,
-		"HOLDLOCK":               true,
-		"ROWCOUNT":               true,
-		"CASE":                   true,
-		"IDENTITY":               true,
-		"ROWGUIDCOL":             true,
-		"CHECK":                  true,
-		"IDENTITY_INSERT":        true,
-		"RULE":                   true,
-		"CHECKPOINT":             true,
-		"IDENTITYCOL":            true,
-		"SAVE":                   true,
-		"CLOSE":                  true,
-		"IF":                     true,
-		"SCHEMA":                 true,
-		"CLUSTERED":              true,
-		"IN":                     true,
-		"SECURITYAUDIT":          true,
-		"COALESCE":               true,
-		"INDEX":                  true,
-		"SELECT":                 true,
-		"COLLATE":                true,
-		"INNER":                  true,
-		"SEMANTICKEYPHRASETABLE": true,
-		"COLUMN":                 true,
-		"INSERT":                 true,
+		"ADD":                            true,
+		"EXTERNAL":                       true,
+		"PROCEDURE":                      true,
+		"ALL":                            true,
+		"FETCH":                          true,
+		"PUBLIC":                         true,
+		"ALTER":                          true,
+		"FILE":                           true,
+		"RAISERROR":                      true,
+		"AND":                            true,
+		"FILLFACTOR":                     true,
+		"READ":                           true,
+		"ANY":                            true,
+		"FOR":                            true,
+		"READTEXT":                       true,
+		"AS":                             true,
+		"FOREIGN":                        true,
+		"RECONFIGURE":                    true,
+		"ASC":                            true,
+		"FREETEXT":                       true,
+		"REFERENCES":                     true,
+		"AUTHORIZATION":                  true,
+		"FREETEXTTABLE":                  true,
+		"REPLICATION":                    true,
+		"BACKUP":                         true,
+		"FROM":                           true,
+		"RESTORE":                        true,
+		"BEGIN":                          true,
+		"FULL":                           true,
+		"RESTRICT":                       true,
+		"BETWEEN":                        true,
+		"FUNCTION":                       true,
+		"RETURN":                         true,
+		"BREAK":                          true,
+		"GOTO":                           true,
+		"REVERT":                         true,
+		"BROWSE":                         true,
+		"GRANT":                          true,
+		"REVOKE":                         true,
+		"BULK":                           true,
+		"GROUP":                          true,
+		"RIGHT":                          true,
+		"BY":                             true,
+		"HAVING":                         true,
+		"ROLLBACK":                       true,
+		"CASCADE":                        true,
+		"HOLDLOCK":                       true,
+		"ROWCOUNT":                       true,
+		"CASE":                           true,
+		"IDENTITY":                       true,
+		"ROWGUIDCOL":                     true,
+		"CHECK":                          true,
+		"IDENTITY_INSERT":                true,
+		"RULE":                           true,
+		"CHECKPOINT":                     true,
+		"IDENTITYCOL":                    true,
+		"SAVE":                           true,
+		"CLOSE":                          true,
+		"IF":                             true,
+		"SCHEMA":                         true,
+		"CLUSTERED":                      true,
+		"IN":                             true,
+		"SECURITYAUDIT":                  true,
+		"COALESCE":                       true,
+		"INDEX":                          true,
+		"SELECT":                         true,
+		"COLLATE":                        true,
+		"INNER":                          true,
+		"SEMANTICKEYPHRASETABLE":         true,
+		"COLUMN":                         true,
+		"INSERT":                         true,
 		"SEMANTICSIMILARITYDETAILSTABLE": true,
-		"COMMIT":                  true,
-		"INTERSECT":               true,
-		"SEMANTICSIMILARITYTABLE": true,
-		"COMPUTE":                 true,
-		"INTO":                    true,
-		"SESSION_USER":            true,
-		"CONSTRAINT":              true,
-		"IS":                      true,
-		"SET":                     true,
-		"CONTAINS":                true,
-		"JOIN":                    true,
-		"SETUSER":                 true,
-		"CONTAINSTABLE":           true,
-		"KEY":                     true,
-		"SHUTDOWN":                true,
-		"CONTINUE":                true,
-		"KILL":                    true,
-		"SOME":                    true,
-		"CONVERT":                 true,
-		"LEFT":                    true,
-		"STATISTICS":              true,
-		"CREATE":                  true,
-		"LIKE":                    true,
-		"SYSTEM_USER":             true,
-		"CROSS":                   true,
-		"LINENO":                  true,
-		"TABLE":                   true,
-		"CURRENT":                 true,
-		"LOAD":                    true,
-		"TABLESAMPLE":             true,
-		"CURRENT_DATE":            true,
-		"MERGE":                   true,
-		"TEXTSIZE":                true,
-		"CURRENT_TIME":            true,
-		"NATIONAL":                true,
-		"THEN":                    true,
-		"CURRENT_TIMESTAMP":       true,
-		"NOCHECK":                 true,
-		"TO":                      true,
-		"CURRENT_USER":            true,
-		"NONCLUSTERED":            true,
-		"TOP":                     true,
-		"CURSOR":                  true,
-		"NOT":                     true,
-		"TRAN":                    true,
-		"DATABASE":                true,
-		"NULL":                    true,
-		"TRANSACTION":             true,
-		"DBCC":                    true,
-		"NULLIF":                  true,
-		"TRIGGER":                 true,
-		"DEALLOCATE":              true,
-		"OF":                      true,
-		"TRUNCATE":                true,
-		"DECLARE":                 true,
-		"OFF":                     true,
-		"TRY_CONVERT":             true,
-		"DEFAULT":                 true,
-		"OFFSETS":                 true,
-		"TSEQUAL":                 true,
-		"DELETE":                  true,
-		"ON":                      true,
-		"UNION":                   true,
-		"DENY":                    true,
-		"OPEN":                    true,
-		"UNIQUE":                  true,
-		"DESC":                    true,
-		"OPENDATASOURCE":          true,
-		"UNPIVOT":                 true,
-		"DISK":                    true,
-		"OPENQUERY":               true,
-		"UPDATE":                  true,
-		"DISTINCT":                true,
-		"OPENROWSET":              true,
-		"UPDATETEXT":              true,
-		"DISTRIBUTED":             true,
-		"OPENXML":                 true,
-		"USE":                     true,
-		"DOUBLE":                  true,
-		"OPTION":                  true,
-		"USER":                    true,
-		"DROP":                    true,
-		"OR":                      true,
-		"VALUES":                  true,
-		"DUMP":                    true,
-		"ORDER":                   true,
-		"VARYING":                 true,
-		"ELSE":                    true,
-		"OUTER":                   true,
-		"VIEW":                    true,
-		"END":                     true,
-		"OVER":                    true,
-		"WAITFOR":                 true,
-		"ERRLVL":                  true,
-		"PERCENT":                 true,
-		"WHEN":                    true,
-		"ESCAPE":                  true,
-		"PIVOT":                   true,
-		"WHERE":                   true,
-		"EXCEPT":                  true,
-		"PLAN":                    true,
-		"WHILE":                   true,
-		"EXEC":                    true,
-		"PRECISION":               true,
-		"WITH":                    true,
-		"EXECUTE":                 true,
-		"PRIMARY":                 true,
-		"WITHIN":                  true,
-		"EXISTS":                  true,
-		"PRINT":                   true,
-		"WRITETEXT":               true,
-		"EXIT":                    true,
-		"PROC":                    true,
+		"COMMIT":                         true,
+		"INTERSECT":                      true,
+		"SEMANTICSIMILARITYTABLE":        true,
+		"COMPUTE":                        true,
+		"INTO":                           true,
+		"SESSION_USER":                   true,
+		"CONSTRAINT":                     true,
+		"IS":                             true,
+		"SET":                            true,
+		"CONTAINS":                       true,
+		"JOIN":                           true,
+		"SETUSER":                        true,
+		"CONTAINSTABLE":                  true,
+		"KEY":                            true,
+		"SHUTDOWN":                       true,
+		"CONTINUE":                       true,
+		"KILL":                           true,
+		"SOME":                           true,
+		"CONVERT":                        true,
+		"LEFT":                           true,
+		"STATISTICS":                     true,
+		"CREATE":                         true,
+		"LIKE":                           true,
+		"SYSTEM_USER":                    true,
+		"CROSS":                          true,
+		"LINENO":                         true,
+		"TABLE":                          true,
+		"CURRENT":                        true,
+		"LOAD":                           true,
+		"TABLESAMPLE":                    true,
+		"CURRENT_DATE":                   true,
+		"MERGE":                          true,
+		"TEXTSIZE":                       true,
+		"CURRENT_TIME":                   true,
+		"NATIONAL":                       true,
+		"THEN":                           true,
+		"CURRENT_TIMESTAMP":              true,
+		"NOCHECK":                        true,
+		"TO":                             true,
+		"CURRENT_USER":                   true,
+		"NONCLUSTERED":                   true,
+		"TOP":                            true,
+		"CURSOR":                         true,
+		"NOT":                            true,
+		"TRAN":                           true,
+		"DATABASE":                       true,
+		"NULL":                           true,
+		"TRANSACTION":                    true,
+		"DBCC":                           true,
+		"NULLIF":                         true,
+		"TRIGGER":                        true,
+		"DEALLOCATE":                     true,
+		"OF":                             true,
+		"TRUNCATE":                       true,
+		"DECLARE":                        true,
+		"OFF":                            true,
+		"TRY_CONVERT":                    true,
+		"DEFAULT":                        true,
+		"OFFSETS":                        true,
+		"TSEQUAL":                        true,
+		"DELETE":                         true,
+		"ON":                             true,
+		"UNION":                          true,
+		"DENY":                           true,
+		"OPEN":                           true,
+		"UNIQUE":                         true,
+		"DESC":                           true,
+		"OPENDATASOURCE":                 true,
+		"UNPIVOT":                        true,
+		"DISK":                           true,
+		"OPENQUERY":                      true,
+		"UPDATE":                         true,
+		"DISTINCT":                       true,
+		"OPENROWSET":                     true,
+		"UPDATETEXT":                     true,
+		"DISTRIBUTED":                    true,
+		"OPENXML":                        true,
+		"USE":                            true,
+		"DOUBLE":                         true,
+		"OPTION":                         true,
+		"USER":                           true,
+		"DROP":                           true,
+		"OR":                             true,
+		"VALUES":                         true,
+		"DUMP":                           true,
+		"ORDER":                          true,
+		"VARYING":                        true,
+		"ELSE":                           true,
+		"OUTER":                          true,
+		"VIEW":                           true,
+		"END":                            true,
+		"OVER":                           true,
+		"WAITFOR":                        true,
+		"ERRLVL":                         true,
+		"PERCENT":                        true,
+		"WHEN":                           true,
+		"ESCAPE":                         true,
+		"PIVOT":                          true,
+		"WHERE":                          true,
+		"EXCEPT":                         true,
+		"PLAN":                           true,
+		"WHILE":                          true,
+		"EXEC":                           true,
+		"PRECISION":                      true,
+		"WITH":                           true,
+		"EXECUTE":                        true,
+		"PRIMARY":                        true,
+		"WITHIN":                         true,
+		"EXISTS":                         true,
+		"PRINT":                          true,
+		"WRITETEXT":                      true,
+		"EXIT":                           true,
+		"PROC":                           true,
 	}
 )
 
@@ -507,7 +507,7 @@ func (db *mssql) CreateTableSql(table *core.Table, tableName, storeEngine, chars
 
 	sql = "IF NOT EXISTS (SELECT [name] FROM sys.tables WHERE [name] = '" + tableName + "' ) CREATE TABLE "
 
-	sql += db.QuoteStr() + tableName + db.QuoteStr() + " ("
+	sql += db.Quote(tableName) + " ("
 
 	pkList := table.PrimaryKeys
 

+ 0 - 7
engine.go

@@ -178,13 +178,6 @@ func (engine *Engine) SupportInsertMany() bool {
 	return engine.dialect.SupportInsertMany()
 }
 
-// QuoteStr Engine's database use which character as quote.
-// mysql, sqlite use ` and postgres use "
-// Deprecated, use Quote() instead
-func (engine *Engine) QuoteStr() string {
-	return engine.dialect.QuoteStr()
-}
-
 func (engine *Engine) quoteColumns(columnStr string) string {
 	columns := strings.Split(columnStr, ",")
 	for i := 0; i < len(columns); i++ {

+ 1 - 1
xorm.go

@@ -20,7 +20,7 @@ import (
 
 const (
 	// Version show the xorm's version
-	Version string = "0.7.0.1103"
+	Version string = "0.7.4.0724"
 )
 
 func regDrvsNDialects() bool {