static rasqal_query* roqet_init_query(rasqal_world *world, const char* ql_name, const char* ql_uri, const unsigned char* query_string, raptor_uri* base_uri, rasqal_feature query_feature, int query_feature_value, const unsigned char* query_feature_string_value, int store_results, raptor_sequence* data_graphs) { rasqal_query* rq; rq = rasqal_new_query(world, (const char*)ql_name, (const unsigned char*)ql_uri); if(!rq) { fprintf(stderr, "%s: Failed to create query name %s\n", program, ql_name); goto tidy_query; } if(query_feature_value >= 0) rasqal_query_set_feature(rq, query_feature, query_feature_value); if(query_feature_string_value) rasqal_query_set_feature_string(rq, query_feature, query_feature_string_value); #ifdef STORE_RESULTS_FLAG if(store_results >= 0) rasqal_query_set_store_results(rq, store_results); #endif if(rasqal_query_prepare(rq, query_string, base_uri)) { size_t len = strlen((const char*)query_string); fprintf(stderr, "%s: Parsing query '", program); if(len > MAX_QUERY_ERROR_REPORT_LEN) { (void)fwrite(query_string, RASQAL_GOOD_CAST(size_t, MAX_QUERY_ERROR_REPORT_LEN), sizeof(char), stderr); fprintf(stderr, "...' (%d bytes) failed\n", RASQAL_BAD_CAST(int, len)); } else {
static rasqal_query* roqet_init_query(rasqal_world *world, const char* ql_name, const char* ql_uri, const unsigned char* query_string, raptor_uri* base_uri, rasqal_feature query_feature, int query_feature_value, const unsigned char* query_feature_string_value, int store_results, raptor_sequence* data_graphs) { rasqal_query* rq; rq = rasqal_new_query(world, (const char*)ql_name, (const unsigned char*)ql_uri); if(!rq) { fprintf(stderr, "%s: Failed to create query name %s\n", program, ql_name); goto tidy_query; } if(query_feature_value >= 0) rasqal_query_set_feature(rq, query_feature, query_feature_value); if(query_feature_string_value) rasqal_query_set_feature_string(rq, query_feature, query_feature_string_value); #ifdef STORE_RESULTS_FLAG if(store_results >= 0) rasqal_query_set_store_results(rq, store_results); #endif if(data_graphs) { rasqal_data_graph* dg; while((dg = (rasqal_data_graph*)raptor_sequence_pop(data_graphs))) { if(rasqal_query_add_data_graph(rq, dg)) { fprintf(stderr, "%s: Failed to add data graph to query\n", program); goto tidy_query; } } } if(rasqal_query_prepare(rq, query_string, base_uri)) { size_t len = strlen((const char*)query_string); fprintf(stderr, "%s: Parsing query '", program); if(len > MAX_QUERY_ERROR_REPORT_LEN) { (void)fwrite(query_string, MAX_QUERY_ERROR_REPORT_LEN, sizeof(char), stderr); fprintf(stderr, "...' (%d bytes) failed\n", (int)len); } else { (void)fwrite(query_string, len, sizeof(char), stderr); fputs("' failed\n", stderr); } rasqal_free_query(rq); rq = NULL; goto tidy_query; } tidy_query: return rq; }