[fpc-devel] SqlDB + Firebird application doesn't run on new Ubuntu installation

Jonas Maebe jonas.maebe at elis.ugent.be
Fri Nov 27 11:54:32 CET 2009


On 27 Nov 2009, at 11:44, Graeme Geldenhuys wrote:

> diff --git a/packages/ibase/src/ibase60.inc b/packages/ibase/src/ 
> ibase60.inc
> index 5bc668d..54e2ab3 100644
> --- a/packages/ibase/src/ibase60.inc
> +++ b/packages/ibase/src/ibase60.inc
> @@ -2647,8 +2647,9 @@ begin
>     end
>   else
>     begin
> -    If (TryInitialiseIBase60(fbclib)=0) and
> -       (TryInitialiseIBase60(gdslib)=0) then
> +    If (TryInitialiseIBase60(fbclib+'.2')=0) and    // major  
> versioned
> +       (TryInitialiseIBase60(fbclib)=0) and         // un-versioned
> +       (TryInitialiseIBase60(gdslib)=0) then        // backward
> compatibility
>         Raise EInOutError.CreateFmt(SErrDefaultsFailed, 
> [gdslib,fbclib]);
>     end;
>   Result := RefCount;
> ----------------------------------------
>
>
> What I don't like about the patch above, is the 'and' statement.
> Wouldn't it be better (optimised) to do the following:
>
>  if not v2 found then                // libfbclient.so.2
>    if not unversioned found then     // libfbclient.so
>      if not gds found then           // libgds.so
>         raise Exception.Create(...)
>
> That way it will stop at the first if that found a valid library.

The first form will do that as well. See "short-circuit evaluation" at http://www.freepascal.org/docs-html/ref/refsu31.html


Jonas



More information about the fpc-devel mailing list