forked from mirror/gorm
Merge pull request #583 from liudanking/master
fix panic in function databaseName()
This commit is contained in:
commit
3f18890ca4
|
@ -70,8 +70,8 @@ func (commonDialect) Quote(key string) string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (commonDialect) databaseName(scope *Scope) string {
|
func (commonDialect) databaseName(scope *Scope) string {
|
||||||
from := strings.Index(scope.db.parent.source, "/") + 1
|
from := strings.LastIndex(scope.db.parent.source, "/") + 1
|
||||||
to := strings.Index(scope.db.parent.source, "?")
|
to := strings.LastIndex(scope.db.parent.source, "?")
|
||||||
if to == -1 {
|
if to == -1 {
|
||||||
to = len(scope.db.parent.source)
|
to = len(scope.db.parent.source)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue