This is an automated email from the ASF dual-hosted git repository.
curth pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-adbc.git
The following commit(s) were added to refs/heads/main by this push:
new df6b34091 feat(csharp): Initial changes for ADBC 1.1 in C#
implementation (#1821)
df6b34091 is described below
commit df6b340911af5eed456b42a0945d9047ccaf9d99
Author: Curt Hagenlocher <[email protected]>
AuthorDate: Thu May 9 19:01:39 2024 -0700
feat(csharp): Initial changes for ADBC 1.1 in C# implementation (#1821)
This adds all the basic elements defined since the initial ADBC 1.0
specification. There's still a bunch of cleanup likely to be required,
including support for exporting an ADBC 1.1 driver. There's also no test
coverage (boo! hiss!) as the DuckDB driver does not yet implement any
1.1 features and some ci infrastructure work is probably needed to
support other drivers.
Closes #1215
---
csharp/README.md | 6 -
csharp/src/Apache.Arrow.Adbc/AdbcConnection.cs | 57 ++-
csharp/src/Apache.Arrow.Adbc/AdbcDatabase.cs | 11 +
csharp/src/Apache.Arrow.Adbc/AdbcDriver.cs | 13 +
csharp/src/Apache.Arrow.Adbc/AdbcInfoCode.cs | 44 +-
csharp/src/Apache.Arrow.Adbc/AdbcOptions.cs | 166 ++++++-
csharp/src/Apache.Arrow.Adbc/AdbcStatement.cs | 24 +
csharp/src/Apache.Arrow.Adbc/AdbcStatistic.cs | 80 +++
.../{AdbcDriver.cs => AdbcVersion.cs} | 24 +-
csharp/src/Apache.Arrow.Adbc/BulkIngestMode.cs | 18 +-
csharp/src/Apache.Arrow.Adbc/C/CAdbcDriver.cs | 294 ++++++++++-
.../src/Apache.Arrow.Adbc/C/CAdbcDriverExporter.cs | 56 ++-
.../C/CAdbcDriverImporter.Defaults.cs | 540 +++++++++++++++++++++
.../src/Apache.Arrow.Adbc/C/CAdbcDriverImporter.cs | 416 ++++++++--------
csharp/src/Apache.Arrow.Adbc/C/CAdbcError.cs | 21 +
.../{BulkIngestMode.cs => C/CAdbcErrorDetail.cs} | 30 +-
csharp/src/Apache.Arrow.Adbc/C/Delegates.cs | 35 +-
17 files changed, 1557 insertions(+), 278 deletions(-)
diff --git a/csharp/README.md b/csharp/README.md
index 458b2c747..31c357583 100644
--- a/csharp/README.md
+++ b/csharp/README.md
@@ -20,9 +20,3 @@
# Apache Arrow ADBC
An implementation of Arrow ADBC targeting .NET Standard 2.0 and .NET 6 or
later.
-
-# Arrow Submodule
-
-This library uses the Arrow C Data API that is published in the [Arrow
repo](https://github.com/apache/arrow/).
-
-This change has not been published to NuGet, so a submodule is currently used
to obtain the Arrow project. Be sure to download the submodule so the solution
loads and correctly.
diff --git a/csharp/src/Apache.Arrow.Adbc/AdbcConnection.cs
b/csharp/src/Apache.Arrow.Adbc/AdbcConnection.cs
index 1efe89e07..7f9493c4b 100644
--- a/csharp/src/Apache.Arrow.Adbc/AdbcConnection.cs
+++ b/csharp/src/Apache.Arrow.Adbc/AdbcConnection.cs
@@ -47,17 +47,26 @@ namespace Apache.Arrow.Adbc
/// <summary>
/// Create a new statement to bulk insert into a table.
/// </summary>
- /// <param name="targetTableName">
- /// The table name
- /// </param>
- /// <param name="mode">
- /// The ingest mode
- /// </param>
+ /// <param name="targetTableName">The table name</param>
+ /// <param name="mode">The ingest mode</param>
public virtual AdbcStatement BulkIngest(string targetTableName,
BulkIngestMode mode)
{
throw AdbcException.NotImplemented("Connection does not support
BulkIngest");
}
+ /// <summary>
+ /// Create a new statement to bulk insert into a table.
+ /// </summary>
+ /// <param name="targetCatalog">The catalog name, or null to use the
current catalog</param>
+ /// <param name="targetDbSchema">The schema name, or null to use the
current schema</param>
+ /// <param name="targetTableName">The table name</param>
+ /// <param name="mode">The ingest mode</param>
+ /// <param name="isTemporary">True for a temporary table. Catalog and
Schema must be null when true.</param>
+ public virtual AdbcStatement BulkIngest(string? targetCatalog, string?
targetDbSchema, string targetTableName, BulkIngestMode mode, bool isTemporary)
+ {
+ throw AdbcException.NotImplemented("Connection does not support
BulkIngest");
+ }
+
public virtual void Dispose()
{
}
@@ -220,5 +229,41 @@ namespace Apache.Arrow.Adbc
get => _isolationLevel;
set => throw AdbcException.NotImplemented("Connection does not
support setting isolation level");
}
+
+ /// <summary>
+ /// Attempts to cancel an in-progress operation on a connection.
+ /// </summary>
+ /// <remarks>
+ /// This can be called during a method like GetObjects or while
consuming an ArrowArrayStream
+ /// returned from such. Calling this function should make the other
function throw a cancellation exception.
+ ///
+ /// This must always be thread-safe.
+ /// </remarks>
+ public virtual void Cancel()
+ {
+ throw AdbcException.NotImplemented("Connection does not support
cancellation");
+ }
+
+ /// <summary>
+ /// Gets the names of statistics specific to this driver.
+ /// </summary>
+ /// <returns></returns>
+ public virtual IArrowArrayStream GetStatisticsNames()
+ {
+ throw AdbcException.NotImplemented("Connection does not support
statistics");
+ }
+
+ /// <summary>
+ /// Gets statistics about the data distribution of table(s)
+ /// </summary>
+ /// <param name="catalogPattern">The catalog or null. May be a search
pattern.</param>
+ /// <param name="schemaPattern">The schema or null. May be a search
pattern.</param>
+ /// <param name="tableName">The table name or null. May be a search
pattern.</param>
+ /// <param name="approximate">If false, consumer desires exact
statistics regardless of cost</param>
+ /// <returns>A result describing the statistics for the
table(s)</returns>
+ public virtual IArrowArrayStream GetStatistics(string? catalogPattern,
string? schemaPattern, string tableNamePattern, bool approximate)
+ {
+ throw AdbcException.NotImplemented("Connection does not support
statistics");
+ }
}
}
diff --git a/csharp/src/Apache.Arrow.Adbc/AdbcDatabase.cs
b/csharp/src/Apache.Arrow.Adbc/AdbcDatabase.cs
index 58f07dcb4..be743d151 100644
--- a/csharp/src/Apache.Arrow.Adbc/AdbcDatabase.cs
+++ b/csharp/src/Apache.Arrow.Adbc/AdbcDatabase.cs
@@ -40,6 +40,17 @@ namespace Apache.Arrow.Adbc
throw AdbcException.NotImplemented("Connection does not support
setting options");
}
+ /// <summary>
+ /// Options are generally set before opening a database. Some drivers
may
+ /// support setting options after opening as well.
+ /// </summary>
+ /// <param name="key">Option name</param>
+ /// <param name="value">Option value</param>
+ public virtual void SetOption(string key, object value)
+ {
+ throw AdbcException.NotImplemented("Connection does not support
setting options");
+ }
+
/// <summary>
/// Create a new connection to the database.
/// </summary>
diff --git a/csharp/src/Apache.Arrow.Adbc/AdbcDriver.cs
b/csharp/src/Apache.Arrow.Adbc/AdbcDriver.cs
index 41976d04b..9ff666e3e 100644
--- a/csharp/src/Apache.Arrow.Adbc/AdbcDriver.cs
+++ b/csharp/src/Apache.Arrow.Adbc/AdbcDriver.cs
@@ -26,6 +26,8 @@ namespace Apache.Arrow.Adbc
/// </summary>
public abstract class AdbcDriver : IDisposable
{
+ public virtual int DriverVersion => AdbcVersion.Version_1_0_0;
+
/// <summary>
/// Open a database via this driver.
/// </summary>
@@ -34,6 +36,17 @@ namespace Apache.Arrow.Adbc
/// </param>
public abstract AdbcDatabase Open(IReadOnlyDictionary<string, string>
parameters);
+ /// <summary>
+ /// Open a database via this driver.
+ /// </summary>
+ /// <param name="parameters">
+ /// Driver-specific parameters.
+ /// </param>
+ public virtual AdbcDatabase Open(IReadOnlyDictionary<string, object>
parameters)
+ {
+ throw AdbcException.NotImplemented("Driver does not support
non-string parameters");
+ }
+
public virtual void Dispose()
{
}
diff --git a/csharp/src/Apache.Arrow.Adbc/AdbcInfoCode.cs
b/csharp/src/Apache.Arrow.Adbc/AdbcInfoCode.cs
index 8919b24a5..247f12a7c 100644
--- a/csharp/src/Apache.Arrow.Adbc/AdbcInfoCode.cs
+++ b/csharp/src/Apache.Arrow.Adbc/AdbcInfoCode.cs
@@ -23,33 +23,63 @@ namespace Apache.Arrow.Adbc
public enum AdbcInfoCode
{
/// <summary>
- /// The database vendor/product name (e.g. the server name).
+ /// The database vendor/product name (e.g. the server name). Type:
string.
/// </summary>
VendorName = 0,
/// <summary>
- /// The database vendor/product version
+ /// The database vendor/product version. Type: string.
/// </summary>
VendorVersion = 1,
/// <summary>
- /// The database vendor/product Arrow library version
+ /// The database vendor/product Arrow library version. Type: string.
/// </summary>
VendorArrowVersion = 2,
/// <summary>
- /// The driver name
+ /// Whether or not SQL queries are supported. Type: bool.
+ /// </summary>
+ VendorSql = 3,
+
+ /// <summary>
+ /// Whether or not Substrait queries are supported. Type: bool.
+ /// </summary>
+ VendorSubstrait = 4,
+
+ /// <summary>
+ /// The minimum supported Substrait version, or null if not supported.
Type: string.
+ /// </summary>
+ VendorSubstraitMinVersion = 5,
+
+ /// <summary>
+ /// The maximum supported Substrait version, or null if not supported.
Type: string.
+ /// </summary>
+ VendorSubstraitMaxVersion = 6,
+
+ /// <summary>
+ /// The driver name. Type: string.
/// </summary>
DriverName = 100,
/// <summary>
- /// The driver version
+ /// The driver version. Type: string.
/// </summary>
DriverVersion = 101,
/// <summary>
- /// The driver Arrow library version
+ /// The driver Arrow library version. Type: string.
+ /// </summary>
+ DriverArrowVersion = 102,
+
+ /// <summary>
+ /// The driver ADBC API version. Type: int64.
/// </summary>
- DriverArrowVersion = 102
+ /// <remarks>
+ /// The value should be one of the ADBC_VERSION...
+ ///
+ /// Added in ADBC 1.1.0.
+ /// </remarks>
+ DriverAdbcVersion = 103,
}
}
diff --git a/csharp/src/Apache.Arrow.Adbc/AdbcOptions.cs
b/csharp/src/Apache.Arrow.Adbc/AdbcOptions.cs
index 92390f7b6..ef425ae23 100644
--- a/csharp/src/Apache.Arrow.Adbc/AdbcOptions.cs
+++ b/csharp/src/Apache.Arrow.Adbc/AdbcOptions.cs
@@ -24,31 +24,189 @@ namespace Apache.Arrow.Adbc
public const string Enabled = "true";
public const string Disabled = "false";
- public const string Autocommit = "adbc.connection.autocommit";
- public const string ReadOnly = "adbc.connection.readonly";
- public const string IsolationLevel =
"adbc.connection.transaction.isolation_level";
+ public const string Uri = "uri";
+ public const string Username = "username";
+ public const string Password = "password";
+
+ public static class Connection
+ {
+ /// <summary>
+ /// The name of the canonical option for whether autocommit is
enabled. The type is string.
+ /// </summary>
+ public const string Autocommit = "adbc.connection.autocommit";
+
+ /// <summary>
+ /// The name of the canonical option for whether the current
connection should be restricted
+ /// to be read-only. The type is string.
+ /// </summary>
+ public const string ReadOnly = "adbc.connection.readonly";
+
+ /// <summary>
+ /// The name of the canonical option for setting the isolation
level of a transaction. Should
+ /// only be used in conjunction with <see
cref="Autocommit">disabled and <see cref="AdbcConnection.Commit"/> /
+ /// <see cref="AdbcConnection.Rollback"/>. If the desired
isolation level is not supported by a driver, it
+ /// should return an appropriate error. The type is string.
+ /// </summary>
+ public const string IsolationLevel =
"adbc.connection.transaction.isolation_level";
+
+ /// <summary>
+ /// The name of the canonical option for the current catalog. The
type is string.
+ /// Added as part of API version 1.1.0.
+ /// </summary>
+ public const string CurrentCatalog = "adbc.connection.catalog";
+
+ /// <summary>
+ /// The name of the canonical option for the current schema. The
type is string.
+ /// Added as part of API version 1.1.0.
+ /// </summary>
+ public const string CurrentDbSchema = "adbc.connection.db_schema";
+ }
+
+ public static class Statement
+ {
+ /// <summary>
+ /// The name of the canonical option for making query execution
non-blocking. When
+ /// enabled, <see cref="AdbcStatement.ExecutePartitioned"/> will
return partitions as soon as
+ /// they are available instead of returning them all at the end.
When there are no more to return,
+ /// it will return an empty set of partitions. The type is string.
+ ///
+ /// <see cref="AdbcStatement.ExecuteQuery"/> and <see
cref="AdbcStatement.ExecuteSchema"/> are not
+ /// affected. The default is <see cref="Disabled">.
+ ///
+ /// Added as part of API version 1.1.0.
+ /// </summary>
+ public const string Incremental =
"adbc.statement.exec.incremental";
+
+ /// <summary>
+ /// The name of the option for getting the progress of a query.
The value is not necessarily
+ /// in any particular range of have any particular units. For
example, it might be a
+ /// percentage, bytes of data, rows of data, number of workers,
etc. The max value can be
+ /// retrieved via <see cref="MaxProgress"/>. The type is double.
+ ///
+ /// Added as part of API version 1.1.0.
+ /// </summary>
+ public const string Progress = "adbc.statement.exec.progress";
+
+ /// <summary>
+ /// The name of the option for getting the maximum progress of a
query. This is the value of
+ /// <see cref="Progress"/> for a completed query. If not supported
or if the value is
+ /// nonpositive, then the maximum is not known. For instance, the
query may be fully streaming
+ /// and the driver does not know when the result set will end. The
type is double.
+ ///
+ /// Added as part of API version 1.1.0.
+ /// </summary>
+ public const string MaxProgress =
"adbc.statement.exec.max_progress";
+ }
public static class IsolationLevels
{
+ /// <summary>
+ /// Use database or driver default isolation level.
+ /// </summary>
public const string Default =
"adbc.connection.transaction.isolation.default";
+
+ /// <summary>
+ /// The lowest isolation level. Dirty reads are allowed so one
transaction may see not-yet-committed
+ /// changes made by others.
+ /// </summary>
public const string ReadUncommitted =
"adbc.connection.transaction.isolation.read_uncommitted";
+
+ /// <summary>
+ /// Lock-based concurrency control keeps write locks until the end
of the transaction, but read
+ /// locks are released as soon as a SELECT is performed.
Non-repeatable reads can occur with
+ /// this isolation level
+ /// </summary>
public const string ReadCommitted =
"adbc.connection.transaction.isolation.read_committed";
+
+ /// <summary>
+ /// Lock-based concurrency control keeps read and write locks
(acquired on selection data)
+ /// until the end of the transaction. However, range locks are not
managed so phantom reads
+ /// can occur. Write skew is possible at this isolation level in
some systems.
+ /// </summary>
public const string RepeatableRead =
"adbc.connection.transaction.isolation.repeatable_read";
+
+ /// <summary>
+ /// This isolation guarantees that all reads in the transaction
will see a consistent snapshot
+ /// of the database and the transaction should only successfully
commit if no updates conflict
+ /// with any concurrent updates made since that snapshot.
+ /// </summary>
public const string Snapshot =
"adbc.connection.transaction.isolation.snapshot";
+
+ /// <summary>
+ /// Serializability requires read and write locks to be released
only at the end of the transaction.
+ /// This includes acquiring range locks when a select query uses a
ranged WHERE clause to avoid
+ /// phantom reads.
+ /// </summary>
public const string Serializable =
"adbc.connection.transaction.isolation.serializable";
+
+ /// <summary>
+ /// Linearizability can be viewed as a special case of strict
serializability where transactions
+ /// are restricted to consist of a single operation applied to a
single object.
+ ///
+ /// The central distinction between serializability and
linearizability is that serializability
+ /// is a global property; a property of an entire history of
operations and transactions.
+ /// Linearizability is a local property; a property of a single
operation or transaction.
+ /// </summary>
public const string Linearizable =
"adbc.connection.transaction.isolation.linearizable";
}
public static class Ingest
{
+ /// <summary>
+ /// The catalog of the table for bulk insert. The type is string.
+ /// Added as part of API version 1.1.0.
+ /// </summary>
+ public const string TargetCatalog = "adbc.ingest.target_catalog";
+
+ /// <summary>
+ /// The schema of the table for bulk insert. The type is string.
+ /// Added as part of API version 1.1.0.
+ /// </summary>
+ public const string TargetDbSchema =
"adbc.ingest.target_db_schema";
+
+ /// <summary>
+ /// The name of the table for bulk insert. The type is string.
+ /// </summary>
public const string TargetTable = "adbc.ingest.target_table";
+
+ /// <summary>
+ /// Use a temporary table for ingestion. The type is string.
+ /// The value should be enabled or disabled.
+ /// </summary>
+ public const string Temporary = "adbc.ingest.temporary";
+
+ /// <summary>
+ /// Whether to create (the default) or append to the table.
+ /// </summary>
public const string Mode = "adbc.ingest.mode";
}
public static class IngestMode
{
+ /// <summary>
+ /// Create the table and insert data; error if the table exists.
+ /// </summary>
public const string Create = "adbc.ingest.mode.create";
+
+ /// <summary>
+ /// Do not create the table and insert data. Error if the table
does exist
+ /// (<see cref="AdbcStatusCode.NotFound"/>) or does not match the
schema of
+ /// the data to append (<see
cref="AdbcStatusCode.AlreadyExists"/>).
+ /// </summary>
public const string Append = "adbc.ingest.mode.append";
+
+ /// <summary>
+ /// Create the table and insert data; drop the original table if
it already exists.
+ /// Added as part of API version 1.1.0.
+ /// </summary>
+ public const string Replace = "adbc.ingest.mode.replace";
+
+ /// <summary>
+ /// Insert data; create the table if it does not exist, or error
if the table exists
+ /// but the schema does not match the schema of the data to append
+ /// (<see cref="AdbcStatusCode.AlreadyExists"/>).
+ /// </summary>
+ public const string CreateAppend =
"adbc.ingest.mode.create_append";
}
public static string GetEnabled(bool value) => value ? Enabled :
Disabled;
@@ -98,6 +256,8 @@ namespace Apache.Arrow.Adbc
{
BulkIngestMode.Create => IngestMode.Create,
BulkIngestMode.Append => IngestMode.Append,
+ BulkIngestMode.Replace => IngestMode.Replace,
+ BulkIngestMode.CreateAppend => IngestMode.CreateAppend,
_ => throw new NotSupportedException("unknown ingestion mode"),
};
}
diff --git a/csharp/src/Apache.Arrow.Adbc/AdbcStatement.cs
b/csharp/src/Apache.Arrow.Adbc/AdbcStatement.cs
index b79b26589..1fbd28c1a 100644
--- a/csharp/src/Apache.Arrow.Adbc/AdbcStatement.cs
+++ b/csharp/src/Apache.Arrow.Adbc/AdbcStatement.cs
@@ -90,6 +90,16 @@ namespace Apache.Arrow.Adbc
return await Task.Run(() => ExecuteQuery());
}
+ /// <summary>
+ /// Analyzes the statement and returns the schema of the result set
that would
+ /// be expected if the statement were to be executed.
+ /// </summary>
+ /// <returns>An Arrow <see cref="Schema"/> describing the result
set.</returns>
+ public virtual Schema ExecuteSchema()
+ {
+ throw AdbcException.NotImplemented("Statement does not support
ExecuteSchema");
+ }
+
/// <summary>
/// Executes an update command and returns the number of
/// records effected.
@@ -248,5 +258,19 @@ namespace Apache.Arrow.Adbc
return null;
}
+
+ /// <summary>
+ /// Attempts to cancel an in-progress operation on a connection.
+ /// </summary>
+ /// <remarks>
+ /// This can be called during a method like ExecuteQuery or while
consuming an ArrowArrayStream
+ /// returned from such. Calling this function should make the other
function throw a cancellation exception.
+ ///
+ /// This must always be thread-safe.
+ /// </remarks>
+ public virtual void Cancel()
+ {
+ throw AdbcException.NotImplemented("Statement does not support
cancellation");
+ }
}
}
diff --git a/csharp/src/Apache.Arrow.Adbc/AdbcStatistic.cs
b/csharp/src/Apache.Arrow.Adbc/AdbcStatistic.cs
new file mode 100644
index 000000000..dc2bedebd
--- /dev/null
+++ b/csharp/src/Apache.Arrow.Adbc/AdbcStatistic.cs
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+namespace Apache.Arrow.Adbc
+{
+ public static class AdbcStatistic
+ {
+ // TODO: Rethink how this is stored
+
+ /// <summary>
+ /// The average byte width statistic. The average size in bytes of a
+ /// row in the column. Value type is float64.
+ ///
+ /// For example, this is roughly the average length of a string for a
string
+ /// column.
+ /// </summary>
+ public const string AverageByteWidthName = "adbc.statistic.byte_width";
+ public const int AverageByteWidthKey = 0;
+
+ /// <summary>
+ /// The distinct value count (NDV) statistic. The number of distinct
+ /// values in the column. Value type is int64 (when not approximate)
or
+ /// float64 (when approximate).
+ /// </summary>
+ public const string DistinctCountName =
"adbc.statistic.distinct_count";
+ public const int DistinctCountKey = 1;
+
+ /// <summary>
+ /// The max byte width statistic. The maximum size in bytes of a row
+ /// in the column. Value type is int64 (when not approximate) or
float64
+ /// (when approximate).
+ ///
+ /// For example, this is the maximum length of a string for a string
column.
+ /// </summary>
+ public const string MaxByteWidthName = "adbc.statistic.max_byte_width";
+ public const int MaxByteWidthKey = 2;
+
+ /// <summary>
+ /// The max value statistic. Value type is column-dependent.
+ /// </summary>
+ public const string MaxValueName = "adbc.statistic.max_value";
+ public const int MaxValueKey = 3;
+
+ /// <summary>
+ /// The min value statistic. Value type is column-dependent.
+ /// </summary>
+ public const string MinValueName = "adbc.statistic.min_value";
+ public const int MinValueKey = 4;
+
+ /// <summary>
+ /// The null count statistic. The number of values that are null in
+ /// the column. Value type is int64 (when not approximate) or float64
+ /// (when approximate).
+ /// </summary>
+ public const string NullCountName = "adbc.statistic.null_count";
+ public const int NullCountKey = 5;
+
+ /// <summary>
+ /// The row count statistic. The number of rows in the column or
+ /// table. Value type is int64 (when not approximate) or float64 (when
+ /// approximate).
+ /// </summary>
+ public const string RowCountName = "adbc.statistic.row_count";
+ public const int RowCountKey = 6;
+ }
+}
diff --git a/csharp/src/Apache.Arrow.Adbc/AdbcDriver.cs
b/csharp/src/Apache.Arrow.Adbc/AdbcVersion.cs
similarity index 59%
copy from csharp/src/Apache.Arrow.Adbc/AdbcDriver.cs
copy to csharp/src/Apache.Arrow.Adbc/AdbcVersion.cs
index 41976d04b..0ee8ff26c 100644
--- a/csharp/src/Apache.Arrow.Adbc/AdbcDriver.cs
+++ b/csharp/src/Apache.Arrow.Adbc/AdbcVersion.cs
@@ -1,4 +1,4 @@
-/*
+/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
@@ -15,27 +15,11 @@
* limitations under the License.
*/
-using System;
-using System.Collections.Generic;
-
namespace Apache.Arrow.Adbc
{
- /// <summary>
- /// This provides a common interface for vendor-specific driver
- /// initialization routines.
- /// </summary>
- public abstract class AdbcDriver : IDisposable
+ public static class AdbcVersion
{
- /// <summary>
- /// Open a database via this driver.
- /// </summary>
- /// <param name="parameters">
- /// Driver-specific parameters.
- /// </param>
- public abstract AdbcDatabase Open(IReadOnlyDictionary<string, string>
parameters);
-
- public virtual void Dispose()
- {
- }
+ public const int Version_1_0_0 = 1000000;
+ public const int Version_1_1_0 = 1001000;
}
}
diff --git a/csharp/src/Apache.Arrow.Adbc/BulkIngestMode.cs
b/csharp/src/Apache.Arrow.Adbc/BulkIngestMode.cs
index a8f7aa2f6..57bfb50a9 100644
--- a/csharp/src/Apache.Arrow.Adbc/BulkIngestMode.cs
+++ b/csharp/src/Apache.Arrow.Adbc/BulkIngestMode.cs
@@ -34,6 +34,22 @@ namespace Apache.Arrow.Adbc
/// does not match the schema of the data to append
/// (<see cref="AdbcStatusCode.AlreadyExists"/>).
/// </summary>
- Append
+ Append,
+
+ /// <summary>
+ /// Create the table and insert data; drop the original table if it
already exists.
+ ///
+ /// Added as part of API version 1.1.0
+ /// </summary>
+ Replace,
+
+ /// <summary>
+ /// Insert data; create the table if it does not exist or error
+ /// (<see cref="AdbcStatusCode.AlreadyExists"/>) if the table exists
but the schema does not
+ /// match the schema of the data to append.
+ ///
+ /// Added as part of API version 1.1.0
+ /// </summary>
+ CreateAppend,
}
}
diff --git a/csharp/src/Apache.Arrow.Adbc/C/CAdbcDriver.cs
b/csharp/src/Apache.Arrow.Adbc/C/CAdbcDriver.cs
index 8f0050b96..616ab3885 100644
--- a/csharp/src/Apache.Arrow.Adbc/C/CAdbcDriver.cs
+++ b/csharp/src/Apache.Arrow.Adbc/C/CAdbcDriver.cs
@@ -33,6 +33,8 @@ namespace Apache.Arrow.Adbc.C
[StructLayout(LayoutKind.Sequential)]
public unsafe struct CAdbcDriver
{
+ #region ADBC API Revision 1.0.0
+
/// <summary>
/// Opaque driver-defined state.
/// This field is NULL if the driver is unintialized/freed (but
@@ -87,7 +89,7 @@ namespace Apache.Arrow.Adbc.C
#endif
/// <summary>
- /// Set a byte* option.
+ /// Set a byte* option on the database.
///
/// Options may be set before AdbcDatabaseInit. Some drivers may
/// support setting options after initialization as well.
@@ -239,7 +241,7 @@ namespace Apache.Arrow.Adbc.C
#endif
/// <summary>
- /// Set a byte* option.
+ /// Set a byte* option on the connection.
///
/// Options may be set before AdbcConnectionInit. Some drivers may
/// support setting options after initialization as well.
@@ -415,5 +417,293 @@ namespace Apache.Arrow.Adbc.C
#else
internal IntPtr StatementSetSubstraitPlan;
#endif
+ #endregion
+
+ #region ADBC API Revision 1.1.0
+
+ /// <summary>
+ /// Get the number of metadata values available in an error.
+ /// </summary>
+#if NET5_0_OR_GREATER
+ internal delegate* unmanaged<CAdbcError*, int> ErrorGetDetailCount;
+#else
+ internal IntPtr ErrorGetDetailCount;
+#endif
+
+ /// <summary>
+ /// Get a metadata value in an error by index.
+ /// </summary>
+ /// <remarks>
+ /// If an index is invalid, returns an AdbcErrorDetail initialized
with null/0 fields.
+ /// </remarks>
+#if NET5_0_OR_GREATER
+ internal delegate* unmanaged<CAdbcError*, int, CAdbcErrorDetail>
ErrorGetDetail;
+#else
+ internal IntPtr ErrorGetDetail;
+#endif
+
+ /// <summary>
+ /// Get an ADBC error from an ArrowArrayStream created by a driver.
+ /// </summary>
+ /// <remarks>
+ /// This allows retrieving error details and other metadata that would
normally be
+ /// suppressed by the Arrow C Stream Interface.
+ ///
+ /// The caller MUST NOT release the error; it is managed by the
release callback
+ /// in the stream itself.
+ /// </remarks>
+#if NET5_0_OR_GREATER
+ internal delegate* unmanaged<CArrowArrayStream*, AdbcStatusCode*,
CAdbcError*> ErrorFromArrayStream;
+#else
+ internal IntPtr ErrorFromArrayStream;
+#endif
+
+ /// <summary>
+ /// Get a string option of the database.
+ /// </summary>
+#if NET5_0_OR_GREATER
+ internal delegate* unmanaged<CAdbcDatabase*, byte*, byte*, nint*,
CAdbcError*, AdbcStatusCode> DatabaseGetOption;
+#else
+ internal IntPtr DatabaseGetOption;
+#endif
+
+ /// <summary>
+ /// Get a byte* option of the database.
+ /// </summary>
+#if NET5_0_OR_GREATER
+ internal delegate* unmanaged<CAdbcDatabase*, byte*, byte*, nint*,
CAdbcError*, AdbcStatusCode> DatabaseGetOptionBytes;
+#else
+ internal IntPtr DatabaseGetOptionBytes;
+#endif
+
+ /// <summary>
+ /// Get a double option of the database.
+ /// </summary>
+#if NET5_0_OR_GREATER
+ internal delegate* unmanaged<CAdbcDatabase*, byte*, double*,
CAdbcError*, AdbcStatusCode> DatabaseGetOptionDouble;
+#else
+ internal IntPtr DatabaseGetOptionDouble;
+#endif
+
+ /// <summary>
+ /// Get an integer option of the database.
+ /// </summary>
+#if NET5_0_OR_GREATER
+ internal delegate* unmanaged<CAdbcDatabase*, byte*, long*,
CAdbcError*, AdbcStatusCode> DatabaseGetOptionInt;
+#else
+ internal IntPtr DatabaseGetOptionInt;
+#endif
+
+ /// <summary>
+ /// Set a byte* option of the database.
+ ///
+ /// Options may be set before AdbcDatabaseInit. Some drivers may
support setting options after initialization as well.
+ /// </summary>
+#if NET5_0_OR_GREATER
+ internal delegate* unmanaged<CAdbcDatabase*, byte*, byte*, nint,
CAdbcError*, AdbcStatusCode> DatabaseSetOptionBytes;
+#else
+ internal IntPtr DatabaseSetOptionBytes;
+#endif
+
+ /// <summary>
+ /// Set a double option of the database.
+ ///
+ /// Options may be set before AdbcDatabaseInit. Some drivers may
support setting options after initialization as well.
+ /// </summary>
+#if NET5_0_OR_GREATER
+ internal delegate* unmanaged<CAdbcDatabase*, byte*, double,
CAdbcError*, AdbcStatusCode> DatabaseSetOptionDouble;
+#else
+ internal IntPtr DatabaseSetOptionDouble;
+#endif
+
+ /// <summary>
+ /// Set an integer option of the database.
+ ///
+ /// Options may be set before AdbcDatabaseInit. Some drivers may
support setting options after initialization as well.
+ /// </summary>
+#if NET5_0_OR_GREATER
+ internal delegate* unmanaged<CAdbcDatabase*, byte*, long, CAdbcError*,
AdbcStatusCode> DatabaseSetOptionInt;
+#else
+ internal IntPtr DatabaseSetOptionInt;
+#endif
+
+ /// <summary>
+ /// Cancel the in-progress operation on a connection.
+ /// </summary>
+#if NET5_0_OR_GREATER
+ internal delegate* unmanaged<CAdbcConnection*, CAdbcError*,
AdbcStatusCode> ConnectionCancel;
+#else
+ internal IntPtr ConnectionCancel;
+#endif
+
+ /// <summary>
+ /// Get a string option of the connection.
+ /// </summary>
+#if NET5_0_OR_GREATER
+ internal delegate* unmanaged<CAdbcConnection*, byte*, byte*, nint*,
CAdbcError*, AdbcStatusCode> ConnectionGetOption;
+#else
+ internal IntPtr ConnectionGetOption;
+#endif
+
+ /// <summary>
+ /// Get a byte* option of the connection.
+ /// </summary>
+#if NET5_0_OR_GREATER
+ internal delegate* unmanaged<CAdbcConnection*, byte*, byte*, nint*,
CAdbcError*, AdbcStatusCode> ConnectionGetOptionBytes;
+#else
+ internal IntPtr ConnectionGetOptionBytes;
+#endif
+
+ /// <summary>
+ /// Get a double option of the connection.
+ /// </summary>
+#if NET5_0_OR_GREATER
+ internal delegate* unmanaged<CAdbcConnection*, byte*, double*,
CAdbcError*, AdbcStatusCode> ConnectionGetOptionDouble;
+#else
+ internal IntPtr ConnectionGetOptionDouble;
+#endif
+
+ /// <summary>
+ /// Get an integer option of the connection.
+ /// </summary>
+#if NET5_0_OR_GREATER
+ internal delegate* unmanaged<CAdbcConnection*, byte*, long*,
CAdbcError*, AdbcStatusCode> ConnectionGetOptionInt;
+#else
+ internal IntPtr ConnectionGetOptionInt;
+#endif
+
+ /// <summary>
+ /// Get statistics about the data distribution of table(s). The result
is an Arrow dataset.
+ /// </summary>
+#if NET5_0_OR_GREATER
+ internal delegate* unmanaged<CAdbcConnection*, byte*, byte*, byte*,
byte, CArrowArrayStream*, CAdbcError*, AdbcStatusCode> ConnectionGetStatistics;
+#else
+ internal IntPtr ConnectionGetStatistics;
+#endif
+
+ /// <summary>
+ /// Get the names of statistics specific to this driver. The result is
an Arrow dataset.
+ /// </summary>
+#if NET5_0_OR_GREATER
+ internal delegate* unmanaged<CAdbcConnection*, CArrowArrayStream*,
CAdbcError*, AdbcStatusCode> ConnectionGetStatisticNames;
+#else
+ internal IntPtr ConnectionGetStatisticNames;
+#endif
+
+ /// <summary>
+ /// Set a byte* option on a connection.
+ ///
+ /// Options may be set before AdbcConnectionInit. Some drivers may
support setting options after initialization as well.
+ /// </summary>
+#if NET5_0_OR_GREATER
+ internal delegate* unmanaged<CAdbcConnection*, byte*, byte*, nint,
CAdbcError*, AdbcStatusCode> ConnectionSetOptionBytes;
+#else
+ internal IntPtr ConnectionSetOptionBytes;
+#endif
+
+ /// <summary>
+ /// Set a double option on a connection.
+ ///
+ /// Options may be set before AdbcConnectionInit. Some drivers may
support setting options after initialization as well.
+ /// </summary>
+#if NET5_0_OR_GREATER
+ internal delegate* unmanaged<CAdbcConnection*, byte*, double,
CAdbcError*, AdbcStatusCode> ConnectionSetOptionDouble;
+#else
+ internal IntPtr ConnectionSetOptionDouble;
+#endif
+
+ /// <summary>
+ /// Set an integer option on a connection.
+ ///
+ /// Options may be set before AdbcConnectionInit. Some drivers may
support setting options after initialization as well.
+ /// </summary>
+#if NET5_0_OR_GREATER
+ internal delegate* unmanaged<CAdbcConnection*, byte*, long,
CAdbcError*, AdbcStatusCode> ConnectionSetOptionInt;
+#else
+ internal IntPtr ConnectionSetOptionInt;
+#endif
+
+ /// <summary>
+ /// Cancel execution of an in-progress query.
+ /// </summary>
+#if NET5_0_OR_GREATER
+ internal delegate* unmanaged<CAdbcStatement*, CAdbcError*,
AdbcStatusCode> StatementCancel;
+#else
+ internal IntPtr StatementCancel;
+#endif
+
+ /// <summary>
+ /// Get the schema of the result set of a query without executing it.
+ /// </summary>
+#if NET5_0_OR_GREATER
+ internal delegate* unmanaged<CAdbcStatement*, CArrowSchema*,
CAdbcError*, AdbcStatusCode> StatementExecuteSchema;
+#else
+ internal IntPtr StatementExecuteSchema;
+#endif
+
+ /// <summary>
+ /// Get a string option of the statement.
+ /// </summary>
+#if NET5_0_OR_GREATER
+ internal delegate* unmanaged<CAdbcStatement*, byte*, byte*, nint*,
CAdbcError*, AdbcStatusCode> StatementGetOption;
+#else
+ internal IntPtr StatementGetOption;
+#endif
+
+ /// <summary>
+ /// Get a byte* option of the statement.
+ /// </summary>
+#if NET5_0_OR_GREATER
+ internal delegate* unmanaged<CAdbcStatement*, byte*, byte*, nint*,
CAdbcError*, AdbcStatusCode> StatementGetOptionBytes;
+#else
+ internal IntPtr StatementGetOptionBytes;
+#endif
+
+ /// <summary>
+ /// Get a double option of the statement.
+ /// </summary>
+#if NET5_0_OR_GREATER
+ internal delegate* unmanaged<CAdbcStatement*, byte*, double*,
CAdbcError*, AdbcStatusCode> StatementGetOptionDouble;
+#else
+ internal IntPtr StatementGetOptionDouble;
+#endif
+
+ /// <summary>
+ /// Get an integer option of the statement.
+ /// </summary>
+#if NET5_0_OR_GREATER
+ internal delegate* unmanaged<CAdbcStatement*, byte*, long*,
CAdbcError*, AdbcStatusCode> StatementGetOptionInt;
+#else
+ internal IntPtr StatementGetOptionInt;
+#endif
+
+ /// <summary>
+ /// Set a byte* option on a statement.
+ /// </summary>
+#if NET5_0_OR_GREATER
+ internal delegate* unmanaged<CAdbcStatement*, byte*, byte*, nint,
CAdbcError*, AdbcStatusCode> StatementSetOptionBytes;
+#else
+ internal IntPtr StatementSetOptionBytes;
+#endif
+
+ /// <summary>
+ /// Set a double option on a statement.
+ /// </summary>
+#if NET5_0_OR_GREATER
+ internal delegate* unmanaged<CAdbcStatement*, byte*, double,
CAdbcError*, AdbcStatusCode> StatementSetOptionDouble;
+#else
+ internal IntPtr StatementSetOptionDouble;
+#endif
+
+ /// <summary>
+ /// Set an integer option on a statement.
+ /// </summary>
+#if NET5_0_OR_GREATER
+ internal delegate* unmanaged<CAdbcStatement*, byte*, long,
CAdbcError*, AdbcStatusCode> StatementSetOptionInt;
+#else
+ internal IntPtr StatementSetOptionInt;
+#endif
+
+ #endregion
}
}
diff --git a/csharp/src/Apache.Arrow.Adbc/C/CAdbcDriverExporter.cs
b/csharp/src/Apache.Arrow.Adbc/C/CAdbcDriverExporter.cs
index 2b77315f2..0accb1338 100644
--- a/csharp/src/Apache.Arrow.Adbc/C/CAdbcDriverExporter.cs
+++ b/csharp/src/Apache.Arrow.Adbc/C/CAdbcDriverExporter.cs
@@ -53,6 +53,7 @@ namespace Apache.Arrow.Adbc.C
private static unsafe delegate* unmanaged<CAdbcStatement*,
CArrowArrayStream*, CAdbcError*, AdbcStatusCode> StatementBindStreamPtr =>
&BindStreamStatement;
private static unsafe delegate* unmanaged<CAdbcStatement*,
CArrowArrayStream*, long*, CAdbcError*, AdbcStatusCode>
StatementExecuteQueryPtr => &ExecuteStatementQuery;
private static unsafe delegate* unmanaged<CAdbcStatement*,
CArrowSchema*, CAdbcPartitions*, long*, CAdbcError*, AdbcStatusCode>
StatementExecutePartitionsPtr => &ExecuteStatementPartitions;
+ private static unsafe delegate* unmanaged<CAdbcStatement*,
CArrowSchema*, CAdbcError*, AdbcStatusCode> StatementExecuteSchemaPtr =>
&ExecuteStatementSchema;
private static unsafe delegate* unmanaged<CAdbcConnection*,
CAdbcStatement*, CAdbcError*, AdbcStatusCode> StatementNewPtr => &NewStatement;
private static unsafe delegate* unmanaged<CAdbcStatement*,
CAdbcError*, AdbcStatusCode> StatementReleasePtr => &ReleaseStatement;
private static unsafe delegate* unmanaged<CAdbcStatement*,
CAdbcError*, AdbcStatusCode> StatementPreparePtr => &PrepareStatement;
@@ -83,6 +84,7 @@ namespace Apache.Arrow.Adbc.C
private static unsafe IntPtr StatementBindStreamPtr =
NativeDelegate<StatementBindStream>.AsNativePointer(BindStreamStatement);
private static unsafe IntPtr StatementExecuteQueryPtr =
NativeDelegate<StatementExecuteQuery>.AsNativePointer(ExecuteStatementQuery);
private static unsafe IntPtr StatementExecutePartitionsPtr =
NativeDelegate<StatementExecutePartitions>.AsNativePointer(ExecuteStatementPartitions);
+ private static unsafe IntPtr StatementExecuteSchemaPtr =
NativeDelegate<StatementExecuteSchema>.AsNativePointer(ExecuteStatementSchema);
private static unsafe IntPtr StatementNewPtr =
NativeDelegate<StatementNew>.AsNativePointer(NewStatement);
private static unsafe IntPtr StatementReleasePtr =
NativeDelegate<StatementRelease>.AsNativePointer(ReleaseStatement);
private static unsafe IntPtr StatementPreparePtr =
NativeDelegate<StatementPrepare>.AsNativePointer(PrepareStatement);
@@ -93,6 +95,12 @@ namespace Apache.Arrow.Adbc.C
public unsafe static AdbcStatusCode AdbcDriverInit(int version,
CAdbcDriver* nativeDriver, CAdbcError* error, AdbcDriver driver)
{
+ if (version != AdbcVersion.Version_1_0_0)
+ {
+ // TODO: implement support for AdbcVersion.Version_1_1_0
+ return AdbcStatusCode.InternalError;
+ }
+
DriverStub stub = new DriverStub(driver);
GCHandle handle = GCHandle.Alloc(stub);
nativeDriver->private_data = (void*)GCHandle.ToIntPtr(handle);
@@ -637,6 +645,26 @@ namespace Apache.Arrow.Adbc.C
}
}
+#if NET5_0_OR_GREATER
+ [UnmanagedCallersOnly]
+#endif
+ private unsafe static AdbcStatusCode
ExecuteStatementSchema(CAdbcStatement* nativeStatement, CArrowSchema* schema,
CAdbcError* error)
+ {
+ try
+ {
+ GCHandle gch =
GCHandle.FromIntPtr((IntPtr)nativeStatement->private_data);
+ AdbcStatement stub = (AdbcStatement)gch.Target!;
+ var result = stub.ExecuteSchema();
+
+ CArrowSchemaExporter.ExportSchema(result, schema);
+ return AdbcStatusCode.Success;
+ }
+ catch (Exception e)
+ {
+ return SetError(error, e);
+ }
+ }
+
#if NET5_0_OR_GREATER
[UnmanagedCallersOnly]
#endif
@@ -824,22 +852,20 @@ namespace Apache.Arrow.Adbc.C
}
else
{
- // TODO: how best to normalize this?
- if (StringComparer.OrdinalIgnoreCase.Equals(stringName,
AdbcOptions.Autocommit))
- {
- connection.AutoCommit =
AdbcOptions.GetEnabled(stringValue);
- }
- else if
(StringComparer.OrdinalIgnoreCase.Equals(stringName,
AdbcOptions.IsolationLevel))
- {
- connection.IsolationLevel =
AdbcOptions.GetIsolationLevel(stringValue);
- }
- else if
(StringComparer.OrdinalIgnoreCase.Equals(stringName, AdbcOptions.ReadOnly))
- {
- connection.ReadOnly =
AdbcOptions.GetEnabled(stringValue);
- }
- else
+ switch (stringName)
{
- connection.SetOption(stringName, stringValue);
+ case AdbcOptions.Connection.Autocommit:
+ connection.AutoCommit =
AdbcOptions.GetEnabled(stringValue);
+ break;
+ case AdbcOptions.Connection.IsolationLevel:
+ connection.IsolationLevel =
AdbcOptions.GetIsolationLevel(stringValue);
+ break;
+ case AdbcOptions.Connection.ReadOnly:
+ connection.ReadOnly =
AdbcOptions.GetEnabled(stringValue);
+ break;
+ default:
+ connection.SetOption(stringName, stringValue);
+ break;
}
}
}
diff --git a/csharp/src/Apache.Arrow.Adbc/C/CAdbcDriverImporter.Defaults.cs
b/csharp/src/Apache.Arrow.Adbc/C/CAdbcDriverImporter.Defaults.cs
new file mode 100644
index 000000000..ed2377ba2
--- /dev/null
+++ b/csharp/src/Apache.Arrow.Adbc/C/CAdbcDriverImporter.Defaults.cs
@@ -0,0 +1,540 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Runtime.InteropServices;
+using Apache.Arrow.C;
+
+namespace Apache.Arrow.Adbc.C
+{
+ public static partial class CAdbcDriverImporter
+ {
+ #region ADBC API Revision 1.0.0
+
+#if !NET5_0_OR_GREATER
+ private static unsafe IntPtr DatabaseSetOptionDefault =
NativeDelegate<DatabaseSetOption>.AsNativePointer(DatabaseSetOptionDefaultImpl);
+#else
+ private static unsafe delegate* unmanaged<CAdbcDatabase*, byte*,
byte*, CAdbcError*, AdbcStatusCode> DatabaseSetOptionDefault =>
&DatabaseSetOptionDefaultImpl;
+ [UnmanagedCallersOnly]
+#endif
+ private static unsafe AdbcStatusCode
DatabaseSetOptionDefaultImpl(CAdbcDatabase* database, byte* key, byte* value,
CAdbcError* error)
+ {
+ return NotImplemented(error,
nameof(CAdbcDriver.DatabaseSetOption));
+ }
+
+#if !NET5_0_OR_GREATER
+ private static unsafe IntPtr ConnectionCommitDefault =
NativeDelegate<ConnectionCommit>.AsNativePointer(ConnectionCommitDefaultImpl);
+#else
+ private static unsafe delegate* unmanaged<CAdbcConnection*,
CAdbcError*, AdbcStatusCode> ConnectionCommitDefault =>
&ConnectionCommitDefaultImpl;
+ [UnmanagedCallersOnly]
+#endif
+ private static unsafe AdbcStatusCode
ConnectionCommitDefaultImpl(CAdbcConnection* connection, CAdbcError* error)
+ {
+ return NotImplemented(error, nameof(CAdbcDriver.ConnectionCommit));
+ }
+
+#if !NET5_0_OR_GREATER
+ private static unsafe IntPtr ConnectionGetInfoDefault =
NativeDelegate<ConnectionGetInfo>.AsNativePointer(ConnectionGetInfoDefaultImpl);
+#else
+ private static unsafe delegate* unmanaged<CAdbcConnection*, int*, int,
CArrowArrayStream*, CAdbcError*, AdbcStatusCode> ConnectionGetInfoDefault =>
&ConnectionGetInfoDefaultImpl;
+ [UnmanagedCallersOnly]
+#endif
+ private static unsafe AdbcStatusCode
ConnectionGetInfoDefaultImpl(CAdbcConnection* connection, int* info_codes, int
info_codes_length, CArrowArrayStream* stream, CAdbcError* error)
+ {
+ return NotImplemented(error,
nameof(CAdbcDriver.ConnectionGetInfo));
+ }
+
+#if !NET5_0_OR_GREATER
+ private static unsafe IntPtr ConnectionGetObjectsDefault =
NativeDelegate<ConnectionGetObjects>.AsNativePointer(ConnectionGetObjectsDefaultImpl);
+#else
+ private static unsafe delegate* unmanaged<CAdbcConnection*, int,
byte*, byte*, byte*, byte**, byte*, CArrowArrayStream*, CAdbcError*,
AdbcStatusCode> ConnectionGetObjectsDefault => &ConnectionGetObjectsDefaultImpl;
+ [UnmanagedCallersOnly]
+#endif
+ private static unsafe AdbcStatusCode
ConnectionGetObjectsDefaultImpl(CAdbcConnection* connection, int depth, byte*
catalog, byte* db_schema, byte* table_name, byte** table_type, byte*
column_name, CArrowArrayStream* stream, CAdbcError* error)
+ {
+ return NotImplemented(error,
nameof(CAdbcDriver.ConnectionGetObjects));
+ }
+
+#if !NET5_0_OR_GREATER
+ private static unsafe IntPtr ConnectionGetTableSchemaDefault =
NativeDelegate<ConnectionGetTableSchema>.AsNativePointer(ConnectionGetTableSchemaDefaultImpl);
+#else
+ private static unsafe delegate* unmanaged<CAdbcConnection*, byte*,
byte*, byte*, CArrowSchema*, CAdbcError*, AdbcStatusCode>
ConnectionGetTableSchemaDefault => &ConnectionGetTableSchemaDefaultImpl;
+ [UnmanagedCallersOnly]
+#endif
+ private static unsafe AdbcStatusCode
ConnectionGetTableSchemaDefaultImpl(CAdbcConnection* connection, byte* catalog,
byte* db_schema, byte* table_name, CArrowSchema* schema, CAdbcError* error)
+ {
+ return NotImplemented(error,
nameof(CAdbcDriver.ConnectionGetTableSchema));
+ }
+
+#if !NET5_0_OR_GREATER
+ private static unsafe IntPtr ConnectionGetTableTypesDefault =
NativeDelegate<ConnectionGetTableTypes>.AsNativePointer(ConnectionGetTableTypesDefaultImpl);
+#else
+ private static unsafe delegate* unmanaged<CAdbcConnection*,
CArrowArrayStream*, CAdbcError*, AdbcStatusCode> ConnectionGetTableTypesDefault
=> &ConnectionGetTableTypesDefaultImpl;
+ [UnmanagedCallersOnly]
+#endif
+ private static unsafe AdbcStatusCode
ConnectionGetTableTypesDefaultImpl(CAdbcConnection* connection,
CArrowArrayStream* stream, CAdbcError* error)
+ {
+ return NotImplemented(error,
nameof(CAdbcDriver.ConnectionGetTableTypes));
+ }
+
+#if !NET5_0_OR_GREATER
+ private static unsafe IntPtr ConnectionReadPartitionDefault =
NativeDelegate<ConnectionReadPartition>.AsNativePointer(ConnectionReadPartitionDefaultImpl);
+#else
+ private static unsafe delegate* unmanaged<CAdbcConnection*, byte*,
int, CArrowArrayStream*, CAdbcError*, AdbcStatusCode>
ConnectionReadPartitionDefault => &ConnectionReadPartitionDefaultImpl;
+ [UnmanagedCallersOnly]
+#endif
+ private static unsafe AdbcStatusCode
ConnectionReadPartitionDefaultImpl(CAdbcConnection* connection, byte*
serialized_partition, int serialized_length, CArrowArrayStream* stream,
CAdbcError* error)
+ {
+ return NotImplemented(error,
nameof(CAdbcDriver.ConnectionReadPartition));
+ }
+
+#if !NET5_0_OR_GREATER
+ private static unsafe IntPtr ConnectionRollbackDefault =
NativeDelegate<ConnectionRollback>.AsNativePointer(ConnectionRollbackDefaultImpl);
+#else
+ private static unsafe delegate* unmanaged<CAdbcConnection*,
CAdbcError*, AdbcStatusCode> ConnectionRollbackDefault =>
&ConnectionRollbackDefaultImpl;
+ [UnmanagedCallersOnly]
+#endif
+ private static unsafe AdbcStatusCode
ConnectionRollbackDefaultImpl(CAdbcConnection* connection, CAdbcError* error)
+ {
+ return NotImplemented(error,
nameof(CAdbcDriver.ConnectionRollback));
+ }
+
+#if !NET5_0_OR_GREATER
+ private static unsafe IntPtr ConnectionSetOptionDefault =
NativeDelegate<ConnectionSetOption>.AsNativePointer(ConnectionSetOptionDefaultImpl);
+#else
+ private static unsafe delegate* unmanaged<CAdbcConnection*, byte*,
byte*, CAdbcError*, AdbcStatusCode> ConnectionSetOptionDefault =>
&ConnectionSetOptionDefaultImpl;
+ [UnmanagedCallersOnly]
+#endif
+ private static unsafe AdbcStatusCode
ConnectionSetOptionDefaultImpl(CAdbcConnection* connection, byte* name, byte*
value, CAdbcError* error)
+ {
+ return NotImplemented(error,
nameof(CAdbcDriver.ConnectionSetOption));
+ }
+
+#if !NET5_0_OR_GREATER
+ private static unsafe IntPtr StatementExecutePartitionsDefault =
NativeDelegate<StatementExecutePartitions>.AsNativePointer(StatementExecutePartitionsDefaultImpl);
+#else
+ private static unsafe delegate* unmanaged<CAdbcStatement*,
CArrowSchema*, CAdbcPartitions*, long*, CAdbcError*, AdbcStatusCode>
StatementExecutePartitionsDefault => &StatementExecutePartitionsDefaultImpl;
+ [UnmanagedCallersOnly]
+#endif
+ private static unsafe AdbcStatusCode
StatementExecutePartitionsDefaultImpl(CAdbcStatement* statement, CArrowSchema*
schema, CAdbcPartitions* partitions, long* rows, CAdbcError* error)
+ {
+ return NotImplemented(error,
nameof(CAdbcDriver.StatementExecutePartitions));
+ }
+
+#if !NET5_0_OR_GREATER
+ private static unsafe IntPtr StatementBindDefault =
NativeDelegate<StatementBind>.AsNativePointer(StatementBindDefaultImpl);
+#else
+ private static unsafe delegate* unmanaged<CAdbcStatement*,
CArrowArray*, CArrowSchema*, CAdbcError*, AdbcStatusCode> StatementBindDefault
=> &StatementBindDefaultImpl;
+ [UnmanagedCallersOnly]
+#endif
+ private static unsafe AdbcStatusCode
StatementBindDefaultImpl(CAdbcStatement* statement, CArrowArray* array,
CArrowSchema* schema, CAdbcError* error)
+ {
+ return NotImplemented(error, nameof(CAdbcDriver.StatementBind));
+ }
+
+#if !NET5_0_OR_GREATER
+ private static unsafe IntPtr StatementBindStreamDefault =
NativeDelegate<StatementBindStream>.AsNativePointer(StatementBindStreamDefaultImpl);
+#else
+ private static unsafe delegate* unmanaged<CAdbcStatement*,
CArrowArrayStream*, CAdbcError*, AdbcStatusCode> StatementBindStreamDefault =>
&StatementBindStreamDefaultImpl;
+ [UnmanagedCallersOnly]
+#endif
+ private static unsafe AdbcStatusCode
StatementBindStreamDefaultImpl(CAdbcStatement* statement, CArrowArrayStream*
stream, CAdbcError* error)
+ {
+ return NotImplemented(error,
nameof(CAdbcDriver.StatementBindStream));
+ }
+
+#if !NET5_0_OR_GREATER
+ private static unsafe IntPtr StatementGetParameterSchemaDefault =
NativeDelegate<StatementGetParameterSchema>.AsNativePointer(StatementGetParameterSchemaDefaultImpl);
+#else
+ private static unsafe delegate* unmanaged<CAdbcStatement*,
CArrowSchema*, CAdbcError*, AdbcStatusCode> StatementGetParameterSchemaDefault
=> &StatementGetParameterSchemaDefaultImpl;
+ [UnmanagedCallersOnly]
+#endif
+ private static unsafe AdbcStatusCode
StatementGetParameterSchemaDefaultImpl(CAdbcStatement* statement, CArrowSchema*
schema, CAdbcError* error)
+ {
+ return NotImplemented(error,
nameof(CAdbcDriver.StatementGetParameterSchema));
+ }
+
+#if !NET5_0_OR_GREATER
+ private static unsafe IntPtr StatementPrepareDefault =
NativeDelegate<StatementPrepare>.AsNativePointer(StatementPrepareDefaultImpl);
+#else
+ private static unsafe delegate* unmanaged<CAdbcStatement*,
CAdbcError*, AdbcStatusCode> StatementPrepareDefault =>
&StatementPrepareDefaultImpl;
+ [UnmanagedCallersOnly]
+#endif
+ private static unsafe AdbcStatusCode
StatementPrepareDefaultImpl(CAdbcStatement* statement, CAdbcError* error)
+ {
+ return NotImplemented(error, nameof(CAdbcDriver.StatementPrepare));
+ }
+
+#if !NET5_0_OR_GREATER
+ private static unsafe IntPtr StatementSetOptionDefault =
NativeDelegate<StatementSetOption>.AsNativePointer(StatementSetOptionDefaultImpl);
+#else
+ private static unsafe delegate* unmanaged<CAdbcStatement*, byte*,
byte*, CAdbcError*, AdbcStatusCode> StatementSetOptionDefault =>
&StatementSetOptionDefaultImpl;
+ [UnmanagedCallersOnly]
+#endif
+ private static unsafe AdbcStatusCode
StatementSetOptionDefaultImpl(CAdbcStatement* statement, byte* name, byte*
value, CAdbcError* error)
+ {
+ return NotImplemented(error,
nameof(CAdbcDriver.StatementSetOption));
+ }
+
+#if !NET5_0_OR_GREATER
+ private static unsafe IntPtr StatementSetSqlQueryDefault =
NativeDelegate<StatementSetSqlQuery>.AsNativePointer(StatementSetSqlQueryDefaultImpl);
+#else
+ private static unsafe delegate* unmanaged<CAdbcStatement*, byte*,
CAdbcError*, AdbcStatusCode> StatementSetSqlQueryDefault =>
&StatementSetSqlQueryDefaultImpl;
+ [UnmanagedCallersOnly]
+#endif
+ private static unsafe AdbcStatusCode
StatementSetSqlQueryDefaultImpl(CAdbcStatement* statement, byte* text,
CAdbcError* error)
+ {
+ return NotImplemented(error,
nameof(CAdbcDriver.StatementSetSqlQuery));
+ }
+
+#if !NET5_0_OR_GREATER
+ private static unsafe IntPtr StatementSetSubstraitPlanDefault =
NativeDelegate<StatementSetSubstraitPlan>.AsNativePointer(StatementSetSubstraitPlanDefaultImpl);
+#else
+ private static unsafe delegate* unmanaged<CAdbcStatement*, byte*, int,
CAdbcError*, AdbcStatusCode> StatementSetSubstraitPlanDefault =>
&StatementSetSubstraitPlanDefaultImpl;
+ [UnmanagedCallersOnly]
+#endif
+ private static unsafe AdbcStatusCode
StatementSetSubstraitPlanDefaultImpl(CAdbcStatement* statement, byte* plan, int
length, CAdbcError* error)
+ {
+ return NotImplemented(error,
nameof(CAdbcDriver.StatementSetSubstraitPlan));
+ }
+
+ #endregion
+
+ #region ADBC API Revision 1.1.0
+
+#if !NET5_0_OR_GREATER
+ private static unsafe IntPtr ErrorGetDetailCountDefault =
NativeDelegate<ErrorGetDetailCount>.AsNativePointer(ErrorGetDetailCountDefaultImpl);
+#else
+ private static unsafe delegate* unmanaged<CAdbcError*, int>
ErrorGetDetailCountDefault => &ErrorGetDetailCountDefaultImpl;
+ [UnmanagedCallersOnly]
+#endif
+ private static unsafe int ErrorGetDetailCountDefaultImpl(CAdbcError*
error)
+ {
+ return 0;
+ }
+
+#if !NET5_0_OR_GREATER
+ private static unsafe IntPtr ErrorGetDetailDefault =
NativeDelegate<ErrorGetDetail>.AsNativePointer(ErrorGetDetailDefaultImpl);
+#else
+ private static unsafe delegate* unmanaged<CAdbcError*, int,
CAdbcErrorDetail> ErrorGetDetailDefault => &ErrorGetDetailDefaultImpl;
+ [UnmanagedCallersOnly]
+#endif
+ private static unsafe CAdbcErrorDetail
ErrorGetDetailDefaultImpl(CAdbcError* error, int index)
+ {
+ return new CAdbcErrorDetail();
+ }
+
+#if !NET5_0_OR_GREATER
+ private static unsafe IntPtr ErrorFromArrayStreamDefault =
NativeDelegate<ErrorFromArrayStream>.AsNativePointer(ErrorFromArrayStreamDefaultImpl);
+#else
+ private static unsafe delegate* unmanaged<CArrowArrayStream*,
AdbcStatusCode*, CAdbcError*> ErrorFromArrayStreamDefault =>
&ErrorFromArrayStreamDefaultImpl;
+ [UnmanagedCallersOnly]
+#endif
+ private static unsafe CAdbcError*
ErrorFromArrayStreamDefaultImpl(CArrowArrayStream* stream, AdbcStatusCode*
status)
+ {
+ return null;
+ }
+
+#if !NET5_0_OR_GREATER
+ private static unsafe IntPtr DatabaseGetOptionDefault =
NativeDelegate<DatabaseGetOption>.AsNativePointer(DatabaseGetOptionDefaultImpl);
+#else
+ private static unsafe delegate* unmanaged<CAdbcDatabase*, byte*,
byte*, nint*, CAdbcError*, AdbcStatusCode> DatabaseGetOptionDefault =>
&DatabaseGetOptionDefaultImpl;
+ [UnmanagedCallersOnly]
+#endif
+ private static unsafe AdbcStatusCode
DatabaseGetOptionDefaultImpl(CAdbcDatabase* database, byte* key, byte* value,
nint* length, CAdbcError* error)
+ {
+ return NotImplemented(error,
nameof(CAdbcDriver.DatabaseGetOption));
+ }
+
+#if !NET5_0_OR_GREATER
+ private static unsafe IntPtr DatabaseGetOptionBytesDefault =
NativeDelegate<DatabaseGetOptionBytes>.AsNativePointer(DatabaseGetOptionBytesDefaultImpl);
+#else
+ private static unsafe delegate* unmanaged<CAdbcDatabase*, byte*,
byte*, nint*, CAdbcError*, AdbcStatusCode> DatabaseGetOptionBytesDefault =>
&DatabaseGetOptionBytesDefaultImpl;
+ [UnmanagedCallersOnly]
+#endif
+ private static unsafe AdbcStatusCode
DatabaseGetOptionBytesDefaultImpl(CAdbcDatabase* database, byte* key, byte*
value, nint* length, CAdbcError* error)
+ {
+ return NotImplemented(error,
nameof(CAdbcDriver.DatabaseGetOptionBytes));
+ }
+
+#if !NET5_0_OR_GREATER
+ private static unsafe IntPtr DatabaseGetOptionDoubleDefault =
NativeDelegate<DatabaseGetOptionDouble>.AsNativePointer(DatabaseGetOptionDoubleDefaultImpl);
+#else
+ private static unsafe delegate* unmanaged<CAdbcDatabase*, byte*,
double*, CAdbcError*, AdbcStatusCode> DatabaseGetOptionDoubleDefault =>
&DatabaseGetOptionDoubleDefaultImpl;
+ [UnmanagedCallersOnly]
+#endif
+ private static unsafe AdbcStatusCode
DatabaseGetOptionDoubleDefaultImpl(CAdbcDatabase* database, byte* key, double*
value, CAdbcError* error)
+ {
+ return NotImplemented(error,
nameof(CAdbcDriver.DatabaseGetOptionDouble));
+ }
+
+#if !NET5_0_OR_GREATER
+ private static unsafe IntPtr DatabaseGetOptionIntDefault =
NativeDelegate<DatabaseGetOptionInt>.AsNativePointer(DatabaseGetOptionIntDefaultImpl);
+#else
+ private static unsafe delegate* unmanaged<CAdbcDatabase*, byte*,
long*, CAdbcError*, AdbcStatusCode> DatabaseGetOptionIntDefault =>
&DatabaseGetOptionIntDefaultImpl;
+ [UnmanagedCallersOnly]
+#endif
+ private static unsafe AdbcStatusCode
DatabaseGetOptionIntDefaultImpl(CAdbcDatabase* database, byte* key, long*
value, CAdbcError* error)
+ {
+ return NotImplemented(error,
nameof(CAdbcDriver.DatabaseGetOptionInt));
+ }
+
+#if !NET5_0_OR_GREATER
+ private static unsafe IntPtr DatabaseSetOptionBytesDefault =
NativeDelegate<DatabaseSetOptionBytes>.AsNativePointer(DatabaseSetOptionBytesDefaultImpl);
+#else
+ private static unsafe delegate* unmanaged<CAdbcDatabase*, byte*,
byte*, nint, CAdbcError*, AdbcStatusCode> DatabaseSetOptionBytesDefault =>
&DatabaseSetOptionBytesDefaultImpl;
+ [UnmanagedCallersOnly]
+#endif
+ private static unsafe AdbcStatusCode
DatabaseSetOptionBytesDefaultImpl(CAdbcDatabase* database, byte* key, byte*
value, nint length, CAdbcError* error)
+ {
+ return NotImplemented(error,
nameof(CAdbcDriver.DatabaseSetOptionBytes));
+ }
+
+#if !NET5_0_OR_GREATER
+ private static unsafe IntPtr DatabaseSetOptionDoubleDefault =
NativeDelegate<DatabaseSetOptionDouble>.AsNativePointer(DatabaseSetOptionDoubleDefaultImpl);
+#else
+ private static unsafe delegate* unmanaged<CAdbcDatabase*, byte*,
double, CAdbcError*, AdbcStatusCode> DatabaseSetOptionDoubleDefault =>
&DatabaseSetOptionDoubleDefaultImpl;
+ [UnmanagedCallersOnly]
+#endif
+ private static unsafe AdbcStatusCode
DatabaseSetOptionDoubleDefaultImpl(CAdbcDatabase* database, byte* key, double
value, CAdbcError* error)
+ {
+ return NotImplemented(error,
nameof(CAdbcDriver.DatabaseSetOptionDouble));
+ }
+
+#if !NET5_0_OR_GREATER
+ private static unsafe IntPtr DatabaseSetOptionIntDefault =
NativeDelegate<DatabaseSetOptionInt>.AsNativePointer(DatabaseSetOptionIntDefaultImpl);
+#else
+ private static unsafe delegate* unmanaged<CAdbcDatabase*, byte*, long,
CAdbcError*, AdbcStatusCode> DatabaseSetOptionIntDefault =>
&DatabaseSetOptionIntDefaultImpl;
+ [UnmanagedCallersOnly]
+#endif
+ private static unsafe AdbcStatusCode
DatabaseSetOptionIntDefaultImpl(CAdbcDatabase* database, byte* key, long value,
CAdbcError* error)
+ {
+ return NotImplemented(error,
nameof(CAdbcDriver.DatabaseSetOptionInt));
+ }
+
+#if !NET5_0_OR_GREATER
+ private static unsafe IntPtr ConnectionCancelDefault =
NativeDelegate<ConnectionCancel>.AsNativePointer(ConnectionCancelDefaultImpl);
+#else
+ private static unsafe delegate* unmanaged<CAdbcConnection*,
CAdbcError*, AdbcStatusCode> ConnectionCancelDefault =>
&ConnectionCancelDefaultImpl;
+ [UnmanagedCallersOnly]
+#endif
+ private static unsafe AdbcStatusCode
ConnectionCancelDefaultImpl(CAdbcConnection* connection, CAdbcError* error)
+ {
+ return NotImplemented(error, nameof(CAdbcDriver.ConnectionCancel));
+ }
+
+#if !NET5_0_OR_GREATER
+ private static unsafe IntPtr ConnectionGetOptionDefault =
NativeDelegate<ConnectionGetOption>.AsNativePointer(ConnectionGetOptionDefaultImpl);
+#else
+ private static unsafe delegate* unmanaged<CAdbcConnection*, byte*,
byte*, nint*, CAdbcError*, AdbcStatusCode> ConnectionGetOptionDefault =>
&ConnectionGetOptionDefaultImpl;
+ [UnmanagedCallersOnly]
+#endif
+ private static unsafe AdbcStatusCode
ConnectionGetOptionDefaultImpl(CAdbcConnection* connection, byte* key, byte*
value, nint* length, CAdbcError* error)
+ {
+ return NotImplemented(error,
nameof(CAdbcDriver.ConnectionGetOption));
+ }
+
+#if !NET5_0_OR_GREATER
+ private static unsafe IntPtr ConnectionGetOptionBytesDefault =
NativeDelegate<ConnectionGetOptionBytes>.AsNativePointer(ConnectionGetOptionBytesDefaultImpl);
+#else
+ private static unsafe delegate* unmanaged<CAdbcConnection*, byte*,
byte*, nint*, CAdbcError*, AdbcStatusCode> ConnectionGetOptionBytesDefault =>
&ConnectionGetOptionBytesDefaultImpl;
+ [UnmanagedCallersOnly]
+#endif
+ private static unsafe AdbcStatusCode
ConnectionGetOptionBytesDefaultImpl(CAdbcConnection* connection, byte* key,
byte* value, nint* length, CAdbcError* error)
+ {
+ return NotImplemented(error,
nameof(CAdbcDriver.ConnectionGetOptionBytes));
+ }
+
+#if !NET5_0_OR_GREATER
+ private static unsafe IntPtr ConnectionGetOptionDoubleDefault =
NativeDelegate<ConnectionGetOptionDouble>.AsNativePointer(ConnectionGetOptionDoubleDefaultImpl);
+#else
+ private static unsafe delegate* unmanaged<CAdbcConnection*, byte*,
double*, CAdbcError*, AdbcStatusCode> ConnectionGetOptionDoubleDefault =>
&ConnectionGetOptionDoubleDefaultImpl;
+ [UnmanagedCallersOnly]
+#endif
+ private static unsafe AdbcStatusCode
ConnectionGetOptionDoubleDefaultImpl(CAdbcConnection* connection, byte* key,
double* value, CAdbcError* error)
+ {
+ return NotImplemented(error,
nameof(CAdbcDriver.ConnectionGetOptionDouble));
+ }
+
+#if !NET5_0_OR_GREATER
+ private static unsafe IntPtr ConnectionGetOptionIntDefault =
NativeDelegate<ConnectionGetOptionInt>.AsNativePointer(ConnectionGetOptionIntDefaultImpl);
+#else
+ private static unsafe delegate* unmanaged<CAdbcConnection*, byte*,
long*, CAdbcError*, AdbcStatusCode> ConnectionGetOptionIntDefault =>
&ConnectionGetOptionIntDefaultImpl;
+ [UnmanagedCallersOnly]
+#endif
+ private static unsafe AdbcStatusCode
ConnectionGetOptionIntDefaultImpl(CAdbcConnection* connection, byte* key, long*
value, CAdbcError* error)
+ {
+ return NotImplemented(error,
nameof(CAdbcDriver.ConnectionGetOptionInt));
+ }
+
+#if !NET5_0_OR_GREATER
+ private static unsafe IntPtr ConnectionGetStatisticsDefault =
NativeDelegate<ConnectionGetStatistics>.AsNativePointer(ConnectionGetStatisticsDefaultImpl);
+#else
+ private static unsafe delegate* unmanaged<CAdbcConnection*, byte*,
byte*, byte*, byte, CArrowArrayStream*, CAdbcError*, AdbcStatusCode>
ConnectionGetStatisticsDefault => &ConnectionGetStatisticsDefaultImpl;
+ [UnmanagedCallersOnly]
+#endif
+ private static unsafe AdbcStatusCode
ConnectionGetStatisticsDefaultImpl(CAdbcConnection* connection, byte* catalog,
byte* db_schema, byte* table_name, byte approximate, CArrowArrayStream* stream,
CAdbcError* error)
+ {
+ return NotImplemented(error,
nameof(CAdbcDriver.ConnectionGetStatistics));
+ }
+
+#if !NET5_0_OR_GREATER
+ private static unsafe IntPtr ConnectionGetStatisticNamesDefault =
NativeDelegate<ConnectionGetStatisticNames>.AsNativePointer(ConnectionGetStatisticNamesDefaultImpl);
+#else
+ private static unsafe delegate* unmanaged<CAdbcConnection*,
CArrowArrayStream*, CAdbcError*, AdbcStatusCode>
ConnectionGetStatisticNamesDefault => &ConnectionGetStatisticNamesDefaultImpl;
+ [UnmanagedCallersOnly]
+#endif
+ private static unsafe AdbcStatusCode
ConnectionGetStatisticNamesDefaultImpl(CAdbcConnection* connection,
CArrowArrayStream* stream, CAdbcError* error)
+ {
+ return NotImplemented(error,
nameof(CAdbcDriver.ConnectionGetStatisticNames));
+ }
+
+#if !NET5_0_OR_GREATER
+ private static unsafe IntPtr ConnectionSetOptionBytesDefault =
NativeDelegate<ConnectionSetOptionBytes>.AsNativePointer(ConnectionSetOptionBytesDefaultImpl);
+#else
+ private static unsafe delegate* unmanaged<CAdbcConnection*, byte*,
byte*, nint, CAdbcError*, AdbcStatusCode> ConnectionSetOptionBytesDefault =>
&ConnectionSetOptionBytesDefaultImpl;
+ [UnmanagedCallersOnly]
+#endif
+ private static unsafe AdbcStatusCode
ConnectionSetOptionBytesDefaultImpl(CAdbcConnection* connection, byte* key,
byte* value, nint length, CAdbcError* error)
+ {
+ return NotImplemented(error,
nameof(CAdbcDriver.ConnectionSetOptionBytes));
+ }
+
+#if !NET5_0_OR_GREATER
+ private static unsafe IntPtr ConnectionSetOptionDoubleDefault =
NativeDelegate<ConnectionSetOptionDouble>.AsNativePointer(ConnectionSetOptionDoubleDefaultImpl);
+#else
+ private static unsafe delegate* unmanaged<CAdbcConnection*, byte*,
double, CAdbcError*, AdbcStatusCode> ConnectionSetOptionDoubleDefault =>
&ConnectionSetOptionDoubleDefaultImpl;
+ [UnmanagedCallersOnly]
+#endif
+ private static unsafe AdbcStatusCode
ConnectionSetOptionDoubleDefaultImpl(CAdbcConnection* connection, byte* key,
double value, CAdbcError* error)
+ {
+ return NotImplemented(error,
nameof(CAdbcDriver.ConnectionSetOptionDouble));
+ }
+
+#if !NET5_0_OR_GREATER
+ private static unsafe IntPtr ConnectionSetOptionIntDefault =
NativeDelegate<ConnectionSetOptionInt>.AsNativePointer(ConnectionSetOptionIntDefaultImpl);
+#else
+ private static unsafe delegate* unmanaged<CAdbcConnection*, byte*,
long, CAdbcError*, AdbcStatusCode> ConnectionSetOptionIntDefault =>
&ConnectionSetOptionIntDefaultImpl;
+ [UnmanagedCallersOnly]
+#endif
+ private static unsafe AdbcStatusCode
ConnectionSetOptionIntDefaultImpl(CAdbcConnection* connection, byte* key, long
value, CAdbcError* error)
+ {
+ return NotImplemented(error,
nameof(CAdbcDriver.ConnectionSetOptionInt));
+ }
+
+#if !NET5_0_OR_GREATER
+ private static unsafe IntPtr StatementCancelDefault =
NativeDelegate<StatementCancel>.AsNativePointer(StatementCancelDefaultImpl);
+#else
+ private static unsafe delegate* unmanaged<CAdbcStatement*,
CAdbcError*, AdbcStatusCode> StatementCancelDefault =>
&StatementCancelDefaultImpl;
+ [UnmanagedCallersOnly]
+#endif
+ private static unsafe AdbcStatusCode
StatementCancelDefaultImpl(CAdbcStatement* statement, CAdbcError* error)
+ {
+ return NotImplemented(error, nameof(CAdbcDriver.StatementCancel));
+ }
+
+#if !NET5_0_OR_GREATER
+ private static unsafe IntPtr StatementExecuteSchemaDefault =
NativeDelegate<StatementExecuteSchema>.AsNativePointer(StatementExecuteSchemaDefaultImpl);
+#else
+ private static unsafe delegate* unmanaged<CAdbcStatement*,
CArrowSchema*, CAdbcError*, AdbcStatusCode> StatementExecuteSchemaDefault =>
&StatementExecuteSchemaDefaultImpl;
+ [UnmanagedCallersOnly]
+#endif
+ private static unsafe AdbcStatusCode
StatementExecuteSchemaDefaultImpl(CAdbcStatement* statement, CArrowSchema*
schema, CAdbcError* error)
+ {
+ return NotImplemented(error,
nameof(CAdbcDriver.StatementExecuteSchema));
+ }
+
+#if !NET5_0_OR_GREATER
+ private static unsafe IntPtr StatementGetOptionDefault =
NativeDelegate<StatementGetOption>.AsNativePointer(StatementGetOptionDefaultImpl);
+#else
+ private static unsafe delegate* unmanaged<CAdbcStatement*, byte*,
byte*, nint*, CAdbcError*, AdbcStatusCode> StatementGetOptionDefault =>
&StatementGetOptionDefaultImpl;
+ [UnmanagedCallersOnly]
+#endif
+ private static unsafe AdbcStatusCode
StatementGetOptionDefaultImpl(CAdbcStatement* statement, byte* key, byte*
value, nint* length, CAdbcError* error)
+ {
+ return NotImplemented(error,
nameof(CAdbcDriver.StatementGetOption));
+ }
+
+#if !NET5_0_OR_GREATER
+ private static unsafe IntPtr StatementGetOptionBytesDefault =
NativeDelegate<StatementGetOptionBytes>.AsNativePointer(StatementGetOptionBytesDefaultImpl);
+#else
+ private static unsafe delegate* unmanaged<CAdbcStatement*, byte*,
byte*, nint*, CAdbcError*, AdbcStatusCode> StatementGetOptionBytesDefault =>
&StatementGetOptionBytesDefaultImpl;
+ [UnmanagedCallersOnly]
+#endif
+ private static unsafe AdbcStatusCode
StatementGetOptionBytesDefaultImpl(CAdbcStatement* statement, byte* key, byte*
value, nint* length, CAdbcError* error)
+ {
+ return NotImplemented(error,
nameof(CAdbcDriver.StatementGetOptionBytes));
+ }
+
+#if !NET5_0_OR_GREATER
+ private static unsafe IntPtr StatementGetOptionDoubleDefault =
NativeDelegate<StatementGetOptionDouble>.AsNativePointer(StatementGetOptionDoubleDefaultImpl);
+#else
+ private static unsafe delegate* unmanaged<CAdbcStatement*, byte*,
double*, CAdbcError*, AdbcStatusCode> StatementGetOptionDoubleDefault =>
&StatementGetOptionDoubleDefaultImpl;
+ [UnmanagedCallersOnly]
+#endif
+ private static unsafe AdbcStatusCode
StatementGetOptionDoubleDefaultImpl(CAdbcStatement* statement, byte* key,
double* value, CAdbcError* error)
+ {
+ return NotImplemented(error,
nameof(CAdbcDriver.StatementGetOptionDouble));
+ }
+
+#if !NET5_0_OR_GREATER
+ private static unsafe IntPtr StatementGetOptionIntDefault =
NativeDelegate<StatementGetOptionInt>.AsNativePointer(StatementGetOptionIntDefaultImpl);
+#else
+ private static unsafe delegate* unmanaged<CAdbcStatement*, byte*,
long*, CAdbcError*, AdbcStatusCode> StatementGetOptionIntDefault =>
&StatementGetOptionIntDefaultImpl;
+ [UnmanagedCallersOnly]
+#endif
+ private static unsafe AdbcStatusCode
StatementGetOptionIntDefaultImpl(CAdbcStatement* statement, byte* key, long*
value, CAdbcError* error)
+ {
+ return NotImplemented(error,
nameof(CAdbcDriver.StatementGetOptionInt));
+ }
+
+#if !NET5_0_OR_GREATER
+ private static unsafe IntPtr StatementSetOptionBytesDefault =
NativeDelegate<StatementSetOptionBytes>.AsNativePointer(StatementSetOptionBytesDefaultImpl);
+#else
+ private static unsafe delegate* unmanaged<CAdbcStatement*, byte*,
byte*, nint, CAdbcError*, AdbcStatusCode> StatementSetOptionBytesDefault =>
&StatementSetOptionBytesDefaultImpl;
+ [UnmanagedCallersOnly]
+#endif
+ private static unsafe AdbcStatusCode
StatementSetOptionBytesDefaultImpl(CAdbcStatement* statement, byte* key, byte*
value, nint length, CAdbcError* error)
+ {
+ return NotImplemented(error,
nameof(CAdbcDriver.StatementSetOptionBytes));
+ }
+
+#if !NET5_0_OR_GREATER
+ private static unsafe IntPtr StatementSetOptionDoubleDefault =
NativeDelegate<StatementSetOptionDouble>.AsNativePointer(StatementSetOptionDoubleDefaultImpl);
+#else
+ private static unsafe delegate* unmanaged<CAdbcStatement*, byte*,
double, CAdbcError*, AdbcStatusCode> StatementSetOptionDoubleDefault =>
&StatementSetOptionDoubleDefaultImpl;
+ [UnmanagedCallersOnly]
+#endif
+ private static unsafe AdbcStatusCode
StatementSetOptionDoubleDefaultImpl(CAdbcStatement* statement, byte* key,
double value, CAdbcError* error)
+ {
+ return NotImplemented(error,
nameof(CAdbcDriver.StatementSetOptionDouble));
+ }
+
+#if !NET5_0_OR_GREATER
+ private static unsafe IntPtr StatementSetOptionIntDefault =
NativeDelegate<StatementSetOptionInt>.AsNativePointer(StatementSetOptionIntDefaultImpl);
+#else
+ private static unsafe delegate* unmanaged<CAdbcStatement*, byte*,
long, CAdbcError*, AdbcStatusCode> StatementSetOptionIntDefault =>
&StatementSetOptionIntDefaultImpl;
+ [UnmanagedCallersOnly]
+#endif
+ private static unsafe AdbcStatusCode
StatementSetOptionIntDefaultImpl(CAdbcStatement* statement, byte* key, long
value, CAdbcError* error)
+ {
+ return NotImplemented(error,
nameof(CAdbcDriver.StatementSetOptionInt));
+ }
+
+ #endregion
+ }
+}
diff --git a/csharp/src/Apache.Arrow.Adbc/C/CAdbcDriverImporter.cs
b/csharp/src/Apache.Arrow.Adbc/C/CAdbcDriverImporter.cs
index 650d99e9d..0083d43fc 100644
--- a/csharp/src/Apache.Arrow.Adbc/C/CAdbcDriverImporter.cs
+++ b/csharp/src/Apache.Arrow.Adbc/C/CAdbcDriverImporter.cs
@@ -33,10 +33,9 @@ namespace Apache.Arrow.Adbc.C
/// <summary>
/// Class for working with imported drivers from files
/// </summary>
- public static class CAdbcDriverImporter
+ public static partial class CAdbcDriverImporter
{
private const string driverInit = "AdbcDriverInit";
- private const int ADBC_VERSION_1_0_0 = 1000000;
/// <summary>
/// Loads an <see cref="AdbcDriver"/> from the file system.
@@ -73,13 +72,23 @@ namespace Apache.Arrow.Adbc.C
AdbcDriverInit init =
Marshal.GetDelegateForFunctionPointer<AdbcDriverInit>(export);
CAdbcDriver driver = new CAdbcDriver();
+ int version;
using (CallHelper caller = new CallHelper())
{
- caller.Call(init, ADBC_VERSION_1_0_0, ref driver);
+ try
+ {
+ caller.Call(init, AdbcVersion.Version_1_1_0, ref
driver);
+ version = AdbcVersion.Version_1_1_0;
+ }
+ catch (AdbcException e) when (e.Status ==
AdbcStatusCode.NotImplemented)
+ {
+ caller.Call(init, AdbcVersion.Version_1_0_0, ref
driver);
+ version = AdbcVersion.Version_1_0_0;
+ }
- ValidateDriver(ref driver, ADBC_VERSION_1_0_0);
+ ValidateDriver(ref driver, version);
- ImportedAdbcDriver result = new
ImportedAdbcDriver(library, driver);
+ ImportedAdbcDriver result = new
ImportedAdbcDriver(library, driver, version);
library = IntPtr.Zero;
return result;
}
@@ -125,193 +134,41 @@ namespace Apache.Arrow.Adbc.C
if (driver.StatementSetOption == empty) {
driver.StatementSetOption = StatementSetOptionDefault; }
if (driver.StatementSetSqlQuery == empty) {
driver.StatementSetSqlQuery = StatementSetSqlQueryDefault; }
if (driver.StatementSetSubstraitPlan == empty) {
driver.StatementSetSubstraitPlan = StatementSetSubstraitPlanDefault; }
- }
-#if !NET5_0_OR_GREATER
- private static unsafe IntPtr DatabaseSetOptionDefault =
NativeDelegate<DatabaseSetOption>.AsNativePointer(DatabaseSetOptionDefaultImpl);
-#else
- private static unsafe delegate* unmanaged<CAdbcDatabase*, byte*,
byte*, CAdbcError*, AdbcStatusCode> DatabaseSetOptionDefault =>
&DatabaseSetOptionDefaultImpl;
- [UnmanagedCallersOnly]
-#endif
- private static unsafe AdbcStatusCode
DatabaseSetOptionDefaultImpl(CAdbcDatabase* database, byte* key, byte* value,
CAdbcError* error)
- {
- return NotImplemented(error,
nameof(CAdbcDriver.DatabaseSetOption));
- }
-
-#if !NET5_0_OR_GREATER
- private static unsafe IntPtr ConnectionCommitDefault =
NativeDelegate<ConnectionCommit>.AsNativePointer(ConnectionCommitDefaultImpl);
-#else
- private static unsafe delegate* unmanaged<CAdbcConnection*,
CAdbcError*, AdbcStatusCode> ConnectionCommitDefault =>
&ConnectionCommitDefaultImpl;
- [UnmanagedCallersOnly]
-#endif
- private static unsafe AdbcStatusCode
ConnectionCommitDefaultImpl(CAdbcConnection* connection, CAdbcError* error)
- {
- return NotImplemented(error, nameof(CAdbcDriver.ConnectionCommit));
- }
-
-#if !NET5_0_OR_GREATER
- private static unsafe IntPtr ConnectionGetInfoDefault =
NativeDelegate<ConnectionGetInfo>.AsNativePointer(ConnectionGetInfoDefaultImpl);
-#else
- private static unsafe delegate* unmanaged<CAdbcConnection*, int*, int,
CArrowArrayStream*, CAdbcError*, AdbcStatusCode> ConnectionGetInfoDefault =>
&ConnectionGetInfoDefaultImpl;
- [UnmanagedCallersOnly]
-#endif
- private static unsafe AdbcStatusCode
ConnectionGetInfoDefaultImpl(CAdbcConnection* connection, int* info_codes, int
info_codes_length, CArrowArrayStream* stream, CAdbcError* error)
- {
- return NotImplemented(error,
nameof(CAdbcDriver.ConnectionGetInfo));
- }
-
-#if !NET5_0_OR_GREATER
- private static unsafe IntPtr ConnectionGetObjectsDefault =
NativeDelegate<ConnectionGetObjects>.AsNativePointer(ConnectionGetObjectsDefaultImpl);
-#else
- private static unsafe delegate* unmanaged<CAdbcConnection*, int,
byte*, byte*, byte*, byte**, byte*, CArrowArrayStream*, CAdbcError*,
AdbcStatusCode> ConnectionGetObjectsDefault => &ConnectionGetObjectsDefaultImpl;
- [UnmanagedCallersOnly]
-#endif
- private static unsafe AdbcStatusCode
ConnectionGetObjectsDefaultImpl(CAdbcConnection* connection, int depth, byte*
catalog, byte* db_schema, byte* table_name, byte** table_type, byte*
column_name, CArrowArrayStream* stream, CAdbcError* error)
- {
- return NotImplemented(error,
nameof(CAdbcDriver.ConnectionGetObjects));
- }
-
-#if !NET5_0_OR_GREATER
- private static unsafe IntPtr ConnectionGetTableSchemaDefault =
NativeDelegate<ConnectionGetTableSchema>.AsNativePointer(ConnectionGetTableSchemaDefaultImpl);
-#else
- private static unsafe delegate* unmanaged<CAdbcConnection*, byte*,
byte*, byte*, CArrowSchema*, CAdbcError*, AdbcStatusCode>
ConnectionGetTableSchemaDefault => &ConnectionGetTableSchemaDefaultImpl;
- [UnmanagedCallersOnly]
-#endif
- private static unsafe AdbcStatusCode
ConnectionGetTableSchemaDefaultImpl(CAdbcConnection* connection, byte* catalog,
byte* db_schema, byte* table_name, CArrowSchema* schema, CAdbcError* error)
- {
- return NotImplemented(error,
nameof(CAdbcDriver.ConnectionGetTableSchema));
- }
-
-#if !NET5_0_OR_GREATER
- private static unsafe IntPtr ConnectionGetTableTypesDefault =
NativeDelegate<ConnectionGetTableTypes>.AsNativePointer(ConnectionGetTableTypesDefaultImpl);
-#else
- private static unsafe delegate* unmanaged<CAdbcConnection*,
CArrowArrayStream*, CAdbcError*, AdbcStatusCode> ConnectionGetTableTypesDefault
=> &ConnectionGetTableTypesDefaultImpl;
- [UnmanagedCallersOnly]
-#endif
- private static unsafe AdbcStatusCode
ConnectionGetTableTypesDefaultImpl(CAdbcConnection* connection,
CArrowArrayStream* stream, CAdbcError* error)
- {
- return NotImplemented(error,
nameof(CAdbcDriver.ConnectionGetTableTypes));
- }
-
-#if !NET5_0_OR_GREATER
- private static unsafe IntPtr ConnectionReadPartitionDefault =
NativeDelegate<ConnectionReadPartition>.AsNativePointer(ConnectionReadPartitionDefaultImpl);
-#else
- private static unsafe delegate* unmanaged<CAdbcConnection*, byte*,
int, CArrowArrayStream*, CAdbcError*, AdbcStatusCode>
ConnectionReadPartitionDefault => &ConnectionReadPartitionDefaultImpl;
- [UnmanagedCallersOnly]
-#endif
- private static unsafe AdbcStatusCode
ConnectionReadPartitionDefaultImpl(CAdbcConnection* connection, byte*
serialized_partition, int serialized_length, CArrowArrayStream* stream,
CAdbcError* error)
- {
- return NotImplemented(error,
nameof(CAdbcDriver.ConnectionReadPartition));
- }
-
-#if !NET5_0_OR_GREATER
- private static unsafe IntPtr ConnectionRollbackDefault =
NativeDelegate<ConnectionRollback>.AsNativePointer(ConnectionRollbackDefaultImpl);
-#else
- private static unsafe delegate* unmanaged<CAdbcConnection*,
CAdbcError*, AdbcStatusCode> ConnectionRollbackDefault =>
&ConnectionRollbackDefaultImpl;
- [UnmanagedCallersOnly]
-#endif
- private static unsafe AdbcStatusCode
ConnectionRollbackDefaultImpl(CAdbcConnection* connection, CAdbcError* error)
- {
- return NotImplemented(error,
nameof(CAdbcDriver.ConnectionRollback));
- }
-
-#if !NET5_0_OR_GREATER
- private static unsafe IntPtr ConnectionSetOptionDefault =
NativeDelegate<ConnectionSetOption>.AsNativePointer(ConnectionSetOptionDefaultImpl);
-#else
- private static unsafe delegate* unmanaged<CAdbcConnection*, byte*,
byte*, CAdbcError*, AdbcStatusCode> ConnectionSetOptionDefault =>
&ConnectionSetOptionDefaultImpl;
- [UnmanagedCallersOnly]
-#endif
- private static unsafe AdbcStatusCode
ConnectionSetOptionDefaultImpl(CAdbcConnection* connection, byte* name, byte*
value, CAdbcError* error)
- {
- return NotImplemented(error,
nameof(CAdbcDriver.ConnectionSetOption));
- }
-
-#if !NET5_0_OR_GREATER
- private static unsafe IntPtr StatementExecutePartitionsDefault =
NativeDelegate<StatementExecutePartitions>.AsNativePointer(StatementExecutePartitionsDefaultImpl);
-#else
- private static unsafe delegate* unmanaged<CAdbcStatement*,
CArrowSchema*, CAdbcPartitions*, long*, CAdbcError*, AdbcStatusCode>
StatementExecutePartitionsDefault => &StatementExecutePartitionsDefaultImpl;
- [UnmanagedCallersOnly]
-#endif
- private static unsafe AdbcStatusCode
StatementExecutePartitionsDefaultImpl(CAdbcStatement* statement, CArrowSchema*
schema, CAdbcPartitions* partitions, long* rows, CAdbcError* error)
- {
- return NotImplemented(error,
nameof(CAdbcDriver.StatementExecutePartitions));
- }
-
-#if !NET5_0_OR_GREATER
- private static unsafe IntPtr StatementBindDefault =
NativeDelegate<StatementBind>.AsNativePointer(StatementBindDefaultImpl);
-#else
- private static unsafe delegate* unmanaged<CAdbcStatement*,
CArrowArray*, CArrowSchema*, CAdbcError*, AdbcStatusCode> StatementBindDefault
=> &StatementBindDefaultImpl;
- [UnmanagedCallersOnly]
-#endif
- private static unsafe AdbcStatusCode
StatementBindDefaultImpl(CAdbcStatement* statement, CArrowArray* array,
CArrowSchema* schema, CAdbcError* error)
- {
- return NotImplemented(error, nameof(CAdbcDriver.StatementBind));
- }
-
-#if !NET5_0_OR_GREATER
- private static unsafe IntPtr StatementBindStreamDefault =
NativeDelegate<StatementBindStream>.AsNativePointer(StatementBindStreamDefaultImpl);
-#else
- private static unsafe delegate* unmanaged<CAdbcStatement*,
CArrowArrayStream*, CAdbcError*, AdbcStatusCode> StatementBindStreamDefault =>
&StatementBindStreamDefaultImpl;
- [UnmanagedCallersOnly]
-#endif
- private static unsafe AdbcStatusCode
StatementBindStreamDefaultImpl(CAdbcStatement* statement, CArrowArrayStream*
stream, CAdbcError* error)
- {
- return NotImplemented(error,
nameof(CAdbcDriver.StatementBindStream));
- }
-
-#if !NET5_0_OR_GREATER
- private static unsafe IntPtr StatementGetParameterSchemaDefault =
NativeDelegate<StatementGetParameterSchema>.AsNativePointer(StatementGetParameterSchemaDefaultImpl);
-#else
- private static unsafe delegate* unmanaged<CAdbcStatement*,
CArrowSchema*, CAdbcError*, AdbcStatusCode> StatementGetParameterSchemaDefault
=> &StatementGetParameterSchemaDefaultImpl;
- [UnmanagedCallersOnly]
-#endif
- private static unsafe AdbcStatusCode
StatementGetParameterSchemaDefaultImpl(CAdbcStatement* statement, CArrowSchema*
schema, CAdbcError* error)
- {
- return NotImplemented(error,
nameof(CAdbcDriver.StatementGetParameterSchema));
- }
-
-#if !NET5_0_OR_GREATER
- private static unsafe IntPtr StatementPrepareDefault =
NativeDelegate<StatementPrepare>.AsNativePointer(StatementPrepareDefaultImpl);
-#else
- private static unsafe delegate* unmanaged<CAdbcStatement*,
CAdbcError*, AdbcStatusCode> StatementPrepareDefault =>
&StatementPrepareDefaultImpl;
- [UnmanagedCallersOnly]
-#endif
- private static unsafe AdbcStatusCode
StatementPrepareDefaultImpl(CAdbcStatement* statement, CAdbcError* error)
- {
- return NotImplemented(error, nameof(CAdbcDriver.StatementPrepare));
- }
-
-#if !NET5_0_OR_GREATER
- private static unsafe IntPtr StatementSetOptionDefault =
NativeDelegate<StatementSetOption>.AsNativePointer(StatementSetOptionDefaultImpl);
-#else
- private static unsafe delegate* unmanaged<CAdbcStatement*, byte*,
byte*, CAdbcError*, AdbcStatusCode> StatementSetOptionDefault =>
&StatementSetOptionDefaultImpl;
- [UnmanagedCallersOnly]
-#endif
- private static unsafe AdbcStatusCode
StatementSetOptionDefaultImpl(CAdbcStatement* statement, byte* name, byte*
value, CAdbcError* error)
- {
- return NotImplemented(error,
nameof(CAdbcDriver.StatementSetOption));
- }
-
-#if !NET5_0_OR_GREATER
- private static unsafe IntPtr StatementSetSqlQueryDefault =
NativeDelegate<StatementSetSqlQuery>.AsNativePointer(StatementSetSqlQueryDefaultImpl);
-#else
- private static unsafe delegate* unmanaged<CAdbcStatement*, byte*,
CAdbcError*, AdbcStatusCode> StatementSetSqlQueryDefault =>
&StatementSetSqlQueryDefaultImpl;
- [UnmanagedCallersOnly]
-#endif
- private static unsafe AdbcStatusCode
StatementSetSqlQueryDefaultImpl(CAdbcStatement* statement, byte* text,
CAdbcError* error)
- {
- return NotImplemented(error,
nameof(CAdbcDriver.StatementSetSqlQuery));
- }
-
-#if !NET5_0_OR_GREATER
- private static unsafe IntPtr StatementSetSubstraitPlanDefault =
NativeDelegate<StatementSetSubstraitPlan>.AsNativePointer(StatementSetSubstraitPlanDefaultImpl);
-#else
- private static unsafe delegate* unmanaged<CAdbcStatement*, byte*, int,
CAdbcError*, AdbcStatusCode> StatementSetSubstraitPlanDefault =>
&StatementSetSubstraitPlanDefaultImpl;
- [UnmanagedCallersOnly]
-#endif
- private static unsafe AdbcStatusCode
StatementSetSubstraitPlanDefaultImpl(CAdbcStatement* statement, byte* plan, int
length, CAdbcError* error)
- {
- return NotImplemented(error,
nameof(CAdbcDriver.StatementSetSubstraitPlan));
+ if (version < AdbcVersion.Version_1_1_0) { return; }
+
+ if (driver.ErrorGetDetailCount == empty) {
driver.ErrorGetDetailCount = ErrorGetDetailCountDefault; }
+ if (driver.ErrorGetDetail == empty) { driver.ErrorGetDetail =
ErrorGetDetailDefault; }
+ if (driver.ErrorFromArrayStream == empty) {
driver.ErrorFromArrayStream = ErrorFromArrayStreamDefault; }
+
+ if (driver.DatabaseGetOption == empty) { driver.DatabaseGetOption
= DatabaseGetOptionDefault; }
+ if (driver.DatabaseGetOptionBytes == empty) {
driver.DatabaseGetOptionBytes = DatabaseGetOptionBytesDefault; }
+ if (driver.DatabaseGetOptionDouble == empty) {
driver.DatabaseGetOptionDouble = DatabaseGetOptionDoubleDefault; }
+ if (driver.DatabaseGetOptionInt == empty) {
driver.DatabaseGetOptionInt = DatabaseGetOptionIntDefault; }
+ if (driver.DatabaseSetOptionBytes == empty) {
driver.DatabaseSetOptionBytes = DatabaseSetOptionBytesDefault; }
+ if (driver.DatabaseSetOptionDouble == empty) {
driver.DatabaseSetOptionDouble = DatabaseSetOptionDoubleDefault; }
+ if (driver.DatabaseSetOptionInt == empty) {
driver.DatabaseSetOptionInt = DatabaseSetOptionIntDefault; }
+
+ if (driver.ConnectionCancel == empty) { driver.ConnectionCancel =
ConnectionCancelDefault; }
+ if (driver.ConnectionGetOption == empty) {
driver.ConnectionGetOption = ConnectionGetOptionDefault; }
+ if (driver.ConnectionGetOptionBytes == empty) {
driver.ConnectionGetOptionBytes = ConnectionGetOptionBytesDefault; }
+ if (driver.ConnectionGetOptionDouble == empty) {
driver.ConnectionGetOptionDouble = ConnectionGetOptionDoubleDefault; }
+ if (driver.ConnectionGetOptionInt == empty) {
driver.ConnectionGetOptionInt = ConnectionGetOptionIntDefault; }
+ if (driver.ConnectionGetStatistics == empty) {
driver.ConnectionGetStatistics = ConnectionGetStatisticsDefault; }
+ if (driver.ConnectionGetStatisticNames == empty) {
driver.ConnectionGetStatisticNames = ConnectionGetStatisticNamesDefault; }
+ if (driver.ConnectionSetOptionBytes == empty) {
driver.ConnectionSetOptionBytes = ConnectionSetOptionBytesDefault; }
+ if (driver.ConnectionSetOptionDouble == empty) {
driver.ConnectionSetOptionDouble = ConnectionSetOptionDoubleDefault; }
+ if (driver.ConnectionSetOptionInt == empty) {
driver.ConnectionSetOptionInt = ConnectionSetOptionIntDefault; }
+
+ if (driver.StatementCancel == empty) { driver.StatementCancel =
StatementCancelDefault; }
+ if (driver.StatementExecuteSchema == empty) {
driver.StatementExecuteSchema = StatementExecuteSchemaDefault; }
+ if (driver.StatementGetOption == empty) {
driver.StatementGetOption = StatementGetOptionDefault; }
+ if (driver.StatementGetOptionBytes == empty) {
driver.StatementGetOptionBytes = StatementGetOptionBytesDefault; }
+ if (driver.StatementGetOptionDouble == empty) {
driver.StatementGetOptionDouble = StatementGetOptionDoubleDefault; }
+ if (driver.StatementGetOptionInt == empty) {
driver.StatementGetOptionInt = StatementGetOptionIntDefault; }
+ if (driver.StatementSetOptionBytes == empty) {
driver.StatementSetOptionBytes = StatementSetOptionBytesDefault; }
+ if (driver.StatementSetOptionDouble == empty) {
driver.StatementSetOptionDouble = StatementSetOptionDoubleDefault; }
+ if (driver.StatementSetOptionInt == empty) {
driver.StatementSetOptionInt = StatementSetOptionIntDefault; }
}
private static unsafe AdbcStatusCode NotImplemented(CAdbcError* error,
string name)
@@ -340,13 +197,15 @@ namespace Apache.Arrow.Adbc.C
{
private IntPtr _library;
private CAdbcDriver _nativeDriver;
+ private int _version;
private int _references;
private bool _disposed;
- public ImportedAdbcDriver(IntPtr library, CAdbcDriver nativeDriver)
+ public ImportedAdbcDriver(IntPtr library, CAdbcDriver
nativeDriver, int version)
{
_library = library;
_nativeDriver = nativeDriver;
+ _version = version;
_references = 1;
}
@@ -364,6 +223,17 @@ namespace Apache.Arrow.Adbc.C
}
}
+ public override int DriverVersion => _version;
+
+ internal ref CAdbcDriver Driver11
+ {
+ get
+ {
+ if (_version < AdbcVersion.Version_1_1_0) { throw
AdbcException.NotImplemented("This driver does not support ADBC 1.1.0"); }
+ return ref Driver;
+ }
+ }
+
internal unsafe ref CAdbcDriver DriverUnsafe
{
get
@@ -396,12 +266,7 @@ namespace Apache.Arrow.Adbc.C
}
}
- /// <summary>
- /// Opens a database
- /// </summary>
- /// <param name="parameters">
- /// Parameters to use when calling DatabaseNew.
- /// </param>
+ /// <inheritdoc />
public unsafe override AdbcDatabase
Open(IReadOnlyDictionary<string, string> parameters)
{
if (parameters == null) throw new
ArgumentNullException(nameof(parameters));
@@ -438,6 +303,33 @@ namespace Apache.Arrow.Adbc.C
return result;
}
+ /// <inheritdoc />
+ public unsafe override AdbcDatabase
Open(IReadOnlyDictionary<string, object> parameters)
+ {
+ if (parameters == null) throw new
ArgumentNullException(nameof(parameters));
+
+ CAdbcDatabase nativeDatabase = new CAdbcDatabase();
+ using (CallHelper caller = new CallHelper())
+ {
+ caller.Call(Driver.DatabaseNew, ref nativeDatabase);
+
+ foreach (KeyValuePair<string, object> pair in parameters)
+ {
+ switch (pair.Value)
+ {
+ case int intValue:
+ case long longValue:
+ // TODO!
+ break;
+ }
+ }
+
+ caller.Call(Driver.DatabaseInit, ref nativeDatabase);
+ }
+
+ return new ImportedAdbcDatabase(this, nativeDatabase);
+ }
+
public unsafe override void Dispose()
{
Dispose(true);
@@ -604,7 +496,7 @@ namespace Apache.Arrow.Adbc.C
get => _autoCommit ?? throw AdbcException.NotImplemented("no
value has been set for AutoCommit");
set
{
- SetOption(AdbcOptions.Autocommit,
AdbcOptions.GetEnabled(value));
+ SetOption(AdbcOptions.Connection.Autocommit,
AdbcOptions.GetEnabled(value));
_autoCommit = value;
}
}
@@ -614,7 +506,7 @@ namespace Apache.Arrow.Adbc.C
get => _isolationLevel ?? IsolationLevel.Default;
set
{
- SetOption(AdbcOptions.IsolationLevel,
AdbcOptions.GetIsolationLevel(value));
+ SetOption(AdbcOptions.Connection.IsolationLevel,
AdbcOptions.GetIsolationLevel(value));
_isolationLevel = value;
}
}
@@ -624,7 +516,7 @@ namespace Apache.Arrow.Adbc.C
get => _readOnly ?? throw AdbcException.NotImplemented("no
value has been set for ReadOnly");
set
{
- SetOption(AdbcOptions.ReadOnly,
AdbcOptions.GetEnabled(value));
+ SetOption(AdbcOptions.Connection.ReadOnly,
AdbcOptions.GetEnabled(value));
_readOnly = value;
}
}
@@ -875,6 +767,15 @@ namespace Apache.Arrow.Adbc.C
}
}
+ private unsafe ref CAdbcDriver Driver11
+ {
+ get
+ {
+ if (_disposed) { throw new
ObjectDisposedException(nameof(ImportedAdbcStatement)); }
+ return ref _driver.Driver11;
+ }
+ }
+
public unsafe override byte[]? SubstraitPlan
{
get => _substraitPlan;
@@ -969,6 +870,31 @@ namespace Apache.Arrow.Adbc.C
}
}
+ public override unsafe Schema ExecuteSchema()
+ {
+ if (SqlQuery != null)
+ {
+ // TODO: Consider moving this to the setter
+ SetSqlQuery(SqlQuery);
+ }
+
+ using (CallHelper caller = new CallHelper())
+ {
+ fixed (CAdbcStatement* statement = &_nativeStatement)
+ {
+ caller.TranslateCode(
+#if NET5_0_OR_GREATER
+ Driver11.StatementExecuteSchema
+#else
+
Marshal.GetDelegateForFunctionPointer<StatementExecuteSchema>(Driver11.StatementExecuteSchema)
+#endif
+ (statement, caller.CreateSchema(),
&caller._error));
+
+ return caller.ImportSchema();
+ }
+ }
+ }
+
public unsafe override UpdateResult ExecuteUpdate()
{
if (SqlQuery != null)
@@ -1156,6 +1082,62 @@ namespace Apache.Arrow.Adbc.C
}
}
+ /// <summary>
+ /// Assists with fetching values of arbitrary length
+ /// </summary>
+ private struct GetBufferHelper : IDisposable
+ {
+ const int DefaultLength = 256;
+
+ private IntPtr _buffer;
+ public IntPtr Length;
+
+ public GetBufferHelper()
+ {
+ Length = (IntPtr)DefaultLength;
+ _buffer = Marshal.AllocHGlobal(Length);
+ }
+
+ public bool RequiresRetry()
+ {
+ if (checked((uint)Length) <= DefaultLength)
+ {
+ return false;
+ }
+
+ Marshal.FreeHGlobal(_buffer);
+ _buffer = IntPtr.Zero;
+ _buffer = Marshal.AllocHGlobal(Length);
+ return true;
+ }
+
+ public unsafe string AsString()
+ {
+ return Encoding.UTF8.GetString((byte*)_buffer,
checked((int)Length));
+ }
+
+ public unsafe byte[] AsBytes()
+ {
+ byte[] result = new byte[checked((int)Length)];
+ fixed (byte* ptr = result)
+ {
+ Buffer.MemoryCopy((byte*)_buffer, ptr, result.Length,
result.Length);
+ }
+ return result;
+ }
+
+ public static unsafe implicit operator byte*(GetBufferHelper s) {
return (byte*)s._buffer; }
+
+ public void Dispose()
+ {
+ if (_buffer != IntPtr.Zero)
+ {
+ Marshal.FreeHGlobal(_buffer);
+ _buffer = IntPtr.Zero;
+ }
+ }
+ }
+
/// <summary>
/// Assists with delegate calls and handling error codes
/// </summary>
@@ -1276,6 +1258,9 @@ namespace Apache.Arrow.Adbc.C
#if NET5_0_OR_GREATER
public unsafe void Call(delegate* unmanaged<CAdbcDatabase*, byte*,
byte*, CAdbcError*, AdbcStatusCode> fn, ref CAdbcDatabase nativeDatabase,
string key, string? value)
+#else
+ public unsafe void Call(IntPtr fn, ref CAdbcDatabase
nativeDatabase, string key, string? value)
+#endif
{
fixed (CAdbcDatabase* db = &nativeDatabase)
fixed (CAdbcError* e = &_error)
@@ -1283,24 +1268,45 @@ namespace Apache.Arrow.Adbc.C
using (Utf8Helper utf8Key = new Utf8Helper(key))
using (Utf8Helper utf8Value = new Utf8Helper(value))
{
+#if NET5_0_OR_GREATER
TranslateCode(fn(db, utf8Key, utf8Value, e));
+#else
+
TranslateCode(Marshal.GetDelegateForFunctionPointer<DatabaseSetOption>(fn)(db,
utf8Key, utf8Value, e));
+#endif
}
}
}
+
+#if NET5_0_OR_GREATER
+ public unsafe string Call(delegate* unmanaged<CAdbcDatabase*,
byte*, byte*, nint*, CAdbcError*, AdbcStatusCode> fn, ref CAdbcDatabase
nativeDatabase, string key)
#else
- public unsafe void Call(IntPtr fn, ref CAdbcDatabase
nativeDatabase, string key, string? value)
+ public unsafe string Call(IntPtr fn, ref CAdbcDatabase
nativeDatabase, string key)
+#endif
{
fixed (CAdbcDatabase* db = &nativeDatabase)
fixed (CAdbcError* e = &_error)
{
using (Utf8Helper utf8Key = new Utf8Helper(key))
- using (Utf8Helper utf8Value = new Utf8Helper(value))
+ using (GetBufferHelper value = new GetBufferHelper())
{
-
TranslateCode(Marshal.GetDelegateForFunctionPointer<DatabaseSetOption>(fn)(db,
utf8Key, utf8Value, e));
+#if NET5_0_OR_GREATER
+ TranslateCode(fn(db, utf8Key, value, &value.Length,
e));
+#else
+
TranslateCode(Marshal.GetDelegateForFunctionPointer<DatabaseGetOption>(fn)(db,
utf8Key, value, &value.Length, e));
+#endif
+ if (value.RequiresRetry())
+ {
+#if NET5_0_OR_GREATER
+ TranslateCode(fn(db, utf8Key, value,
&value.Length, e));
+#else
+
TranslateCode(Marshal.GetDelegateForFunctionPointer<DatabaseGetOption>(fn)(db,
utf8Key, value, &value.Length, e));
+#endif
+ }
+
+ return value.AsString();
}
}
}
-#endif
#if NET5_0_OR_GREATER
public unsafe void Call(delegate* unmanaged<CAdbcConnection*,
CAdbcError*, AdbcStatusCode> fn, ref CAdbcConnection nativeConnection)
diff --git a/csharp/src/Apache.Arrow.Adbc/C/CAdbcError.cs
b/csharp/src/Apache.Arrow.Adbc/C/CAdbcError.cs
index a4ddba2be..840242a81 100644
--- a/csharp/src/Apache.Arrow.Adbc/C/CAdbcError.cs
+++ b/csharp/src/Apache.Arrow.Adbc/C/CAdbcError.cs
@@ -92,5 +92,26 @@ namespace Apache.Arrow.Adbc.C
#else
internal IntPtr release;
#endif
+
+ /// <summary>
+ /// Opaque implementation-defined state.
+ /// </summary>
+ /// <remarks>
+ /// This field may not be used unless vendor_code is
ADBC_ERROR_VENDOR_CODE_PRIVATE_DATA.
+ /// When it is, this field is null iff the error is uninitialized/freed
+ ///
+ /// Added in ADBC 1.1.0.
+ /// </remarks>
+ public void* private_data;
+
+ /// <summary>
+ /// The associated driver, used by the driver manager to help track
state.
+ /// </summary>
+ /// <remarks>
+ /// This field may not be used unless vendor_code is
ADBC_ERROR_VENDOR_CODE_PRIVATE_DATA.
+ ///
+ /// Added in ADBC 1.1.0.
+ /// </remarks>
+ public CAdbcDriver* private_driver;
};
}
diff --git a/csharp/src/Apache.Arrow.Adbc/BulkIngestMode.cs
b/csharp/src/Apache.Arrow.Adbc/C/CAdbcErrorDetail.cs
similarity index 64%
copy from csharp/src/Apache.Arrow.Adbc/BulkIngestMode.cs
copy to csharp/src/Apache.Arrow.Adbc/C/CAdbcErrorDetail.cs
index a8f7aa2f6..00bdfbd4e 100644
--- a/csharp/src/Apache.Arrow.Adbc/BulkIngestMode.cs
+++ b/csharp/src/Apache.Arrow.Adbc/C/CAdbcErrorDetail.cs
@@ -1,4 +1,4 @@
-/*
+/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
@@ -15,25 +15,31 @@
* limitations under the License.
*/
-namespace Apache.Arrow.Adbc
+using System.Runtime.InteropServices;
+
+namespace Apache.Arrow.Adbc.C
{
/// <summary>
- /// How to handle already-existing/nonexistent tables for bulk ingest
- /// operations.
+ /// Extra key-value metadata for an error.
+ ///
+ /// Added in ADBC 1.1.0.
/// </summary>
- public enum BulkIngestMode
+ [StructLayout(LayoutKind.Sequential)]
+ public unsafe struct CAdbcErrorDetail
{
/// <summary>
- /// Create the table and insert data; error if the table exists.
+ /// The metadata key.
+ /// </summary>
+ public byte* key;
+
+ /// <summary>
+ /// The metadata value.
/// </summary>
- Create,
+ public byte* value;
/// <summary>
- /// Do not create the table and append data; error if the table
- /// does not exist (<see cref="AdbcStatusCode.NotFound"/>) or
- /// does not match the schema of the data to append
- /// (<see cref="AdbcStatusCode.AlreadyExists"/>).
+ /// The metadata value length.
/// </summary>
- Append
+ public nint length;
}
}
diff --git a/csharp/src/Apache.Arrow.Adbc/C/Delegates.cs
b/csharp/src/Apache.Arrow.Adbc/C/Delegates.cs
index e1fa475ff..9469ee58e 100644
--- a/csharp/src/Apache.Arrow.Adbc/C/Delegates.cs
+++ b/csharp/src/Apache.Arrow.Adbc/C/Delegates.cs
@@ -26,24 +26,57 @@ namespace Apache.Arrow.Adbc.C
#if !NET5_0_OR_GREATER
internal unsafe delegate AdbcStatusCode DriverRelease(CAdbcDriver* driver,
CAdbcError* error);
internal unsafe delegate void PartitionsRelease(CAdbcPartitions*
partitions);
+
+ internal unsafe delegate int ErrorGetDetailCount(CAdbcError* error);
+ internal unsafe delegate CAdbcErrorDetail ErrorGetDetail(CAdbcError*
error, int index);
+ internal unsafe delegate CAdbcError*
ErrorFromArrayStream(CArrowArrayStream* stream, AdbcStatusCode* status);
+
+ internal unsafe delegate AdbcStatusCode DatabaseGetOption(CAdbcDatabase*
database, byte* name, byte* value, nint* length, CAdbcError* error);
+ internal unsafe delegate AdbcStatusCode
DatabaseGetOptionBytes(CAdbcDatabase* database, byte* name, byte* value, nint*
length, CAdbcError* error);
+ internal unsafe delegate AdbcStatusCode
DatabaseGetOptionDouble(CAdbcDatabase* database, byte* name, double* value,
CAdbcError* error);
+ internal unsafe delegate AdbcStatusCode
DatabaseGetOptionInt(CAdbcDatabase* database, byte* name, long* value,
CAdbcError* error);
internal unsafe delegate AdbcStatusCode DatabaseSetOption(CAdbcDatabase*
database, byte* name, byte* value, CAdbcError* error);
+ internal unsafe delegate AdbcStatusCode
DatabaseSetOptionBytes(CAdbcDatabase* database, byte* name, byte* value, nint
length, CAdbcError* error);
+ internal unsafe delegate AdbcStatusCode
DatabaseSetOptionDouble(CAdbcDatabase* database, byte* name, double value,
CAdbcError* error);
+ internal unsafe delegate AdbcStatusCode
DatabaseSetOptionInt(CAdbcDatabase* database, byte* name, long value,
CAdbcError* error);
+
+ internal unsafe delegate AdbcStatusCode ConnectionCancel(CAdbcConnection*
connection, CAdbcError* error);
internal unsafe delegate AdbcStatusCode ConnectionCommit(CAdbcConnection*
connection, CAdbcError* error);
+ internal unsafe delegate AdbcStatusCode ConnectionGetInfo(CAdbcConnection*
connection, int* info_codes, int info_codes_length, CArrowArrayStream* stream,
CAdbcError* error);
internal unsafe delegate AdbcStatusCode
ConnectionGetObjects(CAdbcConnection* connection, int depth, byte* catalog,
byte* db_schema, byte* table_name, byte** table_type, byte* column_name,
CArrowArrayStream* stream, CAdbcError* error);
+ internal unsafe delegate AdbcStatusCode
ConnectionGetOption(CAdbcConnection* connection, byte* name, byte* value, nint*
length, CAdbcError* error);
+ internal unsafe delegate AdbcStatusCode
ConnectionGetOptionBytes(CAdbcConnection* connection, byte* name, byte* value,
nint* length, CAdbcError* error);
+ internal unsafe delegate AdbcStatusCode
ConnectionGetOptionDouble(CAdbcConnection* connection, byte* name, double*
value, CAdbcError* error);
+ internal unsafe delegate AdbcStatusCode
ConnectionGetOptionInt(CAdbcConnection* connection, byte* name, long* value,
CAdbcError* error);
+ internal unsafe delegate AdbcStatusCode
ConnectionGetStatistics(CAdbcConnection* connection, byte* catalog, byte*
db_schema, byte* table_name, byte approximate, CArrowArrayStream* stream,
CAdbcError* error);
+ internal unsafe delegate AdbcStatusCode
ConnectionGetStatisticNames(CAdbcConnection* connection, CArrowArrayStream*
stream, CAdbcError* error);
internal unsafe delegate AdbcStatusCode
ConnectionGetTableSchema(CAdbcConnection* connection, byte* catalog, byte*
db_schema, byte* table_name, CArrowSchema* schema, CAdbcError* error);
internal unsafe delegate AdbcStatusCode
ConnectionGetTableTypes(CAdbcConnection* connection, CArrowArrayStream* stream,
CAdbcError* error);
internal unsafe delegate AdbcStatusCode ConnectionInit(CAdbcConnection*
connection, CAdbcDatabase* database, CAdbcError* error);
- internal unsafe delegate AdbcStatusCode ConnectionGetInfo(CAdbcConnection*
connection, int* info_codes, int info_codes_length, CArrowArrayStream* stream,
CAdbcError* error);
internal unsafe delegate AdbcStatusCode
ConnectionReadPartition(CAdbcConnection* connection, byte*
serialized_partition, int serialized_length, CArrowArrayStream* stream,
CAdbcError* error);
internal unsafe delegate AdbcStatusCode
ConnectionRollback(CAdbcConnection* connection, CAdbcError* error);
internal unsafe delegate AdbcStatusCode
ConnectionSetOption(CAdbcConnection* connection, byte* name, byte* value,
CAdbcError* error);
+ internal unsafe delegate AdbcStatusCode
ConnectionSetOptionBytes(CAdbcConnection* connection, byte* name, byte* value,
nint length, CAdbcError* error);
+ internal unsafe delegate AdbcStatusCode
ConnectionSetOptionDouble(CAdbcConnection* connection, byte* name, double
value, CAdbcError* error);
+ internal unsafe delegate AdbcStatusCode
ConnectionSetOptionInt(CAdbcConnection* connection, byte* name, long value,
CAdbcError* error);
+
internal unsafe delegate AdbcStatusCode StatementBind(CAdbcStatement*
statement, CArrowArray* array, CArrowSchema* schema, CAdbcError* error);
internal unsafe delegate AdbcStatusCode
StatementBindStream(CAdbcStatement* statement, CArrowArrayStream* stream,
CAdbcError* error);
+ internal unsafe delegate AdbcStatusCode StatementCancel(CAdbcStatement*
statement, CAdbcError* error);
internal unsafe delegate AdbcStatusCode
StatementExecuteQuery(CAdbcStatement* statement, CArrowArrayStream* stream,
long* rows, CAdbcError* error);
internal unsafe delegate AdbcStatusCode
StatementExecutePartitions(CAdbcStatement* statement, CArrowSchema* schema,
CAdbcPartitions* partitions, long* rows, CAdbcError* error);
+ internal unsafe delegate AdbcStatusCode
StatementExecuteSchema(CAdbcStatement* statement, CArrowSchema* stream,
CAdbcError* error);
internal unsafe delegate AdbcStatusCode
StatementGetParameterSchema(CAdbcStatement* statement, CArrowSchema* schema,
CAdbcError* error);
+ internal unsafe delegate AdbcStatusCode StatementGetOption(CAdbcStatement*
statement, byte* name, byte* value, nint* length, CAdbcError* error);
+ internal unsafe delegate AdbcStatusCode
StatementGetOptionBytes(CAdbcStatement* statement, byte* name, byte* value,
nint* length, CAdbcError* error);
+ internal unsafe delegate AdbcStatusCode
StatementGetOptionDouble(CAdbcStatement* statement, byte* name, double* value,
CAdbcError* error);
+ internal unsafe delegate AdbcStatusCode
StatementGetOptionInt(CAdbcStatement* statement, byte* name, long* value,
CAdbcError* error);
internal unsafe delegate AdbcStatusCode StatementNew(CAdbcConnection*
connection, CAdbcStatement* statement, CAdbcError* error);
internal unsafe delegate AdbcStatusCode StatementPrepare(CAdbcStatement*
statement, CAdbcError* error);
internal unsafe delegate AdbcStatusCode StatementSetOption(CAdbcStatement*
statement, byte* name, byte* value, CAdbcError* error);
+ internal unsafe delegate AdbcStatusCode
StatementSetOptionBytes(CAdbcStatement* statement, byte* name, byte* value,
nint length, CAdbcError* error);
+ internal unsafe delegate AdbcStatusCode
StatementSetOptionDouble(CAdbcStatement* statement, byte* name, double value,
CAdbcError* error);
+ internal unsafe delegate AdbcStatusCode
StatementSetOptionInt(CAdbcStatement* statement, byte* name, long value,
CAdbcError* error);
internal unsafe delegate AdbcStatusCode
StatementSetSqlQuery(CAdbcStatement* statement, byte* text, CAdbcError* error);
internal unsafe delegate AdbcStatusCode
StatementSetSubstraitPlan(CAdbcStatement* statement, byte* plan, int length,
CAdbcError* error);
internal unsafe delegate AdbcStatusCode StatementRelease(CAdbcStatement*
statement, CAdbcError* error);