On Thu, Nov 07, 2002 at 08:06:37PM -0500, Gabriel Ricard wrote:
> Speaking from the point of view of a recent convert from the Apache/PHP
> world, one thing that will really lower the bar for people like me is a
> document (or article) along the lines of "AOLServer and Tcl for
> Apache/PHP users." From the end user stand point it may be good to have

As a real live recent convert, what led you convert?  And what is
better/worse about AOLserver/Tcl vs. Apache/PHP?  I'm personally
curious, but maybe your answers would also be an effective
evangelization document!

> packaged versions of AOLServer with snazzy front-ends for configuration
> and maintenance/status of the server. I'm not a terrific write, but I

"snazzy configuration front-ends", yuck!  Well, that was my first
reaction anyway.  If someone really wants to do this, making AOLserver
Tcl or ADP pages for controlling AOLserver should be the right way to
go.  One button out-of-the box install of useful applications sounds
potentially good though.

> I think the only thing I'm still hung up on is arrays. In PHP it was
> ultra-easy to handle database rows using associative arrays,, and
> handling large numbers of rows in multi-dimensional arrays. I don't
> really know how to emulate that in Tcl, without setting up a separate
> API to handle it. Anyone have some tips on that?

I know nothing about PHP's arrays, but it sounds like you're running
into the fact that unlike lists, which may contain other lists, Tcl
arrays can't contain other Tcl arrays, they can only contain named
references to other Tcl arrays.  I know there's been talk in the past
about changing that limitation, but I don't know whether it's
currently on the Tcl core team's agenda, or what they think about it.

In Tcl, if I wanted to get all the rows at once and store them in some
structure, I'd probably use either db_list_of_lists:

  http://openacs.org/api-doc/proc-view?proc=db_list_of_lists

or one of the related OpenACS db or templating procs.  Or, I might
store each row as a list in a Tcl array - as long as you include a
column with a unique id in the list, that works fine.

To store multiple rows each of multiple columns directly in a Tcl
array (without any embedded list structures), you just need to embed
more info into the Tcl array keys.  I've never done that myself, but
it would work, something like what the "A simple database" page on the
Wiki shows:

  http://mini.net/tcl/1598.html

--
Andrew Piskorski <[EMAIL PROTECTED]>
http://www.piskorski.com

Reply via email to