IronRuby ActiveRecord 和 SQLite
我看到 IronRuby 团队已经记录了 在 IronRuby 中使用 ActiveRecord 和 MSSQL - 他们表明需要进行一些调整需要适配器。
在 2009 年 8 月 11 日的采访中,Jimmy 指出IronRuby 的主要缺点:
主要限制是 IronRuby 不支持任何 基于 C 的 Ruby 库
这表明依赖于 sqlite.dll 的 SQLite-Ruby 库可能是不可能的。然而,在同一次采访中,他说:
对于数据库,您可以使用 SQLServer Express(免费), 或任何基于 .NET 的数据库,例如最近的 csharp-sqlite 端口。
这听起来很有希望,但我对如何开始有点不知所措!我该如何将 Ruby 的 ActiveRecord 连接到 csharp-sqlite 或者在哪里可以找到更多指导?
我发现了更多有关 IronRuby 和 SQLite 的文章,但我可能需要一些翻译帮助?
当前的解决方案是移植 do_sqlite3 以使用所有 .NET API。有几个端口 SQLite 到 .NET,但尚未得到广泛使用。对于 1.0,我们将有一个 ironruby-dbi gem 通过 Ruby DBI API 使用基于 .NET 的数据库;所以使用 SQLExpress 和 SQLServer 将与适当的 sqlserver 适配器配合使用。我不确定是否有 DataMapper 还没有 do_sqlserver 适配器,但我们将把它留给社区来做。
这是否意味着我的技术堆栈可能会像这样:ActiveRecord 使用 SQLiteRuby,SQLiteRuby 被调整为使用ironruby-dbi(应该没什么变化,因为这是 Ruby DBI API??)然后ironruby-dbi 可以聪明地与基于 .NET 的数据库,例如 c#sqlite。当然,我需要一个适配器来在 ActiveRecord 和 SQLiteRuby 之间进行转换……希望那里不需要任何更改?
建议、忠告、技巧?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您将无法按原样使用 activerecord 。
您可以包装 SQLite 的 ADO.NET 提供程序,也可以帮助 IronRuby-dbi 项目并提供正确处理 SQLite 的 dbi 适配器。从那时起,将其添加到导轨上就变得很容易,因为需要将连接替换为 dbi 连接。
虽然这是一项正在进行的工作,目前大部分工作都围绕着 sql server,但我也希望让 sqlite 在带有 Rails 的 IronRuby 上正常工作。
另一种方法是更改 sqlite 的活动记录适配器以与 ADO.NET 提供程序一起工作(这可能需要最少的努力,但对 Rails 社区之外没有帮助)。我很清楚需要做什么才能使这一切顺利进行,但不幸的是,我根本没有时间做所有这些事情。
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.
您是否尝试过使用 SQLite 适配器?它可能开箱即用。
不过我个人还没有尝试过。
Have you tried using the SQLite adapter? It might work out-of-the-box.
I haven't tried it personally though.