+ return true;
+ }
+
+ const Cursor& GetCursor() const {
+ return stmt_;
+ }
+
+ int Step() const {
+ return sqlite3_step(stmt_.get());
+ }
+
+ bool Bind(int pos, std::string text) {
+ int ret = sqlite3_bind_text(stmt_.get(), pos, text.c_str(),
+ -1, SQLITE_TRANSIENT);
+ if (ret != SQLITE_OK) {
+ LOGE("bind error: %s", sqlite3_errmsg(db_.get()));
+ return false;
+ }
+
+ return true;
+ }
+
+ bool Bind(int pos, int val) {
+ if (sqlite3_bind_int(stmt_.get(), pos, val) != SQLITE_OK) {
+ LOGE("bind error: %s", sqlite3_errmsg(db_.get()));
+ return false;
+ }
+
+ return true;
+ }
+
+ const char* GetText(int pos) const {
+ return reinterpret_cast<const char*>(sqlite3_column_text(stmt_.get(), pos));
+ }
+
+ int GetInt(int pos) const {
+ return sqlite3_column_int(stmt_.get(), pos);
+ }
+
+ private:
+ const char* GetParserDataPath() const {
+ uid_t target_uid;
+ const char* path;
+ bool is_global;
+
+ pkgmgr_installer_info_get_target_uid(&target_uid);
+
+ if (target_uid == ROOT_USER
+ || target_uid == tzplatform_getuid(TZ_SYS_GLOBALAPP_USER))
+ is_global = true;
+ else
+ is_global = false;
+
+ if (!is_global)
+ tzplatform_set_user(target_uid);
+
+ path = tzplatform_mkpath(is_global ? TZ_SYS_DB : TZ_USER_DB,
+ ".complication_provider.db");
+ tzplatform_reset_user();
+
+ return path;
+ }
+
+ private:
+ std::unique_ptr<sqlite3, decltype(sqlite3_close_v2)*> db_;
+ Cursor stmt_;
+};
+} // namespace
+
+namespace watchface_complication {
+
+DBManager::DBManager() = default;
+DBManager::~DBManager() = default;