cParseQuery *cparse_role_query_roles(cParseRole *role, cParseError **error) { cParseQuery *query = NULL; cParseQueryBuilder *builder = NULL; if (role == NULL) { cparse_log_set_errno(error, EINVAL); return NULL; } query = cparse_query_for_object(role); builder = cparse_query_build_new(); cparse_query_build_related_to(builder, "roles", role); cparse_query_build_where(query, builder); cparse_query_build_free(builder); if (!cparse_query_find_objects(query, error)) { cparse_query_free(query); return NULL; } return query; }
void cparse_query_where_all(cParseQuery *query, const char *key, cParseJson *value) { cParseQueryBuilder *builder = NULL; if (query == NULL || cparse_str_empty(key) || value == NULL) { cparse_log_errno(EINVAL); return; } builder = cparse_query_build_new(); if (builder == NULL) { cparse_log_errno(ENOMEM); return; } cparse_query_build_all(builder, key, value); cparse_query_build_where(query, builder); cparse_query_build_free(builder); }