@@ -362,17 +362,17 @@ public final class MySQLConnection: SQLDatabase, AdvancedSQLDatabase, @unchecked
362362 ///
363363 /// Note: MySQL requires the `CLIENT_MULTI_STATEMENTS` capability for this to work.
364364 /// The driver negotiates this automatically during handshake.
365- public func queryMulti( _ sql: String , _ binds: [ SQLValue ] = [ ] ) async throws -> [ [ SQLRow ] ] {
365+ public func queryMulti( _ sql: String , _ binds: [ SQLValue ] = [ ] ) async throws -> [ SQLResultSet ] {
366366 guard !isClosed else { throw SQLError . connectionClosed }
367367 let rendered = renderQuery ( sql, binds: binds)
368368 logger. debug ( " MySQL queryMulti: \( rendered) " )
369369 try await sendQuery ( rendered)
370370
371- var allSets : [ [ SQLRow ] ] = [ ]
371+ var allSets : [ SQLResultSet ] = [ ]
372372 // MySQL returns one result set at a time; the OK/EOF has a "more results" flag
373373 while true {
374374 let resultSet = try await readResultSetMulti ( )
375- allSets. append ( resultSet. rows )
375+ allSets. append ( resultSet. resultSet )
376376 if !resultSet. hasMore { break }
377377 }
378378 return allSets
@@ -599,7 +599,7 @@ public final class MySQLConnection: SQLDatabase, AdvancedSQLDatabase, @unchecked
599599 // MARK: - Wire helpers
600600
601601 private struct ResultSetChunk {
602- let rows : [ SQLRow ]
602+ let resultSet : SQLResultSet
603603 let hasMore : Bool
604604 }
605605
@@ -609,15 +609,15 @@ public final class MySQLConnection: SQLDatabase, AdvancedSQLDatabase, @unchecked
609609 let firstResponse = try MySQLResponse . decode ( packet: & firstPacket, capabilities: capabilities)
610610 switch firstResponse {
611611 case . ok( _, _, let status, _) :
612- return ResultSetChunk ( rows: [ ] , hasMore: status. contains ( . moreResultsExist) )
612+ return ResultSetChunk ( resultSet : SQLResultSet ( columns : [ ] , rows: [ ] ) , hasMore: status. contains ( . moreResultsExist) )
613613 case . err( let code, _, let message) :
614614 throw SQLError . serverError ( code: Int ( code) , message: message)
615615 case . data( var countPacket) :
616616 countPacket. moveReaderIndex ( forwardBy: 4 )
617617 let columnCount = countPacket. readLengthEncodedInt ( ) ?? 0
618618 return try await readColumnsMulti ( count: Int ( columnCount) )
619619 default :
620- return ResultSetChunk ( rows: [ ] , hasMore: false )
620+ return ResultSetChunk ( resultSet : SQLResultSet ( columns : [ ] , rows: [ ] ) , hasMore: false )
621621 }
622622 }
623623
@@ -655,7 +655,7 @@ public final class MySQLConnection: SQLDatabase, AdvancedSQLDatabase, @unchecked
655655 _ = pkt. readInteger ( endianness: . little) as UInt16 ? // warnings
656656 let statusRaw = pkt. readInteger ( endianness: . little) as UInt16 ? ?? 0
657657 let status = MySQLServerStatus ( rawValue: statusRaw)
658- return ResultSetChunk ( rows: rows, hasMore: status. contains ( . moreResultsExist) )
658+ return ResultSetChunk ( resultSet : SQLResultSet ( columns : sqlCols , rows: rows) , hasMore: status. contains ( . moreResultsExist) )
659659 }
660660 if firstByte == 0x00 && capabilities. contains ( . deprecateEOF) {
661661 // OK (deprecateEOF style)
@@ -664,7 +664,7 @@ public final class MySQLConnection: SQLDatabase, AdvancedSQLDatabase, @unchecked
664664 _ = pkt. readLengthEncodedInt ( ) // last insert id
665665 let statusRaw = pkt. readInteger ( endianness: . little) as UInt16 ? ?? 0
666666 let status = MySQLServerStatus ( rawValue: statusRaw)
667- return ResultSetChunk ( rows: rows, hasMore: status. contains ( . moreResultsExist) )
667+ return ResultSetChunk ( resultSet : SQLResultSet ( columns : sqlCols , rows: rows) , hasMore: status. contains ( . moreResultsExist) )
668668 }
669669
670670 // Data row
@@ -683,7 +683,7 @@ public final class MySQLConnection: SQLDatabase, AdvancedSQLDatabase, @unchecked
683683 }
684684 rows. append ( SQLRow ( columns: sqlCols, values: values) )
685685 }
686- return ResultSetChunk ( rows: rows, hasMore: false )
686+ return ResultSetChunk ( resultSet : SQLResultSet ( columns : sqlCols , rows: rows) , hasMore: false )
687687 }
688688
689689 private func send( _ buffer: ByteBuffer ) {
0 commit comments