Sha256: e057387c954db76394cfaf306e2bc650f6b01c10e944b5f169d928d239a30626

Contents?: true

Size: 1.37 KB

Versions: 2

Compression:

Stored size: 1.37 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 Florian Frank's JSON <tt>JSON.generate</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

2 entries across 2 versions & 1 rubygems

Version Path
mysql2xxxx-0.2.1 README.rdoc
mysql2xxxx-0.2.0 README.rdoc