Sha256: 83fd4280e1e8515bd2acd28c4a971d404af1f700632fe54edf8aae65485bc278

Contents?: true

Size: 1.05 KB

Versions: 11

Compression:

Stored size: 1.05 KB

Contents

unless defined? $__rq_executor__
  module RQ 
#--{{{
    LIBDIR = File::dirname(File::expand_path(__FILE__)) + File::SEPARATOR unless
      defined? LIBDIR

    require LIBDIR + 'mainhelper'

    #
    # the Executor is for expert use only and executes arbitrary sql on the
    # queue's db.  the reason one should not do this directly with the sqlite
    # command line program is that it will not respect the locking subsystem
    # used in RQ - the Executor method will
    #
    class  Executor < MainHelper
#--{{{
    def execute
#--{{{
      set_q
      sql = @argv.join ' '
      if sql.empty? and stdin? 
        debug{ "reading sql from stdin" }
        while((buf = stdin.gets))
          buf.strip!
          buf.gsub! %r/#.*$/o, ''
          next if buf.empty?
          sql << "#{ buf } "
        end
      end
      abort "no sql to execute" if sql.empty?
      @q.qdb.transaction_retries = 0
      @q.transaction{@q.execute(sql, &dumping_yaml_tuples)}
#--}}}
    end
#--}}}
    end # class Executor
#--}}}
  end # module RQ
$__rq_executor__ = __FILE__ 
end

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
rq-3.5.3 lib/rq/executor.rb
rq-3.5.1 lib/rq/executor.rb
rq-3.5.0 lib/rq/executor.rb
rq-ruby1.8-3.4.7 lib/rq/executor.rb
rq-ruby1.8-3.4.6 lib/rq/executor.rb
rq-ruby1.8-3.4.5 lib/rq/executor.rb
rq-ruby1.8-3.4.3 lib/rq/executor.rb
rq-3.0.0 lib/rq-3.0.0/executor.rb
rq-3.1.0 lib/rq-3.1.0/executor.rb
rq-3.3.0 lib/rq/executor.rb
rq-3.4.0 lib/rq/executor.rb