Sha256: 79ab3816fed0cbdfb5c1ab8c4d53f066344cffcb40d50afd98304799514dae4f

Contents?: true

Size: 1.07 KB

Versions: 45

Compression:

Stored size: 1.07 KB

Contents

require 'open3'
require 'flydata-core/mysql/command_generator'

# Command class must be in module Flydata::Command
module Flydata
  module Command

    module MysqlCommandBase
      def run(*args)
        de = data_entry
        cmd = generate_command(de['mysql_data_entry_preference'], args)
        return if cmd.to_s.empty?
        $stderr.puts "command:#{cmd}" if FLYDATA_DEBUG
        if $stdin.tty?
          # interactive shell
          system cmd
        else
          # execute queries given to $stdin
          Open3.popen2e(cmd) do |i, o, wt|
            $stdin.each_line do |line|
              i.print line
            end
            i.close
            while line = o.gets
              print line
            end
          end
        end
      end

      def generate_command(dbconf, args)
        dbconf.delete('tables')
        dbconf[:custom_option_end] = args.join(' ')
        FlydataCore::Mysql::CommandGenerator::generate_mysql_cmd(dbconf)
      end

      def flush; end
      def reset; end
      def skip; end
      def generate_table_ddl; end
    end

  end
end

Version data entries

45 entries across 45 versions & 1 rubygems

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