代码拉取完成,页面将自动刷新
SQLite adapter for Oat++ ORM.
More about Oat++:
-DOATPP_SQLITE_AMALGAMATION=ON
to install oatpp-sqlite together with SQLite amalgamation
in which case you don't need to install SQLite
mkdir build && cd build
cmake ..
make install
Detailed documentation on Oat++ ORM you can find here.
All you need to start using oatpp ORM with SQLite is to create oatpp::sqlite::Executor
and provide it to your DbClient
.
#include "db/MyClient.hpp"
#include "oatpp-sqlite/orm.hpp"
class AppComponent {
public:
/**
* Create DbClient component.
* SQLite is used as an example here. For other databases declaration is similar.
*/
OATPP_CREATE_COMPONENT(std::shared_ptr<db::MyClient>, myDatabaseClient)([] {
/* Create database-specific ConnectionProvider */
auto connectionProvider = std::make_shared<oatpp::sqlite::ConnectionProvider>("/path/to/database.sqlite");
/* Create database-specific ConnectionPool */
auto connectionPool = oatpp::sqlite::ConnectionPool::createShared(connectionProvider,
10 /* max-connections */,
std::chrono::seconds(5) /* connection TTL */);
/* Create database-specific Executor */
auto executor = std::make_shared<oatpp::sqlite::Executor>(connectionPool);
/* Create MyClient database client */
return std::make_shared<MyClient>(executor);
}());
};
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。