Method: Fradium#dbconsole

Defined in:
lib/fradium.rb

#dbconsoleObject



98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# File 'lib/fradium.rb', line 98

def dbconsole
  case @sequel.adapter_scheme
  when :mysql2
    # I know this is not safe.
    Kernel.exec({'MYSQL_PWD' => @params['password']},
                'mysql',
                "--pager=less -SF",
                "--user=#{@params['username']}",
                "--host=#{@params['host']}" ,
                "#{@params['database']}")
  when :postgres
    Kernel.exec({'PGPASSWORD' => @params['password']},
                'psql',
                "--username=#{@params['username']}",
                "--dbname=#{@params['database']}",
                "--host=#{@params['host']}")
  when :sqlite
    Kernel.exec('sqlite3', @params)
  end
end