static exist Method Design Pattern
Each table with a key should have a static exist method. Use it to check if a record that fulfills the specified key actually exists.
The exist method must:
-
Be static because it is used to check the existence of any table object (record) amongst all the objects of the table class.
-
Return a boolean value.
-
Take an argument of the type of the key of the table or a list of arguments if the key consists of more than one field. If there is a list of arguments, they must be in the same order as the fields in the index that are used for the table's key.
-
Check for the most effective, existing index in the record against the supplied key, and then return true if it exists in the table. If not, false.
-
Run on both the client and server. This is the default behavior. You can also make it explicit by putting "client server" in the declaration, but do not specify a single tier in the declaration (either the client or the server).
The method must be used whenever one record should be existence-checked based on its key.
Show: