Recent

Author Topic: Lazarus 1.6 & Firebird 3.0  (Read 17043 times)

mariodosreis

  • New Member
  • *
  • Posts: 16
Re: Lazarus 1.6 & Firebird 3.0
« Reply #15 on: August 24, 2016, 03:39:52 pm »
It work's fine here.
Do you need an example?
Bregards
Mário

regs

  • Jr. Member
  • **
  • Posts: 53
Re: Lazarus 1.6 & Firebird 3.0
« Reply #16 on: August 25, 2016, 02:00:16 pm »
Have a question to those who migrated to FB3. Is there any ready quick solution to migrate smallint boolean domain (0,1) to native FB3 booleans?

dogriz

  • Full Member
  • ***
  • Posts: 127
Re: Lazarus 1.6 & Firebird 3.0
« Reply #17 on: November 21, 2016, 04:19:56 pm »
Regarding this topic:
I have Firebird 3.0.1 installed on Debian 64-bit system.
I noticed that TIBConnection asks for libfbclient.so.2.5.1 library on Linux. (Lazarus fixes 1.6.3)
When I symlinked it like this:
Code: [Select]
$ sudo ln -s /usr/lib/x86-64-linux-gnu/libfbclient.so.3.0.1 /usr/lib/x86_64-linux-gnu/libfbclient.so.2.5.1everything worked for Firebird 3.
Where did that libfbclient.so.2.5.1 dependence come from?
FPC 3.2.2
Lazarus 2.2.4
Debian x86_64, arm

Zoran

  • Hero Member
  • *****
  • Posts: 1830
    • http://wiki.lazarus.freepascal.org/User:Zoran
Re: Lazarus 1.6 & Firebird 3.0
« Reply #18 on: November 22, 2016, 02:01:19 pm »
It's in the very beginning of ibase60.inc - see: http://svn.freepascal.org/svn/fpc/tags/release_3_0_0/packages/ibase/src/ibase60.inc


This should work for you - add this unit to your project:
Code: Pascal  [Select][+][-]
  1. unit FirebirdLibraryLoad;
  2.  
  3. {$mode objfpc}{$H+}
  4.  
  5. interface
  6.  
  7. uses
  8.   Classes, SysUtils, sqldb, IBConnection;
  9.  
  10. procedure SetFBLibPath(NewLibraryPath: String);
  11.  
  12. implementation
  13.  
  14. procedure SetFBLibPath(NewLibraryPath: String);
  15. var
  16.   LF: TLibraryLoadFunction;
  17.   UF: TLibraryUnLoadFunction;
  18.   OldLibraryPath: String;
  19. begin
  20.   OldLibraryPath := TIBConnectionDef.LoadedLibraryName;
  21.   if NewLibraryPath <> OldLibraryPath then begin
  22.  
  23.     if FileExists(NewLibraryPath) then begin
  24.  
  25.       if OldLibraryPath > '' then begin
  26.         UF := TIBConnectionDef.UnLoadFunction;
  27.         if Assigned(UF) then
  28.           UF();
  29.       end;
  30.  
  31.       LF := TIBConnectionDef.LoadFunction;
  32.       if Assigned(LF) then begin
  33.         if NewLibraryPath <> '' then
  34.           LF(NewLibraryPath);
  35.  
  36.       end;
  37.     end;
  38.   end;
  39. end;
  40.  
  41. end.
  42.  

Now, on your project start, call this function. Something like this:
Code: Pascal  [Select][+][-]
  1. program project1;
  2.  
  3. {$mode objfpc}{$H+}
  4.  
  5. uses
  6.   {$IFDEF UNIX}{$IFDEF UseCThreads}
  7.   cthreads,
  8.   {$ENDIF}{$ENDIF}
  9.   Interfaces, // this includes the LCL widgetset
  10.   Forms, Unit1, FirebirdLibraryLoad
  11.   { you can add units after this };
  12.  
  13. {$R *.res}
  14.  
  15. begin
  16.   RequireDerivedFormResource := True;
  17.  
  18.   SetFBLibPath('/usr/lib/x86-64-linux-gnu/libfbclient.so.3.0.1');
  19.  
  20.   Application.Initialize;
  21.   Application.CreateForm(TForm1, Form1);
  22.   Application.Run;
  23. end.
  24.  

abonic

  • New member
  • *
  • Posts: 7
Re: Lazarus 1.6 & Firebird 3.0
« Reply #19 on: November 27, 2016, 05:29:51 pm »
Have a question to those who migrated to FB3. Is there any ready quick solution to migrate smallint boolean domain (0,1) to native FB3 booleans?
I would not rush with that.

a) SqlDb (Lazarus 1.6.2) can't write native Boolean to Firebird 3 database (from DbGrid, at least).

b) ZEOS (7.2.1-rc) can't even read FB3 native Boolean.

The cause of the problem is trivial and I sent a fix to ZeosLib 7.2 Betatest Forum, but still can't see my topic there - apparently still awaiting approval by a moderator. My previous post on that strangely moderated forum did not show up even after several months, so I'll post the fix here:

ZDbcInterbase6Utils.pas

Code: Pascal  [Select][+][-]
  1. procedure TZSQLDA.InitFields(Parameters: boolean);
  2. var
  3.   I: Integer;
  4.   SqlVar: PXSQLVAR;
  5. begin
  6.   {$R-}
  7.   for I := 0 to FXSQLDA.sqld - 1 do
  8.   begin
  9.     SqlVar := @FXSQLDA.SqlVar[I];
  10.     FDecribedLengthArray[i] := SqlVar.sqllen;
  11.     FDecribedScaleArray[i] := SqlVar.sqlscale;
  12.     FDecribedTypeArray[i] := SqlVar.sqltype;
  13.     case SqlVar.sqltype and (not 1) of    
  14.          
  15.      { bug fix start }
  16.       SQL_BOOLEAN_FB,
  17.      { bux fix end }
  18.          
  19.       SQL_BOOLEAN, SQL_TEXT, SQL_TYPE_DATE, SQL_TYPE_TIME, SQL_DATE,
  20.       SQL_BLOB, SQL_ARRAY, SQL_QUAD, SQL_SHORT,
  21.       SQL_LONG, SQL_INT64, SQL_DOUBLE, SQL_FLOAT, SQL_D_FLOAT:
  22.         IbReAlloc(SqlVar.sqldata, 0, Max(1, SqlVar.sqllen));
  23.       SQL_VARYING:
  24.         IbReAlloc(SqlVar.sqldata, 0, SqlVar.sqllen + 2)
  25.     end;

Zoran

  • Hero Member
  • *****
  • Posts: 1830
    • http://wiki.lazarus.freepascal.org/User:Zoran
Re: Lazarus 1.6 & Firebird 3.0
« Reply #20 on: November 27, 2016, 06:56:29 pm »
The cause of the problem is trivial and I sent a fix to ZeosLib 7.2 Betatest Forum, but still can't see my topic there - apparently still awaiting approval by a moderator. My previous post on that strangely moderated forum did not show up even after several months, so I'll post the fix here:

I reported this on their forum: http://zeoslib.sourceforge.net/viewtopic.php?f=40&t=62235
Let's hope moderators will react.

LacaK

  • Hero Member
  • *****
  • Posts: 691
Re: Lazarus 1.6 & Firebird 3.0
« Reply #21 on: November 28, 2016, 07:07:40 pm »

a) SqlDb (Lazarus 1.6.2) can't write native Boolean to Firebird 3 database (from DbGrid, at least).


Lazarus 1.6.2 uses FPC 3.0.0 so there should be already support for Firebird 3 BOOLEAN data type.
Do you get any error on Post ?

marsupilami79

  • New Member
  • *
  • Posts: 38
Re: Lazarus 1.6 & Firebird 3.0
« Reply #22 on: November 28, 2016, 07:35:21 pm »
Hello Zoran and abonic,

the modification has been checked in to the SVN on sourceforge. The post was approved.

With best regards,

Jan
Zeos developer

abonic

  • New member
  • *
  • Posts: 7
Re: Lazarus 1.6 & Firebird 3.0
« Reply #23 on: November 28, 2016, 09:31:10 pm »

a) SqlDb (Lazarus 1.6.2) can't write native Boolean to Firebird 3 database (from DbGrid, at least).


Lazarus 1.6.2 uses FPC 3.0.0 so there should be already support for Firebird 3 BOOLEAN data type.
Do you get any error on Post ?
I stand corrected - SqlDb in Lazarus 1.6.2 works without problems with FB3 native Boolean. Error was in my test project. Sorry for the misinformation.

@Zoran, @marsupilami79 - thank you.
« Last Edit: November 28, 2016, 09:53:35 pm by abonic »

 

TinyPortal © 2005-2018