X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/4d16677d2ee4e57cef44d7a208b15b390d5994f4..22b7aed769fed5e0bcc31479a65869437cb2d5dd:/nominatim/import.c?ds=inline diff --git a/nominatim/import.c b/nominatim/import.c index 95c742ff..419ab6a5 100644 --- a/nominatim/import.c +++ b/nominatim/import.c @@ -486,7 +486,7 @@ void EndElement(xmlTextReaderPtr reader, const xmlChar *name) } paramValues[7] = (const char *)featureExtraTagString; - if (strlen(feature.parentPlaceID) == 0) + if (xmlStrlen(feature.parentPlaceID) == 0) paramValues[8] = "0"; else paramValues[8] = (const char *)feature.parentPlaceID; @@ -515,15 +515,18 @@ void EndElement(xmlTextReaderPtr reader, const xmlChar *name) // insert into place_address paramValues[0] = (const char *)place_id; paramValues[1] = (const char *)featureAddress[i].distance; + if (paramValues[1] == NULL || strlen(paramValues[1]) == 0) paramValues[1] = "0"; paramValues[2] = (const char *)featureAddress[i].type; paramValues[3] = (const char *)featureAddress[i].id; paramValues[4] = (const char *)featureAddress[i].key; paramValues[5] = (const char *)featureAddress[i].value; paramValues[6] = (const char *)featureAddress[i].isAddress; + if (verbose) fprintf(stderr, "placex_insert: %s %s\n", paramValues[2], paramValues[3]); res = PQexecPrepared(conn, "place_addressline_insert", 7, paramValues, NULL, NULL, 0); if (PQresultStatus(res) != PGRES_COMMAND_OK) { fprintf(stderr, "place_addressline_insert: INSERT failed: %s", PQerrorMessage(conn)); + fprintf(stderr, "(%s,%s,%s,%s,%s,%s,%s)",paramValues[0],paramValues[1],paramValues[2],paramValues[3],paramValues[4],paramValues[5],paramValues[6]); PQclear(res); exit(EXIT_FAILURE); } @@ -538,10 +541,10 @@ void EndElement(xmlTextReaderPtr reader, const xmlChar *name) if (featureNameLines) { - if (strlen(feature.parentPlaceID) > 0 && featureAddressLines == 0) + if (xmlStrlen(feature.parentPlaceID) > 0 && featureAddressLines == 0) { paramValues[0] = (const char *)place_id; - paramValues[1] = feature.parentPlaceID; + paramValues[1] = (const char *)feature.parentPlaceID; if (verbose) fprintf(stderr, "search_name_from_parent_insert: INSERT %s %s\n", paramValues[0], paramValues[1]); res = PQexecPrepared(conn, "search_name_from_parent_insert", 2, paramValues, NULL, NULL, 0); if (PQresultStatus(res) != PGRES_COMMAND_OK)