enhanced IsSelect() function to detect recursive INSERT/UPDATE/DELETE statements