Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates from feenk #51

Merged
merged 3 commits into from
Mar 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 29 additions & 11 deletions P3/P3Client.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -142,14 +142,22 @@ P3Client >> clearTextPasswordMessage [
P3Client >> close [
"Cleanly close my connection with the server"

connection
ifNotNil: [
[
self logDisconnecting.
self writeMessage: #[] tag: $X.
connection close ] on: Error do: [ ].
self clearSession.
connection := nil ]
connection ifNotNil: [
[
self writeMessage: #[] tag: $X.
connection close ] on: Error do: [ ].
self clearSession.
connection := nil.
self logDisconnected ]
]

{ #category : #accessing }
P3Client >> compactUrl [
^ self url
scheme: #psql;
password: nil;
queryRemoveAll;
yourself
]

{ #category : #public }
Expand Down Expand Up @@ -514,7 +522,7 @@ P3Client >> logConnected [
]

{ #category : #'private - logging' }
P3Client >> logDisconnecting [
P3Client >> logDisconnected [
(self newLogEvent: P3ConnectionClosedEvent)
emit
]
Expand Down Expand Up @@ -720,11 +728,16 @@ P3Client >> preparedStatementNamed: name [
P3Client >> printOn: stream [
super printOn: stream.
stream nextPut: $(.
stream print: self url.
self session ifNotNil: [ stream space; print: session ].
self printStateOn: stream.
stream nextPut: $)
]

{ #category : #printing }
P3Client >> printStateOn: stream [
stream print: self compactUrl.
self session ifNotNil: [ stream space; print: session ]
]

{ #category : #private }
P3Client >> processBackendKeyData: payload [
session := payload uint32.
Expand Down Expand Up @@ -1104,6 +1117,11 @@ P3Client >> startupOptions: optionsString [
settings at: #options put: optionsString
]

{ #category : #printing }
P3Client >> statePrintString [
^ String streamContents: [ :out | self printStateOn: out ]
]

{ #category : #accessing }
P3Client >> timeout [
"Return the timeout in seconds I (want to) use, the default being 10 seconds."
Expand Down
Loading