Page 1 of 1
TMySQLMonitor loggin only Insert/Update/Delete
Posted: Sat 24 Nov 2007 02:19
by eduardosic
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.
Posted: Mon 26 Nov 2007 08:13
by Antaeus
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.
ok..
Posted: Mon 26 Nov 2007 10:04
by eduardosic
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.
Thank's Antaeus..
suggestion
Posted: Mon 26 Nov 2007 21:32
by eduardosic
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.
hi Antaeus!!
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?
Posted: Tue 27 Nov 2007 12:10
by Antaeus
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:
Code: Select all
MySQLMonitor.TraceFlags := [tfMisc];
You can do this if you want to avoid this condition in your event: