From ed565300332631c82471c8c4adeff3ced23d1d41 Mon Sep 17 00:00:00 2001 From: Wei Yen Lee Date: Tue, 1 Oct 2024 20:38:43 +1000 Subject: [PATCH] Always use text format for results --- Sources/PostgresNIO/Data/PostgresData+Array.swift | 4 ++-- Sources/PostgresNIO/Data/PostgresData.swift | 2 +- .../Connection State Machine/ExtendedQueryStateMachine.swift | 4 ++-- .../PreparedStatementStateMachine.swift | 2 +- Sources/PostgresNIO/New/PostgresFrontendMessageEncoder.swift | 2 +- Sources/PostgresNIO/New/PostgresQuery.swift | 4 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Sources/PostgresNIO/Data/PostgresData+Array.swift b/Sources/PostgresNIO/Data/PostgresData+Array.swift index 5d648db6..91ef5dff 100644 --- a/Sources/PostgresNIO/Data/PostgresData+Array.swift +++ b/Sources/PostgresNIO/Data/PostgresData+Array.swift @@ -41,7 +41,7 @@ extension PostgresData { self.init( type: arrayType, typeModifier: nil, - formatCode: .binary, + formatCode: .text, value: buffer ) } @@ -63,7 +63,7 @@ extension PostgresData { } public var array: [PostgresData]? { - guard case .binary = self.formatCode else { + guard case .text = self.formatCode else { return nil } guard var value = self.value else { diff --git a/Sources/PostgresNIO/Data/PostgresData.swift b/Sources/PostgresNIO/Data/PostgresData.swift index d0be48eb..e7793630 100644 --- a/Sources/PostgresNIO/Data/PostgresData.swift +++ b/Sources/PostgresNIO/Data/PostgresData.swift @@ -20,7 +20,7 @@ public struct PostgresData: Sendable { public var value: ByteBuffer? - public init(type: PostgresDataType, typeModifier: Int32? = nil, formatCode: PostgresFormat = .binary, value: ByteBuffer? = nil) { + public init(type: PostgresDataType, typeModifier: Int32? = nil, formatCode: PostgresFormat = .text, value: ByteBuffer? = nil) { self.type = type self.typeModifier = typeModifier self.formatCode = formatCode diff --git a/Sources/PostgresNIO/New/Connection State Machine/ExtendedQueryStateMachine.swift b/Sources/PostgresNIO/New/Connection State Machine/ExtendedQueryStateMachine.swift index 087a6c24..abf53995 100644 --- a/Sources/PostgresNIO/New/Connection State Machine/ExtendedQueryStateMachine.swift +++ b/Sources/PostgresNIO/New/Connection State Machine/ExtendedQueryStateMachine.swift @@ -186,10 +186,10 @@ struct ExtendedQueryStateMachine { // In the actual protocol description we receive a rowDescription before the Bind // In Postgres extended queries we always request the response rows to be returned in - // `.binary` format. + // `.text` format. let columns = rowDescription.columns.map { column -> RowDescription.Column in var column = column - column.format = .binary + column.format = .text return column } diff --git a/Sources/PostgresNIO/New/Connection State Machine/PreparedStatementStateMachine.swift b/Sources/PostgresNIO/New/Connection State Machine/PreparedStatementStateMachine.swift index 5afa4d0b..6e353a2c 100644 --- a/Sources/PostgresNIO/New/Connection State Machine/PreparedStatementStateMachine.swift +++ b/Sources/PostgresNIO/New/Connection State Machine/PreparedStatementStateMachine.swift @@ -51,7 +51,7 @@ struct PreparedStatementStateMachine { // When sending the bindings we are going to ask for binary data. if var rowDescription = rowDescription { for i in 0..