Subject | Re: [firebird-support] Table/field Alias -> relname in SQLDA |
---|---|
Author | Mark Rotteveel |
Post date | 2014-05-22T21:44:18Z |
On 22-5-2014 19:15, acgomes2001@... [firebird-support] wrote:
makes it easier for us to look at it.
not a table alias.
information item isc_info_sql_relation which is always the original
table of the field. So relname will contain the table name, not its
alias within the query. The alias needs to be retrieved explicitly by a
client (or tool) with a call to isc_dsql_sql_info with the
isc_info_sql_relation_alias information item.
Something similar applies to XSQLVAR.sqlname which will contain the
original column name (isc_info_sql_field), not its alias
(isc_info_sql_alias, which is in aliasname). Although this field is
included in the XSQLVAR.
Mark
--
Mark Rotteveel
> I have the SQL:...
>
> select
> CADPRO.CLIENTE_PRO,
> CADPRO.FORNECEDOR_PRO,
> FORNECEDOR.NOME_CLI NOME_FORNECEDOR,..
> CLIENTE.NOME_CLI NOME_CLIENTE,
> from CADPROI stripped all unnecessary code from your query to reduce the size. This
> inner join CADCLI as FORNECEDOR on (FORNECEDOR.CODCLI =
> CADPRO.FORNECEDOR_PRO)
> inner join CADCLI as CLIENTE on (CLIENTE.CODCLI = CADPRO.CLIENTE_PRO)
makes it easier for us to look at it.
> Always I run sql, table and field alias for table FORNECEDOR and CLIENTEYour title mentions relname, relname is the name of the original table,
> returns CADCLI as table alias...
not a table alias.
> And is not the same table, for CADPRO will be differents the values forNo this isn't a bug. The item retrieved for XSQLVAR.relname is the
> fields "CADPRO.CLIENTE_PRO" and "CADPRO.FORNECEDOR_PRO"
>
> I run the sql, and field origin always returns CADCLI.NOME_CLI instead
> of FORNECEDOR.NOME_FORNECEDOR
>
> and "CADCLI.NOME_CLI" instead of CLIENTE.NOME_CLIENTE.
>
> Its a bug?
information item isc_info_sql_relation which is always the original
table of the field. So relname will contain the table name, not its
alias within the query. The alias needs to be retrieved explicitly by a
client (or tool) with a call to isc_dsql_sql_info with the
isc_info_sql_relation_alias information item.
Something similar applies to XSQLVAR.sqlname which will contain the
original column name (isc_info_sql_field), not its alias
(isc_info_sql_alias, which is in aliasname). Although this field is
included in the XSQLVAR.
Mark
--
Mark Rotteveel