From: ahoward Date: 2003-05-30T06:43:59+09:00 Subject: Re: Metakit for Ruby - Would you want it? On Thu, 29 May 2003, Anders Borch wrote: > Brian Candler wrote: > > On Fri, May 30, 2003 at 04:02:07AM +0900, Anders Borch wrote: > > > >>what I would like is an embedded sql database. It seems to me that > >>metakit does not have an sql parser. having an sql parser would let me > >>make a dbi interface and use an embedded database w/o changing a single > >>line of code. > > > > > > You mean like sqlite? http://www.sqlite.com/ > > yeah! exactly like sqlite! you just saved my day :) > > > There are ruby bindings which work more or less (get the latest ruby-dbi-all > > from CVS) > > and it even has a DBI interface! this is *so* cool! :D i had problems with the api - if the api returned an error code the connection went stale and all sorts of trouble ensued... eg. #!/usr/bin/env ruby require 'sqlite' db = SQLite.new('bar.db') sql = "create table bar (answer int);" db.exec (sql) sql = "insert into bar values (42);" #sql = "insert into foobar values (42);" # ERROR db.exec (sql) query = "select * from bar;" tuples = db.exec (query) when run produces [answer] 42 but if you use the line marked 'ERROR' instead it gives bar.rb:7:in `exec': method call on terminated object (NotImplementedError) from bar.rb:7 > sadly sql isn't standardized at all (in practice), but that does not > change the fact that everyone and their mothers speak some subset of > sql. Therefore if anyone but me is going to maintain and develop for > systems that I made, then I need to use stuff they know - like sql in > stead of some odd db interface... also half of the time i'm building > software using ruby and storing data in some sql database and someone > else is writing some other software in java that works with the same > data. If I am to work together with other people across languages it's > often better to have a common ground that is an sql database. > > > If you just want objects which persist, and your database isn't so enormous, > > you might like to take a completely different approach (e.g. madeleine) > > yeah, I have been looking at a some of those solutions... db-backend was > the one I was most impressed with. It was also the one most likely to > fulfill my needs. I would like to have a nice database backend stucture > (as made possible in db-backend) combined with ease of use (as in some > of the non-sql variants out there). > > db-backend makes it possible to have a nice database structure but the > price is that I need to define the database to ruby object mappings. > madeleine (and the like - i looked at a couple of those) lets me easily > have persistent objects but I cannot easily interact with the java > people whom I would like to share my objects with. > > So, in the spirit of so many other open source developers, I did not > expand upon existing code, but in stead I started my own project. I aim > to have easily persisten objects and at the same time have an easily > manageable database structure. > > The project is awailable at http://rsqlserial.sf.net (and at RAA - > search for sql and it should be among the top 10 hits). > > I ended up rather off-topic and with a not very subtle plug for my own > (still alpha) project. But hey - I got my sqlite now! > > In an effort to get back on topic: more embedded databases can only > benefit us all. And for those who - like Brian - do not like sql, > metakit looks very nice indeed. From what I read of the API it seems > very nice and sleek. Go ahead and make a ruby binding for it :) very well put - and totally correct IMHO. i will check out your project. -a -- ==================================== | Ara Howard | NOAA Forecast Systems Laboratory | Information and Technology Services | Data Systems Group | R/FST 325 Broadway | Boulder, CO 80305-3328 | Email: ara.t.howard@fsl.noaa.gov | Phone: 303-497-7238 | Fax: 303-497-7259 | ~ > ruby -e 'p % ^) .intern' ====================================