-
-
Notifications
You must be signed in to change notification settings - Fork 80
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
Handle EmptyQueryResponse
#500
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -123,6 +123,25 @@ final class IntegrationTests: XCTestCase { | |
XCTAssertEqual(foo, "hello") | ||
} | ||
|
||
func testQueryNothing() throws { | ||
let eventLoopGroup = MultiThreadedEventLoopGroup(numberOfThreads: 1) | ||
defer { XCTAssertNoThrow(try eventLoopGroup.syncShutdownGracefully()) } | ||
let eventLoop = eventLoopGroup.next() | ||
|
||
var conn: PostgresConnection? | ||
XCTAssertNoThrow(conn = try PostgresConnection.test(on: eventLoop).wait()) | ||
defer { XCTAssertNoThrow(try conn?.close().wait()) } | ||
|
||
var _result: PostgresQueryResult? | ||
XCTAssertNoThrow(_result = try conn?.query(""" | ||
-- Some comments | ||
""", logger: .psqlTest).wait()) | ||
|
||
let result = try XCTUnwrap(_result) | ||
XCTAssertEqual(result.rows, []) | ||
XCTAssertEqual(result.metadata.command, "") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. command tag will be empty. Maybe that API should change in V2 to reflect that a query can have no command tag / metadata at all. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please add an issue for this. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
} | ||
|
||
func testDecodeIntegers() { | ||
let eventLoopGroup = MultiThreadedEventLoopGroup(numberOfThreads: 1) | ||
defer { XCTAssertNoThrow(try eventLoopGroup.syncShutdownGracefully()) } | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So it also parses empty command tags.