private TResult ExecuteCommandUnit(CommandExecuteUnit commandExecuteUnit) { if (OnCommandSqlExecute == null) { throw new ShardingException("command sql execute not implement"); } return(OnCommandSqlExecute.Invoke(commandExecuteUnit.Command, commandExecuteUnit.ConnectionMode)); }
/** * To make sure SkyWalking will be available at the next release of ShardingSphere, * a new plugin should be provided to SkyWalking project if this API changed. * * @see <a href="https://github.com/apache/skywalking/blob/master/docs/en/guides/Java-Plugin-Development-Guide.md#user-content-plugin-development-guide">Plugin Development Guide</a> * * @param statementExecuteUnit statement execute unit * @param isTrunkThread is trunk thread * @param dataMap data map * @return result * @throws SQLException SQL exception */ private T Execute0(CommandExecuteUnit commandExecuteUnit, bool isTrunkThread, IDictionary <string, object> dataMap) { ExecutorExceptionHandler.SetExceptionThrow(isExceptionThrown); IDataSourceMetaData dataSourceMetaData = GetDataSourceMetaData(commandExecuteUnit.Command); var hookManager = SqlExecutionHookManager.GetInstance(); try { ExecutionUnit executionUnit = commandExecuteUnit.ExecutionUnit; hookManager.Start(executionUnit.GetDataSourceName(), executionUnit.GetSqlUnit().GetSql(), executionUnit.GetSqlUnit().GetParameterContext(), dataSourceMetaData, isTrunkThread, dataMap); T result = OnSqlExecute(executionUnit.GetSqlUnit().GetSql(), commandExecuteUnit.Command, commandExecuteUnit.ConnectionMode); hookManager.FinishSuccess(); return(result); } catch (Exception ex) { hookManager.FinishFailure(ex); ExecutorExceptionHandler.HandleException(ex); return(default);