Scroll

Global Event: OnExecuteSqlStatementConstructed

The OnExecuteSqlStatementConstructed Event occurs just before SQL is sent to the Data Source to retrieve data for report execution. This Event could be used to inspect, log or modify the SQL that is being used for report execution.

Signature

For custom code the args array is structured as follows:

args[] contains a string representing the execution SQL in position zero.

For .Net Assemblies the method signature is as follows:

string EventHandlerName(SessionInfo sessionInfo, sting exectuionSql, SqlObject sqlObject)

Expected Return

The OnExecuteSqlStatementConstructed Event expects a string to be returned.

Example

The following example shows how report execution SQL can be written to a specified log file.

//Writes the current time, companyId, userId and report name to a specified log file.
File.WriteAllText(“C:\ReportSqlLogFile”, String.Format(“{0}, {1}, {2}, {3}”, DateTime.Now.ToString(), sessionInfo.CompanyId, sessionInfo.UserId, args[0]));
//returns null to proceed with execution
return args[0];

 


Hidden Article Information

Article Author
Exago Development
created 2017-02-21 15:54:28 UTC
updated 2017-06-27 14:42:24 UTC

Labels
Server Events, event handlers, list of server events, execute, sqlstatement, stmt, sqlconstructed, statement, constructed, executesqlstatementconstructed, sqlstmt, sql, execution,
Have more questions? Submit a request