Forum OpenACS Q&A: Re: Rudimentary development method questions

Collapse
Posted by xx xx on
Great. I hope it will find a place on this website's project-section.

I'm no expert, but this is my view.

3/4. Defining acs_Objects and/or acs_Attributes is arbitrary. You just do it if you think there is a need to be able to identify your "code" uniquely. Granting permissions (to read/write/edit/admin the result of your code), is just one (important) example. For me this thread was important.

5. The use of 'Inline_..' is a naming convention in OpenACS to indicate a temporary plpgSQL function. The name has no other specific meaning in postgresql. The temporary function, called Inline_.. is Created, Selected (executed) and Dropped. I concluded that these temporary functions are used to execute SQL and plpgSQL statements in one block.

A normal temporary plpsql function (case insensitive) looks like this:

CREATE FUNCTION #name of function for example Inline_0# () RETURNS #return value for example INTEGER# AS '
  DECLARE
    declarations of variables used between Begin/End;
    [...]
  BEGIN
    SQL and plpgSQL statements;
    [...]
  END;
' LANGUAGE 'plpgsql';

SELECT Inline_0();
DROP FUNCTION Inline_0; 
Perform is used instead of Select to execute a plpqSQL function when a return value of the function is not needed.
Opaque is a special return value for Trigger-functions
The advantage of plpqSQL functions is that you can use conditional statements and variables within the function.