Skip to content

Commit dce2b2f

Browse files
feat(format): add way to introspect supported options (#4551)
Closes #630. Co-authored-by: Curt Hagenlocher <curt@hagenlocher.org>
1 parent 989dbe0 commit dce2b2f

2 files changed

Lines changed: 138 additions & 0 deletions

File tree

  • c/include/arrow-adbc
  • go/adbc/drivermgr/arrow-adbc

c/include/arrow-adbc/adbc.h

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1554,6 +1554,75 @@ struct ADBC_EXPORT AdbcDriver {
15541554
/// \since ADBC API revision 1.2.0
15551555
#define ADBC_DRIVER_1_2_0_SIZE (sizeof(struct AdbcDriver))
15561556

1557+
/// \brief An option that can be set on a database.
1558+
/// \see AdbcDriverGetOptionsList
1559+
/// \since ADBC API revision 1.2.0
1560+
#define ADBC_OPTION_LEVEL_DATABASE 1
1561+
/// \brief An option that can be set on a connection.
1562+
/// \see AdbcDriverGetOptionsList
1563+
/// \since ADBC API revision 1.2.0
1564+
#define ADBC_OPTION_LEVEL_CONNECTION 2
1565+
/// \brief An option that can be set on a statement.
1566+
/// \see AdbcDriverGetOptionsList
1567+
/// \since ADBC API revision 1.2.0
1568+
#define ADBC_OPTION_LEVEL_STATEMENT 4
1569+
/// \brief An option that can be set on a database, connection, or statement.
1570+
/// \see AdbcDriverGetOptionsList
1571+
/// \since ADBC API revision 1.2.0
1572+
#define ADBC_OPTION_LEVEL_ALL \
1573+
(ADBC_OPTION_LEVEL_DATABASE | ADBC_OPTION_CONNECTION | ADBC_OPTION_STATEMENT)
1574+
1575+
/// \brief A string-valued option.
1576+
/// \see AdbcDriverGetOptionsList
1577+
/// \since ADBC API revision 1.2.0
1578+
#define ADBC_OPTION_TYPE_STRING 1
1579+
/// \brief A bytestring-valued option.
1580+
/// \see AdbcDriverGetOptionsList
1581+
/// \since ADBC API revision 1.2.0
1582+
#define ADBC_OPTION_TYPE_BYTES 2
1583+
/// \brief A float-valued option.
1584+
/// \see AdbcDriverGetOptionsList
1585+
/// \since ADBC API revision 1.2.0
1586+
#define ADBC_OPTION_TYPE_DOUBLE 4
1587+
/// \brief An integer-valued option.
1588+
/// \see AdbcDriverGetOptionsList
1589+
/// \since ADBC API revision 1.2.0
1590+
#define ADBC_OPTION_TYPE_INT 8
1591+
1592+
/// \brief Get a list of the options supported by the driver.
1593+
///
1594+
/// The result is an Arrow dataset with the following schema:
1595+
///
1596+
/// | Field Name | Field Type | Comments |
1597+
/// |--------------------------|-------------------------| -------- |
1598+
/// | option_name | utf8 not null | |
1599+
/// | option_level | int8 not null | (1) |
1600+
/// | option_type | int8 not null | (2) |
1601+
/// | option_values | list<OPTION_VALUE> | |
1602+
/// | default_value | utf8 | |
1603+
/// | required | bool not null | |
1604+
/// | can_set_before | bool not null | |
1605+
/// | can_set_after | bool not null | |
1606+
/// | option_documentation | utf8 | |
1607+
///
1608+
/// (1) A bitfield of ADBC_OPTION_LEVEL values.
1609+
/// (2) A bitfield of ADBC_OPTION_TYPE values.
1610+
///
1611+
/// OPTION_VALUE is a Struct with fields:
1612+
///
1613+
/// | Field Name | Field Type |
1614+
/// |--------------------------|-------------------------|
1615+
/// | value | utf8 not null |
1616+
/// | documentation | utf8 |
1617+
///
1618+
/// \param[in] level Which ADBC type the option applies to.
1619+
/// \param[out] out The result set.
1620+
/// \param[out] error Error details, if an error occurs.
1621+
/// \since ADBC API revision 1.2.0
1622+
ADBC_EXPORT
1623+
AdbcStatusCode AdbcDriverGetOptionsList(uint32_t level, struct ArrowArrayStream* out,
1624+
struct AdbcError* error);
1625+
15571626
/// @}
15581627

15591628
/// \addtogroup adbc-database

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

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

0 commit comments

Comments
 (0)