65 template<
typename... Args>
67 std::pair<std::string, Args>... args) {
68 std::unordered_map<std::string, std::unique_ptr<common::Value>> inputParameters;
79 std::unordered_map<std::string, std::unique_ptr<common::Value>> inputParams);
92 template<
typename TR,
typename... Args>
98 template<
typename TR,
typename... Args>
102 std::move(parameterTypes), returnType));
106 addScalarFunction(name, std::move(func));
111 template<
typename TR,
typename... Args>
113 addScalarFunction(name,
121 std::move(parameterTypes), returnType));
127 std::unique_ptr<QueryResult>
query(std::string_view
query, std::string_view encodedJoin,
128 bool enumerateAllPlans =
true);
130 std::unique_ptr<QueryResult> queryResultWithError(std::string_view errMsg);
132 std::unique_ptr<PreparedStatement> preparedStatementWithError(std::string_view errMsg);
134 std::unique_ptr<PreparedStatement> prepareNoLock(
135 std::shared_ptr<parser::Statement> parsedStatement,
bool enumerateAllPlans =
false,
136 std::string_view joinOrder = std::string_view());
138 template<
typename T,
typename... Args>
140 std::unordered_map<std::string, std::unique_ptr<common::Value>> params,
141 std::pair<std::string, T> arg, std::pair<std::string, Args>... args) {
142 return clientContext->executeWithParams(preparedStatement, std::move(params), arg, args...);
145 void bindParametersNoLock(PreparedStatement* preparedStatement,
146 const std::unordered_map<std::string, std::unique_ptr<common::Value>>& inputParams);
148 std::unique_ptr<QueryResult> executeAndAutoCommitIfNecessaryNoLock(
149 PreparedStatement* preparedStatement, uint32_t planIdx = 0u);
152 KUZU_API void removeScalarFunction(std::string name);
154 std::unique_ptr<QueryResult> queryWithID(std::string_view
query, uint64_t queryID);
156 std::unique_ptr<QueryResult> executeWithParamsWithID(PreparedStatement* preparedStatement,
157 std::unordered_map<std::string, std::unique_ptr<common::Value>> inputParams,
162 std::unique_ptr<ClientContext> clientContext;
#define KUZU_API
Definition api.h:25
Contain client side configuration. We make profiler associated per query, so profiler is not maintain...
Definition client_context.h:57
Connection is used to interact with a Database instance. Each Connection is thread-safe....
Definition connection.h:14
friend class ConnectionExecuteAsyncWorker
Definition connection.h:21
friend class kuzu::testing::PrivateGraphTest
Definition connection.h:16
std::unique_ptr< QueryResult > execute(PreparedStatement *preparedStatement, std::pair< std::string, Args >... args)
Executes the given prepared statement with args and returns the result.
Definition connection.h:66
void removeUDFFunction(std::string name)
Definition connection.h:109
void addUDFFunctionSet(std::string name, function::function_set func)
Definition connection.h:105
friend class kuzu::benchmark::Benchmark
Definition connection.h:19
friend class kuzu::testing::BaseGraphTest
Definition connection.h:15
void createVectorizedFunction(std::string name, std::vector< common::LogicalTypeID > parameterTypes, common::LogicalTypeID returnType, function::scalar_func_exec_t scalarFunc)
Definition connection.h:117
KUZU_API std::unique_ptr< QueryResult > executeWithParams(PreparedStatement *preparedStatement, std::unordered_map< std::string, std::unique_ptr< common::Value > > inputParams)
Executes the given prepared statement with inputParams and returns the result.
friend class kuzu::testing::TinySnbDDLTest
Definition connection.h:20
KUZU_API ~Connection()
Destructs the connection.
friend class kuzu::testing::TestRunner
Definition connection.h:18
KUZU_API void interrupt()
interrupts all queries currently executing within this connection.
KUZU_API std::unique_ptr< PreparedStatement > prepare(std::string_view query)
Prepares the given query and returns the prepared statement.
KUZU_API Connection(Database *database)
Creates a connection to the database.
KUZU_API void setMaxNumThreadForExec(uint64_t numThreads)
Sets the maximum number of threads to use for execution in the current connection.
KUZU_API void setQueryTimeOut(uint64_t timeoutInMS)
sets the query timeout value of the current connection. A value of zero (the default) disables the ti...
void createVectorizedFunction(std::string name, function::scalar_func_exec_t scalarFunc)
Definition connection.h:112
ClientContext * getClientContext()
Definition connection.h:124
void createScalarFunction(std::string name, TR(*udfFunc)(Args...))
Definition connection.h:93
KUZU_API uint64_t getMaxNumThreadForExec()
Returns the maximum number of threads to use for execution in the current connection.
friend class ConnectionQueryAsyncWorker
Definition connection.h:22
friend class kuzu::testing::TestHelper
Definition connection.h:17
void createScalarFunction(std::string name, std::vector< common::LogicalTypeID > parameterTypes, common::LogicalTypeID returnType, TR(*udfFunc)(Args...))
Definition connection.h:99
KUZU_API std::unique_ptr< QueryResult > query(std::string_view query)
Executes the given query and returns the result.
Database class is the main class of KùzuDB. It manages all database components.
Definition database.h:81
A prepared statement is a parameterized query which can avoid planning the same query for repeated ex...
Definition prepared_statement.h:20
LogicalTypeID
Definition types.h:167
std::vector< std::unique_ptr< Function > > function_set
Definition function.h:43
std::function< void( const std::vector< std::shared_ptr< common::ValueVector > > &, common::ValueVector &, void *)> scalar_func_exec_t
Definition scalar_function.h:18
Definition array_utils.h:7
static function_set getFunction(std::string name, TR(*udfFunc)(Args...), std::vector< common::LogicalTypeID > parameterTypes, common::LogicalTypeID returnType)
Definition udf_function.h:235
static function_set getVectorizedFunction(std::string name, scalar_func_exec_t execFunc)
Definition udf_function.h:255