Skip to content

Commit 31aa145

Browse files
committed
feat(format): add AdbcConnectionSetWarningHandler
Closes apache#1243.
1 parent 4248d7c commit 31aa145

File tree

2 files changed

+70
-4
lines changed
  • c/include/arrow-adbc
  • go/adbc/drivermgr/arrow-adbc

2 files changed

+70
-4
lines changed

c/include/arrow-adbc/adbc.h

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -989,8 +989,6 @@ struct AdbcPartitions {
989989

990990
/// @}
991991

992-
/// @}
993-
994992
/// \defgroup adbc-statement-multi Multiple Result Set Execution
995993
/// Some databases support executing a statement that returns multiple
996994
/// result sets. This section defines the API for working with such
@@ -1092,6 +1090,18 @@ AdbcStatusCode AdbcMultiResultSetNextPartitions(struct AdbcMultiResultSet* resul
10921090
struct AdbcError* error);
10931091
/// @}
10941092

1093+
/// \brief A warning handler function.
1094+
///
1095+
/// The handler must not block and must not call any other ADBC functions
1096+
/// (besides releasing the warning). The warning does not need to be released
1097+
/// before returning.
1098+
///
1099+
/// \param[in] warning The warning information. The application is
1100+
/// responsible for releasing the warning, but the warning pointer itself
1101+
/// may not be valid after the handler returns.
1102+
/// \param[in] user_data The user_data pointer.
1103+
typedef void (*AdbcWarningHandler)(const struct AdbcError* warning, void* user_data);
1104+
10951105
/// \defgroup adbc-driver Driver Initialization
10961106
///
10971107
/// These functions are intended to help support integration between a
@@ -1264,6 +1274,11 @@ struct ADBC_EXPORT AdbcDriver {
12641274
struct AdbcPartitions*, int64_t*,
12651275
struct AdbcError*);
12661276
AdbcStatusCode (*MultiResultSetRelease)(struct AdbcMultiResultSet*, struct AdbcError*);
1277+
1278+
AdbcStatusCode (*ConnectionSetWarningHandler)(struct AdbcConnection*,
1279+
AdbcWarningHandler handler,
1280+
void* user_data, struct AdbcError*);
1281+
12671282
AdbcStatusCode (*StatementExecuteSchemaMulti)(struct AdbcStatement*,
12681283
struct AdbcMultiResultSet*,
12691284
struct AdbcError*);
@@ -1612,6 +1627,24 @@ ADBC_EXPORT
16121627
AdbcStatusCode AdbcConnectionRelease(struct AdbcConnection* connection,
16131628
struct AdbcError* error);
16141629

1630+
/// \brief Set a warning handler.
1631+
///
1632+
/// May be set before or after AdbcConnectionInit.
1633+
///
1634+
/// \since ADBC API revision 1.2.0
1635+
/// \param[in] database The database.
1636+
/// \param[in] handler The warning handler to use; NULL removes the handler.
1637+
/// \param[in] user_data A user data pointer to be passed to the handler.
1638+
/// Must live at least until the connection is released or the warning
1639+
/// handler is replaced.
1640+
/// \param[out] error An optional location to return an error
1641+
/// message if necessary.
1642+
/// \return ADBC_STATUS_NOT_IMPLEMENTED if warning handlers are not supported
1643+
ADBC_EXPORT
1644+
AdbcStatusCode AdbcConnectionSetWarningHandler(struct AdbcConnection* connection,
1645+
AdbcWarningHandler handler,
1646+
void* user_data, struct AdbcError* error);
1647+
16151648
/// \brief Cancel the in-progress operation on a connection.
16161649
///
16171650
/// This can be called during AdbcConnectionGetObjects (or similar),

go/adbc/drivermgr/arrow-adbc/adbc.h

Lines changed: 35 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)