Closed pavelmash closed 4 years ago
Why not include the new log layout (with r=rows affected t=total time(us) fr=time to first row(us) c=cache q=SQL information) into the trunk? I am not fixed with the previous log content. Yours seems much better. So instead of "silent" the current log, replace it with your layout.
Will be good to move this into trunk. I review UnityBase code and now I see what I can do it! The problem I can't solve before is a "total fetch time":
But I can't put a final log inside FetchAllAsJSON because other app what use SynDB can use while stmt.Step do circle or similar.
But what if I add a final log for statement with result inside Step() function (in case step returns false we already in the end of cursor, so we know total fetch time)? The only BREAKING here is the case when some application did a long operation inside while stmt.Step do - in such code developer will need to add log timer pause/resume as such:
while stmt.Step do begin
stmt.SQLLogTimer.Pause;
// do some long operation
stmt.SQLLogTimer.Resume;
end
@synopse - if you approve such an approach I implement it
Please use ISQLDBRows.Instance to access the timer/sql/cache properties.
This pull request give developer an option to made a custom SQL execution log on the application layer by expose all necessary properties on ISQLDBStatement layer and mute a build-in SynDB* layer SQL execution logging; As a side effect:
We have a couple of hi-load production (~100Mb logs per minute) and need to:
With help of this patch I can made my logging looks like (4 lines less for every SQL, can be analyzed using RegExp/grep, exception contains only important info): (r=rows affected t=total time(us) fr=time to first row(us) c=cache q=SQL)
Before patch