how to make check table with myDAC

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
putukaca
Posts: 4
Joined: Mon 06 Nov 2006 15:09

how to make check table with myDAC

Post by putukaca » Sun 11 Mar 2007 13:29

hi

can myDAC do something like check, repair, optimize and so on. Like in mysql front there is fasility to do that? i want to do with one botton in my app. it' to be like this :

1. i want to make list of the tables from database (in listbox)
2. i click the tables name in the list box.
3. there're an option in group box . like repair, check, optimize and soon
4. i hit the button to do those option and display the status in listbox to. like

table a reair...OK
table c reair...OK
table b reair...OK
etc

thank's

Antaeus
Posts: 2098
Joined: Tue 14 Feb 2006 10:14

Post by Antaeus » Mon 12 Mar 2007 08:04

You can do this with the TMyServerControl component. It can analyze, check, optimize, repair tables and perform some other operations. For more information read the MyDAC Help documentation.
List of the tables in a database you can get by the GetTableNames method of the TMyConnection object.

putukaca
Posts: 4
Joined: Mon 06 Nov 2006 15:09

Post by putukaca » Thu 26 Apr 2007 03:08

thank's for your replay

i can do with TMyServerControl but can u give me some example how to display the status of the table that i chose to analyze, check, optimize or repair like

table a optimize....ok
table b optimize....ok
etc..

nb: if u wish send to my email [email protected]

thank's
yudi

Antaeus
Posts: 2098
Joined: Tue 14 Feb 2006 10:14

Post by Antaeus » Thu 26 Apr 2007 06:48

TMyServerControl is a TDataSet descendant. It returns the result of the operation as a record set. The following code displays the result of the operation:

Code: Select all

  Memo.Lines.Clear;
  MyServerControl.TableNames := 'emp;dept';
  MyServerControl.AnalyzeTable;
  while not MyServerControl.Eof do begin
    Memo.Lines.Add('Table ' + MyServerControl.FieldByName('Table').AsString + '  ' +
                   MyServerControl.FieldByName('Op').AsString + '...' +
                   MyServerControl.FieldByName('Msg_text').AsString);
    MyServerControl.Next;
  end;

putukaca
Posts: 4
Joined: Mon 06 Nov 2006 15:09

Post by putukaca » Sun 29 Apr 2007 15:08

Memo.Lines.Add('Table ' + MyServerControl.FieldByName('Table').AsString + ' ' +
MyServerControl.FieldByName('Op').AsString + '...' +
MyServerControl.FieldByName('Msg_text').AsString);
sorry for asking again. when i compile i get an error [Error] tableService.pas(40): Undeclared identifier: 'FieldByName'. then i check the MyServerControl doesn't have property FieldByName. how to solve this? sorry because i'm new in delphi. please give me more explaination.

thank's
yudi

Antaeus
Posts: 2098
Joined: Tue 14 Feb 2006 10:14

Post by Antaeus » Thu 03 May 2007 08:20

Please check that your MyServerControl variable is an object of the TMyServerControl class. If it is, move the MyServerControl unit to the first place in the uses clause. If this does not help, specify the exact version of MyDAC. You can see it in the About sheet of TMyConnection Editor.

Post Reply