On Thu, 8 Jan 2004, Hal Fulton wrote:

> For example, you might wrap a query in a method that returned
> a Struct whose member names were the database field names.

I write a lot of code that provides some sort of web based view or 
application to data stored in a database, and I find myself following a 
repeated model where I define a Struct that represents a row of data.  
This is very convenient for my manipulation fo the data, but there are 
complications that arise.

The first is that if I change the database schema, I also have to then go 
change the struct code to match, and the second is that I write a lot of 
the exact same sort of SQL to query data with the same Ruby around it to 
put that data into my struct, and when I change the database schema, I 
then need to go change all of the SQL that is affected.

What I need is a layer that, given a db table, will generate a Struct that 
encapsulates that data and provides a few convenience methods for querying 
data from the table into one or more objects, and for pushing the data 
from the objects back to the db.

So far as I have been able to determine, there's nothing on RAA that does 
this.  Am I overlooking something, or is this something that I need to 
write myself?


Thanks,

Kirk Haines