# File lib/new_relic/agent/transaction_sampler.rb, line 186
      def notice_sql(sql, config, duration, state=nil, explainer=nil, binds=nil, name=nil) #THREAD_LOCAL_ACCESS sometimes
        # some statements (particularly INSERTS with large BLOBS
        # may be very large; we should trim them to a maximum usable length
        state ||= TransactionState.tl_get
        builder = state.transaction_sample_builder
        if state.is_sql_recorded?
          statement = Database::Statement.new(sql, config, explainer, binds, name)
          notice_extra_data(builder, statement, duration, :sql)
        end
      end