- paramValues[0] = (const char *)place_id;
- res = PQexecPrepared(conn, "search_name_insert", 1, paramValues, NULL, NULL, 0);
- if (PQresultStatus(res) != PGRES_COMMAND_OK)
- {
- fprintf(stderr, "search_name_insert: INSERT failed: %s", PQerrorMessage(conn));
+ if (strlen(feature.parentPlaceID) > 0 && featureAddressLines == 0)
+ {
+ paramValues[0] = (const char *)place_id;
+ paramValues[1] = 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)
+ {
+ fprintf(stderr, "search_name_from_parent_insert: INSERT failed: %s", PQerrorMessage(conn));
+ PQclear(res);
+ exit(EXIT_FAILURE);
+ }
+ PQclear(res);
+ }
+ else
+ {
+ paramValues[0] = (const char *)place_id;
+ if (verbose) fprintf(stderr, "search_name_insert: INSERT %s\n", paramValues[0]);
+ res = PQexecPrepared(conn, "search_name_insert", 1, paramValues, NULL, NULL, 0);
+ if (PQresultStatus(res) != PGRES_COMMAND_OK)
+ {
+ fprintf(stderr, "search_name_insert: INSERT failed: %s", PQerrorMessage(conn));
+ PQclear(res);
+ exit(EXIT_FAILURE);
+ }