From 7dd663f58c546e2c17dcaef729e9afab3ee4cbee Mon Sep 17 00:00:00 2001 From: Stefan de Konink Date: Fri, 10 Oct 2008 19:58:59 +0200 Subject: [PATCH] Fix with memory, option to allow materialization. --- handler_osm_get.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/handler_osm_get.c b/handler_osm_get.c index c500832..9338663 100644 --- a/handler_osm_get.c +++ b/handler_osm_get.c @@ -755,9 +755,13 @@ get_object_by_id(cherokee_handler_osm_t *hdl, unsigned long int id, cherokee_buf case OSM_NODE_COMMAND_RELATIONS: { fprintf(stderr, "DEBUG2\n"); cherokee_buffer_t relations = CHEROKEE_BUF_INIT; +#ifdef MATERIALIZE cherokee_buffer_add_va (&sql1, SQL_GET_RELATION_BY_ND); run_sql(hdl, &sql1, &relations, result_id_to_list); cherokee_buffer_mrproper(&sql1); +#else + cherokee_buffer_add_va (&relations, SQL_GET_RELATION_BY_ND); +#endif if (relations.len > 0) { cherokee_buffer_add_va (&sql1, SQL_GET_RELATION_BY_IDS, relations.buf); @@ -765,12 +769,12 @@ get_object_by_id(cherokee_handler_osm_t *hdl, unsigned long int id, cherokee_buf cherokee_buffer_add_va (&sql3, SQL_GET_RELATION_MEMBER_NODE_BY_IDS, relations.buf); cherokee_buffer_add_va (&sql4, SQL_GET_RELATION_MEMBER_RELATION_BY_IDS, relations.buf); cherokee_buffer_add_va (&sql5, SQL_GET_RELATION_MEMBER_WAY_BY_IDS, relations.buf); - cherokee_buffer_mrproper(&relations); ret = run_sql5(hdl, &sql1, &sql2, &sql3, &sql4, &sql5, buf, result_relation_to_xml); } else { ret = ret_ok; } + cherokee_buffer_mrproper(&relations); break; } case OSM_WAY_COMMAND: @@ -787,9 +791,13 @@ get_object_by_id(cherokee_handler_osm_t *hdl, unsigned long int id, cherokee_buf break; case OSM_WAY_COMMAND_RELATIONS: { cherokee_buffer_t relations = CHEROKEE_BUF_INIT; +#ifdef MATERIALIZE cherokee_buffer_add_va (&sql1, SQL_GET_RELATION_BY_WAY); run_sql(hdl, &sql1, &relations, result_id_to_list); cherokee_buffer_mrproper(&sql1); +#else + cherokee_buffer_add_va (&relations, SQL_GET_RELATION_BY_WAY); +#endif if (relations.len > 0) { cherokee_buffer_add_va (&sql1, SQL_GET_RELATION_BY_IDS, relations.buf); @@ -797,12 +805,12 @@ get_object_by_id(cherokee_handler_osm_t *hdl, unsigned long int id, cherokee_buf cherokee_buffer_add_va (&sql3, SQL_GET_RELATION_MEMBER_NODE_BY_IDS, relations.buf); cherokee_buffer_add_va (&sql4, SQL_GET_RELATION_MEMBER_RELATION_BY_IDS, relations.buf); cherokee_buffer_add_va (&sql5, SQL_GET_RELATION_MEMBER_WAY_BY_IDS, relations.buf); - cherokee_buffer_mrproper(&relations); ret = run_sql5(hdl, &sql1, &sql2, &sql3, &sql4, &sql5, buf, result_relation_to_xml); } else { ret = ret_ok; } + cherokee_buffer_mrproper(&relations); break; } case OSM_RELATION_COMMAND: @@ -823,9 +831,13 @@ get_object_by_id(cherokee_handler_osm_t *hdl, unsigned long int id, cherokee_buf break; case OSM_RELATION_COMMAND_RELATIONS: { cherokee_buffer_t relations = CHEROKEE_BUF_INIT; +#ifdef MATERIALIZE cherokee_buffer_add_va (&sql1, SQL_GET_RELATION_BY_REL); run_sql(hdl, &sql1, &relations, result_id_to_list); cherokee_buffer_mrproper(&sql1); +#else + cherokee_buffer_add_va (&relations, SQL_GET_RELATION_BY_REL); +#endif if (relations.len > 0) { cherokee_buffer_add_va (&sql1, SQL_GET_RELATION_BY_IDS, relations.buf); @@ -833,12 +845,12 @@ get_object_by_id(cherokee_handler_osm_t *hdl, unsigned long int id, cherokee_buf cherokee_buffer_add_va (&sql3, SQL_GET_RELATION_MEMBER_NODE_BY_IDS, relations.buf); cherokee_buffer_add_va (&sql4, SQL_GET_RELATION_MEMBER_RELATION_BY_IDS, relations.buf); cherokee_buffer_add_va (&sql5, SQL_GET_RELATION_MEMBER_WAY_BY_IDS, relations.buf); - cherokee_buffer_mrproper(&relations); ret = run_sql5(hdl, &sql1, &sql2, &sql3, &sql4, &sql5, buf, result_relation_to_xml); } else { ret = ret_ok; } + cherokee_buffer_mrproper(&relations); break; } default: -- 2.11.4.GIT