1//===----------------------------------------------------------------------===//
2// DuckDB
3//
4// duckdb/common/adbc/adbc.hpp
5//
6//
7//===----------------------------------------------------------------------===//
8
9#pragma once
10
11#include "duckdb/common/adbc/adbc.h"
12
13#include <string>
14
15namespace duckdb_adbc {
16
17AdbcStatusCode DatabaseNew(struct AdbcDatabase *database, struct AdbcError *error);
18
19AdbcStatusCode DatabaseSetOption(struct AdbcDatabase *database, const char *key, const char *value,
20 struct AdbcError *error);
21
22AdbcStatusCode DatabaseInit(struct AdbcDatabase *database, struct AdbcError *error);
23
24AdbcStatusCode DatabaseRelease(struct AdbcDatabase *database, struct AdbcError *error);
25
26AdbcStatusCode ConnectionNew(struct AdbcConnection *connection, struct AdbcError *error);
27
28AdbcStatusCode ConnectionSetOption(struct AdbcConnection *connection, const char *key, const char *value,
29 struct AdbcError *error);
30
31AdbcStatusCode ConnectionInit(struct AdbcConnection *connection, struct AdbcDatabase *database,
32 struct AdbcError *error);
33
34AdbcStatusCode ConnectionRelease(struct AdbcConnection *connection, struct AdbcError *error);
35
36AdbcStatusCode ConnectionGetInfo(struct AdbcConnection *connection, uint32_t *info_codes, size_t info_codes_length,
37 struct ArrowArrayStream *out, struct AdbcError *error);
38
39AdbcStatusCode ConnectionGetObjects(struct AdbcConnection *connection, int depth, const char *catalog,
40 const char *db_schema, const char *table_name, const char **table_type,
41 const char *column_name, struct ArrowArrayStream *out, struct AdbcError *error);
42
43AdbcStatusCode ConnectionGetTableSchema(struct AdbcConnection *connection, const char *catalog, const char *db_schema,
44 const char *table_name, struct ArrowSchema *schema, struct AdbcError *error);
45
46AdbcStatusCode ConnectionGetTableTypes(struct AdbcConnection *connection, struct ArrowArrayStream *out,
47 struct AdbcError *error);
48
49AdbcStatusCode ConnectionReadPartition(struct AdbcConnection *connection, const uint8_t *serialized_partition,
50 size_t serialized_length, struct ArrowArrayStream *out, struct AdbcError *error);
51
52AdbcStatusCode ConnectionCommit(struct AdbcConnection *connection, struct AdbcError *error);
53
54AdbcStatusCode ConnectionRollback(struct AdbcConnection *connection, struct AdbcError *error);
55
56AdbcStatusCode StatementNew(struct AdbcConnection *connection, struct AdbcStatement *statement,
57 struct AdbcError *error);
58
59AdbcStatusCode StatementRelease(struct AdbcStatement *statement, struct AdbcError *error);
60
61AdbcStatusCode StatementExecuteQuery(struct AdbcStatement *statement, struct ArrowArrayStream *out,
62 int64_t *rows_affected, struct AdbcError *error);
63
64AdbcStatusCode StatementPrepare(struct AdbcStatement *statement, struct AdbcError *error);
65
66AdbcStatusCode StatementSetSqlQuery(struct AdbcStatement *statement, const char *query, struct AdbcError *error);
67
68AdbcStatusCode StatementSetSubstraitPlan(struct AdbcStatement *statement, const uint8_t *plan, size_t length,
69 struct AdbcError *error);
70
71AdbcStatusCode StatementBind(struct AdbcStatement *statement, struct ArrowArray *values, struct ArrowSchema *schema,
72 struct AdbcError *error);
73
74AdbcStatusCode StatementBindStream(struct AdbcStatement *statement, struct ArrowArrayStream *stream,
75 struct AdbcError *error);
76
77AdbcStatusCode StatementGetParameterSchema(struct AdbcStatement *statement, struct ArrowSchema *schema,
78 struct AdbcError *error);
79
80AdbcStatusCode StatementSetOption(struct AdbcStatement *statement, const char *key, const char *value,
81 struct AdbcError *error);
82
83AdbcStatusCode StatementExecutePartitions(struct AdbcStatement *statement, struct ArrowSchema *schema,
84 struct AdbcPartitions *partitions, int64_t *rows_affected,
85 struct AdbcError *error);
86
87void SetError(struct AdbcError *error, const std::string &message);
88
89void InitiliazeADBCError(AdbcError *error);
90} // namespace duckdb_adbc
91