If you want a "fast" solution, try backreferences.
Ie, in the 6648-84U entry there is a reference to 6648-8% and all other wildcard entries that match it.
Keep a table of all "wildcard" entries in the db, like 6648-8%.
If someone enters something not in the DB, you can either decide you 'should' fail, or you can decide to do a search only through the "wildcard" entries.
The second use of the "wildcard"-only table is when you add a new normal entry to the DB. You'll have to check it against all existing "wildcard" entries and insert the correct backreferences.
When you add a "wildcard" entry, you can simply search for it, and insert the required backreferences.
This would allow for "wildcard" entries like
66%-8%U
which none of the other proposals deal with reasonably.
(I assume you know how to have an arbitrary number of backreferences in a db: use a linked list)
__________________
Last edited by JHVH : 10-29-4004 BC at 09:00 PM. Reason: Time for a rest.
|