Sha256: de6b57fc8236f04d4a25fce46e2f1e01588dc57a931928feb40b7f8e30ce9f6e

Contents?: true

Size: 608 Bytes

Versions: 21

Compression:

Stored size: 608 Bytes

Contents

require 'flydata/source_mysql/mysql_accessible'

module Flydata
  module SourceMysql
    class SyncDatabaseSizeCheck
      include MysqlAccessible

      SIZE_CHECK_QUERY = <<EOT
SELECT
  SUM(data_length) bytesize
FROM
  information_schema.tables
WHERE
  table_schema = '%s' AND table_name in (%s);
EOT

      def initialize(de_conf)
        super
        @query = SIZE_CHECK_QUERY % [
          de_conf['database'],
          tables = de_conf['tables'].collect{|t| "'#{t}'"}.join(',')]
      end

      def get_db_bytesize
        exec_mysql_query(@query).first['bytesize'].to_i
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
flydata-0.8.10.2 lib/flydata/source_mysql/sync_database_size_check.rb
flydata-0.8.10.1 lib/flydata/source_mysql/sync_database_size_check.rb
flydata-0.8.9.11 lib/flydata/source_mysql/sync_database_size_check.rb
flydata-0.8.10 lib/flydata/source_mysql/sync_database_size_check.rb
flydata-0.8.9 lib/flydata/source_mysql/sync_database_size_check.rb
flydata-0.8.8 lib/flydata/source_mysql/sync_database_size_check.rb
flydata-0.8.7 lib/flydata/source_mysql/sync_database_size_check.rb
flydata-0.8.6 lib/flydata/source_mysql/sync_database_size_check.rb
flydata-0.8.5 lib/flydata/source_mysql/sync_database_size_check.rb
flydata-0.8.4 lib/flydata/source_mysql/sync_database_size_check.rb
flydata-0.8.3 lib/flydata/source_mysql/sync_database_size_check.rb
flydata-0.8.2 lib/flydata/source_mysql/sync_database_size_check.rb
flydata-0.8.1 lib/flydata/source_mysql/sync_database_size_check.rb
flydata-0.8.0 lib/flydata/source_mysql/sync_database_size_check.rb
flydata-0.7.19 lib/flydata/source_mysql/sync_database_size_check.rb
flydata-0.7.18 lib/flydata/source_mysql/sync_database_size_check.rb
flydata-0.7.17 lib/flydata/source_mysql/sync_database_size_check.rb
flydata-0.7.16 lib/flydata/source_mysql/sync_database_size_check.rb
flydata-0.7.15 lib/flydata/source_mysql/sync_database_size_check.rb
flydata-0.7.14 lib/flydata/source_mysql/sync_database_size_check.rb