-
Notifications
You must be signed in to change notification settings - Fork 173
Description
A number of databases can return warnings or notices from the evaluation of a submitted SQL statement. In JDBC, these are returned via a getWarnings API on Connections, Statements and ResultSets. libpq allows the application to set a callback function for a connection object by using PQsetNoticeReceiver. ADBC should support some kind of mechanism to allow an application to get the equivalent information -- either by using a JDBC-style pull or a libpq-style push. My feeling is that this is only needed on AdbcConnection and that a callback is preferable to having to do buffering, but this is based on personal experience and not an exhaustive survey of existing driver capabilities. Perhaps the following?
typedef AdbcStatusCode (*ConnectionNotice)(struct AdbcConnection*, struct AdbcError*);
ADBC_EXPORT AdbcStatusCode AdbcConnectionSetNoticeReceiver(
struct AdbcConnection* connection,
ConnectionNotice receiver,
struct AdbcError* error);
ADBC_EXPORT AdbcStatusCode AdbcConnectionGetNoticeReceiver(
struct AdbcConnection* connection,
ConnectionNotice* receiver,
struct AdbcError* error);
Error details could be available for a notice.
This functionality is implicitly referenced by #81.