in reply to Human readable logic statements
If you can express these conditions in sql, with suitable placeholders for the actual values required for the criteria, then why not just store the sql statements themselves in a table (with placeholders)? That way, a perl script could simply query to get the relevant sql statement, then prepare it and execute it with the appropriate values to see whether a given insertion should be allowed.
(SQL statements are human-readable enough to be meaningful and clear in most cases.)
Nitpick: don't think that just having the same phrase structure on every condition is sufficient to make your conditions understandable -- double and triple negatives are just hard to follow, and you should avoid them. How about:
-- Entry can be made if (select count(*) from data_table where date>? and date<?) > 0;and so on. Perhaps there are other conditions needed to identify your "other record x", "other record y", "other record "z", etc? Putting the conditions in SQL form will help to make sure you use the appropriate amount of detail.
|
|---|