On pgAdmin with a simple query 'select * from data' I got only one record containing a field type text[] with value '{"1","2","3"}'. The following simplified code gives back only the "1" part of the value:
function GetData: string;
var
q: TFDQuery;
s: string;
i: integer;
av: array of variant;
as: array of string;
begin
result:='';
q:=TFDQuery.Create(nil);
try
q.Connection:=FDConnection;
q.SQL.Text:='select * from data';
try
q.Open;
while not q.Eof do
begin
//s:=q.FieldByName('data_array').AsString; //s = '1'
//as:=q.FieldByName('data_array').AsVariant; //as length = 1; as[0] = '1'
av:=q.FieldByName('data_array').AsVariant;
for i:=0 to Length(av)-1 do s:=s+av[i]; //av length = 1; s = '1'
q.Next;
end;
result:=q.RecordCount;
except
result:=-2;
end;
finally
q.Free;
sl.Free;
end;
end;
What is the way to get the whole data?