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 b757473

Browse files
BetaCat0lunny
authored andcommitted
Remove quotestr totally (#1366)
* remove QuoteStr() totally * update xorm.core -> v0.7.0 * update dialect Quote
1 parent 4b0ff8a commit b757473

File tree

6 files changed

+896
-920
lines changed

6 files changed

+896
-920
lines changed

dialect_mssql.go

Lines changed: 0 additions & 4 deletions
Original file line numberOriginal file lineDiff line numberDiff line change
@@ -286,10 +286,6 @@ func (db *mssql) Quote(name string) string {
286
return "\"" + name + "\""
286
return "\"" + name + "\""
287
}
287
}
288

288

289-
func (db *mssql) QuoteStr() string {
290-
return "\""
291-
}
292-
293
func (db *mssql) SupportEngine() bool {
289
func (db *mssql) SupportEngine() bool {
294
return false
290
return false
295
}
291
}

dialect_mysql.go

Lines changed: 6 additions & 12 deletions
Original file line numberOriginal file lineDiff line numberDiff line change
@@ -220,7 +220,7 @@ func (db *mysql) SqlType(c *core.Column) string {
220
case core.TimeStampz:
220
case core.TimeStampz:
221
res = core.Char
221
res = core.Char
222
c.Length = 64
222
c.Length = 64
223-
case core.Enum: //mysql enum
223+
case core.Enum: // mysql enum
224
res = core.Enum
224
res = core.Enum
225
res += "("
225
res += "("
226
opts := ""
226
opts := ""
@@ -229,7 +229,7 @@ func (db *mysql) SqlType(c *core.Column) string {
229
}
229
}
230
res += strings.TrimLeft(opts, ",")
230
res += strings.TrimLeft(opts, ",")
231
res += ")"
231
res += ")"
232-
case core.Set: //mysql set
232+
case core.Set: // mysql set
233
res = core.Set
233
res = core.Set
234
res += "("
234
res += "("
235
opts := ""
235
opts := ""
@@ -278,10 +278,6 @@ func (db *mysql) Quote(name string) string {
278
return "`" + name + "`"
278
return "`" + name + "`"
279
}
279
}
280

280

281-
func (db *mysql) QuoteStr() string {
282-
return "`"
283-
}
284-
285
func (db *mysql) SupportEngine() bool {
281
func (db *mysql) SupportEngine() bool {
286
return true
282
return true
287
}
283
}
@@ -360,7 +356,7 @@ func (db *mysql) GetColumns(tableName string) ([]string, map[string]*core.Column
360
var len1, len2 int
356
var len1, len2 int
361
if len(cts) == 2 {
357
if len(cts) == 2 {
362
idx := strings.Index(cts[1], ")")
358
idx := strings.Index(cts[1], ")")
363-
if colType == core.Enum && cts[1][0] == '\'' { //enum
359+
if colType == core.Enum && cts[1][0] == '\'' { // enum
364
options := strings.Split(cts[1][0:idx], ",")
360
options := strings.Split(cts[1][0:idx], ",")
365
col.EnumOptions = make(map[string]int)
361
col.EnumOptions = make(map[string]int)
366
for k, v := range options {
362
for k, v := range options {
@@ -408,7 +404,7 @@ func (db *mysql) GetColumns(tableName string) ([]string, map[string]*core.Column
408
col.IsPrimaryKey = true
404
col.IsPrimaryKey = true
409
}
405
}
410
if colKey == "UNI" {
406
if colKey == "UNI" {
411-
//col.is
407+
// col.is
412
}
408
}
413

409

414
if extra == "auto_increment" {
410
if extra == "auto_increment" {
@@ -554,12 +550,10 @@ func (db *mysql) CreateTableSql(table *core.Table, tableName, storeEngine, chars
554

550

555
if len(charset) == 0 {
551
if len(charset) == 0 {
556
charset = db.URI().Charset
552
charset = db.URI().Charset
557-
}
553+
}
558
if len(charset) != 0 {
554
if len(charset) != 0 {
559
sql += " DEFAULT CHARSET " + charset
555
sql += " DEFAULT CHARSET " + charset
560
}
556
}
561-
562-
563

557

564
if db.rowFormat != "" {
558
if db.rowFormat != "" {
565
sql += " ROW_FORMAT=" + db.rowFormat
559
sql += " ROW_FORMAT=" + db.rowFormat
@@ -633,7 +627,7 @@ func (p *mysqlDriver) Parse(driverName, dataSourceName string) (*core.Uri, error
633
`\/(?P<dbname>.*?)` + // /dbname
627
`\/(?P<dbname>.*?)` + // /dbname
634
`(?:\?(?P<params>[^\?]*))?$`) // [?param1=value1&paramN=valueN]
628
`(?:\?(?P<params>[^\?]*))?$`) // [?param1=value1&paramN=valueN]
635
matches := dsnPattern.FindStringSubmatch(dataSourceName)
629
matches := dsnPattern.FindStringSubmatch(dataSourceName)
636-
//tlsConfigRegister := make(map[string]*tls.Config)
630+
// tlsConfigRegister := make(map[string]*tls.Config)
637
names := dsnPattern.SubexpNames()
631
names := dsnPattern.SubexpNames()
638

632

639
uri := &core.Uri{DbType: core.MYSQL}
633
uri := &core.Uri{DbType: core.MYSQL}

0 commit comments

Comments
 (0)