dimanche 20 février 2022

Address lookup pattern java

What is the best pattern or design to choose to search for an address. For example, there will be a request

SELECT * 
FROM addresses 
where street_name = 'abcd' 
  AND house_number = '1' 
  AND corps_number = '1' 
  AND app_number = '23' 
  AND index_app = 'A'

if there is no result, remove index_app from the end For example

SELECT * 
FROM addresses 
where street_name = 'abcd' 
  AND house_number = '1' 
  AND corps_number = '1' 
  AND app_number = '23'

And keep going until you get the result.

In Java app I have a request, since I initially do not know what data will be, whether there will be an apartment or building number, based on this data, I form sql and send a request. It’s just that if nothing was found, I need to find out why, maybe there is such a house, but I made a mistake with the apartment number.

Aucun commentaire:

Enregistrer un commentaire