Code Monkey home page Code Monkey logo

mysql2's People

Contributors

ajaska avatar benmcredmond avatar brianmario avatar byroot avatar casperisfine avatar cbandy avatar dbussink avatar dj2 avatar dylanahsmith avatar felixbuenemann avatar ghazel avatar jeremy avatar junaruga avatar justincase avatar kamipo avatar kronn avatar loe avatar luislavena avatar methodmissing avatar mishina2228 avatar mperham avatar nyaxt avatar radsaq avatar simi avatar sodabrew avatar tadd avatar tamird avatar tenderlove avatar timcharper avatar wok avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mysql2's Issues

mysql2 branch for rails 2.3.x

Excellent news that mysql2 is going to Rails 3 core.
But what about users with rails 2.3?

I'm using mysql2 for bunch of my projects under rails 2.3. MySql2 0.1.9 gem has connection issues in development mode (RAIL_ENV = development + Rails 2.3.8 + Unicorn + Bundler + Mac Os X). I switched to Mysql2 master and was waiting for MySql2 0.2 to be released with connection closed issues fixed.

Can you create branch from 5a9ca9c and release new gem build? Last one %)

malloc error

I am getting this:

ruby(32263,0x10240a000) malloc: *** error for object 0x101192c00: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
Exception Mysql2::Error' at /path/mysql_logger.rb:21 - Lost connection to MySQL server at 'reading authorization packet', system error: 9 ExceptionMysql2::Error' at /path/mysql_logger.rb:23 - Lost connection to MySQL server at 'reading authorization packet', system error: 9
zsh: abort ruby -Ilib -d bin/tpm -f -c tpm.conf

And the file:
require 'mysql2'
require 'terminal-table/import'
module TPM
class MysqlLogger

def initialize(host)
  @host    = host
  server   = TPM.config['db']['server']
  user     = TPM.config['db']['user']
  password = TPM.config['db']['password']
  db       = TPM.config['db']['db']
  @con     = Mysql2::Client.new(:host => server, :username => user, :password => password)
  @con.query("USE `#{db}`")
end

def log(loginfo)
  loginfo = {:status => 'info', :action => nil, :version => nil}.merge! loginfo
  loginfo[:message] ||= ''
  loginfo[:category] = 'internal' if loginfo[:category].nil?
  begin
    @con.query("INSERT INTO logs (ts, status, category, action, message, host, site, version) VALUES (#{Time.now.to_i}, '#{loginfo[:status]}', '#{loginfo[:category]}', '#{loginfo[:action]}', '#{loginfo[:message].to_s.esc}', '#{@host}', '#{loginfo[:site]}', '#{loginfo[:version]}')", :async => true)
  rescue Exception
    raise
  end
end

end
end

Hope this helps.

Christoph

handle invalid datetime values somehow

irb(main):020:0> client.query("SELECT cast('0000-00-00 00:00:01' as datetime) as d").to_a
ArgumentError: argument out of range
    from (irb):20:in `local'
    from (irb):20:in `each'
    from (irb):20:in `to_a'
    from (irb):20
    from /usr/local/lib/ruby/site_ruby/1.8/rubygems.rb:168

errors in schema.rb

mysql2 driver fails to generate schema.rb in rails 2.3.5 app
schema.rb contains following, instead of actual table dumps:

# Could not dump table "assets" because of following NameError
#   uninitialized constant ActiveRecord::ConnectionAdapters::Mysql2Adapter::PRIMARY

undefined method `errno' for #<Mysql2::Error:0x8fd09dc>

rails 3.0.0, ruby 1.9.2
Gem installed without any problems, but when i try to make rake db:create i get this error
full log of the error:
rake aborted!
undefined method errno' for #<Mysql2::Error:0x8fd09dc> /opt/ruby/lib/ruby/gems/1.9.1/gems/activerecord-3.0.0/lib/active_record/railties/databases.rake:71:inrescue in rescue in create_database'
/opt/ruby/lib/ruby/gems/1.9.1/gems/activerecord-3.0.0/lib/active_record/railties/databases.rake:66:in rescue in create_database' /opt/ruby/lib/ruby/gems/1.9.1/gems/activerecord-3.0.0/lib/active_record/railties/databases.rake:39:increate_database'
/opt/ruby/lib/ruby/gems/1.9.1/gems/activerecord-3.0.0/lib/active_record/railties/databases.rake:33:in block (2 levels) in <top (required)>' /opt/ruby/lib/ruby/1.9.1/rake.rb:634:incall'
/opt/ruby/lib/ruby/1.9.1/rake.rb:634:in block in execute' /opt/ruby/lib/ruby/1.9.1/rake.rb:629:ineach'
/opt/ruby/lib/ruby/1.9.1/rake.rb:629:in execute' /opt/ruby/lib/ruby/1.9.1/rake.rb:595:inblock in invoke_with_call_chain'
/opt/ruby/lib/ruby/1.9.1/monitor.rb:201:in mon_synchronize' /opt/ruby/lib/ruby/1.9.1/rake.rb:588:ininvoke_with_call_chain'
/opt/ruby/lib/ruby/1.9.1/rake.rb:581:in invoke' /opt/ruby/lib/ruby/1.9.1/rake.rb:2041:ininvoke_task'
/opt/ruby/lib/ruby/1.9.1/rake.rb:2019:in block (2 levels) in top_level' /opt/ruby/lib/ruby/1.9.1/rake.rb:2019:ineach'
/opt/ruby/lib/ruby/1.9.1/rake.rb:2019:in block in top_level' /opt/ruby/lib/ruby/1.9.1/rake.rb:2058:instandard_exception_handling'
/opt/ruby/lib/ruby/1.9.1/rake.rb:2013:in top_level' /opt/ruby/lib/ruby/1.9.1/rake.rb:1992:inrun'
/usr/bin/rake:31:in `

'

performance

hi,

you say that its 25% faster then mysql gem, i have tested it with your Benchmark and ApacheBench and at least at my machine its about 10% slower ;)

im using ubuntu 10.4, ruby 1.8.7 (2010-01-10 patchlevel 249) [x86_64-linux], rails 2.3.5

ActiveRecord mysql2 adapter doesn't work

I installed mysql2 gem and tried to use it as adapter for ActiveRecord. I am using ruby1.9.2-head and rails3 rc. I changed adapter to mysql2, but got this message:

ras@chef:~/Programming/rails/latest$ r c
/home/ras/.rvm/gems/ruby-1.9.2-head/gems/activerecord-3.0.0.rc/lib/active_record/connection_adapters/abstract/connection_specification.rb:71:in 'rescue in establish_connection': Please install the mysql2 adapter: 'gem install activerecord-mysql2-adapter' (no such file to load -- active_record/connection_adapters/mysql2_adapter) (RuntimeError)
from /home/ras/.rvm/gems/ruby-1.9.2-head/gems/activerecord-3.0.0.rc/lib/active_record/connection_adapters/abstract/connection_specification.rb:68:in 'establish_connection'
from /home/ras/.rvm/gems/ruby-1.9.2-head/gems/activerecord-3.0.0.rc/lib/active_record/connection_adapters/abstract/connection_specification.rb:60:in 'establish_connection'
from /home/ras/.rvm/gems/ruby-1.9.2-head/gems/activerecord-3.0.0.rc/lib/active_record/connection_adapters/abstract/connection_specification.rb:55:in 'establish_connection'
from /home/ras/.rvm/gems/ruby-1.9.2-head/gems/activerecord-3.0.0.rc/lib/active_record/railtie.rb:55:in 'block (2 levels) in class:Railtie'
from /home/ras/.rvm/gems/ruby-1.9.2-head/gems/activesupport-3.0.0.rc/lib/active_support/lazy_load_hooks.rb:17:in 'instance_eval'
from /home/ras/.rvm/gems/ruby-1.9.2-head/gems/activesupport-3.0.0.rc/lib/active_support/lazy_load_hooks.rb:17:in 'execute_hook'
from /home/ras/.rvm/gems/ruby-1.9.2-head/gems/activesupport-3.0.0.rc/lib/active_support/lazy_load_hooks.rb:24:in 'block in run_load_hooks'
from /home/ras/.rvm/gems/ruby-1.9.2-head/gems/activesupport-3.0.0.rc/lib/active_support/lazy_load_hooks.rb:23:in 'each'
from /home/ras/.rvm/gems/ruby-1.9.2-head/gems/activesupport-3.0.0.rc/lib/active_support/lazy_load_hooks.rb:23:in 'run_load_hooks'
from /home/ras/.rvm/gems/ruby-1.9.2-head/gems/activerecord-3.0.0.rc/lib/active_record/base.rb:1803:in '<top (required)>'
from /home/ras/.rvm/gems/ruby-1.9.2-head/gems/activerecord-3.0.0.rc/lib/active_record/railtie.rb:28:in 'block in class:Railtie'
from /home/ras/.rvm/gems/ruby-1.9.2-head/gems/railties-3.0.0.rc/lib/rails/railtie.rb:180:in 'call'
from /home/ras/.rvm/gems/ruby-1.9.2-head/gems/railties-3.0.0.rc/lib/rails/railtie.rb:180:in 'each'
from /home/ras/.rvm/gems/ruby-1.9.2-head/gems/railties-3.0.0.rc/lib/rails/railtie.rb:180:in 'load_console'
from /home/ras/.rvm/gems/ruby-1.9.2-head/gems/railties-3.0.0.rc/lib/rails/application.rb:154:in 'block in load_console'
from /home/ras/.rvm/gems/ruby-1.9.2-head/gems/railties-3.0.0.rc/lib/rails/application/railties.rb:11:in 'each'
from /home/ras/.rvm/gems/ruby-1.9.2-head/gems/railties-3.0.0.rc/lib/rails/application/railties.rb:11:in 'all'
from /home/ras/.rvm/gems/ruby-1.9.2-head/gems/railties-3.0.0.rc/lib/rails/application.rb:154:in 'load_console'
from /home/ras/.rvm/gems/ruby-1.9.2-head/gems/railties-3.0.0.rc/lib/rails/commands/console.rb:26:in 'start'
from /home/ras/.rvm/gems/ruby-1.9.2-head/gems/railties-3.0.0.rc/lib/rails/commands/console.rb:8:in 'start'
from /home/ras/.rvm/gems/ruby-1.9.2-head/gems/railties-3.0.0.rc/lib/rails/commands.rb:23:in '<top (required)>'
from script/rails:6:in 'require'
from script/rails:6:in '

'

"can't modify frozen object" error in 1.9.2

getting this issue from a very recent commit:

can't modify frozen object
/Users/james/.rvm/gems/ruby-1.9.2-rc2/bundler/gems/mysql2-6142336/lib/active_record/connection_adapters/mysql2_adapter.rb:299:in query' /Users/james/.rvm/gems/ruby-1.9.2-rc2/bundler/gems/mysql2-6142336/lib/active_record/connection_adapters/mysql2_adapter.rb:299:inexecute'
/Users/james/.rvm/gems/ruby-1.9.2-rc2/bundler/gems/mysql2-6142336/lib/active_record/connection_adapters/mysql2_adapter.rb:602:in configure_connection' /Users/james/.rvm/gems/ruby-1.9.2-rc2/bundler/gems/mysql2-6142336/lib/active_record/connection_adapters/mysql2_adapter.rb:164:ininitialize'
/Users/james/.rvm/gems/ruby-1.9.2-rc2/bundler/gems/mysql2-6142336/lib/active_record/connection_adapters/mysql2_adapter.rb:11:in new' /Users/james/.rvm/gems/ruby-1.9.2-rc2/bundler/gems/mysql2-6142336/lib/active_record/connection_adapters/mysql2_adapter.rb:11:inmysql2_connection'
/Users/james/.rvm/gems/ruby-1.9.2-rc2/gems/activerecord-2.3.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:223:in new_connection' /Users/james/.rvm/gems/ruby-1.9.2-rc2/gems/activerecord-2.3.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:245:incheckout_new_connection'
/Users/james/.rvm/gems/ruby-1.9.2-rc2/gems/activerecord-2.3.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:188:in block (2 levels) in checkout' /Users/james/.rvm/gems/ruby-1.9.2-rc2/gems/activerecord-2.3.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:184:inloop'
/Users/james/.rvm/gems/ruby-1.9.2-rc2/gems/activerecord-2.3.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:184:in block in checkout' /Users/james/.rvm/rubies/ruby-1.9.2-rc2/lib/ruby/1.9.1/monitor.rb:201:inmon_synchronize'
/Users/james/.rvm/gems/ruby-1.9.2-rc2/gems/activerecord-2.3.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:183:in checkout' /Users/james/.rvm/gems/ruby-1.9.2-rc2/gems/activerecord-2.3.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:98:inconnection'
/Users/james/.rvm/gems/ruby-1.9.2-rc2/gems/activerecord-2.3.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:326:in retrieve_connection' /Users/james/.rvm/gems/ruby-1.9.2-rc2/gems/activerecord-2.3.8/lib/active_record/connection_adapters/abstract/connection_specification.rb:123:inretrieve_connection'
/Users/james/.rvm/gems/ruby-1.9.2-rc2/gems/activerecord-2.3.8/lib/active_record/connection_adapters/abstract/connection_specification.rb:115:in connection' /Users/james/projects/music-social/vendor/plugins/set_names_utf8/init.rb:3:inblock (2 levels) in evaluate_init_rb'
/Users/james/.rvm/gems/ruby-1.9.2-rc2/gems/activesupport-2.3.8/lib/active_support/core_ext/kernel/reporting.rb:54:in suppress' /Users/james/projects/music-social/vendor/plugins/set_names_utf8/init.rb:2:inblock in evaluate_init_rb'
/Users/james/.rvm/gems/ruby-1.9.2-rc2/gems/rails-2.3.8/lib/rails/plugin.rb:158:in eval' /Users/james/.rvm/gems/ruby-1.9.2-rc2/gems/rails-2.3.8/lib/rails/plugin.rb:158:inblock in evaluate_init_rb'
/Users/james/.rvm/gems/ruby-1.9.2-rc2/gems/activesupport-2.3.8/lib/active_support/core_ext/kernel/reporting.rb:11:in silence_warnings' /Users/james/.rvm/gems/ruby-1.9.2-rc2/gems/rails-2.3.8/lib/rails/plugin.rb:154:inevaluate_init_rb'
/Users/james/.rvm/gems/ruby-1.9.2-rc2/gems/rails-2.3.8/lib/rails/plugin.rb:48:in load' /Users/james/.rvm/gems/ruby-1.9.2-rc2/gems/rails-2.3.8/lib/rails/plugin/loader.rb:38:inblock in load_plugins'
/Users/james/.rvm/gems/ruby-1.9.2-rc2/gems/rails-2.3.8/lib/rails/plugin/loader.rb:37:in each' /Users/james/.rvm/gems/ruby-1.9.2-rc2/gems/rails-2.3.8/lib/rails/plugin/loader.rb:37:inload_plugins'
/Users/james/.rvm/gems/ruby-1.9.2-rc2/gems/rails-2.3.8/lib/initializer.rb:369:in load_plugins' /Users/james/.rvm/gems/ruby-1.9.2-rc2/gems/rails-2.3.8/lib/initializer.rb:165:inprocess'
/Users/james/.rvm/gems/ruby-1.9.2-rc2/gems/rails-2.3.8/lib/initializer.rb:113:in run' /Users/james/projects/music-social/config/environment.rb:7:in<top (required)>'
/Users/james/.rvm/gems/ruby-1.9.2-rc2/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:156:in require' /Users/james/.rvm/gems/ruby-1.9.2-rc2/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:156:inblock in require'
/Users/james/.rvm/gems/ruby-1.9.2-rc2/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:521:in new_constants_in' /Users/james/.rvm/gems/ruby-1.9.2-rc2/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:156:inrequire'
/Users/james/.rvm/gems/ruby-1.9.2-rc2/gems/rails-2.3.8/lib/tasks/misc.rake:4:in block in <top (required)>' /Users/james/.rvm/gems/ruby-1.9.2-rc2/gems/rake-0.8.7/lib/rake.rb:636:incall'
/Users/james/.rvm/gems/ruby-1.9.2-rc2/gems/rake-0.8.7/lib/rake.rb:636:in block in execute' /Users/james/.rvm/gems/ruby-1.9.2-rc2/gems/rake-0.8.7/lib/rake.rb:631:ineach'
/Users/james/.rvm/gems/ruby-1.9.2-rc2/gems/rake-0.8.7/lib/rake.rb:631:in execute' /Users/james/.rvm/gems/ruby-1.9.2-rc2/gems/rake-0.8.7/lib/rake.rb:597:inblock in invoke_with_call_chain'
/Users/james/.rvm/rubies/ruby-1.9.2-rc2/lib/ruby/1.9.1/monitor.rb:201:in mon_synchronize' /Users/james/.rvm/gems/ruby-1.9.2-rc2/gems/rake-0.8.7/lib/rake.rb:590:ininvoke_with_call_chain'
/Users/james/.rvm/gems/ruby-1.9.2-rc2/gems/rake-0.8.7/lib/rake.rb:607:in block in invoke_prerequisites' /Users/james/.rvm/gems/ruby-1.9.2-rc2/gems/rake-0.8.7/lib/rake.rb:604:ineach'
/Users/james/.rvm/gems/ruby-1.9.2-rc2/gems/rake-0.8.7/lib/rake.rb:604:in invoke_prerequisites' /Users/james/.rvm/gems/ruby-1.9.2-rc2/gems/rake-0.8.7/lib/rake.rb:596:inblock in invoke_with_call_chain'
/Users/james/.rvm/rubies/ruby-1.9.2-rc2/lib/ruby/1.9.1/monitor.rb:201:in mon_synchronize' /Users/james/.rvm/gems/ruby-1.9.2-rc2/gems/rake-0.8.7/lib/rake.rb:590:ininvoke_with_call_chain'
/Users/james/.rvm/gems/ruby-1.9.2-rc2/gems/rake-0.8.7/lib/rake.rb:607:in block in invoke_prerequisites' /Users/james/.rvm/gems/ruby-1.9.2-rc2/gems/rake-0.8.7/lib/rake.rb:604:ineach'
/Users/james/.rvm/gems/ruby-1.9.2-rc2/gems/rake-0.8.7/lib/rake.rb:604:in invoke_prerequisites' /Users/james/.rvm/gems/ruby-1.9.2-rc2/gems/rake-0.8.7/lib/rake.rb:596:inblock in invoke_with_call_chain'
/Users/james/.rvm/rubies/ruby-1.9.2-rc2/lib/ruby/1.9.1/monitor.rb:201:in mon_synchronize' /Users/james/.rvm/gems/ruby-1.9.2-rc2/gems/rake-0.8.7/lib/rake.rb:590:ininvoke_with_call_chain'
/Users/james/.rvm/gems/ruby-1.9.2-rc2/gems/rake-0.8.7/lib/rake.rb:583:in invoke' /Users/james/.rvm/gems/ruby-1.9.2-rc2/gems/rake-0.8.7/lib/rake.rb:2051:ininvoke_task'
/Users/james/.rvm/gems/ruby-1.9.2-rc2/gems/rake-0.8.7/lib/rake.rb:2029:in block (2 levels) in top_level' /Users/james/.rvm/gems/ruby-1.9.2-rc2/gems/rake-0.8.7/lib/rake.rb:2029:ineach'
/Users/james/.rvm/gems/ruby-1.9.2-rc2/gems/rake-0.8.7/lib/rake.rb:2029:in block in top_level' /Users/james/.rvm/gems/ruby-1.9.2-rc2/gems/rake-0.8.7/lib/rake.rb:2068:instandard_exception_handling'
/Users/james/.rvm/gems/ruby-1.9.2-rc2/gems/rake-0.8.7/lib/rake.rb:2023:in top_level' /Users/james/.rvm/gems/ruby-1.9.2-rc2/gems/rake-0.8.7/lib/rake.rb:2001:inblock in run'
/Users/james/.rvm/gems/ruby-1.9.2-rc2/gems/rake-0.8.7/lib/rake.rb:2068:in standard_exception_handling' /Users/james/.rvm/gems/ruby-1.9.2-rc2/gems/rake-0.8.7/lib/rake.rb:1998:inrun'
/Users/james/.rvm/gems/ruby-1.9.2-rc2/gems/rake-0.8.7/bin/rake:31:in <top (required)>' /Users/james/.rvm/gems/ruby-1.9.2-rc2/bin/rake:19:inload'
/Users/james/.rvm/gems/ruby-1.9.2-rc2/bin/rake:19:in `

'

I see a whole heap of stuff has changed. Any ideas?

Date and date_select (rails)

When i try to update/create a model and it doesn't validates, it raises a NoMethodError exception while rendering the form again.
The raised exception says:
undefined method `day' for "2009-01-12 ":String

and the line where the error happens contains:

<%= date_select :user, :birthday %>

This doesn't happen with the classic mysql gem.

Using: Rails 2.3.5 and ruby 1.8.7 p249 and rubyee 1.8.7 2009.10

Rails 3 rake db:migrate Segmentation fault

When we attempt to do a migration we get a segmentation fault in mysql2, is there any fix for this?

rake db:migrate
(in /Users/user/Sites/railsapp)
/Users/user/.rvm/gems/ruby-1.9.2-p0/gems/mysql2-0.2.3/lib/mysql2/mysql2.bundle: [BUG] Segmentation fault
ruby 1.9.2p0 (2010-08-18 revision 29036) [x86_64-darwin10.4.0]

-- control frame ----------
c:0028 p:-541309752 s:0084 b:0084 l:000083 d:000083 TOP
c:0027 p:---- s:0082 b:0082 l:000081 d:000081 CFUNC :require
c:0026 p:0072 s:0078 b:0078 l:000077 d:000077 TOP /Users/user/.rvm/gems/ruby-1.9.2-p0/gems/mysql2-0.2.3/lib/mysql2.rb:7
c:0025 p:---- s:0076 b:0076 l:000075 d:000075 FINISH
c:0024 p:---- s:0074 b:0074 l:000073 d:000073 CFUNC :require
c:0023 p:0026 s:0070 b:0070 l:000051 d:000069 BLOCK /Users/user/.rvm/gems/ruby-1.9.2-p0/gems/bundler-1.0.0/lib/bundler/runtime.rb:64
c:0022 p:---- s:0067 b:0067 l:000066 d:000066 FINISH
c:0021 p:---- s:0065 b:0065 l:000064 d:000064 CFUNC :each
c:0020 p:0091 s:0062 b:0062 l:000051 d:000061 BLOCK /Users/user/.rvm/gems/ruby-1.9.2-p0/gems/bundler-1.0.0/lib/bundler/runtime.rb:62
c:0019 p:---- s:0057 b:0057 l:000056 d:000056 FINISH
c:0018 p:---- s:0055 b:0055 l:000054 d:000054 CFUNC :each
c:0017 p:0046 s:0052 b:0052 l:000051 d:000051 METHOD /Users/user/.rvm/gems/ruby-1.9.2-p0/gems/bundler-1.0.0/lib/bundler/runtime.rb:51
c:0016 p:0021 s:0048 b:0048 l:000047 d:000047 METHOD /Users/user/.rvm/gems/ruby-1.9.2-p0/gems/bundler-1.0.0/lib/bundler.rb:112
c:0015 p:0079 s:0044 b:0044 l:000043 d:000043 TOP /Users/user/Sites/railsapp/config/application.rb:7
c:0014 p:---- s:0042 b:0042 l:000041 d:000041 FINISH
c:0013 p:---- s:0040 b:0040 l:000039 d:000039 CFUNC :require
c:0012 p:0013 s:0036 b:0036 l:000035 d:000035 METHOD internal:lib/rubygems/custom_require:29
c:0011 p:0026 s:0031 b:0031 l:000030 d:000030 TOP /Users/user/Sites/railsapp/Rakefile:4
c:0010 p:---- s:0029 b:0029 l:000028 d:000028 FINISH
c:0009 p:---- s:0027 b:0027 l:000026 d:000026 CFUNC :loadc:0008 p:0334 s:0023 b:0023 l:000022 d:000022 METHOD /Users/user/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/rake.rb
:2373
c:0007 p:0009 s:0018 b:0018 l:000011 d:000017 BLOCK /Users/user/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/rake.rb:2007
c:0006 p:0009 s:0016 b:0016 l:000015 d:000015 METHOD /Users/user/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/rake.rb:2058
c:0005 p:0011 s:0012 b:0012 l:000011 d:000011 METHOD /Users/user/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/rake.rb:2006
c:0004 p:0021 s:0009 b:0009 l:000008 d:000008 METHOD /Users/user/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/rake.rb:1991
c:0003 p:0312 s:0006 b:0006 l:001588 d:0011b8 EVAL /Users/user/.rvm/rubies/ruby-1.9.2-p0/bin/rake:41
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH

c:0001 p:0000 s:0002 b:0002 l:001588 d:001588 TOP

-- Ruby level backtrace information ----------------------------------------
/Users/user/.rvm/rubies/ruby-1.9.2-p0/bin/rake:41:in <main>' /Users/user/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/rake.rb:1991:inrun'
/Users/user/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/rake.rb:2006:in load_rakefile' /Users/user/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/rake.rb:2058:instandard_exception_handling'
/Users/user/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/rake.rb:2007:in block in load_rakefile' /Users/user/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/rake.rb:2373:inraw_load_rakefile'
/Users/user/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/rake.rb:2373:in load' /Users/user/Sites/railsapp/Rakefile:4:in<top (required)>'
internal:lib/rubygems/custom_require:29:in require' <internal:lib/rubygems/custom_require>:29:inrequire'
/Users/user/Sites/railsapp/config/application.rb:7:in <top (required)>' /Users/user/.rvm/gems/ruby-1.9.2-p0/gems/bundler-1.0.0/lib/bundler.rb:112:inrequire'
/Users/user/.rvm/gems/ruby-1.9.2-p0/gems/bundler-1.0.0/lib/bundler/runtime.rb:51:in require' /Users/user/.rvm/gems/ruby-1.9.2-p0/gems/bundler-1.0.0/lib/bundler/runtime.rb:51:ineach'
/Users/user/.rvm/gems/ruby-1.9.2-p0/gems/bundler-1.0.0/lib/bundler/runtime.rb:62:in block in require' /Users/user/.rvm/gems/ruby-1.9.2-p0/gems/bundler-1.0.0/lib/bundler/runtime.rb:62:ineach'
/Users/user/.rvm/gems/ruby-1.9.2-p0/gems/bundler-1.0.0/lib/bundler/runtime.rb:64:in block (2 levels) in require' /Users/user/.rvm/gems/ruby-1.9.2-p0/gems/bundler-1.0.0/lib/bundler/runtime.rb:64:inrequire'
/Users/user/.rvm/gems/ruby-1.9.2-p0/gems/mysql2-0.2.3/lib/mysql2.rb:7:in <top (required)>' /Users/user/.rvm/gems/ruby-1.9.2-p0/gems/mysql2-0.2.3/lib/mysql2.rb:7:inrequire'

-- C level backtrace information -------------------------------------------

AR adaptor: forces non-numeric attributes to be 0

I'm assuming you're planning for the mysql2 AR adaptor to be a drop in replacement for the standard mysql one? Let me know if that isn't the case and I'll stop filing these bugs.

In the standard mysql adaptor if I have a model with a decimal attribute and validates_numericality_of, trying to set that attribute to something silly like an array causes a validation error.

class Supplier < ActiveRecord::Base
  ...
  validates_numericality_of :margin, :greater_than_or_equal_to => 0, :less_than_or_equal_to => 100, :allow_blank => true
  ...
end

>> Supplier.new(:margin => []).valid?
=> false
>> Supplier.new(:margin => 0).valid?
=> true

With the mysql2 adaptor, using an array is accepted:

>> Supplier.new(:margin => []).valid?
=> true
>> Supplier.new(:margin => 0).valid?
=> true

Ruby 1.9.1 is about half the speed of 1.8.7 when selecting integers

If i do this:
I'm using Mysql
Benchmark.bmbm do|b|
b.report("SEQUEL / MYSQL2") do
1000.times do
DB3.fetch("SELECT video_id FROM stats_videos_daily WHERE banner_internal_views = :views LIMIT 1000", {:views => 26}).all
end
end
end

where video_id is an INT in the database (InnoDB) (utf8 / utf8_unicode_ci)

With ruby 1.8.7 => 1.40 sec
With ruby 1.9.1 => 2.80 sec

System:
Snow Leopard:
mysql Ver 14.14 Distrib 5.1.47, for apple-darwin10.3.0 (i386) using readline 5.1
Using:
ruby 1.9.1p378 (2010-01-10 revision 26273) [i386-darwin10.4.0]
and
ruby 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0]

undefined method `truncate_table'

I'm using technoweenie's masochism plugin and recently switched to the mysql2 adapter in a Rails project to give her a whirl. I'm getting the following error in my stack trace:

vendor/plugins/masochism/lib/active_reload/connection_proxy.rb:120:in 'send': undefined method 'truncate_table' for #<ActiveRecord::ConnectionAdapters::Mysql2Adapter:0x2bfae1c> (NoMethodError)

Any plans on adding that? Workarounds? Suggestions?

For now, I'm switching back to the old adapter, but plan on using this when it gets some more mileage. Thanks for your time and contributions!

LOAD DATA LOCAL command

I have a rake task that load data in text files to tables, but got the following error:

Mysql2::Error: The used command is not allowed with this MySQL version: LOAD DATA LOCAL INFILE '/path/to/articles.dat' INTO TABLE articles

Will this command be added in the future or never by design?

rake db:drop don't work with rails 3 and mysql2 gem

Ruby: 1.8.7 and 1.9.3dev (2010-05-08 trunk 27674) [x86_64-linux]
Rails: 3.0.0.beta3
mysql2: (0.1.8)

rake-svn db:drop && rake-svn db:create
(in /home/petrushka/webdev/test)
(in /home/petrushka/webdev/test)
test_test already exists
test_development already exists

I.e. rake db:drop do nothing... But it works fine with common mysql gem.

AR adapter connection pool management problem

I am having troubles with the connection management of the ActiveRecord adapter. For some reason, I am getting "Mysql2::Error: closed MySQL connection" after a couple of refreshes of the same page.

The page uses one ActiveRecord.find(id) call, and several (about 10) calls to the ActiveRecord::Base.connection.select_values(sql) method. It usually works fine the first time and after the first and second refresh of the page, but it'll fail eventually.

The error occurs outside of my own code. This is the backtrace:

mysql2 (0.1.9) lib/active_record/connection_adapters/mysql2_adapter.rb:246:in `close'
mysql2 (0.1.9) lib/active_record/connection_adapters/mysql2_adapter.rb:246:in `disconnect!'
activerecord (3.0.0.beta4) lib/active_record/connection_adapters/abstract/connection_pool.rb:145:in `clear_reloadable_connections_without_synchronization!'
activerecord (3.0.0.beta4) lib/active_record/connection_adapters/abstract/connection_pool.rb:144:in `each'
activerecord (3.0.0.beta4) lib/active_record/connection_adapters/abstract/connection_pool.rb:144:in `clear_reloadable_connections_without_synchronization!'
activesupport (3.0.0.beta4) lib/active_support/core_ext/module/synchronization.rb:34:in `clear_reloadable_connections!'
/Users/willem/.rvm/rubies/ruby-1.8.7-p174/lib/ruby/1.8/monitor.rb:242:in `synchronize'
activesupport (3.0.0.beta4) lib/active_support/core_ext/module/synchronization.rb:33:in `clear_reloadable_connections!'

When I comment out the calls to the custom select_values call, the problem does not seem to occur anymore. This is the code I am using:

  sql = <<-EOSQL 
        SELECT DISTINCT #{field} AS `possible_value`
          FROM `#{table_name}` 
         ORDER BY `possible_value`
      EOSQL

  ActiveRecord::Base.connection.select_values(sql)

These errors only occur in development mode; in production everything seems to be working OK. Also, when I rewrite the method above to use execute and handle the result myself, the problem persists. Moreover, the exact same code works fine with the normal mysql gem, except for some typecasting issues (which is why I want to use mysql2).

Exception during UTC conversion of datetime values

I'm getting an exception whenever I'm accessing a non-null datetime value. The error seems to happen during the UTC conversion:

Rails 2.3.5, ruby 1.8.7-174, OSX 10.6

>> post = Post.first
>> post.created_at

    NoMethodError: undefined method `period_for_utc' for nil:NilClass
  from /Library/WebServer/railsapps/sparkle/vendor/rails/activesupport/lib/active_support/whiny_nil.rb:52:in `method_missing'
  from /Library/WebServer/railsapps/sparkle/vendor/rails/activesupport/lib/active_support/time_with_zone.rb:58:in `period'
  from /Library/WebServer/railsapps/sparkle/vendor/rails/activesupport/lib/active_support/time_with_zone.rb:44:in `time'
  from /Library/WebServer/railsapps/sparkle/vendor/rails/activesupport/lib/active_support/time_with_zone.rb:99:in `inspect'
  from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/irb.rb:302:in `output_value'
  from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/irb.rb:151:in `eval_input'
  from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/irb.rb:263:in `signal_status'
  from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/irb.rb:147:in `eval_input'
  from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/irb.rb:146:in `eval_input'
  from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/irb.rb:70:in `start'
  from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/irb.rb:69:in `catch'
  from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/irb.rb:69:in `start'
  from /usr/bin/irb:13

I do not seem to have this issue with Rails 3.

symbol not found

$ which gem
/Users/ddonnell/.rvm/rubies/ruby-1.8.7-p302/bin/gem

$ ls /usr/local/
git             mysql               mysql-5.1.50-osx10.6-x86

$ gem install mysql2
Building native extensions.  This could take a while...
Successfully installed mysql2-0.2.3
1 gem installed
Installing ri documentation for mysql2-0.2.3...

Enclosing class/module 'mMysql2' for class Client not known

Enclosing class/module 'mMysql2' for class Result not known
Installing RDoc documentation for mysql2-0.2.3...

Enclosing class/module 'mMysql2' for class Client not known

Enclosing class/module 'mMysql2' for class Result not known

$ rake db:migrate
rake aborted!
dlsym(0x102846160, Init_mysql2): symbol not found - /Users/ddonnell/.rvm/gems/ruby-1.8.7-p302/gems/mysql2-0.2.3/lib/mysql2/mysql2.bundle

(See full trace by running task with --trace)

Finish docs

After API has solidified (only a few tweaks left), do a full documentation pass

mysql2 has issues with order in an array with AR 2.3.x

These work with the regular mysql gem. You can work around it by just removing the array or changing it into a string.

Failing
Ontology.all(:order => [:name])
Ontology.all(:order => [:name, :id])
Ontology.all(:order => ['name'])
Ontology.all(:order => ['name', 'id'])

Passing
Ontology.all(:order => :name)
Ontology.all(:order => 'name')
Ontology.all(:order => 'name, id')

Error messages
Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '[:name]' at line 1: SELECT * FROM ontologies ORDER BY [:name]
Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '["name"]' at line 1: SELECT * FROM ontologies ORDER BY ["name"]

Add EventMachine support

Because you are using mysql's native query API and select()'ing the socket yourself, mysql2 won't play nicely in an event-driven system afaik. I'd like to see Mysql2 somehow outsource its socket management to EM when EM is running. Perhaps tmm1 could give us some advice (cause I'm not sure what the right thing to do here is either).

Segfault - mysql2_adapter.rb

I haven't had a chance to investigate this much, but I just put my Rails 3 app into production today and after about 5 hours there was a segfault and all my Thin instances crashed. I will see if I can track down where it happened, since I was in debug log_level in my app... figured I would go ahead and post this:

/rails_apps/my_app/current/vendor/bundle/ruby/1.9.1/gems/mysql2-0.2.1/lib/active_record/connection_adapters/mysql2_adapter.rb:309: [BUG] Segmentation fault
ruby 1.9.2dev (2010-07-11 revision 28618) [x86_64-linux]

-- control frame ----------
c:0116 p:---- s:0557 b:0557 l:000556 d:000556 CFUNC :query
c:0115 p:0014 s:0553 b:0553 l:000534 d:000552 BLOCK /rails_apps/my_app/current/vendor/bundle/ruby/1.9.1/gems/mysql2-0.2.1/lib/active_record/connection_adapters/mysql2_adapter
c:0114 p:0005 s:0551 b:0551 l:000541 d:000550 BLOCK /rails_apps/my_app/current/vendor/bundle/ruby/1.9.1/gems/activerecord-3.0.0.rc/lib/active_record/connection_adapters/abstr
c:0113 p:0032 s:0549 b:0549 l:000548 d:000548 METHOD /rails_apps/myapp/current/vendor/bundle/ruby/1.9.1/gems/activesupport-3.0.0.rc/lib/active_support/notifications/instrumen

using rails connect hangs when initialized from script/server, but not from script/console

Hi,

A certain action in a rails 2.3.5 app stalls when using the mysql2 gem, after investigation we have narrowed this to mysql2 establishing the connection. The loop is on client.c in the function nogvl_connect. When stalled, the script/server process cannot be interrupted and only a kill -KILL will stop it.

The same connection arguments work just fine if the connection is established from script/console (or from a stand-alone ruby process, if that matters). Also the old mysql gem works fine from rails, and the mysql native client can connect perfectly to the server.

To make it clearer, this code hangs forever:

class TestController < ApplicationController
  def test
    Mysql2::Client.new(:host => "our_host", :username => "xxx", :password => "xxx", :port => 3306, :database => "database", :socket => nil, :flags => 2)
  end
end

but this works perfectly:

>script/console
>>  Mysql2::Client.new(:host => "our_host", :username => "xxx", :password => "xxx", :port => 3306, :database => "database", :socket => nil, :flags => 2)

This has been replicated in two machines (Mac OS X, Snow Leopard, 64 bits). The target server is

mysql> status;
--------------
mysql  Ver 14.14 Distrib 5.1.30, for suse-linux-gnu (i686) using readline 5.2
Server version:     5.1.30-log SUSE MySQL RPM
..

What information can we provide for a useful bug report? We have the C and ruby call stack but that doesn't seem very useful.

Fixnum to String

When MySQL password (presumably the same with login) consists only of digits (eg. 123456) there is a "Cannot convert from Fixnum to String" error. After changing password to, say, q123456 - it works.

mysql2 (0.2.3)
ruby 1.9.3dev (2010-08-21 trunk 29063) [i686-linux]
rails 3.0.0

ActiveRecord: decimal attribute of model defaulting to "0.00"

When I extract an existing model with a decimal attribute from my database using ActiveRecord, the value is a BigDecimal:

>> sale = RetailSale.last
=> #<RetailSale id: 76, customer_id: 127, invoice_id: 177329, round: #<BigDecimal:7fec6373bbb0,'0.0',9(18)>

When I start a new AR object of the same model, the decimal attribute is set to a string:

>> RetailSale.new
=> #<RetailSale id: nil, customer_id: nil, invoice_id: nil, round: "0.00">

I was assuming the default should be a BigDecimal set to 0. Is my assumption incorrect or is it a bug? Running on mysql2 v0.1.4.

Raises when password is a fixnum

On localhost password was 123, it tells

can't convert Fixnum into String
/Users/pavel/.rvm/gems/ree-1.8.7-2010.02/gems/mysql2-0.2.3/lib/mysql2/client.rb:36:in `connect'

with '123' - is ok

Password should be converted to a string

When using Mysql2 with Rails 3 and you have a numeric password then an exception is raised as the password is a Fixnum. Putting quotes around the password forces it to be a String but it should be automatically cast to a string.

Add Mysql2::Result#fields

Currently, a result will only yield a hash for every row. The problem with hashes is that the order of the fields in the result is not preserved. In some cases, the order is important however.

Maybe it is a good idea to be able to inspect the fields of a result, e.g. a Mysql2::Result#fields method that will return an (ordered) array with all fields in the result, using the mysql_fetch_field and mysql_num_fields functions from the MySQL client API.

Does not compile against OSX binary install

I installed the 5.1.45 OSX binary package from dev.mysql.com. The headers are in /usr/local/mysql/include:

/usr/local/mysql/include> ls
decimal.h         my_config.h       my_no_pthread.h   mysql_time.h      sslopt-case.h
errmsg.h          my_dbug.h         my_pthread.h      mysql_version.h   sslopt-longopts.h
keycache.h        my_dir.h          my_sys.h          mysqld_ername.h   sslopt-vars.h
m_ctype.h         my_getopt.h       my_xml.h          mysqld_error.h    typelib.h
m_string.h        my_global.h       mysql.h           plugin.h
my_alloc.h        my_list.h         mysql_com.h       sql_common.h
my_attribute.h    my_net.h          mysql_embed.h     sql_state.h

So I get this error:

/Users/mike/.rvm/rubies/ruby-1.9.1-p378/bin/ruby extconf.rb --with-mysql-dir=/usr/local/mysql
checking for mysql/mysql.h... no
checking for main() in -lmysqlclient... yes
creating Makefile

make
gcc -I. -I/Users/mike/.rvm/rubies/ruby-1.9.1-p378/include/ruby-1.9.1/i386-darwin10.2.0 -I/Users/mike/.rvm/rubies/ruby-1.9.1-p378/include/ruby-1.9.1/ruby/backward -I/Users/mike/.rvm/rubies/ruby-1.9.1-p378/include/ruby-1.9.1 -I. -I/usr/local/mysql/include  -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE   -fno-common  -O2 -g -Wall -Wno-parentheses -pipe -fno-common -Wall -Wextra -funroll-loops -DRUBY_19_COMPATIBILITY  -o mysql2_ext.o -c mysql2_ext.c
In file included from mysql2_ext.c:1:
mysql2_ext.h:4:25: error: mysql/mysql.h: No such file or directory
mysql2_ext.h:5:29: error: mysql/mysql_com.h: No such file or directory
mysql2_ext.h:6:26: error: mysql/errmsg.h: No such file or directory
mysql2_ext.h:7:32: error: mysql/mysqld_error.h: No such file or directory

Installing does not work SL 10.6.4 rvm ruby 1.9.3 dev branch and rails 3.0.0 rc

While all other gems are installing properly I'm getting stuck with this error message when trying to install mysql2:

mkmf.rb:368:in try_do': The complier failed to generate an executable file. (RuntimeError) You have to install development tools first. from /Users/spaquet/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/mkmf.rb:435:intry_link0'
from /Users/spaquet/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/mkmf.rb:440:in try_link' from /Users/spaquet/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/mkmf.rb:552:intry_func'
from /Users/spaquet/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/mkmf.rb:797:in block in have_func' from /Users/spaquet/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/mkmf.rb:693:inblock in checking_for'
from /Users/spaquet/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/mkmf.rb:280:in block (2 levels) in postpone' from /Users/spaquet/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/mkmf.rb:254:inopen'
from /Users/spaquet/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/mkmf.rb:280:in block in postpone' from /Users/spaquet/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/mkmf.rb:254:inopen'
from /Users/spaquet/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/mkmf.rb:276:in postpone' from /Users/spaquet/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/mkmf.rb:692:inchecking_for'
from /Users/spaquet/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/mkmf.rb:796:in have_func' from extconf.rb:9:in

'

Gem files will remain installed in /Users/spaquet/.rvm/gems/ruby-1.9.2-head@rails3beta/gems/mysql2-0.1.9 for inspection.
Results logged to /Users/spaquet/.rvm/gems/ruby-1.9.2-head@rails3beta/gems/mysql2-0.1.9/ext/mysql2/gem_make.out

Configuration: SL 10.6.4 rvm ruby 1.9.3 dev branch and rails 3.0.0 rc

runtime issue with mysql2, bundler(1.0.0.rc5) and mysql 5.1.38

When I deploy my application mysql2 builds fine but I get the following error when trying to run the application.

I tried it without any flags (and it built properly) and tried to force a flag (bundle config build.mysql2 --with-mysql-dir=/usr/local/mysql/)

For what it matters the file does exist at (/www/servers/app/current/vendor/bundle/ruby/1.8/gems/mysql2-0.1.9/lib/mysql2/mysql2.so) even though it says it doesn't.

libmysqlclient.so.16: cannot open shared object file: No such file or directory - /www/servers/app/current/vendor/bundle/ruby/1.8/gems/mysql2-0.1.9/lib/mysql2/mysql2.so

0   /www/servers/app/current/vendor/bundle/ruby/1.8/gems/mysql2-0.1.9/lib/mysql2/mysql2.so          
1   /www/servers/app/current/vendor/bundle/ruby/1.8/gems/mysql2-0.1.9/lib/mysql2.rb     6   
2   /usr/local/lib/ruby/gems/1.8/gems/bundler-1.0.0.rc.5/lib/bundler/runtime.rb     64  in `require'
3   /usr/local/lib/ruby/gems/1.8/gems/bundler-1.0.0.rc.5/lib/bundler/runtime.rb     64  in `require'
4   /usr/local/lib/ruby/gems/1.8/gems/bundler-1.0.0.rc.5/lib/bundler/runtime.rb     62  in `each'
5   /usr/local/lib/ruby/gems/1.8/gems/bundler-1.0.0.rc.5/lib/bundler/runtime.rb     62  in `require'
6   /usr/local/lib/ruby/gems/1.8/gems/bundler-1.0.0.rc.5/lib/bundler/runtime.rb     51  in `each'
7   /usr/local/lib/ruby/gems/1.8/gems/bundler-1.0.0.rc.5/lib/bundler/runtime.rb     51  in `require'
8   /usr/local/lib/ruby/gems/1.8/gems/bundler-1.0.0.rc.5/lib/bundler.rb     107     in `require'
9   /www/servers/app/current/config/application.rb  7   
10  /www/servers/app/current/config/environment.rb  2   in `require'
11  /www/servers/app/current/config/environment.rb  2   
12  config.ru   3   in `require'
13  config.ru   3   
14  /www/servers/app/current/vendor/bundle/ruby/1.8/gems/rack-1.2.1/lib/rack/builder.rb     46  in `instance_eval'
15  /www/servers/app/current/vendor/bundle/ruby/1.8/gems/rack-1.2.1/lib/rack/builder.rb     46  in `initialize'
16  config.ru   1   in `new'
17  config.ru

mysql_config
Usage: /usr/local/mysql/bin/mysql_config [OPTIONS]
Options:
--cflags [-I/usr/local/mysql/include/mysql -DUNIV_LINUX -DUNIV_LINUX]
--include [-I/usr/local/mysql/include/mysql]
--libs [-rdynamic -L/usr/local/mysql/lib/mysql -lmysqlclient -lz -lcrypt -lnsl -lm]
--libs_r [-rdynamic -L/usr/local/mysql/lib/mysql -lmysqlclient_r -lz -lpthread -lcrypt -lnsl -lm -lpthread]
--plugindir [/usr/local/mysql/lib/mysql/plugin]
--socket [/tmp/mysql.sock]
--port [0]
--version [5.1.38]
--libmysqld-libs [-rdynamic -L/usr/local/mysql/lib/mysql -lmysqld -ldl -lz -lpthread -lcrypt -lnsl -lm -lpthread -lrt]

Gemfile
source 'http://rubygems.org'

gem 'rails', :git => 'git://github.com/rails/rails.git'

gem 'mysql2', :git => "git://github.com/brianmario/mysql2.git"
gem 'agraph', :require => 'allegro_graph'

gem 'haml'

gem 'warden'
gem 'devise', :git => "git://github.com/plataformatec/devise.git"
gem 'bcrypt-ruby', :require => 'bcrypt'
gem "oauth2"

gem "will_paginate", '3.0.pre2'
gem 'system_timer'

gem 'fastercsv'

group :development do
  gem "rspec-rails", ">= 2.0.0.beta.19"
end

group :test, :cucumber do
  # bundler requires these gems while running tests
  gem 'cucumber'
  gem 'webrat'
  gem "rspec", ">= 2.0.0.beta.19"
  gem "rspec-rails", ">= 2.0.0.beta.19"
end

select_rows incompatible with Rails API

mysql2 0.1.8 ActiveRecord ConnectionAdapter is incompatible with the Rails API specification (and thus can't be blindly used as a drop-in replacement for the mysql gem):

Check the current implementation of mysql2 - the select_rows returns array of hashes, the specification at http://api.rubyonrails.org/ (ActiveRecord::ConnectionAdapters::DatabaseStatements -> select_rows) requires it to return "an array of arrays containing the field values. Order is the same as that returned by columns."

(I have not verified the compatibility of the other methods, so there may be other issues left.)

rake db:create in rails 3

I have an issue with creating a new database in Rails 3 using Mysql2 gem, but if the database is already created, migrate works fine ... Here is the trace when running rake db:create :

rake db:create --trace
(in /home/radu/projects/r30)
** Invoke db:create (first_time)
** Invoke db:load_config (first_time)
** Invoke rails_env (first_time)
** Execute rails_env
** Execute db:load_config
** Execute db:create
rake aborted!
undefined method errno' for #<Mysql2::Error:0xb70e1ebc> /usr/lib/ruby/gems/1.8/gems/activerecord-3.0.0/lib/active_record/railties/databases.rake:71:increate_database'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.0/lib/active_record/railties/databases.rake:33
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in call' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:inexecute'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in each' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:inexecute'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:in invoke_with_call_chain' /usr/lib/ruby/1.8/monitor.rb:242:insynchronize'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in invoke_with_call_chain' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:ininvoke'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:in invoke_task' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:intop_level'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in each' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:intop_level'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in standard_exception_handling' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:intop_level'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:in run' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:instandard_exception_handling'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in run' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/bin/rake:31 /usr/bin/rake:19:inload'
/usr/bin/rake:19

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.