Skip to content

Commit

Permalink
Review Login>>#databaseName
Browse files Browse the repository at this point in the history
Fix #131
  • Loading branch information
astares committed Jul 15, 2023
1 parent d785083 commit 62298c4
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions src/Glorp/Login.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -76,19 +76,16 @@ Login >> database: aDatabasePlatform [
Login >> databaseName [
"connect string looks like hostname:portNumber_db-name.
:portNumber is optional"

| str portIndex index dbIndex |

databaseName == nil
ifFalse: [^ databaseName].
databaseName == nil
ifTrue: [str := self connectString.
portIndex := index := str indexOf: $:.
dbIndex := str indexOf: $_.
index = 0
ifTrue: [index := dbIndex].
databaseName := str copyFrom: dbIndex + 1 to: str size.
^ databaseName]
databaseName ifNotNil: [ ^ databaseName ].

str := self connectString.
portIndex := index := str indexOf: $:.
dbIndex := str indexOf: $_.
index = 0 ifTrue: [ index := dbIndex ].
databaseName := str copyFrom: dbIndex + 1 to: str size.
^ databaseName
]

{ #category : #accessing }
Expand Down

0 comments on commit 62298c4

Please sign in to comment.