Recent

Author Topic: Boolean datatype on Firebird - experiences?  (Read 3536 times)

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Boolean datatype on Firebird - experiences?
« on: June 04, 2014, 04:22:56 pm »
I wonder whether anybody has tried this
http://wiki.lazarus.freepascal.org/firebird#Boolean_data_types
with Lazarus code using either sqldb or Zeos?
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

mangakissa

  • Hero Member
  • *****
  • Posts: 1131
Re: Boolean datatype on Firebird - experiences?
« Reply #1 on: June 05, 2014, 08:48:28 am »
Yes I did. But it doesn't work. SQLdb still see it as an integer. But I don't use FPC 2.71.
Lazarus 2.06 (64b) / FPC 3.0.4 / Windows 10
stucked on Delphi 10.3.1

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: Boolean datatype on Firebird - experiences?
« Reply #2 on: June 05, 2014, 08:56:57 am »
Thanks. Yes, that's probably true.
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

mse

  • Sr. Member
  • ****
  • Posts: 286
Re: Boolean datatype on Firebird - experiences?
« Reply #3 on: June 05, 2014, 09:09:47 am »
In MSEgui version of SQLdb a persistent tfield with ftBoolean can be used for a ftSmalint column. In tibconnection:
Code: [Select]
procedure TIBConnection.SetParameters(cursor: TSQLCursor; AParams: TmseParams);
...
     case paramtypes[sqlvarnr] of
...
      ftInteger,ftsmallint : begin
        if datatype = ftboolean then begin
         i:= 0;
         if asboolean then begin
          i:= 1;
         end;
        end
        else begin
         i:= AsInteger;
        end;
        Move(i, po1^.SQLData^,po1^.SQLLen);
...

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: Boolean datatype on Firebird - experiences?
« Reply #4 on: June 05, 2014, 09:19:17 am »
So the DOMAIN definition in the wiki fits is compatible with mse ;)
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

mangakissa

  • Hero Member
  • *****
  • Posts: 1131
Re: Boolean datatype on Firebird - experiences?
« Reply #5 on: June 05, 2014, 11:15:25 am »
The problem doesn't rely on SQLdb. In the case of Firebird en MySQL (even Oracle) the original datatype is givven back from the library client. I already made a topic of this problem.
The main issue here is TDBGrid checkboxes are not working if datatype isn't a real boolean.
Lazarus 2.06 (64b) / FPC 3.0.4 / Windows 10
stucked on Delphi 10.3.1

mse

  • Sr. Member
  • ****
  • Posts: 286
Re: Boolean datatype on Firebird - experiences?
« Reply #6 on: June 05, 2014, 11:45:13 am »
Is it not possible to use a persistent TBooleanField instead of a TSmallIntField with FCL-SQLdb? MSEgui-SQLdb allows it, not tested with original SQLdb.


korba812

  • Sr. Member
  • ****
  • Posts: 392
Re: Boolean datatype on Firebird - experiences?
« Reply #7 on: June 05, 2014, 01:56:32 pm »
Some time ago I added this functionality to the MDO library. But I stopped to use it in their projects because there is a lot of inconsistency and it is not natural for Firebird.

 

TinyPortal © 2005-2018