Sha256: 9b3aae009a130775bba96c0b406ed99e90a9dcd9102b8927cb8f2bacda90635b

Contents?: true

Size: 910 Bytes

Versions: 6

Compression:

Stored size: 910 Bytes

Contents

module RailsWorkflow
  module Db
    module Mysql
      COUNT_STATUSES = <<-SQL
      SELECT status, cnt FROM
               (
                    SELECT @row_number:=CASE
                                            WHEN @status=status THEN @row_number+1
                                            ELSE 1
                                        END AS row_number,
                           cnt,
                           @status:=status as status
                    FROM
                      ( SELECT count(*) AS cnt,
                               a.status
                        FROM rails_workflow_processes a
                        LEFT JOIN rails_workflow_processes b ON a.status=b.status
                        GROUP BY a.status,a.id
                      ) tmp,
                      (SELECT @row_number:=0,@status:=-1) AS t
               ) t1 WHERE row_number = 1
      SQL

    end
  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rails_workflow-0.3.7 lib/rails_workflow/db/mysql.rb
rails_workflow-0.3.6 lib/rails_workflow/db/mysql.rb
rails_workflow-0.3.5 lib/rails_workflow/db/mysql.rb
rails_workflow-0.3.4 lib/rails_workflow/db/mysql.rb
rails_workflow-0.3.3 lib/rails_workflow/db/mysql.rb
rails_workflow-0.3.2 lib/rails_workflow/db/mysql.rb