Phil Lawrence on 5 Aug 2004 14:02:12 -0000


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: nomenclature


Jeff Abrahamson wrote:
Gosh, I haven't seen that in years, and never not In Fortran. ;-)

So you have an array whose first member is a string representing an
array of keys and whose remaining members are the values associated
with those keys?
Yep.

You probably know that this is an error-prone structure (it can get
out of sync), that it would normally be more readable and less buggy
to use an array of key-value pairs.
The "flattened hash," right?  (To use Perl idiom.)

But, assuming you know that and there's some pressing need to do the
above, the answer to your question is that I don't know a name for
such a structure.
Well, with the keys all pushed up to one end of the array, it reminds me of using a centrifuge. How about "centrifugated hash"? Opinions? That would yield the function: "f_decentrifugate" :-)


As for my reasons:

Normally, mod_plsql (Oracle Application Server) will take a URI like this:
 .../package_name.proc_name?x=1&y=2&z=3

and call my package_name.proc_name, defined like so:
  PROCEDURE proc_name
  (
    x  IN  table_name.x%TYPE  DEFAULT NULL
  , y  IN  table_name.y%TYPE  DEFAULT NULL
  , z  IN  table_name.z%TYPE  DEFAULT NULL
  )
  IS ...

However, I hate to hard code all those field names and types into the procedure definition, because they're likely to change, and anyway, wouldn't it be nice to do a generic procedure that can handle input from an HTML form of n elements?

Well, mod_plsql will supposedly (is documented to) allow "flexible parameter passing," i.e. it will note the "bang" in this URI:
.../!package_name.proc_name?x=A%2CB%2CC&y=1&z=2


and then call my procedure with *2* parameters, instead of 3. That would allow a procedure defined like so:
PROCEDURE proc_name
(
name_array IN [array_type]
, value_array IN [array_type]
)
IS ...


But I can't get that to work, no way, no how. (Anyone interested can contact me off list. This is a real puzzler.)

So, it's work-around time. mod_plsql is documented to (and actually will) take a URI like this:
.../package_name.proc_name?x=1&x=2&x=3


and call my package_name.proc_name, defined like so:
  PROCEDURE proc_name
  (
    x  IN  owa_util.vc_arr
    -- from the owa_util source code (pubutil.sql):
    --   type vc_arr
    --     is table
    --     of varchar2(32000)
    --  index by binary_integer;
  )
  IS ...

At this point, x is basically an array with elements:  (1,2,3)

So...  that led me to use a URI like this:
  .../package_name.proc_name?x=A%2CB%2CC&x=1&x=2

obviously resulting in the array: ('A,B,C', 1, 2)

Phil
-
**Majordomo list services provided by PANIX <URL:http://www.panix.com>**
**To Unsubscribe, send "unsubscribe phl" to majordomo@lists.pm.org**