Tantalus gone? Any users?
Avi Bryant
avi at beta4.com
Mon Nov 10 20:24:28 UTC 2003
On Nov 10, 2003, at 11:43 AM, Mark A. Schwenk wrote:
>
> Although I may be using OODB's soon as the main persistence mechanism
> for some of my projects, I need connectivity and interoperability into
> the relational database world. But I'd like something very minimal and
> comprehensible. Something lighter weight than the Generic Light-Weight
> Object-Relational Persistence (GLORP) framework.
>
> I'd be interested in any info, code, and suggested directions for
> extending Roe.
You can go to http://beta4.com/mc/db , which contains the most recent
Roe snapshots.
Very briefly:
Roe is "Relational Object Expressions" - it models the relational
algebra as Smalltalk collection objects. So, you have a Relation
object for each table in your database that looks like a collection of
tuples. These can be combined with the standard relational operators -
join, select, etc - which will produce new relation objects. All of
these are lazy - it is only when you try to access the contents of the
collection (eg, through #do:) that a query corresponding to the
relation is generated and sent out to the DB.
The main advantage from a mapping point of view is that once you've
built a complex query in this way, you can introspect on it to figure
out exactly what the resulting tuples will be - which columns of which
tables they came from. This means you can take the results of an
arbitrary query and correctly map its rows into objects, something that
wouldn't be possible with a query represented as a string of SQL.
Of course, it's also nice to have queries as first class objects that
can be passed around and composed easily.
Roe supports multiple backends - it comes with one for PostgreSQL and
one that doesn't use SQL at all, but performs all the operations very
inefficiently in memory, which is useful for testing.
The SQL generation requires subqueries (unless you want to write some
funky clause-reduction logic of some kind), so early versions of MySQL
would be hard to support.
I'll try to put together some more detailed info (like where mapping
would hook in) when I have time. Meanwhile, browse the unit tests...
Avi
More information about the Squeak-dev
mailing list
|