Skip to content

Commit c62747c

Browse files
committed
feat(format): add AdbcDatabaseSetWarningHandler
Closes #1243.
1 parent 046417d commit c62747c

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

c/include/arrow-adbc/adbc.h

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1351,6 +1351,35 @@ ADBC_EXPORT
13511351
AdbcStatusCode AdbcDatabaseSetOptionInt(struct AdbcDatabase* database, const char* key,
13521352
int64_t value, struct AdbcError* error);
13531353

1354+
/// \brief A warning handler function.
1355+
///
1356+
/// The handler must not block and must not call any other ADBC functions
1357+
/// (besides releasing the warning). The warning does not need to be released
1358+
/// before returning.
1359+
///
1360+
/// \param[in] warning The warning information. The application must release
1361+
/// the warning.
1362+
/// \param[in] user_data The user_data pointer.
1363+
typedef void (*AdbcWarningHandler)(const struct AdbcError* warning, void* user_data);
1364+
1365+
/// \brief Set a warning handler.
1366+
///
1367+
/// May be set before or after AdbcDatabaseInit.
1368+
///
1369+
/// \since ADBC API revision 1.2.0
1370+
/// \param[in] database The database.
1371+
/// \param[in] handler The warning handler to use; NULL removes the handler.
1372+
/// \param[in] user_data A user data pointer to be passed to the handler.
1373+
/// Must live at least until the database is released or the warning handler
1374+
/// is replaced.
1375+
/// \param[out] error An optional location to return an error
1376+
/// message if necessary.
1377+
/// \return ADBC_STATUS_NOT_IMPLEMENTED if warning handlers are not supported
1378+
ADBC_EXPORT
1379+
AdbcStatusCode AdbcDatabaseSetWarningHandler(struct AdbcDatabase* database,
1380+
AdbcWarningHandler handler,
1381+
struct AdbcError* error);
1382+
13541383
/// \brief Finish setting options and initialize the database.
13551384
///
13561385
/// Some drivers may support setting options after initialization
@@ -1446,6 +1475,23 @@ AdbcStatusCode AdbcConnectionSetOptionDouble(struct AdbcConnection* connection,
14461475
const char* key, double value,
14471476
struct AdbcError* error);
14481477

1478+
/// \brief Set a double option.
1479+
///
1480+
/// Options may be set before AdbcConnectionInit. Some drivers may
1481+
/// support setting options after initialization as well.
1482+
///
1483+
/// \since ADBC API revision 1.1.0
1484+
/// \param[in] connection The database connection.
1485+
/// \param[in] key The option to set.
1486+
/// \param[in] value The option value.
1487+
/// \param[out] error An optional location to return an error
1488+
/// message if necessary.
1489+
/// \return ADBC_STATUS_NOT_IMPLEMENTED if the option is not recognized
1490+
ADBC_EXPORT
1491+
AdbcStatusCode AdbcConnectionSetOptionDouble(struct AdbcConnection* connection,
1492+
const char* key, double value,
1493+
struct AdbcError* error);
1494+
14491495
/// \brief Finish setting options and initialize the connection.
14501496
///
14511497
/// Some drivers may support setting options after initialization

0 commit comments

Comments
 (0)