lidavidm commented on code in PR #3871:
URL: https://github.com/apache/arrow-adbc/pull/3871#discussion_r2710591006


##########
c/include/arrow-adbc/adbc.h:
##########
@@ -973,6 +991,95 @@ struct AdbcPartitions {
 
 /// @}
 
+/// \defgroup adbc-statement-multi Multiple Result Set Execution
+/// Some databases support executing a statement that returns multiple
+/// result sets.  This section defines the API for working with such
+/// statements and result sets.
+/// @{
+
+/// \brief A struct for handling a potentially multi-result set execution
+///
+/// This struct is populated by AdbcStatementExecuteMulti and can be used to 
iterate
+/// through the result sets of the execution.  The caller can use the 
NextResultSet or
+/// NextResultSetPartitions functions on the AdbcResultSet struct to iterate 
through the
+/// result sets.  The caller is responsible for calling the release function 
when finished
+/// with the result set.
+///
+/// \since ADBC API revision 1.2.0
+struct ADBC_EXPORT AdbcResultSet {
+  /// \brief opaque implementation-defined state
+  void* private_data;
+
+  /// \brief Release the result set and any associated resources.
+  void (*release)(struct AdbcResultSet* result_set);
+
+  /// \brief Get the next result set from a multi-result-set execution.
+  ///
+  /// The AdbcResultSet must outlive the returned ArrowArrayStream.
+  ///
+  /// The driver can decide whether to allow fetching the next result set
+  /// as a single stream or as a set of partitions.  If the driver does not
+  /// support fetching the next result set as a stream (indicating it should
+  /// be fetched as partitions), it should return ADBC_STATUS_NOT_IMPLEMENTED.
+  ///
+  /// To indicate that no additional result sets are available, this should 
return
+  /// ADBC_STATUS_OK and set the release callback on out to NULL. The expected
+  /// pattern is that after calling `StatementExecuteMulti`, the caller would
+  /// then call `NextResultSet` repeatedly until it returns ADBC_STATUS_OK and
+  /// sets the release callback to NULL, indicating that there are no more 
result sets.
+  /// It is not an error to repeatedly call `NextResultSet` after the last 
result set
+  /// has been reached; it should simply continue to return ADBC_STATUS_OK 
with a
+  /// NULL release callback.
+  ///
+  /// \param[in] self The result set struct to fetch the next result from.
+  /// \param[out] out The result stream to populate
+  /// \param[out] rows_affected The number of rows affected if known, else -
+  /// \param[out] error An optional location to return an error message if 
necessary.
+  ///
+  /// \return ADBC_STATUS_NOT_IMPLEMENTED if the driver only supports fetching 
results
+  ///   as partitions, ADBC_STATUS_INVALID_STATE if called at an inappropriate 
time,
+  ///   and ADBC_STATUS_OK (or an appropriate error code) otherwise.
+  AdbcStatusCode (*NextResultSet)(struct AdbcResultSet* self,

Review Comment:
   Maybe we can also have an ExecuteSchemaMulti? And/or, some flag or otherwise 
a way to indicate that you only want the schema, so the returned 
ArrowArrayStreams will only have get_schema and won't return any data.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to