Subject | Re: [IBO] Column does not belong to referenced table - Bug report |
---|---|
Author | omar l m rosa |
Post date | 2007-02-08T13:21:19Z |
Sorry, I wrote wrong. (my fingers is faster then my mind)
I made two tests again:
FIRST TEST:
FIRST TEST:
FIRST TEST:
FIRST TEST:
In this example, the query runs OK, until I execute an refresh, when then error "column does not..." occurs
This is the copy from the source form:
=======================================
object IBOQueryFolha: TIBOQuery
Params = <
item
DataType = ftUnknown
Name = 'pk_funcionarios'
ParamType = ptUnknown
end
item
DataType = ftUnknown
Name = 'mes_referencia'
ParamType = ptUnknown
end>
DatabaseName = 'localhost:wkf_vs_br_3'
DeleteSQL.Strings = (
'DELETE FROM '
'WHERE'
'RDB$DB_KEY = :DB_KEY')
===================================
LOOK HERE:
===================================
EditSQL.Strings = (
'UPD TE SET'
'WHERE'
'RDB$DB_KEY = :DB_KEY')
===================================
GeneratorLinks.Strings = (
'pk_folha=g_folha')
IB_Connection = DM_WKF.IBODatabase1
IB_Transaction = DM_WKF.IBOTransaction1
===================================
LOOK HERE:
===================================
InsertSQL.Strings = (
'INSER) INTO ('
'VALUES )')
===================================
KeyLinksAutoDefine = True
RecordCountAccurate = True
AfterScroll = IBOQueryFolhaAfterScroll
AfterPost = IBOQueryFolhaAfterPost
OnNewRecord = IBOQueryFolhaNewRecord
RequestLive = True
====================================
SQL.Strings = (
'select f.*'
' from folha f'
' where f.pk_funcionarios = :pk_funcionarios and'
' f.mes_referencia = :mes_referencia and'
' exists(select C.pk_tb_fpg_cod'
' from tb_fpg_cod C'
' where C.vencim_desc in (4,7) and'
' C.pk_tb_fpg_cod = f.pk_tb_fpg_cod)')
============================================
FieldOptions = []
Left = 477
Top = 96
end
===================================
SECOND TEST
SECOND TEST
SECOND TEST
SECOND TEST
SECOND TEST
Now, if I remove all alias and reference explicity the ambibuous field name "FOLHA.pk_tb_fpg_cod" all runs OK!
This is the copy from the source form:
=====================================
object IBOQueryFolha: TIBOQuery
Params = <
item
DataType = ftUnknown
Name = 'pk_funcionarios'
ParamType = ptUnknown
end
item
DataType = ftUnknown
Name = 'mes_referencia'
ParamType = ptUnknown
end>
DatabaseName = 'localhost:wkf_vs_br_3'
DeleteSQL.Strings = (
'DELETE FROM FOLHA'
'WHERE'
' PK_FOLHA = :OLD_PK_FOLHA')
EditSQL.Strings = (
'UPDATE FOLHA SET'
' PK_FOLHA = :PK_FOLHA, /*PK*/'
' PK_FUNCIONARIOS = :PK_FUNCIONARIOS,'
' MES_REFERENCIA = :MES_REFERENCIA,'
' PK_HISTORICOS = :PK_HISTORICOS,'
' PK_TB_FPG_COD = :PK_TB_FPG_COD,'
' QUANTIDADE = :QUANTIDADE,'
' VALOR = :VALOR,'
' HORAS = :HORAS,'
' AT_DATA = :AT_DATA,'
' DIA = :DIA,'
' PK_FPG_FOLHA = :PK_FPG_FOLHA,'
' WBASE = :WBASE,'
' WQTD = :WQTD,'
' WCOEF = :WCOEF,'
' WVALOR = :WVALOR'
'WHERE'
' PK_FOLHA = :OLD_PK_FOLHA')
GeneratorLinks.Strings = (
'pk_folha=g_folha')
IB_Connection = DM_WKF.IBODatabase1
IB_Transaction = DM_WKF.IBOTransaction1
InsertSQL.Strings = (
'INSERT INTO FOLHA('
' PK_FOLHA, /*PK*/'
' PK_FUNCIONARIOS,'
' MES_REFERENCIA,'
' PK_HISTORICOS,'
' PK_TB_FPG_COD,'
' QUANTIDADE,'
' VALOR,'
' HORAS,'
' AT_DATA,'
' DIA,'
' PK_FPG_FOLHA,'
' WBASE,'
' WQTD,'
' WCOEF,'
' WVALOR)'
'VALUES ('
' :PK_FOLHA,'
' :PK_FUNCIONARIOS,'
' :MES_REFERENCIA,'
' :PK_HISTORICOS,'
' :PK_TB_FPG_COD,'
' :QUANTIDADE,'
' :VALOR,'
' :HORAS,'
' :AT_DATA,'
' :DIA,'
' :PK_FPG_FOLHA,'
' :WBASE,'
' :WQTD,'
' :WCOEF,'
' :WVALOR)')
KeyLinksAutoDefine = True
RecordCountAccurate = True
AfterScroll = IBOQueryFolhaAfterScroll
AfterPost = IBOQueryFolhaAfterPost
OnNewRecord = IBOQueryFolhaNewRecord
RequestLive = True
SQL.Strings = (
'select *'
' from folha '
' where pk_funcionarios = :pk_funcionarios and'
' mes_referencia = :mes_referencia and'
' exists(select pk_tb_fpg_cod'
' from tb_fpg_cod'
' where vencim_desc in (4,7) and'
' pk_tb_fpg_cod = FOLHA.pk_tb_fpg_cod)')
FieldOptions = []
Left = 477
Top = 96
end
=====================================
THIRD TEST
THIRD TEST
THIRD TEST
THIRD TEST
THIRD TEST
THIRD TEST
I put the property KEYLINKSAUTODEFINE=FALSE, cleaned keylinks , and the application runs OK with alias and whithout alias!
Note, the application runs more then 2 years with FB 1.5 and when I update to FB 2.0 and IBO 4.7 BETA 15 then error appear!
Thanks for your attention!
Helen Borrie said has an error in sql sentence! I donĀ“t know where!
bai!
omar
I made two tests again:
FIRST TEST:
FIRST TEST:
FIRST TEST:
FIRST TEST:
In this example, the query runs OK, until I execute an refresh, when then error "column does not..." occurs
This is the copy from the source form:
=======================================
object IBOQueryFolha: TIBOQuery
Params = <
item
DataType = ftUnknown
Name = 'pk_funcionarios'
ParamType = ptUnknown
end
item
DataType = ftUnknown
Name = 'mes_referencia'
ParamType = ptUnknown
end>
DatabaseName = 'localhost:wkf_vs_br_3'
DeleteSQL.Strings = (
'DELETE FROM '
'WHERE'
'RDB$DB_KEY = :DB_KEY')
===================================
LOOK HERE:
===================================
EditSQL.Strings = (
'UPD TE SET'
'WHERE'
'RDB$DB_KEY = :DB_KEY')
===================================
GeneratorLinks.Strings = (
'pk_folha=g_folha')
IB_Connection = DM_WKF.IBODatabase1
IB_Transaction = DM_WKF.IBOTransaction1
===================================
LOOK HERE:
===================================
InsertSQL.Strings = (
'INSER) INTO ('
'VALUES )')
===================================
KeyLinksAutoDefine = True
RecordCountAccurate = True
AfterScroll = IBOQueryFolhaAfterScroll
AfterPost = IBOQueryFolhaAfterPost
OnNewRecord = IBOQueryFolhaNewRecord
RequestLive = True
====================================
SQL.Strings = (
'select f.*'
' from folha f'
' where f.pk_funcionarios = :pk_funcionarios and'
' f.mes_referencia = :mes_referencia and'
' exists(select C.pk_tb_fpg_cod'
' from tb_fpg_cod C'
' where C.vencim_desc in (4,7) and'
' C.pk_tb_fpg_cod = f.pk_tb_fpg_cod)')
============================================
FieldOptions = []
Left = 477
Top = 96
end
===================================
SECOND TEST
SECOND TEST
SECOND TEST
SECOND TEST
SECOND TEST
Now, if I remove all alias and reference explicity the ambibuous field name "FOLHA.pk_tb_fpg_cod" all runs OK!
This is the copy from the source form:
=====================================
object IBOQueryFolha: TIBOQuery
Params = <
item
DataType = ftUnknown
Name = 'pk_funcionarios'
ParamType = ptUnknown
end
item
DataType = ftUnknown
Name = 'mes_referencia'
ParamType = ptUnknown
end>
DatabaseName = 'localhost:wkf_vs_br_3'
DeleteSQL.Strings = (
'DELETE FROM FOLHA'
'WHERE'
' PK_FOLHA = :OLD_PK_FOLHA')
EditSQL.Strings = (
'UPDATE FOLHA SET'
' PK_FOLHA = :PK_FOLHA, /*PK*/'
' PK_FUNCIONARIOS = :PK_FUNCIONARIOS,'
' MES_REFERENCIA = :MES_REFERENCIA,'
' PK_HISTORICOS = :PK_HISTORICOS,'
' PK_TB_FPG_COD = :PK_TB_FPG_COD,'
' QUANTIDADE = :QUANTIDADE,'
' VALOR = :VALOR,'
' HORAS = :HORAS,'
' AT_DATA = :AT_DATA,'
' DIA = :DIA,'
' PK_FPG_FOLHA = :PK_FPG_FOLHA,'
' WBASE = :WBASE,'
' WQTD = :WQTD,'
' WCOEF = :WCOEF,'
' WVALOR = :WVALOR'
'WHERE'
' PK_FOLHA = :OLD_PK_FOLHA')
GeneratorLinks.Strings = (
'pk_folha=g_folha')
IB_Connection = DM_WKF.IBODatabase1
IB_Transaction = DM_WKF.IBOTransaction1
InsertSQL.Strings = (
'INSERT INTO FOLHA('
' PK_FOLHA, /*PK*/'
' PK_FUNCIONARIOS,'
' MES_REFERENCIA,'
' PK_HISTORICOS,'
' PK_TB_FPG_COD,'
' QUANTIDADE,'
' VALOR,'
' HORAS,'
' AT_DATA,'
' DIA,'
' PK_FPG_FOLHA,'
' WBASE,'
' WQTD,'
' WCOEF,'
' WVALOR)'
'VALUES ('
' :PK_FOLHA,'
' :PK_FUNCIONARIOS,'
' :MES_REFERENCIA,'
' :PK_HISTORICOS,'
' :PK_TB_FPG_COD,'
' :QUANTIDADE,'
' :VALOR,'
' :HORAS,'
' :AT_DATA,'
' :DIA,'
' :PK_FPG_FOLHA,'
' :WBASE,'
' :WQTD,'
' :WCOEF,'
' :WVALOR)')
KeyLinksAutoDefine = True
RecordCountAccurate = True
AfterScroll = IBOQueryFolhaAfterScroll
AfterPost = IBOQueryFolhaAfterPost
OnNewRecord = IBOQueryFolhaNewRecord
RequestLive = True
SQL.Strings = (
'select *'
' from folha '
' where pk_funcionarios = :pk_funcionarios and'
' mes_referencia = :mes_referencia and'
' exists(select pk_tb_fpg_cod'
' from tb_fpg_cod'
' where vencim_desc in (4,7) and'
' pk_tb_fpg_cod = FOLHA.pk_tb_fpg_cod)')
FieldOptions = []
Left = 477
Top = 96
end
=====================================
THIRD TEST
THIRD TEST
THIRD TEST
THIRD TEST
THIRD TEST
THIRD TEST
I put the property KEYLINKSAUTODEFINE=FALSE, cleaned keylinks , and the application runs OK with alias and whithout alias!
Note, the application runs more then 2 years with FB 1.5 and when I update to FB 2.0 and IBO 4.7 BETA 15 then error appear!
Thanks for your attention!
Helen Borrie said has an error in sql sentence! I donĀ“t know where!
bai!
omar
----- Original Message -----
From: Svein Erling Tysvaer
To: ibobjects@yahoogroups.com
Sent: Wednesday, February 07, 2007 7:40 PM
Subject: Re: [IBO] Column does not belong to referenced table - Bug report
omar l m rosa wrote:
> I try to put explicitly alias in deep select like this:( to eliminate
> ambiguous reference)
>
> select f.*
> from folha f
> where f.pk_funcionarios = :pk_funcionarios and
> f.mes_referencia = :mes_referencia and
> exists(select c.pk_tb_fpg_cod
> from tb_fpg_cod
> where c.vencim_desc in (4,7) and
> c.pk_tb_fpg_cod = f.pk_tb_fpg_cod)
>
> And nothing change...
> the error (column does not belong...) occurs only after a iboquery.refresh.=
> Before, runs ok.
>
> Please, where is the error in sql sentence?
If this is truly copied from your database, then the error is that you
don't specify 'as c', and hence 'c.' will invariably fail.
If you copy this code:
select *
from folha f
where f.pk_funcionarios = :pk_funcionarios and
f.mes_referencia = :mes_referencia and
exists(select 1
from tb_fpg_cod c
where c.vencim_desc in (4, 7) and
c.pk_tb_fpg_cod = f.pk_tb_fpg_cod)
do you still get an error?
HTH,
Set
[Non-text portions of this message have been removed]