Wojciech Kocjan wrote:

> On Wed, 16 May 2001, Valerio Gionco wrote:
> > mod_dtcl must parse QUERY_STRING to find the right variable;
> > every time you call [vars get xxx], the module (in the worst case)
> > must parse every variable in the string - which is exactly what
> > you wanted to avoid.
>
> Actually, libapreq (or something similar :-) parses QUERY_STRING, not
> mod_dtcl. But it returns a key-value list.

the current code in mod_dtcl is:

    /* take results and create tcl variables from them */
    if (req->parms)
    {
        int i;
        array_header *parmsarray = ap_table_elts(req->parms);
        table_entry *parms = (table_entry *)parmsarray->elts;
        Tcl_Obj *varsobj = Tcl_NewStringObj("::request::VARS", -1);
        for (i = 0; i < parmsarray->nelts; ++i)
        {
            if (!parms[i].key)
                continue;

            Tcl_ObjSetVar2(interp, varsobj,
                           STRING_TO_UTF_TO_OBJ(parms[i].key),
                           STRING_TO_UTF_TO_OBJ(parms[i].val),
                           0);
        }

    }

I'm not an Apache API expert, but looks like all what you have is
the number of the defined keys (in parmsarray->nelts) and
an array parmsarray->elts of name-value couples.

>
> But since multiple values are a rare case (but may also happen with
> cookies and should be considered), it can involve a bit slower methods.
>
> I suppose that one using a list I came up with lately is quite good -
> it does not convert the data (except to tcl lists) so the user has
> low-level access...
>
> Actually, I'm using mod_dtcl for almost a year and I've never sent
> multiple checkboxes with the same name. I'm using NAME=prefix_name
> and then array names VARS prefix_*. Didn't benchmark that one, but
> shouldn't be that slow...

This would be a big pain for us, since we are porting a (big!!) set of
CGI scripts with an internal API, and changing the names of
all those checkboxes is out of question. My boss would probably
kill me. :-)

>
> How does PHP handle 'x=1&x=2'? AFAIR you just send NAME=prefix[] and then
> you get an array or list $prefix[value]. But I could be wrong. Same
> solution could be done here - NAME=prefix() means it should be set in
> another variable or it should be set as a list.
>
> Ok, out of fresh ideas :-(

My priorities are:

- Being able to retrieve all variables :)

- Having a consistent way to do it

- ok, the performance is important, too...

For my purposes a key-value list would be a great thing; other

methods to access a single variable could be useful but not mandatory;

I'd probably end not using them, anyway.

-
Valerio Gionco   [[EMAIL PROTECTED]]
MOST s.r.l.      Via Bezzecca, 9 - 10131 Torino
************************************************************************
            "Life's not fair, but the root password helps."




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to