From: sera@... (Francis Hwang) Date: 2003-08-04T06:28:03+09:00 Subject: Re: Lafcadio: An object-relational mapping layer for Ruby Database independence, to my mind, is a useful goal but not the main point of an object-relational mapping layer. For me, the main point is reducing the need to keep small database-details in mind, and treat domain entities like they're first-class Ruby objects, with as little thinking about the underlying DB as possible. Example 1: You have a Invoice class (or table) with an invoiceDate field. Lafcadio code to manipulate this date might look like: myInvoice = objectStore.getInvoice invoiceNum myInvoice = Date.today objectStore.commit myInvoice .... so you don't have to think about SQL date formatting. Similarly, string fields don't have to be quote-escaped for commits. Example 2: Your Invoice table has two boolean fields: "shipped" stores values in MySQL as 0 and 1, while "viewed" stores values as "Y" and "N". This is far from ideal, of course, but unfortunately I've seen far worse code in my career. And let's say you can't change these fields easily because they're accessed in an indeterminate number of PHP scripts. (Also common, unfortunately.) Committing straight through DBI would require you to always remember which field uses which enumeration, but by setting your field definitions in Lafcadio code you'd never have to think about it again. You could simply set them to be true or false: myInvoice.viewed = true myInvoice.shipped = false objectStore.commit myInvoice .... and when the objectStore does the committing it will figure out what values to enter into what fields. Francis Brian McCallister wrote in message news:<8B2BF50C-C5CE-11D7-86DC-000A95782782@forthillcompany.com>... > I have noticed this, and Vapor (for PostgreSQL) being advertised. Is > there difficulty in building against the DBI module to allow some > degree of database independence? > > -Brian > > On Sunday, August 3, 2003, at 08:45 AM, Francis Hwang wrote: > > > Hi everybody, > > > > I've just released Lafcadio, an object-relational mapping layer for > > Ruby and MySQL, as an alpha release. So far this code hasn't been used > > by anybody else, but it's currently in use on three live sites -- > > including one pretty high-traffic site -- not to mention that I've > > used it over the past year on a number of personal projects. > > > > Again, it's in alpha, so I don't expect anybody to put their payroll > > system on it right now. But if there's anybody out there who's > > interested in this sort of thing, and would like to help me out with > > it -- either just testing it or coding or just telling me where my > > docs could be clearer -- I'd appreciate your input. > > > > http://lafcadio.sourceforge.net > > > > Francis > >