Manuel Lemos wrote:
> 
> Hello,
> 
> "Tomas V.V.Cox" wrote:
> >
> > Manuel Lemos wrote:
> > >
> > > > >
> > > > > But it does not work with computed columns like those that apply
> > > > > functions (COUNT, SUM, SUBSTRING, etc...). The code assumes that you are
> > > > > actually selecting only real table fields. I think it also does not work
> > > > > with columns with table name prefixes.
> > > >
> > > > That's partially true. But it's a common practise to use column aliases
> > > > in conyunction with functions (and a must for assoc fetchs) and this is
> > > > supported by the code I wrote, for ex:
> > > >
> > > > select count(field) as count from foo;
> > >
> > > That would work, but you require people to change their queries. I guess
> > > that does not work as general practice because.
> > >
> > > > Also if Oracle name a sum(foo) column as "sum" will be trivial to add
> > > > it.
> >
> > I ran a query without the column alias and seems that Oracle names that
> > column with the entire name for ex: "sum(foo)". If that is true the
> > support could be completed.
> 
> I don't think it will ever work. When you do not use column alias, you
> will be asking Oracle to to apply a function to a column that does not
> exist in the inner query.

I installed Oracle at home at did some tests. I was true, Oracle uses
the entire function name as the column name, so that works:

SELECT "COUNT(A)" FROM (SELECT count(a) FROM table);

Postgres for example will name the col only to "COUNT". But I'm still
thinking that I'm wasting my time supporting this as always people use
column aliases in cols from a SQL function.

Well, to be honest still persists the problem when you select all the
columns (with "*"), but have already a weird solution :)

> If you think it works, just show me the result query that you end up
> executing.

I'll commit a cleaner version of my actual patch to show you that it
works.
 

Tomas V.V.Cox

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to