new: add wrapper for database chnages files

This commit is contained in:
ngn 2024-07-18 23:48:57 +03:00
parent bc79c642ac
commit 2e918b55ee
4 changed files with 26 additions and 12 deletions

View File

@ -101,8 +101,10 @@ lm_pool_t *lm_ctx_pool_by_url(lm_ctx_t *ctx, char *host, char *path); // find p
/* ######################## /* ########################
## database fucntions ## ## database fucntions ##
######################## */ ######################## */
bool lm_ctx_database_init(lm_ctx_t *ctx); // init ctx database (if not already present) bool lm_ctx_database_init(lm_ctx_t *ctx); // init ctx database (if not already present)
bool lm_ctx_database_is_installed(lm_ctx_t *ctx, lm_pkg_t *pkg, bool check_version); // check if a package is installed bool lm_ctx_database_is_installed(lm_ctx_t *ctx, lm_pkg_t *pkg, bool check_version); // check if a package is installed
bool lm_ctx_database_find(lm_ctx_t *ctx, lm_pkg_t *pkg, char *name, char *version); // find a package by name bool lm_ctx_database_find(lm_ctx_t *ctx, lm_pkg_t *pkg, char *name, char *version); // find a package by name
bool lm_ctx_database_next(lm_ctx_t *ctx, lm_pkg_t *pkg); // load the next package into pkg pointer bool lm_ctx_database_next(lm_ctx_t *ctx, lm_pkg_t *pkg); // load the next package into pkg pointer
bool lm_ctx_database_next_free(lm_ctx_t *ctx, lm_pkg_t *pkg); // free the used next pointers bool lm_ctx_database_next_free(lm_ctx_t *ctx, lm_pkg_t *pkg); // free the used next pointers
char *lm_ctx_database_changes(
lm_ctx_t *ctx, lm_pkg_t *pkg); // get changes file path for a package, FREE THE RETURNED POINTER

View File

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-07-18 19:15+0300\n" "POT-Creation-Date: 2024-07-18 23:48+0300\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"

View File

@ -68,3 +68,15 @@ bool lm_ctx_database_next_free(lm_ctx_t *ctx, lm_pkg_t *pkg){
lm_database_package_next_free(ctx->db, pkg); lm_database_package_next_free(ctx->db, pkg);
return true; return true;
} }
char *lm_ctx_database_changes(lm_ctx_t *ctx, lm_pkg_t *pkg){
if(NULL == ctx || NULL == pkg){
lm_error_set(LM_ERR_ArgNULL);
return false;
}
if(!lm_ctx_database_init(ctx))
return false; // error set by function
return lm_database_changes_get(ctx->db, pkg);
}