Yup, I Stand corrected.

There is one adder to this. If you are going to use functions like
aggregates as a return you should alias them so you can control the name
stored in the zero row

Example:
select MetatagName,count(MetatagName) from witangometatags group by
MetatagName 
yields: MetatagName,Expr1001 for column name I the zero row

But
select MetatagName,count(MetatagName) as MetaCnt  from witangometatags
group by MetatagName
yields: MetatagName,MetaCnt for column name I the zero row

I do not consider this a rant, this is a correction of an error. Since I
use directDMBS to do the odd select statements and couldn't rely on the
zero row.

I apologize, for the confusion :-b

Ben Johansen - http://www.pcforge.com
Authorized Witango Reseller http://www.pcforge.com/WitangoGoodies.htm 
Latest downloads & List Archives @ http://www.witango.ws


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]] On Behalf Of Simon Boddy
Sent: Tuesday, December 10, 2002 2:11 AM
To: Multiple recipients of list witango-talk
Subject: Re: RE: Witango-Talk: Database View

Hi,

> I just wanted to bring to your attention that the @@resultset from a
> DirectDBMS is different from a Search action with regards to column
> names
> 
> The resultset from a search action returns the column names into the
row
> zero of the array whereas the directdbms doesn't

I feel obliged to kill this dangerous notion. Direct DBMSs contain
column names in row 0 like any other DB result set. They behave slightly
differently... the table name is not returned and if you have two same
named columns from different tables, referencing by column name alone
will return nothing.

I would strongly advocate referencing Direct DBMS results by column
name. Code readability goes out the window if you reference by number,
and your code breaks if you change the order of columns returned, by
inserting a new column for example.

With Direct DBMS, you can assign aliases to your column expressions in
the SQL, then use those aliases in the square brackets to reference the
returned data. You can also use SELECT *, or better, SELECT tablename.*,
then reference by name. This allows you to add columns to your database,
and start using them in your results HTML, without having to disturb a
complex multi-table query. Can't do that with a search action.

Ok, back in my box. Thanks for indulging my rant.
Simon.

-- 
_______________________________________________
Get your free email from http://www.graffiti.net

Powered by Outblaze
________________________________________________________________________
TO UNSUBSCRIBE: send a plain text/US ASCII email to [EMAIL PROTECTED]
                with unsubscribe witango-talk in the message body

________________________________________________________________________
TO UNSUBSCRIBE: send a plain text/US ASCII email to [EMAIL PROTECTED]
                with unsubscribe witango-talk in the message body

Reply via email to