Browse Source

* Ensure value 1 is stored for True boolean values (fpc > 2.2 stores -1 in a wordbool when assigned a True boolean value)

git-svn-id: trunk@14441 -
blikblum 15 years ago
parent
commit
32e7daeee9
1 changed files with 5 additions and 1 deletions
  1. 5 1
      packages/fcl-db/src/sqlite/customsqliteds.pas

+ 5 - 1
packages/fcl-db/src/sqlite/customsqliteds.pas

@@ -1326,7 +1326,11 @@ begin
       end;
     ftBoolean, ftWord:
       begin
-        Str(Word(Buffer^), TempStr);
+        //ensure that boolean True value is stored as 1
+        if Field.DataType = ftBoolean then
+          TempStr := IfThen(Boolean(Buffer^), '1', '0')
+        else
+          Str(Word(Buffer^), TempStr);
         EditItem^.Row[FieldOffset] := StrAlloc(Length(TempStr) + 1);
         Move(PChar(TempStr)^, (EditItem^.Row[FieldOffset])^, Length(TempStr) + 1);
       end;