The problem is that, to ease readability, I'd like to store the properties and values in the database as the constant name, not the constant value,
I'm not sure I agree with this.
Surely the database is the place to store encoded data, and the best way to store the data is as constant value. Then you can write your metadata management frontend (e.g. written in forms!) to display the constant names for you.
Isn't this how you would normally write a database application?
As the constants are simply number value, you could do something like this
CREATE TABLE PROPERTY_MAPPINGS (
And in forms do something like
INSERT INTO PROPERTY_MAPPINGS(ID, NAME) VALUES (INSERT_ALLOWED, 'INSERT_ALLOWED');
Of course you have to do this for every property.
1 person found this helpful
As I see it, the problem with storing this kind of metadata in the database is that for every lookup you perform on this metadata you have to go to the database to retrieve the values. Depending on how often you will perform this type of comparison in your Forms application, it could cause your application to appear slow or actually slow it down. Since these are Forms Constants, if you must have some type of table you can query against, I would opt more towards creating some type of an "In-Memory" collection that is subclassed in all of your Forms (via PL/SQL Library or Object Library) rather than have to hit the database each time your application needs to perform a comparison against this data.
We do something similar to this in our application. All of the code is stored in a PL/SQL Library (.pll) and the .pll is attached to all Forms. We instantiate the "reference" collection in the Application Menu form and then it is available to all other forms called during that user session.
Just my thoughts...
Thanks CraigB, if there is not an easy way to access to the internal constant list (my "Name_In" like function), I'll have to go with your approach.
The procedure that sets the properties is already on a pll, so I could declare and fulfill an index by varchar2 collection, index by the constant name.
Are you implying that if I instantiate it in the pll in the application menu, and the called forms have the same pll attached, the collection is not flushed?