Forum OpenACS Development: Response to A query writing tool.

Collapse
Posted by Tom Jackson on

What I am using now is an nsv array that is stuffed with the following procs (which are auto generated as comments in the pgplsql data model):

qd_add_package pb_acs_pkg__new package_id package_name title description owner_id object_type creation_date creation_user creation_ip context_id
qd_add_function pb_acs_pkg__new "package_id" "null" "package_name" "" "title" "null" "description" "null" "owner_id" "" "object_type" "'pb_acs_pkg'" "creation_date" "now()" "creation_user" "null" "creation_ip" "null" "context_id" "null" 

To allow for function overloading, you can have as many qd_add_function calls as you want per qd_add_package. The way it works, probably there is a limit of the size of integer allowed in tcl, maybe 32?

qd_add_package assigns a value: 1,2,4,etc. to each attribute. qd_add_function creates a signature which is the total of the attributes. qd_choose_function, which is used by any of the query writing procedures takes the input attributes and calculates their value. Then it looks to see if there is a perfect match to a function, if not, it steps through each added function value and does a bit wise and. The first match is used.