lidavidm commented on issue #60:
URL: https://github.com/apache/arrow-adbc/issues/60#issuecomment-1211134073
How about this? The parameters are always encoded as a schema, but unknown
types are represented as just NullType. Avoids having lots of optional
things/multiple calls.
```diff
diff --git a/adbc.h b/adbc.h
index e7d9d51..2748d0d 100644
--- a/adbc.h
+++ b/adbc.h
@@ -746,6 +746,22 @@ AdbcStatusCode AdbcStatementBindStream(struct
AdbcStatement* statement,
struct ArrowArrayStream* values,
struct AdbcError* error);
+/// \brief Get the schema for bound parameters.
+///
+/// This should be called after AdbcStatementPrepare. This retrieves
+/// an Arrow schema describing the number, names, and types of the
+/// parameters in a parameterized statement. Not all drivers will
+/// support this. If the name of a parameter cannot be determined,
+/// the name of the corresponding field in the schema will be an empty
+/// string. Similarly, if the type cannot be statically determined,
+/// the type of the corresponding field will be NA (NullType).
+///
+/// \return ADBC_STATUS_NOT_IMPLEMENTED if the schema cannot be determined.
+ADBC_EXPORT
+AdbcStatusCode AdbcStatementGetParameterSchema(struct AdbcStatement*
statement,
+ struct ArrowSchema* schema,
+ struct AdbcError* error);
+
/// \brief Read the result of a statement.
///
/// This method can be called only once per execution of the
diff --git
a/java/core/src/main/java/org/apache/arrow/adbc/core/AdbcStatement.java
b/java/core/src/main/java/org/apache/arrow/adbc/core/AdbcStatement.java
index b621587..fbc1d5f 100644
--- a/java/core/src/main/java/org/apache/arrow/adbc/core/AdbcStatement.java
+++ b/java/core/src/main/java/org/apache/arrow/adbc/core/AdbcStatement.java
@@ -22,6 +22,7 @@ import java.util.Collections;
import java.util.List;
import org.apache.arrow.vector.VectorSchemaRoot;
import org.apache.arrow.vector.ipc.ArrowReader;
+import org.apache.arrow.vector.types.pojo.Schema;
public interface AdbcStatement extends AutoCloseable {
/** Set a generic query option. */
@@ -75,6 +76,20 @@ public interface AdbcStatement extends AutoCloseable {
*/
ArrowReader getArrowReader() throws AdbcException;
+ /**
+ * Get the schema for bound parameters.
+ *
+ * <p>This should be called after AdbcStatementPrepare. This retrieves an
Arrow schema describing
+ * the number, names, and types of the parameters in a parameterized
statement. Not all drivers
+ * will support this. If the name of a parameter cannot be determined,
the name of the
+ * corresponding field in the schema will be an empty string. Similarly,
if the type cannot be
+ * statically determined, the type of the corresponding field will be NA
(NullType).
+ *
+ * @throws AdbcException with {@link AdbcStatusCode#NOT_IMPLEMENTED} if
the parameters cannot be
+ * determined at all.
+ */
+ Schema getParameterSchema() throws AdbcException;
+
/**
* Get a list of partitions of the result set.
*
```
--
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]