fix panic in function databaseName when there are special characters in password, such as '?', '/'

This commit is contained in:
liudan 2015-07-28 16:33:32 +08:00
parent 82d726bbfd
commit 2fe185eb77
1 changed files with 2 additions and 2 deletions

View File

@ -70,8 +70,8 @@ func (commonDialect) Quote(key string) string {
}
func (commonDialect) databaseName(scope *Scope) string {
from := strings.Index(scope.db.parent.source, "/") + 1
to := strings.Index(scope.db.parent.source, "?")
from := strings.LastIndex(scope.db.parent.source, "/") + 1
to := strings.LastIndex(scope.db.parent.source, "?")
if to == -1 {
to = len(scope.db.parent.source)
}