Subject Re: [firebird-support] Error function in FB 2.1
Author Helen Borrie
At 06:44 AM 1/05/2009, you wrote:
>HI I HAD A ERROR IN A DB RECENTLY MIGRATED OF FB 1.5 TO FB 2.1, IN A DLL I HAD THIS FUNCTION WHO CALL THE TYPE RECORD.
>
>TISC_QUAD = record
> gds_quad_high : Longint;
> gds_quad_low : Cardinal;
> end;
>PISC_QUAD = ^TISC_QUAD;
>
>function MinuteToHour(var M : Integer) : PISC_QUAD;
>var TempDate : TCTimeStructure; Hr, Mt, S, MS : Word;
>begin
> Result := malloc(SizeOf(TISC_QUAD));
> FillChar(TempDate, SizeOf(TCTimeStructure), 0);
> DecodeTime(IncMinute(0, M), Hr, Mt, S, MS);
> with TempDate do
> begin
> tm_sec := S;
> tm_min := Mt;
> tm_hour := Hr;
> end;
> isc_encode_date(@TempDate, Result);
>end;
>
>BUT WHEN I TRY TO DO A SELECT FOR EXAMPLE
>
>SELECT D.*, MinuteToHour(TAB_HOUR) as HOUR_START
>FROM DB_TABLE D, DB_TABLE_2 E
>WHERE D.TAB_ID = E.TBL_TABLEID
>
>WHEN I RUN THIS CONSULT BRING A MESSAGE SAY
>
>'Unsuccessful execution caused by the system error precludes
> successful execution of subsequent statements
> Error writting data to the connection'.
>
>the FIELD TAB_HOUR is type integer and never is null, in FB 1.5 run without problems. why in FB 2.1 break... what sentence of my code is wrong i dont know.. thx for you time.

Before you start worrying about the UDF being broken, first try offering the correct SQL syntax in your query:

SELECT
D.*,
MinuteToHour(E.TAB_HOUR) as HOUR_START
FROM DB_TABLE D, DB_TABLE_2 E
WHERE D.TAB_ID = E.TBL_TABLEID

From v.2 forward, ambiguous join specifications are no longer permitted. You must qualify all column references.

./hb