The Artima Developer Community
Sponsored Link

Ruby Buzz Forum
Missing: Self-Contained Database

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Anders Bengtsson

Posts: 12
Nickname: ghostganz
Registered: Jun, 2006

Anders Bengtsson is a software developer
Missing: Self-Contained Database Posted: Apr 9, 2007 9:12 AM
Reply to this message Reply

This post originated from an RSS feed registered with Ruby Buzz by Anders Bengtsson.
Original Post: Missing: Self-Contained Database
Feed Title: A View From Above: Ruby
Feed URL: http://www.ghostganz.com/blog/xml/rss20/category/Ruby/feed.xml
Feed Description: Anders Bengtsson on programming and other things
Latest Ruby Buzz Posts
Latest Ruby Buzz Posts by Anders Bengtsson
Latest Posts From A View From Above: Ruby

Advertisement

I was going to use ActiveRecord for some simple storage in a small application I’m hacking on. Since ActiveRecord itself has support for lots of databases I figured that it didn’t matter which database I used for testing1.

In Java I would have used Hypersonic, or some other self-contained in-memory database, for this. Looking around in Rails land, you find that most people use Rails’ testing features and run their tests against a separate instance of their production database, usually MySQL. Other people use Sqlite3, which seems to be the simplest database around.

Since I don’t have a production database (and generally dislike MySQL2), I looked at Sqlite. First of all, it requires Sqlite itself to be installed. In OS X this is already done, but it will be a problem elsewhere. Then there’s a confusing selection of different gems with drivers. But once you get the right one installed, it seems to work fine.

Once I started working with it, I ran into a problem. Every time something is wrong with the database structure, no matter if it’s the whole database missing or just a single column misspelled, I get the same error:

`table_structure': ActiveRecord::StatementInvalid (ActiveRecord::StatementInvalid)

Since I was changing the database structure a lot, I got this all the time. Don’t know if this is Sqlite, the driver, ActiveRecord or me that’s to blame, but it wasn’t very practical.

Since my patience is very short, I simply dropped the database storage feature from my app. :) But there seems to be two issues here:

  • There is no self-contained, gem-installed database for Ruby
  • The error handling in Sqlite, or something on the way to Sqlite, isn’t very good

I now hope that someone will tell me what an idiot I am and that I should use some other driver, or some other database.

1 I’m using RSpec, which is the best testing framework since sliced bread.

2 Bleh.

Read: Missing: Self-Contained Database

Topic: .NET the Ruby Way Previous Topic   Next Topic Topic: Caboose Sample rails application

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use