new: add wrapper for database chnages files
This commit is contained in:
parent
bc79c642ac
commit
2e918b55ee
@ -101,8 +101,10 @@ lm_pool_t *lm_ctx_pool_by_url(lm_ctx_t *ctx, char *host, char *path); // find p
|
||||
/* ########################
|
||||
## database fucntions ##
|
||||
######################## */
|
||||
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_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_free(lm_ctx_t *ctx, lm_pkg_t *pkg); // free the used next pointers
|
||||
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_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_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
|
||||
|
@ -8,7 +8,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\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"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
|
@ -39,7 +39,7 @@ bool lm_ctx_database_find(lm_ctx_t *ctx, lm_pkg_t *pkg, char *name, char *versio
|
||||
|
||||
if(!lm_ctx_database_init(ctx))
|
||||
return false; // error set by function
|
||||
|
||||
|
||||
lm_error_clear();
|
||||
return lm_database_package_find(ctx->db, pkg, name, version);
|
||||
}
|
||||
@ -49,10 +49,10 @@ bool lm_ctx_database_next(lm_ctx_t *ctx, lm_pkg_t *pkg){
|
||||
lm_error_set(LM_ERR_ArgNULL);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if(!lm_ctx_database_init(ctx))
|
||||
return false; // error set by function
|
||||
|
||||
|
||||
return lm_database_package_next(ctx->db, pkg);
|
||||
}
|
||||
|
||||
@ -61,10 +61,22 @@ bool lm_ctx_database_next_free(lm_ctx_t *ctx, lm_pkg_t *pkg){
|
||||
lm_error_set(LM_ERR_ArgNULL);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if(!lm_ctx_database_init(ctx))
|
||||
return false; // error set by function
|
||||
|
||||
|
||||
lm_database_package_next_free(ctx->db, pkg);
|
||||
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);
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ bool lm_database_changes_del(lm_database_t *db, lm_pkg_t *pkg){
|
||||
lm_error_set(LM_ERR_DbChangesUnlinkFail);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user