Question

I see that the IronRuby team has documented using ActiveRecord in IronRuby with MSSQL - they indicate that some adjustments were required to the adapter.

In interview on 8/11/2009, Jimmy indicates a major drawback of IronRuby:

The main limitation is that IronRuby does not support any of the C-based Ruby libraries

That indicates that the SQLite-Ruby library that depends on sqlite.dll is probably out of the question. However, in the same interview, he says:

For the database you can use SQLServer Express (which is free), or any .NET based database, like the recent csharp-sqlite port.

That sounds promising, but I'm a bit overwhelmed on how to begin! How do I go about connecting Ruby's ActiveRecord to csharp-sqlite or where can I look for more guidance?

I found some more write-up on IronRuby and SQLite, but I may need some translation help?

The current solution is to port do_sqlite3 to use all .NET APIs. There are a couple ports of SQLite to .NET, but none are widely used yet. For 1.0 we will have an ironruby-dbi gem for using .NET based databases through the Ruby DBI API; so using SQLExpress and SQLServer will work with an appropriate sqlserver adapter. I'm not sure if there is a do_sqlserver adapter yet for DataMapper, but we'll leave that to the community for doing.

Does this imply that my technology stack could go something like: ActiveRecord uses SQLiteRuby, SQLiteRuby is tweaked to use ironruby-dbi (should be little change since this is the Ruby DBI API??) then ironruby-dbi has the smarts to work with a .NET based database such as c#sqlite. Of course I will need an adaptor to go between ActiveRecord and SQLiteRuby ... hopefully no change required there?

Sugggestions, Advice, Tips?

Was it helpful?

Solution

you won't be able to use activerecord as is.

You can either wrap the ADO.NET provider for SQLite or you can perhaps help with the ironruby-dbi project and provide a dbi adapter that handles sqlite correctly. From then on adding it to rails is easy as it would require replacing the connection with the dbi connection.

It is a work in progress though and at this moment most efforts have been around sql server, but I too would like to get sqlite working properly on IronRuby with rails.

Another approach would be to change the active record adapter for sqlite to work with the ADO.NET provider (that would probably require the least effort but won't help outside the rails community). I have a pretty good idea of what needs to happen to make it all work but I simply don't have the time to do all of these things, unfortunately.

OTHER TIPS

Have you tried using the SQLite adapter? It might work out-of-the-box.

I haven't tried it personally though.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top