Subject | Re: [Firebird-Architect] XSQLDA/XSQLVAR issues |
---|---|
Author | Arno Brinkman |
Post date | 2005-01-09T14:41:06Z |
Hi,
double alias, same name known as field etc...
SELECT
FX AS FY,
FY AS FX,
GEN_ID(MY_GEN_ID, 1) AS ITEMID,
(SELECT FIELD FROM TABLEX WHERE FX = FY) AS SUBS
FROM
TABLEY
WHERE
ITEMID = 1 and
SUBS = 1 and
FX = 1 and
FY = 1
Should a sub-select be able to use the ALIAS inside etc...
inside WHERE, GROUP BY, HAVING clauses.
in this query :
SELECT
F1 AS F2
FROM
TableX
WHERE
F2 = 1
Where TableX has F1 and F2 as fields, should it use TableX.F1 or TableX.F2
in the WHERE clause? May be a stupid example, but you can imagine...
when no one found look in the select-list for aliasses?
make it nice looking code with objects.
Regards,
Arno Brinkman
ABVisie
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Firebird open source database (based on IB-OE) with many SQL-99 features :
http://www.firebirdsql.org
http://www.firebirdsql.info
http://www.fingerbird.de/
http://www.comunidade-firebird.org/
Support list for Interbase and Firebird users :
firebird-support@yahoogroups.com
Nederlandse firebird nieuwsgroep :
news://80.126.130.81
> selectCould be useful, but not very much IMO.
> schema,
> tablename,
> tableid as id
> from
> system.tables
> where
> id=46
>
> in Netfrastructure dutifully gives
>
> SCHEMA TABLENAME ID
> ---------- ---------- --
>
> NETFRASITE MEMBERSHIP 46
> The important questions are:
>
> 1. Is it useful?
> 2. Is it well defined?Indeed, what should be happen for example with generators, sub-queries,
double alias, same name known as field etc...
SELECT
FX AS FY,
FY AS FX,
GEN_ID(MY_GEN_ID, 1) AS ITEMID,
(SELECT FIELD FROM TABLEX WHERE FX = FY) AS SUBS
FROM
TABLEY
WHERE
ITEMID = 1 and
SUBS = 1 and
FX = 1 and
FY = 1
Should a sub-select be able to use the ALIAS inside etc...
> 3. Does it violate the standard?I can't find anything about it that column-aliasses should be supported
inside WHERE, GROUP BY, HAVING clauses.
> 4. Is it likely to violate the standard at some future if the SQLThe only problem i currently can see is what field would have the precedence
> committee does something borderline plausible but dumb?
in this query :
SELECT
F1 AS F2
FROM
TableX
WHERE
F2 = 1
Where TableX has F1 and F2 as fields, should it use TableX.F1 or TableX.F2
in the WHERE clause? May be a stupid example, but you can imagine...
> A general implement is very easy.Shouldn't be that difficult, but the rules must be clear.
> Hang a pointer to a select object offThus your precedence is always first fields from available contextes and
> the SQL context object. If a single name identifier doesn't resolve to
> a context column name, check it against the select list. The immediate
> complication is that the current guy who resolves an identifier to a
> context returns only a field pointer, not a compiled expression which is
> necessary to support aliases expressions.
when no one found look in the select-list for aliasses?
> We really should encrypt pass1.cpp so only the most experienced,I agree it's ugly and hard to work with. Hopefully the time will come to
> hardened, least impressionable programmers are exposed to such hideous,
> deplorable, disease infested, festering code. It is exactly the sort of
> code that makes me want to to make a special programmers' editor that
> supports block move but not cut and paste. Ugh.
make it nice looking code with objects.
Regards,
Arno Brinkman
ABVisie
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Firebird open source database (based on IB-OE) with many SQL-99 features :
http://www.firebirdsql.org
http://www.firebirdsql.info
http://www.fingerbird.de/
http://www.comunidade-firebird.org/
Support list for Interbase and Firebird users :
firebird-support@yahoogroups.com
Nederlandse firebird nieuwsgroep :
news://80.126.130.81