diff options
Diffstat (limited to 'lib/dbshell')
| -rw-r--r-- | lib/dbshell/client/mysql.rb | 23 | 
1 files changed, 23 insertions, 0 deletions
| diff --git a/lib/dbshell/client/mysql.rb b/lib/dbshell/client/mysql.rb new file mode 100644 index 0000000..6cb8233 --- /dev/null +++ b/lib/dbshell/client/mysql.rb @@ -0,0 +1,23 @@ +module DBShell +  module Client +    class MySQL +      EXECUTABLE_NAME = 'mysql' + +      def self.build_command(db_info) +        args = [EXECUTABLE_NAME] + +        host = db_info['host'] +        port = db_info['port'] +        db_name = db_info['database'] +        user = db_info['username'] +        password = db_info['password'] + +        args.push("--user=#{user}") if user +        args.push("--password=#{password}") if password +        args.push("--host=#{host}") if host +        args.push("--port=#{port}") if port +        args.push(db_name) +      end +    end +  end +end | 
