Environment:
Server: Ubuntu 18.04
Database: MariaDB 10.4.13
Client: Win10 x64
Lazarus 2.0.8 + FPC 3.0.4
Connection: TMySQL56Connection
Test:
Firstly, create a table for the test:
CREATE TABLE test_bit(flag BIT(1));
INSERT INTO test_bit(flag) VALUES(1);
SELECT * FROM test_bit; // Surely this returns value 1
But, when I test it using lazarus:
with AppDB.newQuery do // create a new TSQLQuery and set it's Database, etc.
try
SQL.Text := 'select * from test_bit';
Open;
if Fields[0].AsInteger <> 1 then
begin
raise Exception.Create('bit field value error!');
end;
Close;
finally
Free;
end;
In the above code, Fields[0].AsInteger is ALWAYS 0!
Why?
Something I did wrong or it's a bug ?
Furthermore, I checked the type of Fields[0], its ftLargeInt, and the FieldKind of the field is fkData
The libmysql.dll I used to connect to DB server is from HeidiSQL. It's too large to upload