Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

Rails 2.3.5 on Windows: script/dbconsole cannot find sqlite3

#3999

When using Rails 2.3.5 with the default sqlite3, issuing the following command will redirect you into the sqlite3 command interpreter:

c:\test\test_rails>ruby script/dbconsole

This command fails if you have Ruby installed via the RubyInstaller . In order to avoid this error, a patch should be issued for railties\lib\commands\dbconsole.rb

More info If you have a look at dbconsole.rb in the railties (in the rails gem directory, inside lib\commands), you can see that in order to locate the sqlite3 command interpreter (or any other, because the code is generic), the find_cmd method will look into the path environment variable. For windows, executable files have an ".exe" extension so this is added to the lookup string.
The way this test is done is to parse the RUBY_PLATFORM variable and see whether it contains "win32".
The trouble here is that the above test will fail if you installed Ruby via a different installer. For example, RubyInstaller will set your RUBY_PLATFORM to "i386-mingw32".
I don't have a 64-bits system, but presumably this should also be taken into account here (eg RUBY_PLATFORM =~ /win64/?).

Thanks,
Rollo

Reported by Rollo Tomazzi · February 19th, 2010 @ 10:00 AM

State: committed
Milestone: none
Assigned to: Jeremy Kemper Jeremy Kemper
Importance: none

Activity

  1. Rollo Tomazzi
    Rollo Tomazzi

    Hello,

    For good measure, I've also created a ticket 27858 in the RubyInstaller project at Rubyforge.

    Thanks,
    Rollo

    February 19th, 2010 @ 10:13 AM

  2. Rollo Tomazzi
    Rollo Tomazzi

    Okay, so Luis at RubyForge has clarified the issue.
    The way dbconsole.find_cmd identifies the Windows environment is definitely not the way it should be. Information related to the simple fix to be implemented is here: http://blog.emptyway.com/2009/11/03/proper-way-to-detect-windows-
    platform-in-ruby/
    Looks simple enough.

    Thanks,
    Rollo

    February 19th, 2010 @ 02:48 PM

  3. Rollo Tomazzi
  4. Andrew Grimm
    Andrew Grimm

    The bad news: I created a duplicate with #4470 DB console doesn't run for all Windows-based ruby implementations
    The good news: I supplied a patch.

    April 25th, 2010 @ 12:24 PM

  5. Andrew Grimm
  6. Anil Wadghule
    Anil Wadghule
    • Assigned user set to Jeremy Kemper

    April 26th, 2010 @ 12:12 PM

  7. Repository