Hi Antaeus!
exists some form to make TMySQLMonitor log only Insert into/Update/Delete
Statments? dont log Select?
I want to register commands SQL and to create a replication mechanism.
thank's
Eduardo.
TMySQLMonitor loggin only Insert/Update/Delete
-
eduardosic
- Posts: 387
- Joined: Fri 18 Nov 2005 00:26
- Location: Brazil
-
eduardosic
- Posts: 387
- Joined: Fri 18 Nov 2005 00:26
- Location: Brazil
ok..
Thank's Antaeus..Antaeus wrote:You can leave only the ftQExecute flag in TMySQLMonitor.Traceflags to avoid logging of events like connect, prepare, etc. In the TMySQLMonitor.OnSQL event you can parse the Text parameter to save in your log only necessary statements.
-
eduardosic
- Posts: 387
- Joined: Fri 18 Nov 2005 00:26
- Location: Brazil
suggestion
hi Antaeus!!Antaeus wrote:You can leave only the ftQExecute flag in TMySQLMonitor.Traceflags to avoid logging of events like connect, prepare, etc. In the TMySQLMonitor.OnSQL event you can parse the Text parameter to save in your log only necessary statements.
I implemented in the following way
Code: Select all
procedure TFrmMain.MySQLMonitorSQL(Sender: TObject; Text: string;Flag: TDATraceFlag);
begin
//save the Statement in a table...
if Flag = tfMisc then begin
MySQLMonitor.Active := False;
if Pos( 'SELECT', AnsiUpperCase( Copy(text,1,10) ) = 0 then begin //saved everything that is not select
QryLOG_SQL.ParamByName( 'SQL' ).AsString := Text + ';';
QryLOG_SQL.ParamByName( 'Ds_Sistema' ).AsString := 'MySYSTEM_A';
QryLOG_SQL.Execute;
end;
MySQLMonitor.Active := true;
end;
end;
you have some better suggestion?
This is a good solution. The only suggestion I have is to change TraceFlags of MySQLMonitor at design time or at run time in this way:
You can do this if you want to avoid this condition in your event:
Code: Select all
MySQLMonitor.TraceFlags := [tfMisc];Code: Select all
if Flag = tfMisc then begin