Sha256: 4edf888720eff3180ad1b0b7565d7ea0deb9b6061cf3a028cc4d532b83af0678

Contents?: true

Size: 1.36 KB

Versions: 3

Compression:

Stored size: 1.36 KB

Contents

=mysql2xxxx

==Binaries

    mysql2csv --user=dbuser --password=dbpassword --database=dbname --execute="select * from automobile_makes"
    mysql2json --user=dbuser --password=dbpassword --database=dbname --execute="select * from automobile_makes"
    mysql2xml --user=dbuser --password=dbpassword --database=dbname --execute="select * from automobile_makes"

To see all options

    mysql2csv --help

==Ruby

    a = Mysql2xxxx::JSON.new :user => 'dbuser', :password => 'dbpassword', :database => 'dbname', :execute => "select * from automobile_makes"
    a.to_stdout                                     # write it directly to $stdout
    puts a.to_s                                     # get a string
    a.to_path('/tmp/outfile.json')                  # write it to a file at this path
    a.to_file(File.open('/tmp/outfile.json', 'w'))  # write it to a file handle

Note also that if you're running it inside a Rails application, it will default to the ActiveRecord connection config.

    a = Mysql2xxxx::JSON.new :execute => "select * from automobile_makes"  # no need to specify user, etc. because it's taken from ActiveRecord

==Well-formedness

* CSV output depends on FasterCSV <tt>to_csv</tt>
* JSON output depends on ActiveSupport <tt>to_json</tt>
* XML output is written manually, but looks like the output of <tt>mysql [hyphen][hyphen]xml</tt>

Copyright 2011 Seamus Abshere

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mysql2xxxx-0.0.4 README.rdoc
mysql2xxxx-0.0.3 README.rdoc
mysql2xxxx-0.0.2 README.rdoc