How can we easily log all SQL statements with as much as possible info
I would like to log the actual SQL with the execution duration (~SQL server time) with (custom) info from the RO client (PC, application, process id)
Talk issue
speaks about demo server application but I cannot find this sample code after a quick scan of C:\Users\Public\Documents\RemObjects Samples\Data Abstract for .NET
DASchema GetSQL event does not give me duration
BusinessProcessor.OnGenerate does not give me duration and is only called for update/insert
ProcessorAfterExecuteCommand not always called (after update/insert and some selects?) and ElapsedMilliseconds always seems 0 (delphi SDAC)
Our main focus is C#.NET code with MSSQL DB connections
The best way to log all MS SQL server activity is their SQL Server Profiler tool. However this tool won’t show application-level data like name of the user connected to the DA server etc. Also profiler tool might not be available for some databases supported by Data Abstract.
It is possible to add custom logging to the server app itself. Data Abstract server uses only 2 methods to access and update data and 1 additional to execute Schema command. The logging code would look like this:
Can the duration be added? It is very useful to see which queries took a long time.
SQL profiler is not an option for us for the reasons you mentioned.
The FlushLog method already displays elapsed time. This time also includes data serialization time, however for long-running queries this additional time won’t matter much. F.e. if a query runs for 5 seconds then 10 additional milliseconds won’t change the overall picture.
Do you have a similar solution for delphi? I don’t see the BeforeExecutingGetDataReader and GetData event in delphi.
How can we log all the SQL statements for a delphi RO dataabstract server?
It looks like the OnBeforeGetDatasetData does not get called for custom GetDataCall functions
So I assume we add our logging directly in our own server call in this case.
Do we have all the SQL traffic then or are there other cases where the events aren’t triggered