# DbClient.hpp

This File On Github
Ask A Question

API: latest
module: oatpp
#include "oatpp/orm/DbClient.hpp"

# DbClient

Database client.

namespace oatpp { namespace orm { 
  class DbClient {}
}}

# Methods

Return Type Name Summary
[none] DbClient Constructor.
[none] ~DbClient Virtual destructor.
std::shared_ptr<Connection> getConnection Get database connection.
std::shared_ptr<QueryResult> executeQuery Execute arbitrary query.
Transaction beginTransaction Begin database transaction.

# DbClient::DbClient

Constructor.

DbClient(const std::shared_ptr<Executor>& executor)

# DbClient::~DbClient

Virtual destructor.

virtual ~DbClient() = default

# DbClient::getConnection

Get database connection.

  • @return

std::shared_ptr<Connection> getConnection()

# DbClient::executeQuery

Execute arbitrary query.

  • @param query - query text.
  • @param params - query parameters.
  • @param connection - database connection.
  • @return - oatpp::orm::QueryResult.

std::shared_ptr<QueryResult> executeQuery(const oatpp::String& query,
                                          const std::unordered_map<oatpp::String, oatpp::Void>& params,
                                          const std::shared_ptr<Connection>& connection = nullptr)

# DbClient::beginTransaction

Begin database transaction.

Transaction beginTransaction(const std::shared_ptr<Connection>& connection = nullptr)