On Jul 2, 12:08 pm, Steve H <p.wi...@gmail.com> wrote:
> > Can you try using the RUBYLIB
> > environment variable and make sure that one of the working mysql
> > libraries first?
>
> I tried this.  It didn't work, but maybe I was doing something wrong?
>
> $ gem which mysql
> (checking gem mysql-2.7 for mysql)
> /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/
> 1.8/mysql.rb
> $ export RUBYLIB=/System/Library/Frameworks/Ruby.framework/Versions/
> 1.8/usr/lib/ruby/1.8/mysql.rb
> $ echo $RUBYLIB
> /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/
> 1.8/mysql.rb
> $ sequel mysql://localhost/castle_gameserver?user=root
> Error: Sequel::DatabaseConnectionError: NameError uninitialized
> constant Mysql::CLIENT_MULTI_RESULTS/Library/Ruby/Gems/1.8/gems/
> sequel-3.1.0/lib/sequel/adapters/mysql.rb:97:in `connect'

RUBYLIB should be a directory, not a file:

  export RUBYLIB=/System/Library/Frameworks/Ruby.framework/Versions/
1.8/usr/lib/ruby/1.8/

> $ irb>> require 'sequel' rescue nil
> => true
> >> p $:
>
> ["/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/
> 1.8/mysql.rb", "/Library/Ruby/Gems/1.8/gems/sequel-3.1.0/bin", "/
> Library/Ruby/Gems/1.8/gems/sequel-3.1.0/lib", "/Library/Ruby/Site/
> 1.8", "/Library/Ruby/Site/1.8/powerpc-darwin9.0", "/Library/Ruby/Site/
> 1.8/universal-darwin9.0", "/Library/Ruby/Site", "/System/Library/
> Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8", "/System/
> Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/
> powerpc-darwin9.0", "/System/Library/Frameworks/Ruby.framework/
> Versions/1.8/usr/lib/ruby/1.8/universal-darwin9.0", "."]
> => nil

You have to go through those directories in order to find the first
one that contains a mysql.rb or mysql.so file (maybe there's a
different extension for shared library extensions on the Mac, I'm not
sure).  That one needs to support CLIENT_MULTI_RESULTS in order for
Sequel to work.  My guess is the first one doesn't work, so you need
to set RUBYLIB to the directory containing the correct mysql file, or
modify the load path manually so that that directory is the first one
reached that contains a mysql file.

> Any other ideas? All I want to do is be able to run migrations. Is
> there some way to do that from within irb?

Before you can run migrations, you need to setup your database
connection.  Once your database connection is setup, running
migrations is trivial:

  Sequel::Migrator.apply(DB, '/path/to/migrations/dir')

Jeremy
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To post to this group, send email to sequel-talk@googlegroups.com
To unsubscribe from this group, send email to 
sequel-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sequel-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to