- 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;
+ 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;
+ 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);
+ }