Transfer metadata from MySql to Delphi

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
kaffeburk
Posts: 214
Joined: Mon 29 Jan 2007 08:03

Transfer metadata from MySql to Delphi

Post by kaffeburk » Sat 26 Jul 2008 16:55

Im trying to get information about a MYSQL database to Delphi.

I use this code:

procedure TForm1.Button2Click(Sender: TObject);
var
s: string;
i : integer;
tl : tstringlist;
loop: integer;
Mymax : integer;

begin

tl:=tstringlist.Create;
qry_getinfo.SQL.Text:='describe organs.org';
qry_getinfo.open;

Mymax:=qry_getinfo.Fields.Count;
for loop := 0 to Mymax - 1 do
begin
tl.Add(qry_getinfo.Fields[loop].asstring);
end;

memo1.Text:= tl.Text;


tl.Free;

end;

I only get the first row of the information, but there should be about 18...

eduardosic
Posts: 387
Joined: Fri 18 Nov 2005 00:26
Location: Brazil

Re: Transfer metadata from MySql to Delphi

Post by eduardosic » Sun 27 Jul 2008 19:35

Hi!!

Upgrade you mydac to the last version and try to use TMyMetaData or:

Code: Select all

  memo1.Text := '';
  qry_getinfo.First;

  while not qry_getinfo.eof do 
  begin
   for loop := 0 to qry_getinfo.Fields.Count - 1 do
   begin
    tl.Add( qry_getinfo.Fields[ loop ].asstring );
    memo1.Text := memo1.Text + tl.Text;
   end;
   qry_getinfo.Next; 
  end; 


Post Reply