Subject | Re: [IBO] Column does not belong to referenced table - Bug report |
---|---|
Author | Helen Borrie |
Post date | 2007-02-06T22:42:18Z |
At 07:26 AM 7/02/2007, you wrote:
2. The "bug" is your bug. You had better study the Fb2 release
notes carefully as it is likely to impact a lot of your SQL statements.
The generated SQL will be garbage if the SELECT statement is
garbage. But even when you correct your SQL, you must always provide
valid KeyLinks for joined sets.
Helen
>I use IBO4.5hi and when upgraded firebird to 2.0 I had some trobles.The exception is coming because this is illegal syntax in Firebird
>I downloaded IBO 4.7 beta 15 and new problems found:
>
>The errors messages:
>============================================
>ISC ERROR MESSAGE:
>Dynamic SQL Error
>SQL error code = -206
>Column unknown
>FOLHA.PK_FOLHA
>At line 2, column 13
>
>STATEMENT:
>TIB_BindingCursor: "<TApplication>.F_WKF_VS.F_Atu_Fun.IBOQueryFolha.I
>BOqrIBOQueryFolha.<TIB_BindingCursor>."
>=============================================
>
>When I run a iboquery.refresh, after a storedproc call.
>
>The sql sentence:
>=============================================
>select f.*
> from folha f
> where f.pk_funcionarios = :pk_funcionarios and
> f.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 = f.pk_tb_fpg_cod)
2. The "bug" is your bug. You had better study the Fb2 release
notes carefully as it is likely to impact a lot of your SQL statements.
>=============================================Garbage in, garbage out.
>
>In IBO Query Editor if I try to create the updateSQL estatements:
>============================================
>EditSQL:
>----------------------------
>UPD TE SET
>WHERE
>RDB$DB_KEY = :DB_KEY
>insertSQL:Ditto.
>---------------------------
>INSER) INTO (
>VALUES )
>DeleteSQL:Ditto.
>---------------------------
>DELETE FROM
>WHERE
>RDB$DB_KEY = :DB_KEY
>---------------------------
The generated SQL will be garbage if the SELECT statement is
garbage. But even when you correct your SQL, you must always provide
valid KeyLinks for joined sets.
>If I change the SQL statement to:And your problem is ????
>===================================
>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)
>--------------------------------------------
>I did: Removed "f" alias from sql sentence and putted "folha." in
>where clause of sql sentence inside "exists")
>
>Then, I try to create the updateSQL again, and everything is OK!
>=====================================
>EditSQL:
>--------------------
>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
>
>InsertSQL:
>--------------------------------
>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)
>
>DeleteSQL:
>--------------------------------
>DELETE FROM FOLHA
>WHERE
> PK_FOLHA = :OLD_PK_FOLHA
>
>==================================================
Helen